mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #116239 - cjgillot:issue-116212, r=WaffleLapkin
Only visit reachable nodes in SsaLocals. Fixes https://github.com/rust-lang/rust/issues/116212
This commit is contained in:
commit
4f09f80bcf
@ -78,14 +78,10 @@ impl SsaLocals {
|
||||
visitor.assignments[local] = Set1::One(LocationExtended::Arg);
|
||||
}
|
||||
|
||||
if body.basic_blocks.len() > 2 {
|
||||
for (bb, data) in traversal::reverse_postorder(body) {
|
||||
visitor.visit_basic_block_data(bb, data);
|
||||
}
|
||||
} else {
|
||||
for (bb, data) in body.basic_blocks.iter_enumerated() {
|
||||
visitor.visit_basic_block_data(bb, data);
|
||||
}
|
||||
// For SSA assignments, a RPO visit will see the assignment before it sees any use.
|
||||
// We only visit reachable nodes: computing `dominates` on an unreachable node ICEs.
|
||||
for (bb, data) in traversal::reverse_postorder(body) {
|
||||
visitor.visit_basic_block_data(bb, data);
|
||||
}
|
||||
|
||||
for var_debug_info in &body.var_debug_info {
|
||||
|
14
tests/mir-opt/ssa_unreachable_116212.rs
Normal file
14
tests/mir-opt/ssa_unreachable_116212.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// Regression test for issue #116212.
|
||||
|
||||
#![feature(never_type)]
|
||||
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
struct Foo {
|
||||
x: u8,
|
||||
y: !,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let foo = unsafe { MaybeUninit::<Foo>::uninit().assume_init() };
|
||||
}
|
Loading…
Reference in New Issue
Block a user