Skip to content

Commit 08ae733

Browse files
committed
Update compiletest to only accept //@ directives
1 parent a0db7b2 commit 08ae733

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
@@ -891,11 +891,7 @@ fn iter_header(
891891
}
892892
}
893893

894-
let comment = if testfile.extension().is_some_and(|e| e == "rs") {
895-
if mode == Mode::Ui && suite == "ui" { "//@" } else { "//" }
896-
} else {
897-
"#"
898-
};
894+
let comment = if testfile.extension().is_some_and(|e| e == "rs") { "//@" } else { "#" };
899895

900896
let mut rdr = BufReader::with_capacity(1024, rdr);
901897
let mut ln = String::new();
@@ -922,7 +918,7 @@ fn iter_header(
922918
// First try to accept `ui_test` style comments
923919
} else if let Some((header_revision, directive)) = line_directive(comment, ln) {
924920
it(HeaderLine { header_revision, original_line, directive, line_number });
925-
} else if mode == Mode::Ui && suite == "ui" && !REVISION_MAGIC_COMMENT_RE.is_match(ln) {
921+
} else if !REVISION_MAGIC_COMMENT_RE.is_match(ln) {
926922
let Some((_, rest)) = line_directive("//", ln) else {
927923
continue;
928924
};
@@ -942,7 +938,7 @@ fn iter_header(
942938
// directive. We emit an error here to warn the user.
943939
*poisoned = true;
944940
eprintln!(
945-
"error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
941+
"error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
946942
testfile.display(),
947943
line_number,
948944
line_directive("//", ln),
@@ -955,7 +951,7 @@ fn iter_header(
955951
// directive. We emit an error here to warn the user.
956952
*poisoned = true;
957953
eprintln!(
958-
"error: detected legacy-style directives in ui test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
954+
"error: detected legacy-style directives in compiletest test: {}:{}, please use `ui_test`-style directives `//@` instead:{:#?}",
959955
testfile.display(),
960956
line_number,
961957
line_directive("//", ln),
@@ -1256,11 +1252,8 @@ pub fn make_test_description<R: Read>(
12561252

12571253
if let Some((_, post)) = original_line.trim_start().split_once("//") {
12581254
let post = post.trim_start();
1259-
if post.starts_with("ignore-tidy")
1260-
&& config.mode == Mode::Ui
1261-
&& config.suite == "ui"
1262-
{
1263-
// not handled by compiletest under the ui test mode and ui test suite.
1255+
if post.starts_with("ignore-tidy") {
1256+
// Not handled by compiletest.
12641257
} else {
12651258
decision!(cfg::handle_ignore(config, ln));
12661259
}

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)