mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Auto merge of #118791 - saethlin:use-immediate-type, r=nikic
Use immediate_backend_type when reading from a const alloc Fixes https://github.com/rust-lang/rust/issues/118047 r? `@nikic`
This commit is contained in:
commit
7e452c123c
@ -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(
|
||||
|
15
tests/ui/codegen/const-bool-bitcast.rs
Normal file
15
tests/ui/codegen/const-bool-bitcast.rs
Normal file
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user