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

Commit 58eb996

Browse files
committed
Auto merge of rust-lang#108442 - scottmcm:mir-transmute, r=oli-obk
Add `CastKind::Transmute` to MIR ~~Nothing actually produces it in this commit, so I don't know how to test it, but it also means it shouldn't be possible for it to break anything.~~ Includes lowering `transmute` calls to it, so it's used. Zulip Conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Good.20first.20isssue/near/321849610>
2 parents f345904 + 8bdd54e commit 58eb996

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)