mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Auto merge of #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>
This commit is contained in:
commit
58eb9964cc
1 changed files with 3 additions and 0 deletions
|
@ -176,6 +176,9 @@ fn check_rvalue<'tcx>(
|
|||
// FIXME(dyn-star)
|
||||
unimplemented!()
|
||||
},
|
||||
Rvalue::Cast(CastKind::Transmute, _, _) => {
|
||||
Err((span, "transmute can attempt to turn pointers into integers, so is unstable in const fn".into()))
|
||||
},
|
||||
// binops are fine on integers
|
||||
Rvalue::BinaryOp(_, box (lhs, rhs)) | Rvalue::CheckedBinaryOp(_, box (lhs, rhs)) => {
|
||||
check_operand(tcx, lhs, span, body)?;
|
||||
|
|
Loading…
Reference in a new issue