about summary refs log tree commit diff
path: root/tests/ui/editions
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/ui/editions
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip
Move /src/test to /tests
Diffstat (limited to 'tests/ui/editions')
-rw-r--r--tests/ui/editions/async-block-2015.rs30
-rw-r--r--tests/ui/editions/async-block-2015.stderr41
-rw-r--r--tests/ui/editions/auxiliary/absolute.rs1
-rw-r--r--tests/ui/editions/auxiliary/edition-extern-crate-allowed.rs1
-rw-r--r--tests/ui/editions/auxiliary/edition-imports-2015.rs31
-rw-r--r--tests/ui/editions/auxiliary/edition-imports-2018.rs17
-rw-r--r--tests/ui/editions/auxiliary/edition-kw-macro-2015.rs28
-rw-r--r--tests/ui/editions/auxiliary/edition-kw-macro-2018.rs28
-rw-r--r--tests/ui/editions/dyn-trait-sugg-2021.rs12
-rw-r--r--tests/ui/editions/dyn-trait-sugg-2021.stderr14
-rw-r--r--tests/ui/editions/edition-extern-crate-allowed.rs10
-rw-r--r--tests/ui/editions/edition-extern-crate-allowed.stderr15
-rw-r--r--tests/ui/editions/edition-feature-ok.rs5
-rw-r--r--tests/ui/editions/edition-feature-redundant.rs7
-rw-r--r--tests/ui/editions/edition-feature-redundant.stderr9
-rw-r--r--tests/ui/editions/edition-imports-2015.rs26
-rw-r--r--tests/ui/editions/edition-imports-2015.stderr10
-rw-r--r--tests/ui/editions/edition-imports-2018.rs27
-rw-r--r--tests/ui/editions/edition-imports-2018.stderr10
-rw-r--r--tests/ui/editions/edition-imports-virtual-2015-ambiguity.rs20
-rw-r--r--tests/ui/editions/edition-imports-virtual-2015-gated.rs11
-rw-r--r--tests/ui/editions/edition-imports-virtual-2015-gated.stderr11
-rw-r--r--tests/ui/editions/edition-keywords-2015-2015-expansion.rs17
-rw-r--r--tests/ui/editions/edition-keywords-2015-2015-parsing.rs26
-rw-r--r--tests/ui/editions/edition-keywords-2015-2015-parsing.stderr26
-rw-r--r--tests/ui/editions/edition-keywords-2015-2015.rs36
-rw-r--r--tests/ui/editions/edition-keywords-2015-2018-expansion.rs14
-rw-r--r--tests/ui/editions/edition-keywords-2015-2018-expansion.stderr15
-rw-r--r--tests/ui/editions/edition-keywords-2015-2018-parsing.rs26
-rw-r--r--tests/ui/editions/edition-keywords-2015-2018-parsing.stderr26
-rw-r--r--tests/ui/editions/edition-keywords-2015-2018.rs36
-rw-r--r--tests/ui/editions/edition-keywords-2018-2015-expansion.rs17
-rw-r--r--tests/ui/editions/edition-keywords-2018-2015-parsing.rs30
-rw-r--r--tests/ui/editions/edition-keywords-2018-2015-parsing.stderr68
-rw-r--r--tests/ui/editions/edition-keywords-2018-2015.rs34
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018-expansion.rs14
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018-expansion.stderr15
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018-parsing.rs30
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018-parsing.stderr68
-rw-r--r--tests/ui/editions/edition-keywords-2018-2018.rs34
-rw-r--r--tests/ui/editions/edition-raw-pointer-method-2015.rs12
-rw-r--r--tests/ui/editions/edition-raw-pointer-method-2015.stderr17
-rw-r--r--tests/ui/editions/edition-raw-pointer-method-2018.rs11
-rw-r--r--tests/ui/editions/edition-raw-pointer-method-2018.stderr9
-rw-r--r--tests/ui/editions/epoch-gate-feature.rs15
45 files changed, 960 insertions, 0 deletions
diff --git a/tests/ui/editions/async-block-2015.rs b/tests/ui/editions/async-block-2015.rs
new file mode 100644
index 00000000000..3daf4930c5b
--- /dev/null
+++ b/tests/ui/editions/async-block-2015.rs
@@ -0,0 +1,30 @@
+async fn foo() {
+//~^ ERROR `async fn` is not permitted in Rust 2015
+//~| NOTE to use `async fn`, switch to Rust 2018 or later
+//~| HELP pass `--edition 2021` to `rustc`
+//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
+
+    let x = async {};
+    //~^ ERROR cannot find struct, variant or union type `async` in this scope
+    //~| NOTE `async` blocks are only allowed in Rust 2018 or later
+    let y = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
+        let x = 42;
+        //~^ ERROR expected identifier, found keyword `let`
+        //~| NOTE expected identifier, found keyword
+        //~| HELP pass `--edition 2021` to `rustc`
+        //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
+        42
+    };
+    let z = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
+        42
+        //~^ ERROR expected identifier, found `42`
+        //~| NOTE expected identifier
+        //~| HELP pass `--edition 2021` to `rustc`
+        //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
+    };
+    y.await;
+    z.await;
+    x
+}
+
+fn main() {}
diff --git a/tests/ui/editions/async-block-2015.stderr b/tests/ui/editions/async-block-2015.stderr
new file mode 100644
index 00000000000..b792b8c1e0d
--- /dev/null
+++ b/tests/ui/editions/async-block-2015.stderr
@@ -0,0 +1,41 @@
+error[E0670]: `async fn` is not permitted in Rust 2015
+  --> $DIR/async-block-2015.rs:1:1
+   |
+LL | async fn foo() {
+   | ^^^^^ to use `async fn`, switch to Rust 2018 or later
+   |
+   = help: pass `--edition 2021` to `rustc`
+   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error: expected identifier, found keyword `let`
+  --> $DIR/async-block-2015.rs:11:9
+   |
+LL |     let y = async {
+   |             ----- `async` blocks are only allowed in Rust 2018 or later
+LL |         let x = 42;
+   |         ^^^ expected identifier, found keyword
+   |
+   = help: pass `--edition 2021` to `rustc`
+   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error: expected identifier, found `42`
+  --> $DIR/async-block-2015.rs:19:9
+   |
+LL |     let z = async {
+   |             ----- `async` blocks are only allowed in Rust 2018 or later
+LL |         42
+   |         ^^ expected identifier
+   |
+   = help: pass `--edition 2021` to `rustc`
+   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
+
+error[E0422]: cannot find struct, variant or union type `async` in this scope
+  --> $DIR/async-block-2015.rs:7:13
+   |
+LL |     let x = async {};
+   |             ^^^^^ `async` blocks are only allowed in Rust 2018 or later
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0422, E0670.
+For more information about an error, try `rustc --explain E0422`.
diff --git a/tests/ui/editions/auxiliary/absolute.rs b/tests/ui/editions/auxiliary/absolute.rs
new file mode 100644
index 00000000000..d596f97355f
--- /dev/null
+++ b/tests/ui/editions/auxiliary/absolute.rs
@@ -0,0 +1 @@
+pub struct Path;
diff --git a/tests/ui/editions/auxiliary/edition-extern-crate-allowed.rs b/tests/ui/editions/auxiliary/edition-extern-crate-allowed.rs
new file mode 100644
index 00000000000..d11c69f812a
--- /dev/null
+++ b/tests/ui/editions/auxiliary/edition-extern-crate-allowed.rs
@@ -0,0 +1 @@
+// intentionally empty
diff --git a/tests/ui/editions/auxiliary/edition-imports-2015.rs b/tests/ui/editions/auxiliary/edition-imports-2015.rs
new file mode 100644
index 00000000000..c72331ca2e1
--- /dev/null
+++ b/tests/ui/editions/auxiliary/edition-imports-2015.rs
@@ -0,0 +1,31 @@
+// edition:2015
+
+#[macro_export]
+macro_rules! gen_imports { () => {
+    use import::Path;
+    use std::collections::LinkedList;
+
+    fn check_absolute() {
+        ::absolute::Path;
+        ::std::collections::LinkedList::<u8>::new();
+    }
+}}
+
+#[macro_export]
+macro_rules! gen_glob { () => {
+    use *;
+}}
+
+#[macro_export]
+macro_rules! gen_gated { () => {
+    fn check_gated() {
+        enum E { A }
+        use E::*;
+    }
+}}
+
+#[macro_export]
+macro_rules! gen_ambiguous { () => {
+    use Ambiguous;
+    type A = ::edition_imports_2015::Path;
+}}
diff --git a/tests/ui/editions/auxiliary/edition-imports-2018.rs b/tests/ui/editions/auxiliary/edition-imports-2018.rs
new file mode 100644
index 00000000000..b08dc499a0d
--- /dev/null
+++ b/tests/ui/editions/auxiliary/edition-imports-2018.rs
@@ -0,0 +1,17 @@
+// edition:2018
+
+#[macro_export]
+macro_rules! gen_imports { () => {
+    use import::Path;
+    use std::collections::LinkedList;
+
+    fn check_absolute() {
+        ::absolute::Path;
+        ::std::collections::LinkedList::<u8>::new();
+    }
+}}
+
+#[macro_export]
+macro_rules! gen_glob { () => {
+    use *;
+}}
diff --git a/tests/ui/editions/auxiliary/edition-kw-macro-2015.rs b/tests/ui/editions/auxiliary/edition-kw-macro-2015.rs
new file mode 100644
index 00000000000..7cfd128f2bf
--- /dev/null
+++ b/tests/ui/editions/auxiliary/edition-kw-macro-2015.rs
@@ -0,0 +1,28 @@
+// edition:2015
+
+#![allow(keyword_idents)]
+
+#[macro_export]
+macro_rules! produces_async {
+    () => (pub fn async() {})
+}
+
+#[macro_export]
+macro_rules! produces_async_raw {
+    () => (pub fn r#async() {})
+}
+
+#[macro_export]
+macro_rules! consumes_async {
+    (async) => (1)
+}
+
+#[macro_export]
+macro_rules! consumes_async_raw {
+    (r#async) => (1)
+}
+
+#[macro_export]
+macro_rules! passes_ident {
+    ($i: ident) => ($i)
+}
diff --git a/tests/ui/editions/auxiliary/edition-kw-macro-2018.rs b/tests/ui/editions/auxiliary/edition-kw-macro-2018.rs
new file mode 100644
index 00000000000..d07c0218db3
--- /dev/null
+++ b/tests/ui/editions/auxiliary/edition-kw-macro-2018.rs
@@ -0,0 +1,28 @@
+// edition:2018
+
+#![allow(keyword_idents)]
+
+#[macro_export]
+macro_rules! produces_async {
+    () => (pub fn async() {})
+}
+
+#[macro_export]
+macro_rules! produces_async_raw {
+    () => (pub fn r#async() {})
+}
+
+#[macro_export]
+macro_rules! consumes_async {
+    (async) => (1)
+}
+
+#[macro_export]
+macro_rules! consumes_async_raw {
+    (r#async) => (1)
+}
+
+#[macro_export]
+macro_rules! passes_ident {
+    ($i: ident) => ($i)
+}
diff --git a/tests/ui/editions/dyn-trait-sugg-2021.rs b/tests/ui/editions/dyn-trait-sugg-2021.rs
new file mode 100644
index 00000000000..de0444b63e2
--- /dev/null
+++ b/tests/ui/editions/dyn-trait-sugg-2021.rs
@@ -0,0 +1,12 @@
+// edition:2021
+
+trait Foo<T> {}
+
+impl<T> dyn Foo<T> {
+    fn hi(_x: T) {}
+}
+
+fn main() {
+    Foo::hi(123);
+    //~^ ERROR trait objects must include the `dyn` keyword
+}
diff --git a/tests/ui/editions/dyn-trait-sugg-2021.stderr b/tests/ui/editions/dyn-trait-sugg-2021.stderr
new file mode 100644
index 00000000000..8c68dec1df7
--- /dev/null
+++ b/tests/ui/editions/dyn-trait-sugg-2021.stderr
@@ -0,0 +1,14 @@
+error[E0782]: trait objects must include the `dyn` keyword
+  --> $DIR/dyn-trait-sugg-2021.rs:10:5
+   |
+LL |     Foo::hi(123);
+   |     ^^^
+   |
+help: add `dyn` keyword before this trait
+   |
+LL |     <dyn Foo>::hi(123);
+   |     ++++    +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0782`.
diff --git a/tests/ui/editions/edition-extern-crate-allowed.rs b/tests/ui/editions/edition-extern-crate-allowed.rs
new file mode 100644
index 00000000000..8d142cea5de
--- /dev/null
+++ b/tests/ui/editions/edition-extern-crate-allowed.rs
@@ -0,0 +1,10 @@
+// aux-build:edition-extern-crate-allowed.rs
+// edition:2015
+// check-pass
+
+#![warn(rust_2018_idioms)]
+
+extern crate edition_extern_crate_allowed;
+//~^ WARNING unused extern crate
+
+fn main() {}
diff --git a/tests/ui/editions/edition-extern-crate-allowed.stderr b/tests/ui/editions/edition-extern-crate-allowed.stderr
new file mode 100644
index 00000000000..dde774c520d
--- /dev/null
+++ b/tests/ui/editions/edition-extern-crate-allowed.stderr
@@ -0,0 +1,15 @@
+warning: unused extern crate
+  --> $DIR/edition-extern-crate-allowed.rs:7:1
+   |
+LL | extern crate edition_extern_crate_allowed;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+   |
+note: the lint level is defined here
+  --> $DIR/edition-extern-crate-allowed.rs:5:9
+   |
+LL | #![warn(rust_2018_idioms)]
+   |         ^^^^^^^^^^^^^^^^
+   = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/editions/edition-feature-ok.rs b/tests/ui/editions/edition-feature-ok.rs
new file mode 100644
index 00000000000..69242fd715c
--- /dev/null
+++ b/tests/ui/editions/edition-feature-ok.rs
@@ -0,0 +1,5 @@
+// check-pass
+
+#![feature(rust_2018_preview)]
+
+fn main() {}
diff --git a/tests/ui/editions/edition-feature-redundant.rs b/tests/ui/editions/edition-feature-redundant.rs
new file mode 100644
index 00000000000..1049a2da8fd
--- /dev/null
+++ b/tests/ui/editions/edition-feature-redundant.rs
@@ -0,0 +1,7 @@
+// edition:2018
+// check-pass
+
+#![feature(rust_2018_preview)]
+//~^ WARN the feature `rust_2018_preview` is included in the Rust 2018 edition
+
+fn main() {}
diff --git a/tests/ui/editions/edition-feature-redundant.stderr b/tests/ui/editions/edition-feature-redundant.stderr
new file mode 100644
index 00000000000..b11e616d7f2
--- /dev/null
+++ b/tests/ui/editions/edition-feature-redundant.stderr
@@ -0,0 +1,9 @@
+warning[E0705]: the feature `rust_2018_preview` is included in the Rust 2018 edition
+  --> $DIR/edition-feature-redundant.rs:4:12
+   |
+LL | #![feature(rust_2018_preview)]
+   |            ^^^^^^^^^^^^^^^^^
+
+warning: 1 warning emitted
+
+For more information about this error, try `rustc --explain E0705`.
diff --git a/tests/ui/editions/edition-imports-2015.rs b/tests/ui/editions/edition-imports-2015.rs
new file mode 100644
index 00000000000..5ba45b19dde
--- /dev/null
+++ b/tests/ui/editions/edition-imports-2015.rs
@@ -0,0 +1,26 @@
+// edition:2015
+// compile-flags:--extern absolute
+// aux-build:edition-imports-2018.rs
+// aux-build:absolute.rs
+
+#[macro_use]
+extern crate edition_imports_2018;
+
+mod check {
+    mod import {
+        pub struct Path;
+    }
+
+    gen_imports!(); // OK
+
+    fn check() {
+        Path;
+        LinkedList::<u8>::new();
+    }
+}
+
+mod check_glob {
+    gen_glob!(); //~ ERROR cannot glob-import all possible crates
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-imports-2015.stderr b/tests/ui/editions/edition-imports-2015.stderr
new file mode 100644
index 00000000000..3f38e6f8e80
--- /dev/null
+++ b/tests/ui/editions/edition-imports-2015.stderr
@@ -0,0 +1,10 @@
+error: cannot glob-import all possible crates
+  --> $DIR/edition-imports-2015.rs:23:5
+   |
+LL |     gen_glob!();
+   |     ^^^^^^^^^^^
+   |
+   = note: this error originates in the macro `gen_glob` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/editions/edition-imports-2018.rs b/tests/ui/editions/edition-imports-2018.rs
new file mode 100644
index 00000000000..dcdbf0d050b
--- /dev/null
+++ b/tests/ui/editions/edition-imports-2018.rs
@@ -0,0 +1,27 @@
+// edition:2018
+// aux-build:edition-imports-2015.rs
+
+#[macro_use]
+extern crate edition_imports_2015;
+
+mod import {
+    pub struct Path;
+}
+mod absolute {
+    pub struct Path;
+}
+
+mod check {
+    gen_imports!(); // OK
+
+    fn check() {
+        Path;
+        LinkedList::<u8>::new();
+    }
+}
+
+mod check_glob {
+    gen_glob!(); //~ ERROR cannot glob-import all possible crates
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-imports-2018.stderr b/tests/ui/editions/edition-imports-2018.stderr
new file mode 100644
index 00000000000..e7f760e49bc
--- /dev/null
+++ b/tests/ui/editions/edition-imports-2018.stderr
@@ -0,0 +1,10 @@
+error: cannot glob-import all possible crates
+  --> $DIR/edition-imports-2018.rs:24:5
+   |
+LL |     gen_glob!();
+   |     ^^^^^^^^^^^
+   |
+   = note: this error originates in the macro `gen_glob` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/editions/edition-imports-virtual-2015-ambiguity.rs b/tests/ui/editions/edition-imports-virtual-2015-ambiguity.rs
new file mode 100644
index 00000000000..3fffb30c612
--- /dev/null
+++ b/tests/ui/editions/edition-imports-virtual-2015-ambiguity.rs
@@ -0,0 +1,20 @@
+// check-pass
+// edition:2018
+// compile-flags:--extern edition_imports_2015
+// aux-build:edition-imports-2015.rs
+
+mod edition_imports_2015 {
+    pub struct Path;
+}
+
+pub struct Ambiguous {}
+
+mod check {
+    pub struct Ambiguous {}
+
+    fn check() {
+        edition_imports_2015::gen_ambiguous!(); // OK
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-imports-virtual-2015-gated.rs b/tests/ui/editions/edition-imports-virtual-2015-gated.rs
new file mode 100644
index 00000000000..634d3e9a443
--- /dev/null
+++ b/tests/ui/editions/edition-imports-virtual-2015-gated.rs
@@ -0,0 +1,11 @@
+// edition:2018
+// aux-build:edition-imports-2015.rs
+
+#[macro_use]
+extern crate edition_imports_2015;
+
+mod check {
+    gen_gated!(); //~ ERROR unresolved import `E`
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-imports-virtual-2015-gated.stderr b/tests/ui/editions/edition-imports-virtual-2015-gated.stderr
new file mode 100644
index 00000000000..e4bdd28213e
--- /dev/null
+++ b/tests/ui/editions/edition-imports-virtual-2015-gated.stderr
@@ -0,0 +1,11 @@
+error[E0432]: unresolved import `E`
+  --> $DIR/edition-imports-virtual-2015-gated.rs:8:5
+   |
+LL |     gen_gated!();
+   |     ^^^^^^^^^^^^ could not find `E` in the list of imported crates
+   |
+   = note: this error originates in the macro `gen_gated` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/editions/edition-keywords-2015-2015-expansion.rs b/tests/ui/editions/edition-keywords-2015-2015-expansion.rs
new file mode 100644
index 00000000000..b2695bea5c3
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2015-expansion.rs
@@ -0,0 +1,17 @@
+// edition:2015
+// aux-build:edition-kw-macro-2015.rs
+// check-pass
+
+#![allow(keyword_idents)]
+
+#[macro_use]
+extern crate edition_kw_macro_2015;
+
+mod one_async {
+    produces_async! {} // OK
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2015-2015-parsing.rs b/tests/ui/editions/edition-keywords-2015-2015-parsing.rs
new file mode 100644
index 00000000000..d1752a7ec71
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2015-parsing.rs
@@ -0,0 +1,26 @@
+// edition:2015
+// aux-build:edition-kw-macro-2015.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2015;
+
+mod module {
+    pub fn async() {}
+}
+
+pub fn check_async() {
+    let mut async = 1; // OK
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
+    r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
+    r#async = consumes_async_raw!(r#async); // OK
+
+    if passes_ident!(async) == 1 {} // OK
+    if passes_ident!(r#async) == 1 {} // OK
+    module::async(); // OK
+    module::r#async(); // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2015-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2015-2015-parsing.stderr
new file mode 100644
index 00000000000..39944622d07
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2015-parsing.stderr
@@ -0,0 +1,26 @@
+error: no rules expected the token `r#async`
+  --> $DIR/edition-keywords-2015-2015-parsing.rs:16:31
+   |
+LL |     r#async = consumes_async!(r#async);
+   |                               ^^^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `async`
+  --> $DIR/auxiliary/edition-kw-macro-2015.rs:17:6
+   |
+LL |     (async) => (1)
+   |      ^^^^^
+
+error: no rules expected the token `async`
+  --> $DIR/edition-keywords-2015-2015-parsing.rs:17:35
+   |
+LL |     r#async = consumes_async_raw!(async);
+   |                                   ^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `r#async`
+  --> $DIR/auxiliary/edition-kw-macro-2015.rs:22:6
+   |
+LL |     (r#async) => (1)
+   |      ^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/editions/edition-keywords-2015-2015.rs b/tests/ui/editions/edition-keywords-2015-2015.rs
new file mode 100644
index 00000000000..943d203b806
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2015.rs
@@ -0,0 +1,36 @@
+// run-pass
+
+#![allow(unused_mut)]
+#![allow(unused_assignments)]
+#![allow(unused_variables)]
+// edition:2015
+// aux-build:edition-kw-macro-2015.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2015;
+
+pub fn check_async() {
+    let mut async = 1; // OK
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    // r#async = consumes_async!(r#async); // ERROR, not a match
+    // r#async = consumes_async_raw!(async); // ERROR, not a match
+    r#async = consumes_async_raw!(r#async); // OK
+
+    if passes_ident!(async) == 1 {} // OK
+    if passes_ident!(r#async) == 1 {} // OK
+    one_async::async(); // OK
+    one_async::r#async(); // OK
+    two_async::async(); // OK
+    two_async::r#async(); // OK
+}
+
+mod one_async {
+    produces_async! {} // OK
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2015-2018-expansion.rs b/tests/ui/editions/edition-keywords-2015-2018-expansion.rs
new file mode 100644
index 00000000000..9f34a3887b7
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2018-expansion.rs
@@ -0,0 +1,14 @@
+// edition:2015
+// aux-build:edition-kw-macro-2018.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+mod one_async {
+    produces_async! {} //~ ERROR expected identifier, found keyword
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2015-2018-expansion.stderr b/tests/ui/editions/edition-keywords-2015-2018-expansion.stderr
new file mode 100644
index 00000000000..570bbac2b21
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2018-expansion.stderr
@@ -0,0 +1,15 @@
+error: expected identifier, found keyword `async`
+  --> $DIR/edition-keywords-2015-2018-expansion.rs:8:5
+   |
+LL |     produces_async! {}
+   |     ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
+   |
+   = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: escape `async` to use it as an identifier
+  --> $DIR/auxiliary/edition-kw-macro-2018.rs:7:19
+   |
+LL |     () => (pub fn r#async() {})
+   |                   ++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/editions/edition-keywords-2015-2018-parsing.rs b/tests/ui/editions/edition-keywords-2015-2018-parsing.rs
new file mode 100644
index 00000000000..44455f43856
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2018-parsing.rs
@@ -0,0 +1,26 @@
+// edition:2015
+// aux-build:edition-kw-macro-2018.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+mod module {
+    pub fn async() {}
+}
+
+pub fn check_async() {
+    let mut async = 1; // OK
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
+    r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
+    r#async = consumes_async_raw!(r#async); // OK
+
+    if passes_ident!(async) == 1 {} // OK
+    if passes_ident!(r#async) == 1 {} // OK
+    module::async(); // OK
+    module::r#async(); // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2015-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2015-2018-parsing.stderr
new file mode 100644
index 00000000000..fa83908e666
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2018-parsing.stderr
@@ -0,0 +1,26 @@
+error: no rules expected the token `r#async`
+  --> $DIR/edition-keywords-2015-2018-parsing.rs:16:31
+   |
+LL |     r#async = consumes_async!(r#async);
+   |                               ^^^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `async`
+  --> $DIR/auxiliary/edition-kw-macro-2018.rs:17:6
+   |
+LL |     (async) => (1)
+   |      ^^^^^
+
+error: no rules expected the token `async`
+  --> $DIR/edition-keywords-2015-2018-parsing.rs:17:35
+   |
+LL |     r#async = consumes_async_raw!(async);
+   |                                   ^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `r#async`
+  --> $DIR/auxiliary/edition-kw-macro-2018.rs:22:6
+   |
+LL |     (r#async) => (1)
+   |      ^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/editions/edition-keywords-2015-2018.rs b/tests/ui/editions/edition-keywords-2015-2018.rs
new file mode 100644
index 00000000000..8c3397c951d
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2015-2018.rs
@@ -0,0 +1,36 @@
+// run-pass
+
+#![allow(unused_mut)]
+#![allow(unused_assignments)]
+#![allow(unused_variables)]
+// edition:2015
+// aux-build:edition-kw-macro-2018.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+pub fn check_async() {
+    let mut async = 1; // OK
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    // r#async = consumes_async!(r#async); // ERROR, not a match
+    // r#async = consumes_async_raw!(async); // ERROR, not a match
+    r#async = consumes_async_raw!(r#async); // OK
+
+    if passes_ident!(async) == 1 {} // OK
+    if passes_ident!(r#async) == 1 {} // OK
+    // one_async::async(); // ERROR, unresolved name
+    // one_async::r#async(); // ERROR, unresolved name
+    two_async::async(); // OK
+    two_async::r#async(); // OK
+}
+
+mod one_async {
+    // produces_async! {} // ERROR, reserved
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2018-2015-expansion.rs b/tests/ui/editions/edition-keywords-2018-2015-expansion.rs
new file mode 100644
index 00000000000..707d8e95c14
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2015-expansion.rs
@@ -0,0 +1,17 @@
+// edition:2018
+// aux-build:edition-kw-macro-2015.rs
+// check-pass
+
+#![allow(keyword_idents)]
+
+#[macro_use]
+extern crate edition_kw_macro_2015;
+
+mod one_async {
+    produces_async! {} // OK
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs
new file mode 100644
index 00000000000..d5ed9fb9a28
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs
@@ -0,0 +1,30 @@
+// edition:2018
+// aux-build:edition-kw-macro-2015.rs
+
+#![feature(async_closure)]
+
+fn main() {}
+
+#[macro_use]
+extern crate edition_kw_macro_2015;
+
+mod module {
+    pub fn r#async() {}
+}
+
+pub fn check_async() {
+    let mut async = 1; //~ ERROR expected identifier, found keyword `async`
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
+    r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
+    r#async = consumes_async_raw!(r#async); // OK
+
+    if passes_ident!(async) == 1 {}
+    if passes_ident!(r#async) == 1 {} // OK
+    module::async(); //~ ERROR expected identifier, found keyword `async`
+    module::r#async(); // OK
+
+    let _recovery_witness: () = 0; //~ ERROR mismatched types
+}
diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr
new file mode 100644
index 00000000000..1a4a94e9733
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr
@@ -0,0 +1,68 @@
+error: expected identifier, found keyword `async`
+  --> $DIR/edition-keywords-2018-2015-parsing.rs:16:13
+   |
+LL |     let mut async = 1;
+   |             ^^^^^ expected identifier, found keyword
+   |
+help: escape `async` to use it as an identifier
+   |
+LL |     let mut r#async = 1;
+   |             ++
+
+error: expected identifier, found keyword `async`
+  --> $DIR/edition-keywords-2018-2015-parsing.rs:26:13
+   |
+LL |     module::async();
+   |             ^^^^^ expected identifier, found keyword
+   |
+help: escape `async` to use it as an identifier
+   |
+LL |     module::r#async();
+   |             ++
+
+error: no rules expected the token `r#async`
+  --> $DIR/edition-keywords-2018-2015-parsing.rs:20:31
+   |
+LL |     r#async = consumes_async!(r#async);
+   |                               ^^^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `async`
+  --> $DIR/auxiliary/edition-kw-macro-2015.rs:17:6
+   |
+LL |     (async) => (1)
+   |      ^^^^^
+
+error: no rules expected the token `async`
+  --> $DIR/edition-keywords-2018-2015-parsing.rs:21:35
+   |
+LL |     r#async = consumes_async_raw!(async);
+   |                                   ^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `r#async`
+  --> $DIR/auxiliary/edition-kw-macro-2015.rs:22:6
+   |
+LL |     (r#async) => (1)
+   |      ^^^^^^^
+
+error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||`
+  --> $DIR/auxiliary/edition-kw-macro-2015.rs:27:23
+   |
+LL |     ($i: ident) => ($i)
+   |                       ^ expected one of `move`, `|`, or `||`
+   |
+  ::: $DIR/edition-keywords-2018-2015-parsing.rs:24:8
+   |
+LL |     if passes_ident!(async) == 1 {}
+   |        -------------------- in this macro invocation
+
+error[E0308]: mismatched types
+  --> $DIR/edition-keywords-2018-2015-parsing.rs:29:33
+   |
+LL |     let _recovery_witness: () = 0;
+   |                            --   ^ expected `()`, found integer
+   |                            |
+   |                            expected due to this
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/editions/edition-keywords-2018-2015.rs b/tests/ui/editions/edition-keywords-2018-2015.rs
new file mode 100644
index 00000000000..2cb2dfb18a0
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2015.rs
@@ -0,0 +1,34 @@
+// run-pass
+
+#![allow(unused_assignments)]
+// edition:2018
+// aux-build:edition-kw-macro-2015.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2015;
+
+pub fn check_async() {
+    // let mut async = 1; // ERROR, reserved
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    // r#async = consumes_async!(r#async); // ERROR, not a match
+    // r#async = consumes_async_raw!(async); // ERROR, not a match
+    r#async = consumes_async_raw!(r#async); // OK
+
+    // if passes_ident!(async) == 1 {} // ERROR, reserved
+    if passes_ident!(r#async) == 1 {} // OK
+    // one_async::async(); // ERROR, reserved
+    one_async::r#async(); // OK
+    // two_async::async(); // ERROR, reserved
+    two_async::r#async(); // OK
+}
+
+mod one_async {
+    produces_async! {} // OK
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2018-2018-expansion.rs b/tests/ui/editions/edition-keywords-2018-2018-expansion.rs
new file mode 100644
index 00000000000..a8e69fed695
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2018-expansion.rs
@@ -0,0 +1,14 @@
+// edition:2018
+// aux-build:edition-kw-macro-2018.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+mod one_async {
+    produces_async! {} //~ ERROR expected identifier, found keyword `async`
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-keywords-2018-2018-expansion.stderr b/tests/ui/editions/edition-keywords-2018-2018-expansion.stderr
new file mode 100644
index 00000000000..69f275746bd
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2018-expansion.stderr
@@ -0,0 +1,15 @@
+error: expected identifier, found keyword `async`
+  --> $DIR/edition-keywords-2018-2018-expansion.rs:8:5
+   |
+LL |     produces_async! {}
+   |     ^^^^^^^^^^^^^^^^^^ expected identifier, found keyword
+   |
+   = note: this error originates in the macro `produces_async` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: escape `async` to use it as an identifier
+  --> $DIR/auxiliary/edition-kw-macro-2018.rs:7:19
+   |
+LL |     () => (pub fn r#async() {})
+   |                   ++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
new file mode 100644
index 00000000000..044ab249f2c
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs
@@ -0,0 +1,30 @@
+// edition:2018
+// aux-build:edition-kw-macro-2018.rs
+
+#![feature(async_closure)]
+
+fn main() {}
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+mod module {
+    pub fn r#async() {}
+}
+
+pub fn check_async() {
+    let mut async = 1; //~ ERROR expected identifier, found keyword `async`
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async`
+    r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async`
+    r#async = consumes_async_raw!(r#async); // OK
+
+    if passes_ident!(async) == 1 {}
+    if passes_ident!(r#async) == 1 {} // OK
+    module::async(); //~ ERROR expected identifier, found keyword `async`
+    module::r#async(); // OK
+
+    let _recovery_witness: () = 0; //~ ERROR mismatched types
+}
diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr
new file mode 100644
index 00000000000..19eb7ac9823
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr
@@ -0,0 +1,68 @@
+error: expected identifier, found keyword `async`
+  --> $DIR/edition-keywords-2018-2018-parsing.rs:16:13
+   |
+LL |     let mut async = 1;
+   |             ^^^^^ expected identifier, found keyword
+   |
+help: escape `async` to use it as an identifier
+   |
+LL |     let mut r#async = 1;
+   |             ++
+
+error: expected identifier, found keyword `async`
+  --> $DIR/edition-keywords-2018-2018-parsing.rs:26:13
+   |
+LL |     module::async();
+   |             ^^^^^ expected identifier, found keyword
+   |
+help: escape `async` to use it as an identifier
+   |
+LL |     module::r#async();
+   |             ++
+
+error: no rules expected the token `r#async`
+  --> $DIR/edition-keywords-2018-2018-parsing.rs:20:31
+   |
+LL |     r#async = consumes_async!(r#async);
+   |                               ^^^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `async`
+  --> $DIR/auxiliary/edition-kw-macro-2018.rs:17:6
+   |
+LL |     (async) => (1)
+   |      ^^^^^
+
+error: no rules expected the token `async`
+  --> $DIR/edition-keywords-2018-2018-parsing.rs:21:35
+   |
+LL |     r#async = consumes_async_raw!(async);
+   |                                   ^^^^^ no rules expected this token in macro call
+   |
+note: while trying to match `r#async`
+  --> $DIR/auxiliary/edition-kw-macro-2018.rs:22:6
+   |
+LL |     (r#async) => (1)
+   |      ^^^^^^^
+
+error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||`
+  --> $DIR/auxiliary/edition-kw-macro-2018.rs:27:23
+   |
+LL |     ($i: ident) => ($i)
+   |                       ^ expected one of `move`, `|`, or `||`
+   |
+  ::: $DIR/edition-keywords-2018-2018-parsing.rs:24:8
+   |
+LL |     if passes_ident!(async) == 1 {}
+   |        -------------------- in this macro invocation
+
+error[E0308]: mismatched types
+  --> $DIR/edition-keywords-2018-2018-parsing.rs:29:33
+   |
+LL |     let _recovery_witness: () = 0;
+   |                            --   ^ expected `()`, found integer
+   |                            |
+   |                            expected due to this
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/editions/edition-keywords-2018-2018.rs b/tests/ui/editions/edition-keywords-2018-2018.rs
new file mode 100644
index 00000000000..5043440aa16
--- /dev/null
+++ b/tests/ui/editions/edition-keywords-2018-2018.rs
@@ -0,0 +1,34 @@
+// run-pass
+
+#![allow(unused_assignments)]
+// edition:2018
+// aux-build:edition-kw-macro-2018.rs
+
+#[macro_use]
+extern crate edition_kw_macro_2018;
+
+pub fn check_async() {
+    // let mut async = 1; // ERROR, reserved
+    let mut r#async = 1; // OK
+
+    r#async = consumes_async!(async); // OK
+    // r#async = consumes_async!(r#async); // ERROR, not a match
+    // r#async = consumes_async_raw!(async); // ERROR, not a match
+    r#async = consumes_async_raw!(r#async); // OK
+
+    // if passes_ident!(async) == 1 {} // ERROR, reserved
+    if passes_ident!(r#async) == 1 {} // OK
+    // one_async::async(); // ERROR, reserved
+    // one_async::r#async(); // ERROR, unresolved name
+    // two_async::async(); // ERROR, reserved
+    two_async::r#async(); // OK
+}
+
+mod one_async {
+    // produces_async! {} // ERROR, reserved
+}
+mod two_async {
+    produces_async_raw! {} // OK
+}
+
+fn main() {}
diff --git a/tests/ui/editions/edition-raw-pointer-method-2015.rs b/tests/ui/editions/edition-raw-pointer-method-2015.rs
new file mode 100644
index 00000000000..fcfe493c1a2
--- /dev/null
+++ b/tests/ui/editions/edition-raw-pointer-method-2015.rs
@@ -0,0 +1,12 @@
+// edition:2015
+
+// tests that editions work with the tyvar warning-turned-error
+
+#[deny(warnings)]
+fn main() {
+    let x = 0;
+    let y = &x as *const _;
+    let _ = y.is_null();
+    //~^ error: type annotations needed [tyvar_behind_raw_pointer]
+    //~^^ warning: this is accepted in the current edition
+}
diff --git a/tests/ui/editions/edition-raw-pointer-method-2015.stderr b/tests/ui/editions/edition-raw-pointer-method-2015.stderr
new file mode 100644
index 00000000000..612dd17e71e
--- /dev/null
+++ b/tests/ui/editions/edition-raw-pointer-method-2015.stderr
@@ -0,0 +1,17 @@
+error: type annotations needed
+  --> $DIR/edition-raw-pointer-method-2015.rs:9:15
+   |
+LL |     let _ = y.is_null();
+   |               ^^^^^^^
+   |
+   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
+   = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
+note: the lint level is defined here
+  --> $DIR/edition-raw-pointer-method-2015.rs:5:8
+   |
+LL | #[deny(warnings)]
+   |        ^^^^^^^^
+   = note: `#[deny(tyvar_behind_raw_pointer)]` implied by `#[deny(warnings)]`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/editions/edition-raw-pointer-method-2018.rs b/tests/ui/editions/edition-raw-pointer-method-2018.rs
new file mode 100644
index 00000000000..af0b2d6bd4a
--- /dev/null
+++ b/tests/ui/editions/edition-raw-pointer-method-2018.rs
@@ -0,0 +1,11 @@
+// edition:2018
+
+// tests that editions work with the tyvar warning-turned-error
+
+#[deny(warnings)]
+fn main() {
+    let x = 0;
+    let y = &x as *const _;
+    let _ = y.is_null();
+    //~^ error: the type of this value must be known to call a method on a raw pointer on it [E0699]
+}
diff --git a/tests/ui/editions/edition-raw-pointer-method-2018.stderr b/tests/ui/editions/edition-raw-pointer-method-2018.stderr
new file mode 100644
index 00000000000..23452495b4b
--- /dev/null
+++ b/tests/ui/editions/edition-raw-pointer-method-2018.stderr
@@ -0,0 +1,9 @@
+error[E0699]: the type of this value must be known to call a method on a raw pointer on it
+  --> $DIR/edition-raw-pointer-method-2018.rs:9:15
+   |
+LL |     let _ = y.is_null();
+   |               ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0699`.
diff --git a/tests/ui/editions/epoch-gate-feature.rs b/tests/ui/editions/epoch-gate-feature.rs
new file mode 100644
index 00000000000..5f7feb5347b
--- /dev/null
+++ b/tests/ui/editions/epoch-gate-feature.rs
@@ -0,0 +1,15 @@
+// run-pass
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+// Checks if the correct registers are being used to pass arguments
+// when the sysv64 ABI is specified.
+
+#![feature(rust_2018_preview)]
+
+pub trait Foo {}
+
+// should compile without the dyn trait feature flag
+fn foo(x: &dyn Foo) {}
+
+pub fn main() {}