Skip to content

Commit

Permalink
Rollup merge of rust-lang#94243 - compiler-errors:compiler-flags-typo…
Browse files Browse the repository at this point in the history
…, r=Mark-Simulacrum

`s/compiler-flags/compile-flags` in compiletest

Also make compiletest panic so this doesn't happen in the future! I literally always forget which it's called, so I wanted to make my life easier in the future.

Also open to the possibility of parsing both.
  • Loading branch information
Dylan-DPC authored Apr 11, 2022
2 parents 1f7fb64 + 52dd0b6 commit d10673b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/test/ui/ptr_ops/issue-80309-safe.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// run-pass
// min-llvm-version: 13.0
// compiler-flags: -O
// compile-flags: -O

// Regression test for issue #80309

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/ptr_ops/issue-80309.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// run-pass
// min-llvm-version: 13.0
// compiler-flags: -O
// compile-flags: -O

// Regression test for issue #80309

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/rfc-2632-const-trait-impl/without-tilde.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compiler-flags: -Z parse-only
// compile-flags: -Z parse-only

#![feature(const_trait_impl)]

Expand Down
5 changes: 5 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ mod directives {
pub const STDERR_PER_BITWIDTH: &'static str = "stderr-per-bitwidth";
pub const INCREMENTAL: &'static str = "incremental";
pub const KNOWN_BUG: &'static str = "known-bug";
// This isn't a real directive, just one that is probably mistyped often
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
}

impl TestProps {
Expand Down Expand Up @@ -282,6 +284,9 @@ impl TestProps {
if let Some(flags) = config.parse_name_value_directive(ln, COMPILE_FLAGS) {
self.compile_flags.extend(flags.split_whitespace().map(|s| s.to_owned()));
}
if config.parse_name_value_directive(ln, INCORRECT_COMPILER_FLAGS).is_some() {
panic!("`compiler-flags` directive should be spelled `compile-flags`");
}

if let Some(edition) = config.parse_edition(ln) {
self.compile_flags.push(format!("--edition={}", edition));
Expand Down

0 comments on commit d10673b

Please sign in to comment.