diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-10 10:58:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-10 10:58:19 +0100 |
| commit | 8a9f3fd1be6c1b60c6f77aac52fd61ed8b171f30 (patch) | |
| tree | e6a19dfb5c4f288caea4030582fe4a9bb5dc5831 | |
| parent | 4faf535a558b871bae3d8679172e6fa31fc88416 (diff) | |
| parent | ff1459a37022f002d28d1c116d8a073f5b9a6720 (diff) | |
| download | rust-8a9f3fd1be6c1b60c6f77aac52fd61ed8b171f30.tar.gz rust-8a9f3fd1be6c1b60c6f77aac52fd61ed8b171f30.zip | |
Rollup merge of #122251 - jieyouxu:unused-lifetimes-dedup-test, r=Nadrieril
Add test to check unused_lifetimes don't duplicate "parameter is never used" error Closes #72587.
| -rw-r--r-- | tests/ui/single-use-lifetime/dedup.rs | 9 | ||||
| -rw-r--r-- | tests/ui/single-use-lifetime/dedup.stderr | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/single-use-lifetime/dedup.rs b/tests/ui/single-use-lifetime/dedup.rs new file mode 100644 index 00000000000..16b39609a6d --- /dev/null +++ b/tests/ui/single-use-lifetime/dedup.rs @@ -0,0 +1,9 @@ +// Check that `unused_lifetimes` lint doesn't duplicate a "parameter is never used" error. +// Fixed in <https://github.com/rust-lang/rust/pull/96833>. +// Issue: <https://github.com/rust-lang/rust/issues/72587>. + +#![warn(unused_lifetimes)] +struct Foo<'a>; +//~^ ERROR parameter `'a` is never used + +fn main() {} diff --git a/tests/ui/single-use-lifetime/dedup.stderr b/tests/ui/single-use-lifetime/dedup.stderr new file mode 100644 index 00000000000..6d02cb3c714 --- /dev/null +++ b/tests/ui/single-use-lifetime/dedup.stderr @@ -0,0 +1,11 @@ +error[E0392]: lifetime parameter `'a` is never used + --> $DIR/dedup.rs:6:12 + | +LL | struct Foo<'a>; + | ^^ unused lifetime parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0392`. |
