Skip to content

Commit 599a9cc

Browse files
committed
Update compiletest to only accept //@ directives
1 parent e1e1b0d commit 599a9cc

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

src/tools/compiletest/src/header.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -887,11 +887,7 @@ fn iter_header(
887887
}
888888
}
889889

890-
let comment = if testfile.extension().is_some_and(|e| e == "rs") {
891-
if mode == Mode::Ui && suite == "ui" { "//@" } else { "//" }
892-
} else {
893-
"#"
894-
};
890+
let comment = if testfile.extension().is_some_and(|e| e == "rs") { "//@" } else { "#" };
895891

896892
let mut rdr = BufReader::with_capacity(1024, rdr);
897893
let mut ln = String::new();
@@ -918,7 +914,7 @@ fn iter_header(
918914
// First try to accept `ui_test` style comments
919915
} else if let Some((header_revision, directive)) = line_directive(comment, ln) {
920916
it(HeaderLine { header_revision, original_line, directive, line_number });
921-
} else if mode == Mode::Ui && suite == "ui" && !REVISION_MAGIC_COMMENT_RE.is_match(ln) {
917+
} else if !REVISION_MAGIC_COMMENT_RE.is_match(ln) {
922918
let Some((_, rest)) = line_directive("//", ln) else {
923919
continue;
924920
};
@@ -938,7 +934,7 @@ fn iter_header(
938934
// directive. We emit an error here to warn the user.
939935
*poisoned = true;
940936
eprintln!(
941-
"error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
937+
"error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
942938
testfile.display(),
943939
line_number,
944940
line_directive("//", ln),
@@ -951,7 +947,7 @@ fn iter_header(
951947
// directive. We emit an error here to warn the user.
952948
*poisoned = true;
953949
eprintln!(
954-
"error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
950+
"error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
955951
testfile.display(),
956952
line_number,
957953
line_directive("//", ln),
@@ -1252,11 +1248,8 @@ pub fn make_test_description<R: Read>(
12521248

12531249
if let Some((_, post)) = original_line.trim_start().split_once("//") {
12541250
let post = post.trim_start();
1255-
if post.starts_with("ignore-tidy")
1256-
&& config.mode == Mode::Ui
1257-
&& config.suite == "ui"
1258-
{
1259-
// not handled by compiletest under the ui test mode and ui test suite.
1251+
if post.starts_with("ignore-tidy") {
1252+
// Not handled by compiletest.
12601253
} else {
12611254
decision!(cfg::handle_ignore(config, ln));
12621255
}

src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3939,7 +3939,7 @@ impl<'test> TestCx<'test> {
39393939
);
39403940
} else if !expected_fixed.is_empty() {
39413941
panic!(
3942-
"the `// run-rustfix` directive wasn't found but a `*.fixed` \
3942+
"the `//@ run-rustfix` directive wasn't found but a `*.fixed` \
39433943
file was found"
39443944
);
39453945
}

0 commit comments

Comments
 (0)