Skip to content

Commit 75d33cf

Browse files
committedJun 27, 2018
add edition compiletest header + fix tests
1 parent 2a1c4ee commit 75d33cf

34 files changed

+48
-37
lines changed
 

‎src/test/compile-fail/edition-raw-pointer-method-2015.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-tidy-linelength
12-
// compile-flags: --edition=2015 -Zunstable-options
12+
// edition:2015
1313

1414
// tests that editions work with the tyvar warning-turned-error
1515

‎src/test/compile-fail/edition-raw-pointer-method-2018.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-tidy-linelength
12-
// compile-flags: --edition=2018 -Zunstable-options
12+
// edition:2018
1313

1414
// tests that editions work with the tyvar warning-turned-error
1515

‎src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018 -Zunstable-options
11+
// edition:2018
1212

1313
#![feature(extern_absolute_paths)]
1414

‎src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018 -Zunstable-options
11+
// edition:2018
1212

1313
#![feature(extern_absolute_paths)]
1414

‎src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018 -Zunstable-options
11+
// edition:2018
1212

1313
#![feature(extern_absolute_paths)]
1414

‎src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// aux-build:xcrate.rs
12-
// compile-flags: --edition=2018 -Zunstable-options
12+
// edition:2018
1313

1414
#![feature(crate_in_paths)]
1515
#![feature(extern_absolute_paths)]

‎src/test/run-pass/async-await.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212

1313
#![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)]
1414

‎src/test/run-pass/auxiliary/edition-kw-macro-2015.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212

1313
#![feature(raw_identifiers)]
1414

‎src/test/run-pass/auxiliary/edition-kw-macro-2018.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212

1313
#![feature(raw_identifiers)]
1414

‎src/test/run-pass/edition-keywords-2015-2015.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212
// aux-build:edition-kw-macro-2015.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/run-pass/edition-keywords-2015-2018.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212
// aux-build:edition-kw-macro-2018.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/run-pass/edition-keywords-2018-2015.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212
// aux-build:edition-kw-macro-2015.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/run-pass/edition-keywords-2018-2018.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212
// aux-build:edition-kw-macro-2018.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// aux-build:xcrate.rs
12-
// compile-flags: --edition=2018 -Zunstable-options
12+
// edition:2018
1313

1414
#![feature(extern_absolute_paths)]
1515

‎src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
//
1313
// Regression test for #47075.
1414

15-
// compile-flags: --test --edition=2018 -Zunstable-options
15+
// edition:2018
16+
// compile-flags: --test
1617

1718
#![feature(extern_absolute_paths)]
1819

‎src/test/ui/async-fn-multiple-lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212

1313
#![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)]
1414

‎src/test/ui/auxiliary/edition-kw-macro-2015.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212

1313
#![feature(raw_identifiers)]
1414

‎src/test/ui/auxiliary/edition-kw-macro-2018.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212

1313
#![feature(raw_identifiers)]
1414

‎src/test/ui/edition-keywords-2015-2015-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212
// aux-build:edition-kw-macro-2015.rs
1313
// compile-pass
1414

‎src/test/ui/edition-keywords-2015-2015-parsing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212
// aux-build:edition-kw-macro-2015.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/ui/edition-keywords-2015-2018-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212
// aux-build:edition-kw-macro-2018.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/ui/edition-keywords-2015-2018-parsing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212
// aux-build:edition-kw-macro-2018.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/ui/edition-keywords-2018-2015-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212
// aux-build:edition-kw-macro-2015.rs
1313
// compile-pass
1414

‎src/test/ui/edition-keywords-2018-2015-parsing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212
// aux-build:edition-kw-macro-2015.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/ui/edition-keywords-2018-2018-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212
// aux-build:edition-kw-macro-2018.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/ui/edition-keywords-2018-2018-parsing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212
// aux-build:edition-kw-macro-2018.rs
1313

1414
#![feature(raw_identifiers)]

‎src/test/ui/feature-gate-async-await-2015-edition.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2015
11+
// edition:2015
1212

1313
#![feature(futures_api)]
1414

‎src/test/ui/feature-gate-async-await.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
12+
1213
#![feature(futures_api)]
1314

1415
async fn foo() {} //~ ERROR async fn is unstable

‎src/test/ui/feature-gate-async-await.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error[E0658]: async fn is unstable (see issue #50547)
2-
--> $DIR/feature-gate-async-await.rs:14:1
2+
--> $DIR/feature-gate-async-await.rs:15:1
33
|
44
LL | async fn foo() {} //~ ERROR async fn is unstable
55
| ^^^^^^^^^^^^^^^^^
66
|
77
= help: add #![feature(async_await)] to the crate attributes to enable
88

99
error[E0658]: async blocks are unstable (see issue #50547)
10-
--> $DIR/feature-gate-async-await.rs:17:13
10+
--> $DIR/feature-gate-async-await.rs:18:13
1111
|
1212
LL | let _ = async {}; //~ ERROR async blocks are unstable
1313
| ^^^^^^^^
1414
|
1515
= help: add #![feature(async_await)] to the crate attributes to enable
1616

1717
error[E0658]: async closures are unstable (see issue #50547)
18-
--> $DIR/feature-gate-async-await.rs:18:13
18+
--> $DIR/feature-gate-async-await.rs:19:13
1919
|
2020
LL | let _ = async || {}; //~ ERROR async closures are unstable
2121
| ^^^^^^^^^^^

‎src/test/ui/lint-anon-param-edition.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// tests that the anonymous_parameters lint is warn-by-default on the 2018 edition
1212

1313
// compile-pass
14-
// compile-flags: --edition=2018
14+
// edition:2018
1515
// run-rustfix
1616

1717
trait Foo {

‎src/test/ui/lint-anon-param-edition.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// tests that the anonymous_parameters lint is warn-by-default on the 2018 edition
1212

1313
// compile-pass
14-
// compile-flags: --edition=2018
14+
// edition:2018
1515
// run-rustfix
1616

1717
trait Foo {

‎src/test/ui/no-args-non-move-async-closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: --edition=2018
11+
// edition:2018
1212

1313
#![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)]
1414

‎src/tools/compiletest/src/header.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ impl TestProps {
298298
.extend(flags.split_whitespace().map(|s| s.to_owned()));
299299
}
300300

301+
if let Some(edition) = config.parse_edition(ln) {
302+
self.compile_flags.push(format!("--edition={}", edition));
303+
}
304+
301305
if let Some(r) = config.parse_revisions(ln) {
302306
self.revisions.extend(r);
303307
}
@@ -371,9 +375,9 @@ impl TestProps {
371375
self.compile_pass = config.parse_compile_pass(ln) || self.run_pass;
372376
}
373377

374-
if !self.skip_codegen {
375-
self.skip_codegen = config.parse_skip_codegen(ln);
376-
}
378+
if !self.skip_codegen {
379+
self.skip_codegen = config.parse_skip_codegen(ln);
380+
}
377381

378382
if !self.disable_ui_testing_normalization {
379383
self.disable_ui_testing_normalization =
@@ -647,6 +651,10 @@ impl Config {
647651
fn parse_run_rustfix(&self, line: &str) -> bool {
648652
self.parse_name_directive(line, "run-rustfix")
649653
}
654+
655+
fn parse_edition(&self, line: &str) -> Option<String> {
656+
self.parse_name_value_directive(line, "edition")
657+
}
650658
}
651659

652660
pub fn lldb_version_to_int(version_string: &str) -> isize {

‎src/tools/compiletest/src/runtest.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,7 @@ impl<'test> TestCx<'test> {
13681368
.arg(out_dir)
13691369
.arg(&self.testpaths.file)
13701370
.args(&self.props.compile_flags);
1371+
13711372
if let Some(ref linker) = self.config.linker {
13721373
rustdoc
13731374
.arg("--linker")

0 commit comments

Comments
 (0)
Please sign in to comment.