about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-03-18 18:54:43 +0100
committerSamuel Tardieu <sam@rfc1149.net>2025-05-21 17:17:30 +0200
commitf2d49731575198637ee3bb2d83c7060c3581a512 (patch)
tree58e857e4c2b355132872631b78305ee80e5b2189
parente236bfc8d7136bbb1d1fc9143d1289297cec4ea0 (diff)
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.
-rw-r--r--tests/ui/incompatible_msrv.rs14
-rw-r--r--tests/ui/incompatible_msrv.stderr28
2 files changed, 21 insertions, 21 deletions
diff --git a/tests/ui/incompatible_msrv.rs b/tests/ui/incompatible_msrv.rs
index 546f1661469..a6595dcb81e 100644
--- a/tests/ui/incompatible_msrv.rs
+++ b/tests/ui/incompatible_msrv.rs
@@ -1,6 +1,5 @@
 #![warn(clippy::incompatible_msrv)]
 #![feature(custom_inner_attributes)]
-#![feature(panic_internals)]
 #![clippy::msrv = "1.3.0"]
 
 use std::collections::HashMap;
@@ -45,21 +44,22 @@ fn core_special_treatment(p: bool) {
 
     // But still lint code calling `core` functions directly
     if p {
-        core::panicking::panic("foo");
-        //~^ ERROR: is `1.3.0` but this item is stable since `1.6.0`
+        let _ = core::iter::once_with(|| 0);
+        //~^ incompatible_msrv
     }
 
     // Lint code calling `core` from non-`core` macros
     macro_rules! my_panic {
         ($msg:expr) => {
-            core::panicking::panic($msg)
-        }; //~^ ERROR: is `1.3.0` but this item is stable since `1.6.0`
+            let _ = core::iter::once_with(|| $msg);
+            //~^ incompatible_msrv
+        };
     }
     my_panic!("foo");
 
     // Lint even when the macro comes from `core` and calls `core` functions
-    assert!(core::panicking::panic("out of luck"));
-    //~^ ERROR: is `1.3.0` but this item is stable since `1.6.0`
+    assert!(core::iter::once_with(|| 0).next().is_some());
+    //~^ incompatible_msrv
 }
 
 #[clippy::msrv = "1.26.0"]
diff --git a/tests/ui/incompatible_msrv.stderr b/tests/ui/incompatible_msrv.stderr
index 0a294f2f2b9..18548c3ec18 100644
--- a/tests/ui/incompatible_msrv.stderr
+++ b/tests/ui/incompatible_msrv.stderr
@@ -1,5 +1,5 @@
 error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.10.0`
-  --> tests/ui/incompatible_msrv.rs:14:39
+  --> tests/ui/incompatible_msrv.rs:13:39
    |
 LL |     assert_eq!(map.entry("poneyland").key(), &"poneyland");
    |                                       ^^^^^
@@ -8,39 +8,39 @@ LL |     assert_eq!(map.entry("poneyland").key(), &"poneyland");
    = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
 
 error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.12.0`
-  --> tests/ui/incompatible_msrv.rs:20:11
+  --> tests/ui/incompatible_msrv.rs:19:11
    |
 LL |         v.into_key();
    |           ^^^^^^^^^^
 
 error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.4.0`
-  --> tests/ui/incompatible_msrv.rs:24:5
+  --> tests/ui/incompatible_msrv.rs:23:5
    |
 LL |     sleep(Duration::new(1, 0));
    |     ^^^^^
 
-error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.6.0`
-  --> tests/ui/incompatible_msrv.rs:48:9
+error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.43.0`
+  --> tests/ui/incompatible_msrv.rs:47:17
    |
-LL |         core::panicking::panic("foo");
-   |         ^^^^^^^^^^^^^^^^^^^^^^
+LL |         let _ = core::iter::once_with(|| 0);
+   |                 ^^^^^^^^^^^^^^^^^^^^^
 
-error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.6.0`
-  --> tests/ui/incompatible_msrv.rs:55:13
+error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.43.0`
+  --> tests/ui/incompatible_msrv.rs:54:21
    |
-LL |             core::panicking::panic($msg)
-   |             ^^^^^^^^^^^^^^^^^^^^^^
+LL |             let _ = core::iter::once_with(|| $msg);
+   |                     ^^^^^^^^^^^^^^^^^^^^^
 ...
 LL |     my_panic!("foo");
    |     ---------------- in this macro invocation
    |
    = note: this error originates in the macro `my_panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.6.0`
+error: current MSRV (Minimum Supported Rust Version) is `1.3.0` but this item is stable since `1.43.0`
   --> tests/ui/incompatible_msrv.rs:61:13
    |
-LL |     assert!(core::panicking::panic("out of luck"));
-   |             ^^^^^^^^^^^^^^^^^^^^^^
+LL |     assert!(core::iter::once_with(|| 0).next().is_some());
+   |             ^^^^^^^^^^^^^^^^^^^^^
 
 error: current MSRV (Minimum Supported Rust Version) is `1.80.0` but this item is stable since `1.82.0`
   --> tests/ui/incompatible_msrv.rs:74:13