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
4 changes: 3 additions & 1 deletion compiler/rustc_mir/src/transform/add_call_guards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ impl<'tcx> MirPass<'tcx> for AddCallGuards {

impl AddCallGuards {
pub fn add_call_guards(&self, body: &mut Body<'_>) {
let pred_count: IndexVec<_, _> = body.predecessors().iter().map(|ps| ps.len()).collect();
let mut pred_count: IndexVec<_, _> =
body.predecessors().iter().map(|ps| ps.len()).collect();
pred_count[START_BLOCK] += 1;

// We need a place to store the new blocks generated
let mut new_blocks = Vec::new();
Expand Down
10 changes: 10 additions & 0 deletions src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ fn take_until(terminate: impl Fn() -> bool) {
// CHECK-LABEL: @main
fn main() {
take_until(|| true);
f(None);
}

fn f(_a: Option<String>) -> Option<u32> {
loop {
g();
()
}
}

fn g() -> Option<u32> { None }