elided_lifetimes_in_paths lint is broken #51902
Labels
A-lifetimes
Area: Lifetimes / regions
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
Uh oh!
There was an error while loading. Please reload this page.
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: