Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a compiletest header for edition #51800

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/test/compile-fail/edition-raw-pointer-method-2015.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, simple. seems good enough for now.

}

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
Original file line number Diff line number Diff line change
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