From 62c68e15b8c41d0e42c62bb59f7ab7aa5c5130ea Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 31 Jan 2025 01:24:37 +0000 Subject: [PATCH 1/2] Implement MIR, CTFE, and codegen for unsafe binders --- clippy_utils/src/qualify_min_const_fn.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs index 287bdc9a6fd6..916017b09ddd 100644 --- a/clippy_utils/src/qualify_min_const_fn.rs +++ b/clippy_utils/src/qualify_min_const_fn.rs @@ -289,7 +289,8 @@ fn check_place<'tcx>(tcx: TyCtxt<'tcx>, place: Place<'tcx>, span: Span, body: &B | ProjectionElem::Downcast(..) | ProjectionElem::Subslice { .. } | ProjectionElem::Subtype(_) - | ProjectionElem::Index(_) => {}, + | ProjectionElem::Index(_) + | ProjectionElem::UnwrapUnsafeBinder(_) => {}, } } From a9434c08e242e0fb404edcc2b672bb5f3e687dc0 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 31 Jan 2025 02:04:10 +0000 Subject: [PATCH 2/2] Enforce unsafe binders must be Copy (for now) --- clippy_utils/src/qualify_min_const_fn.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs index 916017b09ddd..0aaef91e48a6 100644 --- a/clippy_utils/src/qualify_min_const_fn.rs +++ b/clippy_utils/src/qualify_min_const_fn.rs @@ -116,6 +116,7 @@ fn check_rvalue<'tcx>( Rvalue::CopyForDeref(place) => check_place(tcx, *place, span, body, msrv), Rvalue::Repeat(operand, _) | Rvalue::Use(operand) + | Rvalue::WrapUnsafeBinder(operand, _) | Rvalue::Cast( CastKind::PointerWithExposedProvenance | CastKind::IntToInt