-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
elided_lifetimes_in_paths lint is broken #51902
Comments
The elided-lifetimes-in-paths lint was rewritten in #52069; the example code in this issue no longer warns.
|
Awesome :) (And, of course, the third one is no issue at all :) ) |
Can you be more explicit? I assume "the second part" refers to the part of the issue starting with "Note, this does compile", but I don't understand what you're suggesting the compiler should do differently. I'm going to close this to keep the issue-tracker tidy, but please re-open or file a new issue if you still have concerns with the |
Oh, you know what @zackmdavis, I'm not sure what I was thinking when I wrote my previous comment, but if the snippet you sent compiles, then the same trick (using Thanks for the help :) |
Using the latest stable compiler(1.27) (and probably earlier ones too) given the snippet:
we get the error:
This makes no sense, both because the name
Foo
is constant in the error message, and both because the lifetime parameter suggested doesn't fix anything. (again, because the error message is just a constant)https://doc.rust-lang.org/nightly/nightly-rustc/rustc/lint/builtin/static.ELIDED_LIFETIMES_IN_PATHS.html
Note, this does compile:
but since
main
can't have any lifetime parameters,Bar
can no be initialized directly inmain
, andfun
is defined with a lifetime parameter that is only used internally, rather than giving any information about how the function is to be used.while experimenting with the same code, THIS COMPILED:
EDIT: This last example compiles because of the "rvalue static promotion" feature, which i was not aware of when opening the issue. Had that
Foo
been a mutable local variable, this would correctly fail. Learn something new every day :)See also #51903.
The text was updated successfully, but these errors were encountered: