about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/xtask
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2025-04-09 08:54:28 +0000
committerGitHub <noreply@github.com>2025-04-09 08:54:28 +0000
commitb2835b59642b097612a6f6747b733a6f409c227f (patch)
tree83a4a902e022cef9286522277f63e23b5df2387f /src/tools/rust-analyzer/xtask
parent620b404068594aeab4a5005ac619cdae294c01b6 (diff)
parentf4848a71d4fa913f17b31cd9939db9bd45754e9f (diff)
downloadrust-b2835b59642b097612a6f6747b733a6f409c227f.tar.gz
rust-b2835b59642b097612a6f6747b733a6f409c227f.zip
Merge pull request #19462 from Veykril/push-ypvprvvwkyll
refactor: Lower type-refs before type inference
Diffstat (limited to 'src/tools/rust-analyzer/xtask')
-rw-r--r--src/tools/rust-analyzer/xtask/src/tidy.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/xtask/src/tidy.rs b/src/tools/rust-analyzer/xtask/src/tidy.rs
index c11d1c4247d..f91192b0076 100644
--- a/src/tools/rust-analyzer/xtask/src/tidy.rs
+++ b/src/tools/rust-analyzer/xtask/src/tidy.rs
@@ -4,6 +4,7 @@ use std::{
     path::{Path, PathBuf},
 };
 
+use itertools::Itertools;
 use xshell::Shell;
 
 use xshell::cmd;
@@ -189,9 +190,17 @@ fn check_test_attrs(path: &Path, text: &str) {
         // Generated code from lints contains doc tests in string literals.
         "ide-db/src/generated/lints.rs",
     ];
-    if text.contains("#[should_panic") && !need_panic.iter().any(|p| path.ends_with(p)) {
+    if need_panic.iter().any(|p| path.ends_with(p)) {
+        return;
+    }
+    if let Some((line, _)) = text
+        .lines()
+        .tuple_windows()
+        .enumerate()
+        .find(|(_, (a, b))| b.contains("#[should_panic") && !a.contains("FIXME"))
+    {
         panic!(
-            "\ndon't add `#[should_panic]` tests, see:\n\n    {}\n\n   {}\n",
+            "\ndon't add `#[should_panic]` tests, see:\n\n    {}\n\n   {}:{line}\n",
             panic_rule,
             path.display(),
         )