ensure //@compile-flags are last even when passing --edition

This commit is contained in:
Pietro Albini 2025-04-08 15:33:06 +02:00
parent cd371b90e2
commit cd3a7bb961
No known key found for this signature in database
GPG key ID: CD76B35F7734769E

View file

@ -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));
}
}