about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-04-10 16:15:22 +0200
committerGitHub <noreply@github.com>2024-04-10 16:15:22 +0200
commitfa696a3629f69e79780d36810085a2f3436808a7 (patch)
treef42b93959ee1c27fa6e4a6de9bd21c6408c40356 /compiler/rustc_errors/src
parentb14d8b2ef20c64c1002e2c6c724025c3d0846b91 (diff)
parentda2b714ba122d7befe1f10c808e82a536c9efcf0 (diff)
downloadrust-fa696a3629f69e79780d36810085a2f3436808a7.tar.gz
rust-fa696a3629f69e79780d36810085a2f3436808a7.zip
Rollup merge of #118391 - compiler-errors:lifetimes-eq, r=lcnr
Add `REDUNDANT_LIFETIMES` lint to detect lifetimes which are semantically redundant

There already is a `UNUSED_LIFETIMES` lint which is fired when we detect where clause bounds like `where 'a: 'static`, however, it doesn't use the full power of lexical region resolution to detect failures.

Right now `UNUSED_LIFETIMES` is an `Allow` lint, though presumably we could bump it to warn? I can (somewhat) easily implement a structured suggestion so this can be rustfix'd automatically, since we can just walk through the HIR body, replacing instances of the redundant lifetime.

Fixes #118376
r? lcnr
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic_impls.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs
index f90190797ae..6c0551848d6 100644
--- a/compiler/rustc_errors/src/diagnostic_impls.rs
+++ b/compiler/rustc_errors/src/diagnostic_impls.rs
@@ -46,6 +46,7 @@ impl<'a, T: Clone + IntoDiagArg> IntoDiagArg for &'a T {
     }
 }
 
+#[macro_export]
 macro_rules! into_diag_arg_using_display {
     ($( $ty:ty ),+ $(,)?) => {
         $(