Skip to content

Commit 3862c6b

Browse files
authored
Rollup merge of rust-lang#131585 - Zalathar:original-line, r=jieyouxu
compiletest: Remove the one thing that was checking a directive's `original_line` This special handling of `ignore-tidy*` was introduced during the migration to `//`@`` directives (rust-lang#120881), and has become unnecessary after the subsequent removal of the legacy directive check (rust-lang#131392).
2 parents ddb0c61 + 3d15d2d commit 3862c6b

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

src/tools/compiletest/src/header.rs

+9-28
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl EarlyProps {
5757
&mut poisoned,
5858
testfile,
5959
rdr,
60-
&mut |HeaderLine { directive: ln, .. }| {
60+
&mut |DirectiveLine { directive: ln, .. }| {
6161
parse_and_update_aux(config, ln, &mut props.aux);
6262
config.parse_and_update_revisions(ln, &mut props.revisions);
6363
},
@@ -344,7 +344,7 @@ impl TestProps {
344344
&mut poisoned,
345345
testfile,
346346
file,
347-
&mut |HeaderLine { header_revision, directive: ln, .. }| {
347+
&mut |DirectiveLine { header_revision, directive: ln, .. }| {
348348
if header_revision.is_some() && header_revision != test_revision {
349349
return;
350350
}
@@ -738,17 +738,13 @@ const KNOWN_JSONDOCCK_DIRECTIVE_NAMES: &[&str] =
738738
/// ```text
739739
/// //@ compile-flags: -O
740740
/// ^^^^^^^^^^^^^^^^^ directive
741-
/// ^^^^^^^^^^^^^^^^^^^^^ original_line
742741
///
743742
/// //@ [foo] compile-flags: -O
744743
/// ^^^ header_revision
745744
/// ^^^^^^^^^^^^^^^^^ directive
746-
/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ original_line
747745
/// ```
748-
struct HeaderLine<'ln> {
746+
struct DirectiveLine<'ln> {
749747
line_number: usize,
750-
/// Raw line from the test file, including comment prefix and any revision.
751-
original_line: &'ln str,
752748
/// Some header directives start with a revision name in square brackets
753749
/// (e.g. `[foo]`), and only apply to that revision of the test.
754750
/// If present, this field contains the revision name (e.g. `foo`).
@@ -803,7 +799,7 @@ fn iter_header(
803799
poisoned: &mut bool,
804800
testfile: &Path,
805801
rdr: impl Read,
806-
it: &mut dyn FnMut(HeaderLine<'_>),
802+
it: &mut dyn FnMut(DirectiveLine<'_>),
807803
) {
808804
if testfile.is_dir() {
809805
return;
@@ -824,7 +820,7 @@ fn iter_header(
824820
];
825821
// Process the extra implied directives, with a dummy line number of 0.
826822
for directive in extra_directives {
827-
it(HeaderLine { line_number: 0, original_line: "", header_revision: None, directive });
823+
it(DirectiveLine { line_number: 0, header_revision: None, directive });
828824
}
829825
}
830826

@@ -841,11 +837,6 @@ fn iter_header(
841837
if rdr.read_line(&mut ln).unwrap() == 0 {
842838
break;
843839
}
844-
845-
// Assume that any directives will be found before the first
846-
// module or function. This doesn't seem to be an optimization
847-
// with a warm page cache. Maybe with a cold one.
848-
let original_line = &ln;
849840
let ln = ln.trim();
850841

851842
// Assume that any directives will be found before the first module or function. This
@@ -897,9 +888,8 @@ fn iter_header(
897888
}
898889
}
899890

900-
it(HeaderLine {
891+
it(DirectiveLine {
901892
line_number,
902-
original_line,
903893
header_revision,
904894
directive: non_revisioned_directive_line,
905895
});
@@ -1286,13 +1276,14 @@ pub fn make_test_description<R: Read>(
12861276

12871277
let mut local_poisoned = false;
12881278

1279+
// Scan through the test file to handle `ignore-*`, `only-*`, and `needs-*` directives.
12891280
iter_header(
12901281
config.mode,
12911282
&config.suite,
12921283
&mut local_poisoned,
12931284
path,
12941285
src,
1295-
&mut |HeaderLine { header_revision, original_line, directive: ln, line_number }| {
1286+
&mut |DirectiveLine { header_revision, directive: ln, line_number }| {
12961287
if header_revision.is_some() && header_revision != test_revision {
12971288
return;
12981289
}
@@ -1317,17 +1308,7 @@ pub fn make_test_description<R: Read>(
13171308
};
13181309
}
13191310

1320-
if let Some((_, post)) = original_line.trim_start().split_once("//") {
1321-
let post = post.trim_start();
1322-
if post.starts_with("ignore-tidy") {
1323-
// Not handled by compiletest.
1324-
} else {
1325-
decision!(cfg::handle_ignore(config, ln));
1326-
}
1327-
} else {
1328-
decision!(cfg::handle_ignore(config, ln));
1329-
}
1330-
1311+
decision!(cfg::handle_ignore(config, ln));
13311312
decision!(cfg::handle_only(config, ln));
13321313
decision!(needs::handle_needs(&cache.needs, config, ln));
13331314
decision!(ignore_llvm(config, ln));

0 commit comments

Comments
 (0)