Skip to content

Commit 984cc68

Browse files
authored
Rollup merge of rust-lang#130514 - compiler-errors:unsafe-binders, r=oli-obk
Implement MIR lowering for unsafe binders This is the final bit of the unsafe binders puzzle. It implements MIR, CTFE, and codegen for unsafe binders, and enforces that (for now) they are `Copy`. Later on, I'll introduce a new trait that relaxes this requirement to being "is `Copy` or `ManuallyDrop<T>`" which more closely models how we treat union fields. Namely, wrapping unsafe binders is now `Rvalue::WrapUnsafeBinder`, which acts much like an `Rvalue::Aggregate`. Unwrapping unsafe binders are implemented as a MIR projection `ProjectionElem::UnwrapUnsafeBinder`, which acts much like `ProjectionElem::Field`. Tracking: - rust-lang#130516
2 parents 9c8fe30 + a9434c0 commit 984cc68

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_utils/src/qualify_min_const_fn.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ fn check_rvalue<'tcx>(
116116
Rvalue::CopyForDeref(place) => check_place(tcx, *place, span, body, msrv),
117117
Rvalue::Repeat(operand, _)
118118
| Rvalue::Use(operand)
119+
| Rvalue::WrapUnsafeBinder(operand, _)
119120
| Rvalue::Cast(
120121
CastKind::PointerWithExposedProvenance
121122
| CastKind::IntToInt
@@ -289,7 +290,8 @@ fn check_place<'tcx>(tcx: TyCtxt<'tcx>, place: Place<'tcx>, span: Span, body: &B
289290
| ProjectionElem::Downcast(..)
290291
| ProjectionElem::Subslice { .. }
291292
| ProjectionElem::Subtype(_)
292-
| ProjectionElem::Index(_) => {},
293+
| ProjectionElem::Index(_)
294+
| ProjectionElem::UnwrapUnsafeBinder(_) => {},
293295
}
294296
}
295297

0 commit comments

Comments
 (0)