about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-06 23:32:03 +0200
committerGitHub <noreply@github.com>2023-05-06 23:32:03 +0200
commit1de257bd33eecdcc1386beccd8ad3ed90012f358 (patch)
treeb3694730afdeb13a0052615a89268a44a86ebd8d /compiler/rustc_lint/src
parentecc061596746dd5902cd29f64b61003b35cf8904 (diff)
parent9027d208f2b516a843aa6dcfd0ed30c882a04a28 (diff)
downloadrust-1de257bd33eecdcc1386beccd8ad3ed90012f358.tar.gz
rust-1de257bd33eecdcc1386beccd8ad3ed90012f358.zip
Rollup merge of #111289 - clubby789:fix-111280, r=jyn514
Check arguments length in trivial diagnostic lint

Fixes #111280
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/internal.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index 595b50c4063..0082aaa4a38 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -478,8 +478,10 @@ impl EarlyLintPass for Diagnostics {
         }
         if !segments.iter().all(|(name, args)| {
             let arg = match name.as_str() {
-                "struct_span_err" | "span_note" | "span_label" | "span_help" => &args[1],
-                "note" | "help" => &args[0],
+                "struct_span_err" | "span_note" | "span_label" | "span_help" if args.len() == 2 => {
+                    &args[1]
+                }
+                "note" | "help" if args.len() == 1 => &args[0],
                 _ => {
                     return false;
                 }