Skip to content

Weird parse error when writing a lifetime-bounded trait object in the wrong order #17487

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

Closed
arielb1 opened this issue Sep 23, 2014 · 2 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@arielb1
Copy link
Contributor

arielb1 commented Sep 23, 2014

The following code

trait Tr {}
struct S<'a>(&'a 'static+Tr);

gives the following weird error

<anon>:2:18: 2:25 error: expected type, found token LIFETIME(ast::Ident{name: ast::Name(3u32), ctxt: 0u32})
<anon>:2 struct S<'a>(&'a 'static+Tr);

If you write the bounds in the reverse order

trait Tr {}
struct S<'a>(&'a Tr+'static);

It works.

@steveklabnik
Copy link
Member

This now says "expected type, found 'static", which is better. I'm not sure if it's good enough though.

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 27, 2015
@steveklabnik
Copy link
Member

It has been over a year, nobody else has mentioned this issue, and the error message, while it could be a bit better, is at least reasonable now. As such, I'm going to close this one as "wontfix".

lnicola pushed a commit to lnicola/rust that referenced this issue Jul 11, 2024
internal: Some more small memory optimizations

Not a big impact on metrics, though there are some more savings in queries mainly used by the IDE layer from this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants