about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2025-04-08 15:33:06 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2025-04-10 09:56:39 +0200
commitcd3a7bb9616959f34028bd4530387d9406964cec (patch)
tree4690b29fea5695395261580609190147058a7c45 /src/tools/compiletest
parentcd371b90e25a5923f8106cea55b5705061974139 (diff)
downloadrust-cd3a7bb9616959f34028bd4530387d9406964cec.tar.gz
rust-cd3a7bb9616959f34028bd4530387d9406964cec.zip
ensure //@compile-flags are last even when passing --edition
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/header.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index a0178f4bcc5..21bd69d59b0 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -385,7 +385,9 @@ impl TestProps {
                     }
 
                     if let Some(edition) = config.parse_edition(ln) {
-                        self.compile_flags.push(format!("--edition={}", edition.trim()));
+                        // The edition is added at the start, since flags from //@compile-flags must
+                        // be passed to rustc last.
+                        self.compile_flags.insert(0, format!("--edition={}", edition.trim()));
                         has_edition = true;
                     }
 
@@ -606,7 +608,9 @@ impl TestProps {
         }
 
         if let (Some(edition), false) = (&config.edition, has_edition) {
-            self.compile_flags.push(format!("--edition={}", edition));
+            // The edition is added at the start, since flags from //@compile-flags must be passed
+            // to rustc last.
+            self.compile_flags.insert(0, format!("--edition={}", edition));
         }
     }