diff --git a/src/test/compile-fail/edition-raw-pointer-method-2015.rs b/src/test/compile-fail/edition-raw-pointer-method-2015.rs index b304443f631..4ba44fa54d8 100644 --- a/src/test/compile-fail/edition-raw-pointer-method-2015.rs +++ b/src/test/compile-fail/edition-raw-pointer-method-2015.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags: --edition=2015 -Zunstable-options +// edition:2015 // tests that editions work with the tyvar warning-turned-error diff --git a/src/test/compile-fail/edition-raw-pointer-method-2018.rs b/src/test/compile-fail/edition-raw-pointer-method-2018.rs index d0cf81d59cf..c8548ed35b9 100644 --- a/src/test/compile-fail/edition-raw-pointer-method-2018.rs +++ b/src/test/compile-fail/edition-raw-pointer-method-2018.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags: --edition=2018 -Zunstable-options +// edition:2018 // tests that editions work with the tyvar warning-turned-error diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs index fcf4714ba96..e04bb27f435 100644 --- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 -Zunstable-options +// edition:2018 #![feature(extern_absolute_paths)] diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs index c256c5592c2..bebf0236bb4 100644 --- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 -Zunstable-options +// edition:2018 #![feature(extern_absolute_paths)] diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs index 837dc617b3a..5906a0719c8 100644 --- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 -Zunstable-options +// edition:2018 #![feature(extern_absolute_paths)] diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs index 9b7baa00163..7111176dbd9 100644 --- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs @@ -9,7 +9,7 @@ // except according to those terms. // aux-build:xcrate.rs -// compile-flags: --edition=2018 -Zunstable-options +// edition:2018 #![feature(crate_in_paths)] #![feature(extern_absolute_paths)] diff --git a/src/test/run-pass/async-await.rs b/src/test/run-pass/async-await.rs index 817db4bb79e..8b649f6ef7b 100644 --- a/src/test/run-pass/async-await.rs +++ b/src/test/run-pass/async-await.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 #![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)] diff --git a/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs b/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs index 9127c8e350a..69952e9f90a 100644 --- a/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs +++ b/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 #![feature(raw_identifiers)] diff --git a/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs b/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs index 4fef77d67ea..415988586a0 100644 --- a/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs +++ b/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 #![feature(raw_identifiers)] diff --git a/src/test/run-pass/edition-keywords-2015-2015.rs b/src/test/run-pass/edition-keywords-2015-2015.rs index 41480bb978e..73869e63de7 100644 --- a/src/test/run-pass/edition-keywords-2015-2015.rs +++ b/src/test/run-pass/edition-keywords-2015-2015.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 // aux-build:edition-kw-macro-2015.rs #![feature(raw_identifiers)] diff --git a/src/test/run-pass/edition-keywords-2015-2018.rs b/src/test/run-pass/edition-keywords-2015-2018.rs index 78835d51063..0a1c6505854 100644 --- a/src/test/run-pass/edition-keywords-2015-2018.rs +++ b/src/test/run-pass/edition-keywords-2015-2018.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 // aux-build:edition-kw-macro-2018.rs #![feature(raw_identifiers)] diff --git a/src/test/run-pass/edition-keywords-2018-2015.rs b/src/test/run-pass/edition-keywords-2018-2015.rs index 46d5f222cbb..4c22667d0bf 100644 --- a/src/test/run-pass/edition-keywords-2018-2015.rs +++ b/src/test/run-pass/edition-keywords-2018-2015.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 // aux-build:edition-kw-macro-2015.rs #![feature(raw_identifiers)] diff --git a/src/test/run-pass/edition-keywords-2018-2018.rs b/src/test/run-pass/edition-keywords-2018-2018.rs index 06482988937..2a98b904da5 100644 --- a/src/test/run-pass/edition-keywords-2018-2018.rs +++ b/src/test/run-pass/edition-keywords-2018-2018.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 // aux-build:edition-kw-macro-2018.rs #![feature(raw_identifiers)] diff --git a/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs b/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs index bbe066481a8..dfa583415f7 100644 --- a/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs +++ b/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs @@ -9,7 +9,7 @@ // except according to those terms. // aux-build:xcrate.rs -// compile-flags: --edition=2018 -Zunstable-options +// edition:2018 #![feature(extern_absolute_paths)] diff --git a/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs b/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs index ead462cf0d2..6317dc17652 100644 --- a/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs +++ b/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs @@ -12,7 +12,8 @@ // // Regression test for #47075. -// compile-flags: --test --edition=2018 -Zunstable-options +// edition:2018 +// compile-flags: --test #![feature(extern_absolute_paths)] diff --git a/src/test/ui/async-fn-multiple-lifetimes.rs b/src/test/ui/async-fn-multiple-lifetimes.rs index ce062ded7f7..aab4974e2e7 100644 --- a/src/test/ui/async-fn-multiple-lifetimes.rs +++ b/src/test/ui/async-fn-multiple-lifetimes.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 #![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)] diff --git a/src/test/ui/auxiliary/edition-kw-macro-2015.rs b/src/test/ui/auxiliary/edition-kw-macro-2015.rs index 9127c8e350a..69952e9f90a 100644 --- a/src/test/ui/auxiliary/edition-kw-macro-2015.rs +++ b/src/test/ui/auxiliary/edition-kw-macro-2015.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 #![feature(raw_identifiers)] diff --git a/src/test/ui/auxiliary/edition-kw-macro-2018.rs b/src/test/ui/auxiliary/edition-kw-macro-2018.rs index 4fef77d67ea..415988586a0 100644 --- a/src/test/ui/auxiliary/edition-kw-macro-2018.rs +++ b/src/test/ui/auxiliary/edition-kw-macro-2018.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 #![feature(raw_identifiers)] diff --git a/src/test/ui/edition-keywords-2015-2015-expansion.rs b/src/test/ui/edition-keywords-2015-2015-expansion.rs index b8a1994a105..349ab3e27ad 100644 --- a/src/test/ui/edition-keywords-2015-2015-expansion.rs +++ b/src/test/ui/edition-keywords-2015-2015-expansion.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 // aux-build:edition-kw-macro-2015.rs // compile-pass diff --git a/src/test/ui/edition-keywords-2015-2015-parsing.rs b/src/test/ui/edition-keywords-2015-2015-parsing.rs index 1fb91ca006c..08cba2d2908 100644 --- a/src/test/ui/edition-keywords-2015-2015-parsing.rs +++ b/src/test/ui/edition-keywords-2015-2015-parsing.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 // aux-build:edition-kw-macro-2015.rs #![feature(raw_identifiers)] diff --git a/src/test/ui/edition-keywords-2015-2018-expansion.rs b/src/test/ui/edition-keywords-2015-2018-expansion.rs index bc14c104c49..082eb8d89f9 100644 --- a/src/test/ui/edition-keywords-2015-2018-expansion.rs +++ b/src/test/ui/edition-keywords-2015-2018-expansion.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 // aux-build:edition-kw-macro-2018.rs #![feature(raw_identifiers)] diff --git a/src/test/ui/edition-keywords-2015-2018-parsing.rs b/src/test/ui/edition-keywords-2015-2018-parsing.rs index 0b680eb16c7..337d6be6bbc 100644 --- a/src/test/ui/edition-keywords-2015-2018-parsing.rs +++ b/src/test/ui/edition-keywords-2015-2018-parsing.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 // aux-build:edition-kw-macro-2018.rs #![feature(raw_identifiers)] diff --git a/src/test/ui/edition-keywords-2018-2015-expansion.rs b/src/test/ui/edition-keywords-2018-2015-expansion.rs index 6f85f427eb0..6e2073e0e49 100644 --- a/src/test/ui/edition-keywords-2018-2015-expansion.rs +++ b/src/test/ui/edition-keywords-2018-2015-expansion.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 // aux-build:edition-kw-macro-2015.rs // compile-pass diff --git a/src/test/ui/edition-keywords-2018-2015-parsing.rs b/src/test/ui/edition-keywords-2018-2015-parsing.rs index 02dc8c87956..713da57f7e2 100644 --- a/src/test/ui/edition-keywords-2018-2015-parsing.rs +++ b/src/test/ui/edition-keywords-2018-2015-parsing.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 // aux-build:edition-kw-macro-2015.rs #![feature(raw_identifiers)] diff --git a/src/test/ui/edition-keywords-2018-2018-expansion.rs b/src/test/ui/edition-keywords-2018-2018-expansion.rs index ef7f63e225c..50db4202e98 100644 --- a/src/test/ui/edition-keywords-2018-2018-expansion.rs +++ b/src/test/ui/edition-keywords-2018-2018-expansion.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 // aux-build:edition-kw-macro-2018.rs #![feature(raw_identifiers)] diff --git a/src/test/ui/edition-keywords-2018-2018-parsing.rs b/src/test/ui/edition-keywords-2018-2018-parsing.rs index f9b4d0e18c1..263ec95caa7 100644 --- a/src/test/ui/edition-keywords-2018-2018-parsing.rs +++ b/src/test/ui/edition-keywords-2018-2018-parsing.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 // aux-build:edition-kw-macro-2018.rs #![feature(raw_identifiers)] diff --git a/src/test/ui/feature-gate-async-await-2015-edition.rs b/src/test/ui/feature-gate-async-await-2015-edition.rs index b1dd6a77e97..5b865e9c1c7 100644 --- a/src/test/ui/feature-gate-async-await-2015-edition.rs +++ b/src/test/ui/feature-gate-async-await-2015-edition.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2015 +// edition:2015 #![feature(futures_api)] diff --git a/src/test/ui/feature-gate-async-await.rs b/src/test/ui/feature-gate-async-await.rs index 971b75c6dd0..be34842dea3 100644 --- a/src/test/ui/feature-gate-async-await.rs +++ b/src/test/ui/feature-gate-async-await.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 + #![feature(futures_api)] async fn foo() {} //~ ERROR async fn is unstable diff --git a/src/test/ui/feature-gate-async-await.stderr b/src/test/ui/feature-gate-async-await.stderr index fdee6e20575..79ed5c4d008 100644 --- a/src/test/ui/feature-gate-async-await.stderr +++ b/src/test/ui/feature-gate-async-await.stderr @@ -1,5 +1,5 @@ error[E0658]: async fn is unstable (see issue #50547) - --> $DIR/feature-gate-async-await.rs:14:1 + --> $DIR/feature-gate-async-await.rs:15:1 | LL | async fn foo() {} //~ ERROR async fn is unstable | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | async fn foo() {} //~ ERROR async fn is unstable = help: add #![feature(async_await)] to the crate attributes to enable error[E0658]: async blocks are unstable (see issue #50547) - --> $DIR/feature-gate-async-await.rs:17:13 + --> $DIR/feature-gate-async-await.rs:18:13 | LL | let _ = async {}; //~ ERROR async blocks are unstable | ^^^^^^^^ @@ -15,7 +15,7 @@ LL | let _ = async {}; //~ ERROR async blocks are unstable = help: add #![feature(async_await)] to the crate attributes to enable error[E0658]: async closures are unstable (see issue #50547) - --> $DIR/feature-gate-async-await.rs:18:13 + --> $DIR/feature-gate-async-await.rs:19:13 | LL | let _ = async || {}; //~ ERROR async closures are unstable | ^^^^^^^^^^^ diff --git a/src/test/ui/lint-anon-param-edition.fixed b/src/test/ui/lint-anon-param-edition.fixed index de223d9ccf7..c4379b496f8 100644 --- a/src/test/ui/lint-anon-param-edition.fixed +++ b/src/test/ui/lint-anon-param-edition.fixed @@ -11,7 +11,7 @@ // tests that the anonymous_parameters lint is warn-by-default on the 2018 edition // compile-pass -// compile-flags: --edition=2018 +// edition:2018 // run-rustfix trait Foo { diff --git a/src/test/ui/lint-anon-param-edition.rs b/src/test/ui/lint-anon-param-edition.rs index 35406806df9..13eb5dfd816 100644 --- a/src/test/ui/lint-anon-param-edition.rs +++ b/src/test/ui/lint-anon-param-edition.rs @@ -11,7 +11,7 @@ // tests that the anonymous_parameters lint is warn-by-default on the 2018 edition // compile-pass -// compile-flags: --edition=2018 +// edition:2018 // run-rustfix trait Foo { diff --git a/src/test/ui/no-args-non-move-async-closure.rs b/src/test/ui/no-args-non-move-async-closure.rs index f2ecc447718..9cb754167cf 100644 --- a/src/test/ui/no-args-non-move-async-closure.rs +++ b/src/test/ui/no-args-non-move-async-closure.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: --edition=2018 +// edition:2018 #![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)] diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index f66f5c5b70e..1dd7fe7f0cb 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -298,6 +298,10 @@ impl TestProps { .extend(flags.split_whitespace().map(|s| s.to_owned())); } + if let Some(edition) = config.parse_edition(ln) { + self.compile_flags.push(format!("--edition={}", edition)); + } + if let Some(r) = config.parse_revisions(ln) { self.revisions.extend(r); } @@ -371,9 +375,9 @@ impl TestProps { self.compile_pass = config.parse_compile_pass(ln) || self.run_pass; } - if !self.skip_codegen { - self.skip_codegen = config.parse_skip_codegen(ln); - } + if !self.skip_codegen { + self.skip_codegen = config.parse_skip_codegen(ln); + } if !self.disable_ui_testing_normalization { self.disable_ui_testing_normalization = @@ -647,6 +651,10 @@ impl Config { fn parse_run_rustfix(&self, line: &str) -> bool { self.parse_name_directive(line, "run-rustfix") } + + fn parse_edition(&self, line: &str) -> Option { + self.parse_name_value_directive(line, "edition") + } } pub fn lldb_version_to_int(version_string: &str) -> isize { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index caf73f4f68b..408eda5ba5b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1368,6 +1368,7 @@ impl<'test> TestCx<'test> { .arg(out_dir) .arg(&self.testpaths.file) .args(&self.props.compile_flags); + if let Some(ref linker) = self.config.linker { rustdoc .arg("--linker")