You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
println!(), derive(Debug), derive(Clone), and probably many other macros break when using the elided_lifetimes_in_paths lint #51903
in the latest stable compiler(1.27) (and probably earlier ones too) this snippet won't compile:
#![deny(elided_lifetimes_in_paths)]#[derive(Debug)]structFoo{a:i32,b:i32,}#[derive(Debug)]structBar<'a>{a:&'aFoo,}fnfun<'a>(){let foo = Foo{a:1,b:2};let bar = Bar::<'a>{a:&foo};println!("{}", bar);}fnmain(){fun();}
The issue is that the code is perfectly fine. The compilation errors come from the macros used:
error: hidden lifetime parameters are deprecated, try `Foo<'_>`
--> src/main.rs:18:5
|
18 | println!("{}", bar);
| ^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> src/main.rs:1:9
|
1 | #![deny(elided_lifetimes_in_paths)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in a macro outside of the current crate(in Nightly builds, run with -Z external-macro-backtrace for more info)
error: hidden lifetime parameters are deprecated, try `Foo<'_>`
--> src/main.rs:18:5
|
18 | println!("{}", bar);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate(in Nightlybuilds, run with -Z external-macro-backtrace for more info)
error: hidden lifetime parameters are deprecated,try `Foo<'_>`
--> src/main.rs:4:10
|
4 | #[derive(Debug)]
| ^^^^^
error: hidden lifetime parameters are deprecated, try `Foo<'_>`
--> src/main.rs:10:10
|
10 | #[derive(Debug)]
| ^^^^^
error: hidden lifetime parameters are deprecated, try `Foo<'_>`
error: aborting due to 5 previous errors
The user of these macros + lint can't do anything to fix the errors. It seems as though at least some macro definitions in the standard library aren't ready for this lint yet.
changed the title [-]println!(), derive(Debug), derive(Clone), and probably many other macros break when using elided_lifetimes_in_paths[/-][+]println!(), derive(Debug), derive(Clone), and probably many other macros break when using the elided_lifetimes_in_paths lint[/+]on Jun 29, 2018
Activity
[-]println!(), derive(Debug), derive(Clone), and probably many other macros break when using elided_lifetimes_in_paths[/-][+]println!(), derive(Debug), derive(Clone), and probably many other macros break when using the elided_lifetimes_in_paths lint[/+]zackmdavis commentedon Oct 31, 2018
The lint was rewritten in #52069. With some borrow-checker fixes (and
{:?}instead of{}), the example now works: