Closed
Description
Given the following code: clicky
#![warn(explicit_outlives_requirements)]
#![allow(dead_code)]
macro_rules! make_baz {
($a:lifetime, $b:lifetime) => {
struct Baz<$a, $b: $a> where (): Sized, $b: $a {
baz: &$a &$b (),
}
};
}
make_baz!{ 'a, 'b }
The current output is:
warning: outlives requirements can be inferred
--> src/lib.rs:6:49
|
6 | struct Baz<$a, $b: $a> where (): Sized, $b: $a {
| ^
...
12 | make_baz!{ 'a, 'b }
| -----------^^^^^^-- in this macro invocation
|
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![warn(explicit_outlives_requirements)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this warning originates in the macro `make_baz` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove these bounds
|
6 ~ struct Baz<$a, $b: $a> where (): Sized, $b: $a {
7 | baz: &$a &$b (),
...
11 |
12 ~ make_baz!{ }
|
warning: `rust-test` (lib) generated 1 warning (run `cargo fix --lib -p rust-test` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.20s
Notice the invalid machine applicable suggestion.
Ideally the output should look like: Probably no warning at all?
related to #106044
@rustbot label A-suggestion-diagnostics A-lifetimes D-invalid-suggestion