Closed
Description
#![feature(generators, generator_trait)]
fn main() {
let mut foo = || {
yield;
};
}
I only tested this with -Cpanic=abort
.
Wrong jumps: bb1 -> bb5, bb4 -> bb6, bb5 -> bb2.
Note: made mir dump below using println!("{:#?}")
, because rustc_mir::util::write_mir_pretty
doesn't work correctly for shims.
Mir for `Instance { def: DropGlue(DefId(2/0:691 ~ core[479c]::ptr[0]::real_drop_in_place[0]), Some([generator@/Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6 {()}])), substs: [[generator@/Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6 {()}]] } _ZN4core3ptr18real_drop_in_place17h0fdaf8ce1f626024E`
Mir {
basic_blocks: [
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
kind: switchInt(((*_1).0: u32)) -> [0u32: bb4, 3u32: bb7, otherwise: bb8]
}
),
is_cleanup: false
},
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:10:5: 10:6,
scope: scope[0]
},
kind: goto -> bb5
}
),
is_cleanup: false
},
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
kind: return
}
),
is_cleanup: false
},
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
kind: return
}
),
is_cleanup: false
},
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
kind: goto -> bb6
}
),
is_cleanup: false
},
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:10:5: 10:6,
scope: scope[0]
},
kind: goto -> bb2
}
),
is_cleanup: true
},
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
kind: goto -> bb3
}
),
is_cleanup: true
},
BasicBlockData {
statements: [
StorageLive(_3)
],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
kind: goto -> bb1
}
),
is_cleanup: false
},
BasicBlockData {
statements: [],
terminator: Some(
Terminator {
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
kind: return
}
),
is_cleanup: false
}
],
phase: Validated,
source_scopes: [
SourceScopeData {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
parent_scope: None
}
],
source_scope_local_data: Set(
[
SourceScopeLocalData {
lint_root: HirId {
owner: DefIndex(0:3),
local_id: 8
},
safety: Safe
}
]
),
promoted: [],
yield_ty: None,
generator_drop: None,
generator_layout: Some(
GeneratorLayout {
fields: []
}
),
local_decls: [
LocalDecl {
mutability: Mut,
is_user_variable: None,
internal: false,
is_block_tail: None,
ty: (),
user_ty: UserTypeProjections {
contents: []
},
name: None,
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
visibility_scope: scope[0]
},
LocalDecl {
mutability: Mut,
is_user_variable: None,
internal: false,
is_block_tail: None,
ty: *mut [generator@/Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6 {()}],
user_ty: UserTypeProjections {
contents: []
},
name: None,
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
scope: scope[0]
},
visibility_scope: scope[0]
},
LocalDecl {
mutability: Mut,
is_user_variable: None,
internal: false,
is_block_tail: None,
ty: (),
user_ty: UserTypeProjections {
contents: []
},
name: None,
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:9:9: 9:14,
scope: scope[0]
},
visibility_scope: scope[0]
},
LocalDecl {
mutability: Mut,
is_user_variable: None,
internal: false,
is_block_tail: None,
ty: (),
user_ty: UserTypeProjections {
contents: []
},
name: None,
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:9:9: 9:14,
scope: scope[0]
},
visibility_scope: scope[0]
},
LocalDecl {
mutability: Mut,
is_user_variable: None,
internal: false,
is_block_tail: None,
ty: (),
user_ty: UserTypeProjections {
contents: []
},
name: None,
source_info: SourceInfo {
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:22: 8:22,
scope: scope[0]
},
visibility_scope: scope[0]
}
],
user_type_annotations: [],
arg_count: 1,
upvar_decls: [],
spread_arg: None,
control_flow_destroyed: [],
span: /Users/bjorn/Documents/rustc_codegen_cranelift/rust/src/test/run-pass/generator/panic-drops.rs:8:19: 10:6,
cache: Cache {
predecessors: RwLock(
RefCell {
value: None
}
)
}
}