Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
Abi::Scalar(s @ abi::Scalar::Initialized { .. }) => {
let size = s.size(bx);
assert_eq!(size, layout.size, "abi::Scalar size does not match layout size");
let val = read_scalar(offset, size, s, bx.backend_type(layout));
let val = read_scalar(offset, size, s, bx.immediate_backend_type(layout));
OperandRef { val: OperandValue::Immediate(val), layout }
}
Abi::ScalarPair(
Expand Down
15 changes: 15 additions & 0 deletions tests/ui/codegen/const-bool-bitcast.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This is a regression test for https://github.com/rust-lang/rust/issues/118047
// build-pass
// compile-flags: -Zmir-opt-level=0 -Zmir-enable-passes=+DataflowConstProp

#![crate_type = "lib"]

pub struct State {
inner: bool
}

pub fn make() -> State {
State {
inner: true
}
}