-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to parse existential type in statement position #52631
Comments
Workaround: macros to the rescue. #![feature(existential_type)]
use std::fmt::Debug;
macro_rules! this_is_an_item {
($i:item) => { $i };
}
fn main() {
this_is_an_item! {
existential type Existential: Debug;
}
fn f() -> Existential {}
println!("{:?}", f());
} |
hm... this needs some lookahead, but should be doable ( |
I would like this to be fixed even if we know the syntax will change. Some use cases require existential type in statement position -- #52632 (comment) is one example -- and we want people with those use cases to be able to try out existential type and provide feedback that informs the ultimate implementation. |
…tolnay Allow declaring existential types inside blocks fixes rust-lang#52631 r? @dtolnay
As of rustc 1.29.0-nightly (874dec2 2018-07-21) the following works:
But the following does not parse. I would expect this to be equivalent to the above except for
Existential
in scope just withinmain
, but if this is disallowed by the RFC then it should produce a better error message.Mentioning the existential types tracking issue #34511
Mentioning @oli-obk and @cramertj
The text was updated successfully, but these errors were encountered: