Skip to content

Commit 9779f6c

Browse files
committed
Add a rustfix test to the test project
1 parent 9247955 commit 9779f6c

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

test-project/tests/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ fn run_mode(mode: &'static str) {
1919
fn compile_test() {
2020
run_mode("compile-fail");
2121
run_mode("run-pass");
22+
run_mode("ui");
2223

2324
#[cfg(not(feature = "stable"))]
2425
run_mode("pretty");
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// run-rustfix
12+
13+
#![allow(unused_variables)]
14+
#![deny(keyword_idents)]
15+
16+
fn main() {
17+
let r#dyn = (); //~ ERROR dyn
18+
//~^ WARN hard error in the 2018 edition
19+
}

test-project/tests/ui/dyn-keyword.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// run-rustfix
12+
13+
#![allow(unused_variables)]
14+
#![deny(keyword_idents)]
15+
16+
fn main() {
17+
let dyn = (); //~ ERROR dyn
18+
//~^ WARN hard error in the 2018 edition
19+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: `dyn` is a keyword in the 2018 edition
2+
--> $DIR/dyn-keyword.rs:17:9
3+
|
4+
17 | let dyn = (); //~ ERROR dyn
5+
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
6+
|
7+
note: lint level defined here
8+
--> $DIR/dyn-keyword.rs:14:9
9+
|
10+
14 | #![deny(keyword_idents)]
11+
| ^^^^^^^^^^^^^^
12+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
13+
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
14+
15+
error: aborting due to previous error
16+

0 commit comments

Comments
 (0)