warning: hiding a lifetime that's elided elsewhere is confusing
--> src/main.rs:5:16
|
5 | fn foo<T>(foo: &()) -> Foo<T> {
| ^^^ ^^^^^^ the same lifetime is hidden here
| |
| the lifetime is elided here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
= note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
After reading threads on default lifetimes, it seems to address some issues that were raised earlier, regarding compatibility with pre-existing defaults and inference? And generally, can you please point out is there some work on default lifetimes going on?
Just to clarify, I understand what the lint is telling, just noticing that it may be related to the discussion with default lifetimes. If this lint becomes a hard error in future, it may be easier to integrate default lifetimes.
I don't think those lints were enabled with the intention of making the annotation always required in the future (so that default lifetimes would be feasible). For example this triggers no warning:
Last time I checked it had four structured suggestions (for every combination of named and anonymous lifetimes), and the problem was that the error reporting data format doesn't correctly support more than one.
Oh, I made the mistake of thinking that the quoted lint was the full output, but it isn't:
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/lib.rs:2:16
|
2 | fn foo<T>(foo: &()) -> Foo<T> {
| ^^^ ^^^^^^ the same lifetime is hidden here
| |
| the lifetime is elided here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
= note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
|
2 | fn foo<T>(foo: &()) -> Foo<'_, T> {
| +++