]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_lint/src/lints.rs
Rollup merge of #107656 - jonhoo:bump-rust-installer, r=Mark-Simulacrum
[rust.git] / compiler / rustc_lint / src / lints.rs
index c997d8945d16ebdf2d5ac2f4a3f9dbee0e41d8b3..2e447b900e1174b79ed142bb3c1cbf0d664e34ba 100644 (file)
@@ -917,6 +917,13 @@ pub struct CStringPtr {
     pub unwrap: Span,
 }
 
+// multiple_supertrait_upcastable.rs
+#[derive(LintDiagnostic)]
+#[diag(lint_multple_supertrait_upcastable)]
+pub struct MultipleSupertraitUpcastable {
+    pub ident: Ident,
+}
+
 // non_ascii_idents.rs
 #[derive(LintDiagnostic)]
 #[diag(lint_identifier_non_ascii_char)]
@@ -1395,6 +1402,21 @@ pub struct UnusedDef<'a, 'b> {
     pub cx: &'a LateContext<'b>,
     pub def_id: DefId,
     pub note: Option<Symbol>,
+    pub suggestion: Option<UnusedDefSuggestion>,
+}
+
+#[derive(Subdiagnostic)]
+pub enum UnusedDefSuggestion {
+    #[suggestion(
+        suggestion,
+        style = "verbose",
+        code = "let _ = ",
+        applicability = "machine-applicable"
+    )]
+    Default {
+        #[primary_span]
+        span: Span,
+    },
 }
 
 // Needed because of def_path_str
@@ -1410,6 +1432,9 @@ fn decorate_lint<'b>(
         if let Some(note) = self.note {
             diag.note(note.as_str());
         }
+        if let Some(sugg) = self.suggestion {
+            diag.subdiagnostic(sugg);
+        }
         diag
     }