rust/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
2024-01-11 09:58:19 +00:00

79 lines
1.8 KiB
Rust

// MIR for `mapped` after PreCodegen
fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
debug iter => _1;
debug f => _2;
let mut _0: ();
let mut _3: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
let mut _4: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
let mut _5: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
let mut _6: std::option::Option<U>;
let mut _7: isize;
let _9: ();
scope 1 {
debug iter => _4;
let _8: U;
scope 2 {
debug x => _8;
}
}
scope 3 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as IntoIterator>::into_iter) {
debug self => _3;
}
bb0: {
_3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> [return: bb1, unwind continue];
}
bb1: {
StorageLive(_4);
_4 = _3;
goto -> bb2;
}
bb2: {
StorageLive(_6);
StorageLive(_5);
_5 = &mut _4;
_6 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _5) -> [return: bb3, unwind: bb9];
}
bb3: {
StorageDead(_5);
_7 = discriminant(_6);
switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb8];
}
bb4: {
StorageDead(_6);
drop(_4) -> [return: bb5, unwind continue];
}
bb5: {
StorageDead(_4);
return;
}
bb6: {
_8 = move ((_6 as Some).0: U);
_9 = opaque::<U>(move _8) -> [return: bb7, unwind: bb9];
}
bb7: {
StorageDead(_6);
goto -> bb2;
}
bb8: {
unreachable;
}
bb9 (cleanup): {
drop(_4) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
resume;
}
}