about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2025-04-08 15:36:12 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2025-04-10 09:57:15 +0200
commit2638e4e8b226ea1a51247f3660691ed5543cbf7d (patch)
tree8c72601763177cefc7646030ef9e5d9a13a08dc2
parentcd3a7bb9616959f34028bd4530387d9406964cec (diff)
downloadrust-2638e4e8b226ea1a51247f3660691ed5543cbf7d.tar.gz
rust-2638e4e8b226ea1a51247f3660691ed5543cbf7d.zip
prevent configuring the edition with //@compile-flags
-rw-r--r--src/tools/compiletest/src/header.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 21bd69d59b0..80274613768 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -378,7 +378,13 @@ impl TestProps {
                     }
 
                     if let Some(flags) = config.parse_name_value_directive(ln, COMPILE_FLAGS) {
-                        self.compile_flags.extend(split_flags(&flags));
+                        let flags = split_flags(&flags);
+                        for flag in &flags {
+                            if flag == "--edition" || flag.starts_with("--edition=") {
+                                panic!("you must use `//@ edition` to configure the edition");
+                            }
+                        }
+                        self.compile_flags.extend(flags);
                     }
                     if config.parse_name_value_directive(ln, INCORRECT_COMPILER_FLAGS).is_some() {
                         panic!("`compiler-flags` directive should be spelled `compile-flags`");