diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-09-22 09:56:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-22 09:56:27 +0200 |
| commit | 822c51121e7379ad72c2a2ccfed3443ecc40fbf4 (patch) | |
| tree | c8bfbe482b6e2af917d6dfad6872bf2c45f15b65 /src/test | |
| parent | e6ee4e056d7855cb0353efbb4207dceb9ab46414 (diff) | |
| parent | cb594cf3730c35fd6c514e98d9c7a0d78a00a02d (diff) | |
| download | rust-822c51121e7379ad72c2a2ccfed3443ecc40fbf4.tar.gz rust-822c51121e7379ad72c2a2ccfed3443ecc40fbf4.zip | |
Rollup merge of #54261 - varkor:dyn-keyword-2018, r=petrochenkov
Make `dyn` a keyword in the 2018 edition Proposed in https://github.com/rust-lang/rust/issues/44662#issuecomment-421596088.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/rust-2018/dyn-keyword.fixed | 10 | ||||
| -rw-r--r-- | src/test/ui/rust-2018/dyn-keyword.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/rust-2018/dyn-keyword.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/rust-2018/dyn-trait-compatibility.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/rust-2018/dyn-trait-compatibility.stderr | 14 |
5 files changed, 58 insertions, 0 deletions
diff --git a/src/test/ui/rust-2018/dyn-keyword.fixed b/src/test/ui/rust-2018/dyn-keyword.fixed new file mode 100644 index 00000000000..e9cda1af939 --- /dev/null +++ b/src/test/ui/rust-2018/dyn-keyword.fixed @@ -0,0 +1,10 @@ +// edition:2015 +// run-rustfix + +#![allow(unused_variables)] +#![deny(keyword_idents)] + +fn main() { + let r#dyn = (); //~ ERROR dyn + //~^ WARN hard error in the 2018 edition +} diff --git a/src/test/ui/rust-2018/dyn-keyword.rs b/src/test/ui/rust-2018/dyn-keyword.rs new file mode 100644 index 00000000000..bdd3a90cab9 --- /dev/null +++ b/src/test/ui/rust-2018/dyn-keyword.rs @@ -0,0 +1,10 @@ +// edition:2015 +// run-rustfix + +#![allow(unused_variables)] +#![deny(keyword_idents)] + +fn main() { + let dyn = (); //~ ERROR dyn + //~^ WARN hard error in the 2018 edition +} diff --git a/src/test/ui/rust-2018/dyn-keyword.stderr b/src/test/ui/rust-2018/dyn-keyword.stderr new file mode 100644 index 00000000000..5a3e00ab1d9 --- /dev/null +++ b/src/test/ui/rust-2018/dyn-keyword.stderr @@ -0,0 +1,16 @@ +error: `dyn` is a keyword in the 2018 edition + --> $DIR/dyn-keyword.rs:8:9 + | +LL | let dyn = (); //~ ERROR dyn + | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` + | +note: lint level defined here + --> $DIR/dyn-keyword.rs:5:9 + | +LL | #![deny(keyword_idents)] + | ^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: aborting due to previous error + diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.rs b/src/test/ui/rust-2018/dyn-trait-compatibility.rs new file mode 100644 index 00000000000..9548df5959b --- /dev/null +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.rs @@ -0,0 +1,8 @@ +// edition:2018 + +type A0 = dyn; +type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword +type A2 = dyn<dyn, dyn>; //~ERROR expected identifier, found `<` +type A3 = dyn<<dyn as dyn>::dyn>; + +fn main() {} diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr new file mode 100644 index 00000000000..ea0483394b5 --- /dev/null +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found reserved keyword `dyn` + --> $DIR/dyn-trait-compatibility.rs:4:16 + | +LL | type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword + | ^^^ expected identifier, found reserved keyword + +error: expected identifier, found `<` + --> $DIR/dyn-trait-compatibility.rs:5:14 + | +LL | type A2 = dyn<dyn, dyn>; //~ERROR expected identifier, found `<` + | ^ expected identifier + +error: aborting due to 2 previous errors + |
