about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-08-19 23:27:50 +0000
committerMichael Goulet <michael@errs.io>2023-08-20 00:21:47 +0000
commitfad7d220fd2daefe8ee778b8cafbbeaf2dda4fc5 (patch)
tree5f623258dc5138acbc9cb12f9626d12f8de40f9a /compiler/rustc_lint/src
parent6ef7d16be0fb9d6ecf300c27990f4bff49d22d46 (diff)
downloadrust-fad7d220fd2daefe8ee778b8cafbbeaf2dda4fc5.tar.gz
rust-fad7d220fd2daefe8ee778b8cafbbeaf2dda4fc5.zip
Warn on elided lifetimes in associated constants
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/context.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs
index f73797415bc..aabefb729f3 100644
--- a/compiler/rustc_lint/src/context.rs
+++ b/compiler/rustc_lint/src/context.rs
@@ -966,6 +966,14 @@ pub trait LintContext: Sized {
                         Applicability::MachineApplicable
                     );
                 }
+                BuiltinLintDiagnostics::AssociatedConstElidedLifetime { elided, span } => {
+                    db.span_suggestion_verbose(
+                        if elided { span.shrink_to_hi() } else { span },
+                        "use the `'static` lifetime",
+                        if elided { "'static " } else { "'static" },
+                        Applicability::MachineApplicable
+                    );
+                }
             }
             // Rewrap `db`, and pass control to the user.
             decorate(db)