Skip to content

Commit eb07369

Browse files
committed
update most tests to 2021 edition
1 parent df65291 commit eb07369

25 files changed

+91
-55
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tempfile = { version = "3.2", optional = true }
2828

2929
[dev-dependencies]
3030
cargo_metadata = "0.12"
31-
compiletest_rs = { version = "0.7", features = ["tmp"] }
31+
compiletest_rs = { version = "0.7.1", features = ["tmp"] }
3232
tester = "0.9"
3333
regex = "1.5"
3434
# This is used by the `collect-metadata` alias.

tests/compile-test.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ fn extern_flags() -> String {
104104
}
105105

106106
fn default_config() -> compiletest::Config {
107-
let mut config = compiletest::Config::default();
107+
let mut config = compiletest::Config {
108+
edition: Some("2021".into()),
109+
..compiletest::Config::default()
110+
};
108111

109112
if let Ok(filters) = env::var("TESTNAME") {
110113
config.filters = filters.split(',').map(std::string::ToString::to_string).collect();

tests/ui/assertions_on_constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//edition:2015
12
#![allow(non_fmt_panics)]
23

34
macro_rules! assert_const {
@@ -6,7 +7,6 @@ macro_rules! assert_const {
67
debug_assert!($len < 0);
78
};
89
}
9-
1010
fn main() {
1111
assert!(true);
1212
assert!(false);

tests/ui/crashes/ice-3969.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//edition:2015
12
// https://github.com/rust-lang/rust-clippy/issues/3969
23
// used to crash: error: internal compiler error:
34
// src/librustc_traits/normalize_erasing_regions.rs:43: could not fully normalize `<i32 as
@@ -7,7 +8,6 @@
78
// in type inference.
89
#![feature(trivial_bounds)]
910
#![allow(unused)]
10-
1111
trait A {}
1212

1313
impl A for i32 {}

tests/ui/crashes/ice-6252.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
//edition:2015
12
// originally from glacier fixed/77919.rs
23
// encountered errors resolving bounds after type-checking
3-
44
trait TypeVal<T> {
55
const VAL: T;
66
}

tests/ui/debug_assert_with_mut_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// compile-flags: --edition=2018
21
#![feature(custom_inner_attributes)]
32
#![rustfmt::skip]
43
#![warn(clippy::debug_assert_with_mut_call)]
54
#![allow(clippy::redundant_closure_call)]
65

6+
77
struct S;
88

99
impl S {

tests/ui/diverging_sub_expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
//edition:2015
12
#![warn(clippy::diverging_sub_expression)]
23
#![allow(clippy::match_same_arms, clippy::logic_bug)]
3-
44
#[allow(clippy::empty_loop)]
55
fn diverge() -> ! {
66
loop {}

tests/ui/fallible_impl_from.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ note: potential failure(s)
3838
|
3939
LL | panic!();
4040
| ^^^^^^^^
41-
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
41+
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
4242

4343
error: consider implementing `TryFrom` instead
4444
--> $DIR/fallible_impl_from.rs:36:1
@@ -65,7 +65,7 @@ LL | } else if s.parse::<u32>().unwrap() != 42 {
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6666
LL | panic!("{:?}", s);
6767
| ^^^^^^^^^^^^^^^^^
68-
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
68+
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
6969

7070
error: consider implementing `TryFrom` instead
7171
--> $DIR/fallible_impl_from.rs:54:1
@@ -87,7 +87,7 @@ LL | if s.parse::<u32>().ok().unwrap() != 42 {
8787
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8888
LL | panic!("{:?}", s);
8989
| ^^^^^^^^^^^^^^^^^
90-
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
90+
= note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
9191

9292
error: aborting due to 4 previous errors
9393

tests/ui/if_then_panic.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// edition:2018
12
// run-rustfix
23
#![warn(clippy::if_then_panic)]
34

tests/ui/if_then_panic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// edition:2018
12
// run-rustfix
23
#![warn(clippy::if_then_panic)]
34

0 commit comments

Comments
 (0)