Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8bdd54e

Browse files
committed
Add CastKind::Transmute to MIR
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
1 parent 6db2d59 commit 8bdd54e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ fn check_rvalue<'tcx>(
176176
// FIXME(dyn-star)
177177
unimplemented!()
178178
},
179+
Rvalue::Cast(CastKind::Transmute, _, _) => {
180+
Err((span, "transmute can attempt to turn pointers into integers, so is unstable in const fn".into()))
181+
},
179182
// binops are fine on integers
180183
Rvalue::BinaryOp(_, box (lhs, rhs)) | Rvalue::CheckedBinaryOp(_, box (lhs, rhs)) => {
181184
check_operand(tcx, lhs, span, body)?;

0 commit comments

Comments
 (0)