Skip to content

Commit

Permalink
add edition compiletest header + fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-i-m committed Jun 27, 2018
1 parent 2a1c4ee commit 75d33cf
Show file tree
Hide file tree
Showing 34 changed files with 48 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/test/compile-fail/edition-raw-pointer-method-2015.rs
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/edition-raw-pointer-method-2018.rs
Expand Up @@ -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

Expand Down
Expand Up @@ -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)]

Expand Down
Expand Up @@ -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)]

Expand Down
Expand Up @@ -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)]

Expand Down
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/async-await.rs
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/auxiliary/edition-kw-macro-2015.rs
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/auxiliary/edition-kw-macro-2018.rs
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/edition-keywords-2015-2015.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/edition-keywords-2015-2018.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/edition-keywords-2018-2015.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/edition-keywords-2018-2018.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs
Expand Up @@ -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)]

Expand Down
3 changes: 2 additions & 1 deletion src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs
Expand Up @@ -12,7 +12,8 @@
//
// Regression test for #47075.

// compile-flags: --test --edition=2018 -Zunstable-options
// edition:2018
// compile-flags: --test

#![feature(extern_absolute_paths)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-fn-multiple-lifetimes.rs
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/auxiliary/edition-kw-macro-2015.rs
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/auxiliary/edition-kw-macro-2018.rs
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2015-2015-expansion.rs
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2015-2015-parsing.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2015-2018-expansion.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2015-2018-parsing.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2018-2015-expansion.rs
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2018-2015-parsing.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2018-2018-expansion.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/edition-keywords-2018-2018-parsing.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate-async-await-2015-edition.rs
Expand Up @@ -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)]

Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/feature-gate-async-await.rs
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/feature-gate-async-await.stderr
@@ -1,21 +1,21 @@
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
| ^^^^^^^^^^^^^^^^^
|
= 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
| ^^^^^^^^
|
= 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
| ^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint-anon-param-edition.fixed
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint-anon-param-edition.rs
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/no-args-non-move-async-closure.rs
Expand Up @@ -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)]

Expand Down
14 changes: 11 additions & 3 deletions src/tools/compiletest/src/header.rs
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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<String> {
self.parse_name_value_directive(line, "edition")
}
}

pub fn lldb_version_to_int(version_string: &str) -> isize {
Expand Down
1 change: 1 addition & 0 deletions src/tools/compiletest/src/runtest.rs
Expand Up @@ -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")
Expand Down

0 comments on commit 75d33cf

Please sign in to comment.