about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Macleod <alex@macleod.io>2025-04-30 13:12:29 +0000
committerAlex Macleod <alex@macleod.io>2025-04-30 13:12:29 +0000
commitd49b8aa7d2290241c2ea3ee246f3ffad8486dd35 (patch)
tree1f079330abbc345a1586e6d98c9f9ff2ee135eee
parent549107dbada33d5531d8d896791d8dc07852d8af (diff)
downloadrust-d49b8aa7d2290241c2ea3ee246f3ffad8486dd35.tar.gz
rust-d49b8aa7d2290241c2ea3ee246f3ffad8486dd35.zip
Remove `ClippyCtfe` pass
-rw-r--r--clippy_lints/src/ctfe.rs26
-rw-r--r--clippy_lints/src/lib.rs3
-rw-r--r--tests/ui/crashes/ice-9463.rs7
-rw-r--r--tests/ui/crashes/ice-9463.stderr29
-rw-r--r--tests/ui/indexing_slicing_index.rs1
-rw-r--r--tests/ui/indexing_slicing_index.stderr31
6 files changed, 12 insertions, 85 deletions
diff --git a/clippy_lints/src/ctfe.rs b/clippy_lints/src/ctfe.rs
deleted file mode 100644
index 7bae04a10f1..00000000000
--- a/clippy_lints/src/ctfe.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-use rustc_hir::def_id::LocalDefId;
-use rustc_hir::intravisit::FnKind;
-use rustc_hir::{Body, FnDecl};
-use rustc_lint::{LateContext, LateLintPass};
-use rustc_session::declare_lint_pass;
-use rustc_span::Span;
-
-declare_lint_pass! {
-    /// Ensures that Constant-time Function Evaluation is being done (specifically, MIR lint passes).
-    /// As Clippy deactivates codegen, this lint ensures that CTFE (used in hard errors) is still ran.
-    ClippyCtfe => []
-}
-
-impl<'tcx> LateLintPass<'tcx> for ClippyCtfe {
-    fn check_fn(
-        &mut self,
-        cx: &LateContext<'_>,
-        _: FnKind<'tcx>,
-        _: &'tcx FnDecl<'tcx>,
-        _: &'tcx Body<'tcx>,
-        _: Span,
-        defid: LocalDefId,
-    ) {
-        cx.tcx.ensure_ok().mir_drops_elaborated_and_const_checked(defid); // Lint
-    }
-}
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index bc7fc60827a..1090b3ec045 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -67,7 +67,6 @@ extern crate clippy_utils;
 
 mod utils;
 
-pub mod ctfe; // Very important lint, do not remove (rust#125116)
 pub mod declared_lints;
 pub mod deprecated_lints;
 
@@ -583,8 +582,6 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
     let attrs = attr_storage.clone();
     store.register_early_pass(move || Box::new(AttrCollector::new(attrs.clone())));
 
-    store.register_late_pass(|_| Box::new(ctfe::ClippyCtfe));
-
     store.register_late_pass(move |_| Box::new(operators::arithmetic_side_effects::ArithmeticSideEffects::new(conf)));
     store.register_late_pass(|_| Box::new(utils::dump_hir::DumpHir));
     store.register_late_pass(|_| Box::new(utils::author::Author));
diff --git a/tests/ui/crashes/ice-9463.rs b/tests/ui/crashes/ice-9463.rs
index 93808e0f892..cfa6cdac6fa 100644
--- a/tests/ui/crashes/ice-9463.rs
+++ b/tests/ui/crashes/ice-9463.rs
@@ -1,8 +1,7 @@
-#![deny(arithmetic_overflow)]
+//@check-pass
+
 fn main() {
     let _x = -1_i32 >> -1;
-    //~^ ERROR: this arithmetic operation will overflow
+    #[expect(overflowing_literals)]
     let _y = 1u32 >> 10000000000000u32;
-    //~^ ERROR: this arithmetic operation will overflow
-    //~| ERROR: literal out of range
 }
diff --git a/tests/ui/crashes/ice-9463.stderr b/tests/ui/crashes/ice-9463.stderr
deleted file mode 100644
index 9a3a5e444ad..00000000000
--- a/tests/ui/crashes/ice-9463.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error: this arithmetic operation will overflow
-  --> tests/ui/crashes/ice-9463.rs:3:14
-   |
-LL |     let _x = -1_i32 >> -1;
-   |              ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow
-   |
-note: the lint level is defined here
-  --> tests/ui/crashes/ice-9463.rs:1:9
-   |
-LL | #![deny(arithmetic_overflow)]
-   |         ^^^^^^^^^^^^^^^^^^^
-
-error: this arithmetic operation will overflow
-  --> tests/ui/crashes/ice-9463.rs:5:14
-   |
-LL |     let _y = 1u32 >> 10000000000000u32;
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift right by `1316134912_u32`, which would overflow
-
-error: literal out of range for `u32`
-  --> tests/ui/crashes/ice-9463.rs:5:22
-   |
-LL |     let _y = 1u32 >> 10000000000000u32;
-   |                      ^^^^^^^^^^^^^^^^^
-   |
-   = note: the literal `10000000000000u32` does not fit into the type `u32` whose range is `0..=4294967295`
-   = note: `#[deny(overflowing_literals)]` on by default
-
-error: aborting due to 3 previous errors
-
diff --git a/tests/ui/indexing_slicing_index.rs b/tests/ui/indexing_slicing_index.rs
index cfa1c2f7c75..2510a023acd 100644
--- a/tests/ui/indexing_slicing_index.rs
+++ b/tests/ui/indexing_slicing_index.rs
@@ -68,7 +68,6 @@ fn main() {
     // This should be linted, since `suppress-restriction-lint-in-const` default is false.
     const { &ARR[idx4()] };
     //~^ ERROR: indexing may panic
-    //~| ERROR: evaluation of `main
 
     let y = &x;
     // Ok, referencing shouldn't affect this lint. See the issue 6021
diff --git a/tests/ui/indexing_slicing_index.stderr b/tests/ui/indexing_slicing_index.stderr
index 50ee9b9edc7..c68e1d53a93 100644
--- a/tests/ui/indexing_slicing_index.stderr
+++ b/tests/ui/indexing_slicing_index.stderr
@@ -9,18 +9,6 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
    = note: `-D clippy::indexing-slicing` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
 
-error[E0080]: evaluation of `main::{constant#3}` failed
-  --> tests/ui/indexing_slicing_index.rs:69:14
-   |
-LL |     const { &ARR[idx4()] };
-   |              ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
-
-note: erroneous constant encountered
-  --> tests/ui/indexing_slicing_index.rs:69:5
-   |
-LL |     const { &ARR[idx4()] };
-   |     ^^^^^^^^^^^^^^^^^^^^^^
-
 error: indexing may panic
   --> tests/ui/indexing_slicing_index.rs:48:5
    |
@@ -63,13 +51,13 @@ LL |     const { &ARR[idx4()] };
    = note: the suggestion might not be applicable in constant blocks
 
 error: index is out of bounds
-  --> tests/ui/indexing_slicing_index.rs:77:5
+  --> tests/ui/indexing_slicing_index.rs:76:5
    |
 LL |     y[4];
    |     ^^^^
 
 error: indexing may panic
-  --> tests/ui/indexing_slicing_index.rs:81:5
+  --> tests/ui/indexing_slicing_index.rs:80:5
    |
 LL |     v[0];
    |     ^^^^
@@ -77,7 +65,7 @@ LL |     v[0];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> tests/ui/indexing_slicing_index.rs:83:5
+  --> tests/ui/indexing_slicing_index.rs:82:5
    |
 LL |     v[10];
    |     ^^^^^
@@ -85,7 +73,7 @@ LL |     v[10];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> tests/ui/indexing_slicing_index.rs:85:5
+  --> tests/ui/indexing_slicing_index.rs:84:5
    |
 LL |     v[1 << 3];
    |     ^^^^^^^^^
@@ -93,13 +81,13 @@ LL |     v[1 << 3];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: index is out of bounds
-  --> tests/ui/indexing_slicing_index.rs:93:5
+  --> tests/ui/indexing_slicing_index.rs:92:5
    |
 LL |     x[N];
    |     ^^^^
 
 error: indexing may panic
-  --> tests/ui/indexing_slicing_index.rs:97:5
+  --> tests/ui/indexing_slicing_index.rs:96:5
    |
 LL |     v[N];
    |     ^^^^
@@ -107,7 +95,7 @@ LL |     v[N];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: indexing may panic
-  --> tests/ui/indexing_slicing_index.rs:99:5
+  --> tests/ui/indexing_slicing_index.rs:98:5
    |
 LL |     v[M];
    |     ^^^^
@@ -115,11 +103,10 @@ LL |     v[M];
    = help: consider using `.get(n)` or `.get_mut(n)` instead
 
 error: index is out of bounds
-  --> tests/ui/indexing_slicing_index.rs:103:13
+  --> tests/ui/indexing_slicing_index.rs:102:13
    |
 LL |     let _ = x[4];
    |             ^^^^
 
-error: aborting due to 15 previous errors
+error: aborting due to 14 previous errors
 
-For more information about this error, try `rustc --explain E0080`.