diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 5ba726726cb..c76cba824a3 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -869,7 +869,7 @@ struct HeaderLine<'ln> { fn iter_header( mode: Mode, - suite: &str, + _suite: &str, poisoned: &mut bool, testfile: &Path, rdr: impl Read, @@ -900,11 +900,7 @@ fn iter_header( } } - let comment = if testfile.extension().is_some_and(|e| e == "rs") { - if mode == Mode::Ui && suite == "ui" { "//@" } else { "//" } - } else { - "#" - }; + let comment = if testfile.extension().is_some_and(|e| e == "rs") { "//@" } else { "#" }; let mut rdr = BufReader::with_capacity(1024, rdr); let mut ln = String::new(); @@ -931,7 +927,7 @@ fn iter_header( // First try to accept `ui_test` style comments } else if let Some((header_revision, directive)) = line_directive(comment, ln) { it(HeaderLine { line_number, original_line, header_revision, directive }); - } else if mode == Mode::Ui && suite == "ui" && !REVISION_MAGIC_COMMENT_RE.is_match(ln) { + } else if !REVISION_MAGIC_COMMENT_RE.is_match(ln) { let Some((_, rest)) = line_directive("//", ln) else { continue; }; @@ -951,7 +947,7 @@ fn iter_header( // directive. We emit an error here to warn the user. *poisoned = true; eprintln!( - "error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", + "error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", testfile.display(), line_number, line_directive("//", ln), @@ -964,7 +960,7 @@ fn iter_header( // directive. We emit an error here to warn the user. *poisoned = true; eprintln!( - "error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", + "error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}", testfile.display(), line_number, line_directive("//", ln), @@ -1265,11 +1261,8 @@ pub fn make_test_description( if let Some((_, post)) = original_line.trim_start().split_once("//") { let post = post.trim_start(); - if post.starts_with("ignore-tidy") - && config.mode == Mode::Ui - && config.suite == "ui" - { - // not handled by compiletest under the ui test mode and ui test suite. + if post.starts_with("ignore-tidy") { + // Not handled by compiletest. } else { decision!(cfg::handle_ignore(config, ln)); } diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index f76fb406cea..a01f71a6876 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -578,12 +578,7 @@ fn ignore_mode() { assert_eq!(config.mode, Mode::from_str(mode).unwrap()); assert_ne!(config.mode, Mode::from_str(other).unwrap()); - if mode == "ui" { - assert!(check_ignore(&config, &format!("//@ ignore-mode-{mode}"))); - assert!(!check_ignore(&config, &format!("//@ ignore-mode-{other}"))); - } else { - assert!(check_ignore(&config, &format!("// ignore-mode-{mode}"))); - assert!(!check_ignore(&config, &format!("// ignore-mode-{other}"))); - } + assert!(check_ignore(&config, &format!("//@ ignore-mode-{mode}"))); + assert!(!check_ignore(&config, &format!("//@ ignore-mode-{other}"))); } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index f3e2a940f36..27a8079d893 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3938,15 +3938,10 @@ impl<'test> TestCx<'test> { self.props.compare_output_lines_by_subset, ); } else if !expected_fixed.is_empty() { - if self.config.suite == "ui" { - panic!( - "the `//@ run-rustfix` directive wasn't found but a `*.fixed` file was found" - ); - } else { - panic!( - "the `// run-rustfix` directive wasn't found but a `*.fixed` file was found" - ); - } + panic!( + "the `//@ run-rustfix` directive wasn't found but a `*.fixed` \ + file was found" + ); } if errors > 0 {