Skip to content

Commit 860a84c

Browse files
committed
Remove bad-directive detection that has been subsumed by the allowlist
Now that all directive names are checked against a list of known-good names, these ad-hoc checks can never fire.
1 parent 891b847 commit 860a84c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/tools/compiletest/src/directives.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ mod directives {
256256
pub const NO_AUTO_CHECK_CFG: &'static str = "no-auto-check-cfg";
257257
pub const ADD_CORE_STUBS: &'static str = "add-core-stubs";
258258
pub const CORE_STUBS_COMPILE_FLAGS: &'static str = "core-stubs-compile-flags";
259-
// This isn't a real directive, just one that is probably mistyped often
260-
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
261259
pub const DISABLE_GDB_PRETTY_PRINTERS: &'static str = "disable-gdb-pretty-printers";
262260
pub const COMPARE_OUTPUT_BY_LINES: &'static str = "compare-output-by-lines";
263261
}
@@ -418,9 +416,6 @@ impl TestProps {
418416
}
419417
self.compile_flags.extend(flags);
420418
}
421-
if config.parse_name_value_directive(ln, INCORRECT_COMPILER_FLAGS).is_some() {
422-
panic!("`compiler-flags` directive should be spelled `compile-flags`");
423-
}
424419

425420
if let Some(range) = parse_edition_range(config, ln) {
426421
self.edition = Some(range.edition_to_test(config.edition));
@@ -686,9 +681,6 @@ impl TestProps {
686681
panic!("`{}-fail` directive is only supported in UI tests", mode);
687682
}
688683
};
689-
if config.mode == TestMode::Ui && config.parse_name_directive(ln, "compile-fail") {
690-
panic!("`compile-fail` directive is useless in UI tests");
691-
}
692684
let fail_mode = if config.parse_name_directive(ln, "check-fail") {
693685
check_ui("check");
694686
Some(FailMode::Check)
@@ -809,6 +801,11 @@ fn check_directive<'a>(
809801
.map(|remark| remark.trim_start().split(' ').next().unwrap())
810802
.filter(|token| KNOWN_DIRECTIVE_NAMES.contains(token));
811803

804+
// FIXME(Zalathar): Consider emitting specialized error/help messages for
805+
// bogus directive names that are similar to real ones, e.g.:
806+
// - *`compiler-flags` => `compile-flags`
807+
// - *`compile-fail` => `check-fail` or `build-fail`
808+
812809
CheckDirectiveResult { is_known_directive, trailing_directive }
813810
}
814811

0 commit comments

Comments
 (0)