Skip to content

Commit f2d4973

Browse files
committed
Use public core items for testing
A later commit will introduce the non-linting of feature-enabled items. Switch to public items from `core` for the tests as to not interfere.
1 parent e236bfc commit f2d4973

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

tests/ui/incompatible_msrv.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![warn(clippy::incompatible_msrv)]
22
#![feature(custom_inner_attributes)]
3-
#![feature(panic_internals)]
43
#![clippy::msrv = "1.3.0"]
54

65
use std::collections::HashMap;
@@ -45,21 +44,22 @@ fn core_special_treatment(p: bool) {
4544

4645
// But still lint code calling `core` functions directly
4746
if p {
48-
core::panicking::panic("foo");
49-
//~^ ERROR: is `1.3.0` but this item is stable since `1.6.0`
47+
let _ = core::iter::once_with(|| 0);
48+
//~^ incompatible_msrv
5049
}
5150

5251
// Lint code calling `core` from non-`core` macros
5352
macro_rules! my_panic {
5453
($msg:expr) => {
55-
core::panicking::panic($msg)
56-
}; //~^ ERROR: is `1.3.0` but this item is stable since `1.6.0`
54+
let _ = core::iter::once_with(|| $msg);
55+
//~^ incompatible_msrv
56+
};
5757
}
5858
my_panic!("foo");
5959

6060
// Lint even when the macro comes from `core` and calls `core` functions
61-
assert!(core::panicking::panic("out of luck"));
62-
//~^ ERROR: is `1.3.0` but this item is stable since `1.6.0`
61+
assert!(core::iter::once_with(|| 0).next().is_some());
62+
//~^ incompatible_msrv
6363
}
6464

6565
#[clippy::msrv = "1.26.0"]

tests/ui/incompatible_msrv.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.10.0`
2-
--> tests/ui/incompatible_msrv.rs:14:39
2+
--> tests/ui/incompatible_msrv.rs:13:39
33
|
44
LL | assert_eq!(map.entry("poneyland").key(), &"poneyland");
55
| ^^^^^
@@ -8,39 +8,39 @@ LL | assert_eq!(map.entry("poneyland").key(), &"poneyland");
88
= help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
99

1010
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.12.0`
11-
--> tests/ui/incompatible_msrv.rs:20:11
11+
--> tests/ui/incompatible_msrv.rs:19:11
1212
|
1313
LL | v.into_key();
1414
| ^^^^^^^^^^
1515

1616
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.4.0`
17-
--> tests/ui/incompatible_msrv.rs:24:5
17+
--> tests/ui/incompatible_msrv.rs:23:5
1818
|
1919
LL | sleep(Duration::new(1, 0));
2020
| ^^^^^
2121

22-
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.6.0`
23-
--> tests/ui/incompatible_msrv.rs:48:9
22+
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.43.0`
23+
--> tests/ui/incompatible_msrv.rs:47:17
2424
|
25-
LL | core::panicking::panic("foo");
26-
| ^^^^^^^^^^^^^^^^^^^^^^
25+
LL | let _ = core::iter::once_with(|| 0);
26+
| ^^^^^^^^^^^^^^^^^^^^^
2727

28-
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.6.0`
29-
--> tests/ui/incompatible_msrv.rs:55:13
28+
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.43.0`
29+
--> tests/ui/incompatible_msrv.rs:54:21
3030
|
31-
LL | core::panicking::panic($msg)
32-
| ^^^^^^^^^^^^^^^^^^^^^^
31+
LL | let _ = core::iter::once_with(|| $msg);
32+
| ^^^^^^^^^^^^^^^^^^^^^
3333
...
3434
LL | my_panic!("foo");
3535
| ---------------- in this macro invocation
3636
|
3737
= note: this error originates in the macro `my_panic` (in Nightly builds, run with -Z macro-backtrace for more info)
3838

39-
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.6.0`
39+
error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.43.0`
4040
--> tests/ui/incompatible_msrv.rs:61:13
4141
|
42-
LL | assert!(core::panicking::panic("out of luck"));
43-
| ^^^^^^^^^^^^^^^^^^^^^^
42+
LL | assert!(core::iter::once_with(|| 0).next().is_some());
43+
| ^^^^^^^^^^^^^^^^^^^^^
4444

4545
error: current MSRV (Minimum Supported Rust Version) is `1.80.0` but this item is stable since `1.82.0`
4646
--> tests/ui/incompatible_msrv.rs:74:13

0 commit comments

Comments
 (0)