Auto merge of #116427 - cjgillot:no-internal, r=oli-obk

Remove mir::LocalDecl::internal.

It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
This commit is contained in:
bors 2023-10-05 09:59:14 +00:00
commit 5c3a0e932b
38 changed files with 106 additions and 57 deletions

View File

@ -237,7 +237,7 @@ pub fn check_body(&mut self) {
if self.const_kind() == hir::ConstContext::ConstFn {
for (idx, local) in body.local_decls.iter_enumerated() {
// Handle the return place below.
if idx == RETURN_PLACE || local.internal {
if idx == RETURN_PLACE {
continue;
}

View File

@ -830,22 +830,6 @@ pub struct LocalDecl<'tcx> {
// FIXME(matthewjasper) Don't store in this in `Body`
pub local_info: ClearCrossCrate<Box<LocalInfo<'tcx>>>,
/// `true` if this is an internal local.
///
/// These locals are not based on types in the source code and are only used
/// for a few desugarings at the moment.
///
/// The generator transformation will sanity check the locals which are live
/// across a suspension point against the type components of the generator
/// which type checking knows are live across a suspension point. We need to
/// flag drop flags to avoid triggering this check as they are introduced
/// outside of type inference.
///
/// This should be sound because the drop flags are fully algebraic, and
/// therefore don't affect the auto-trait or outlives properties of the
/// generator.
pub internal: bool,
/// The type of this local.
pub ty: Ty<'tcx>,
@ -1058,7 +1042,7 @@ pub fn from_compiler_desugaring(&self) -> bool {
self.source_info.span.desugaring_kind().is_some()
}
/// Creates a new `LocalDecl` for a temporary: mutable, non-internal.
/// Creates a new `LocalDecl` for a temporary, mutable.
#[inline]
pub fn new(ty: Ty<'tcx>, span: Span) -> Self {
Self::with_source_info(ty, SourceInfo::outermost(span))
@ -1070,20 +1054,12 @@ pub fn with_source_info(ty: Ty<'tcx>, source_info: SourceInfo) -> Self {
LocalDecl {
mutability: Mutability::Mut,
local_info: ClearCrossCrate::Set(Box::new(LocalInfo::Boring)),
internal: false,
ty,
user_ty: None,
source_info,
}
}
/// Converts `self` into same `LocalDecl` except tagged as internal.
#[inline]
pub fn internal(mut self) -> Self {
self.internal = true;
self
}
/// Converts `self` into same `LocalDecl` except tagged as immutable.
#[inline]
pub fn immutable(mut self) -> Self {

View File

@ -127,7 +127,7 @@ pub fn terminator_loc(&self, body: &Body<'tcx>, bb: BasicBlock) -> Location {
Location { block: bb, statement_index: offset }
}
pub fn new_internal_with_info(
pub fn new_local_with_info(
&mut self,
ty: Ty<'tcx>,
span: Span,
@ -135,7 +135,7 @@ pub fn new_internal_with_info(
) -> Local {
let index = self.next_local;
self.next_local += 1;
let mut new_decl = LocalDecl::new(ty, span).internal();
let mut new_decl = LocalDecl::new(ty, span);
**new_decl.local_info.as_mut().assert_crate_local() = local_info;
self.new_locals.push(new_decl);
Local::new(index)
@ -148,13 +148,6 @@ pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
Local::new(index)
}
pub fn new_internal(&mut self, ty: Ty<'tcx>, span: Span) -> Local {
let index = self.next_local;
self.next_local += 1;
self.new_locals.push(LocalDecl::new(ty, span).internal());
Local::new(index)
}
pub fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock {
let block = BasicBlock::new(self.patch_map.len());
debug!("MirPatch: new_block: {:?}: {:?}", block, data);

View File

@ -815,7 +815,6 @@ fn super_local_decl(&mut self,
ty,
user_ty,
source_info,
internal: _,
local_info: _,
} = local_decl;

View File

@ -183,7 +183,7 @@ pub(crate) fn as_rvalue(
// The `Box<T>` temporary created here is not a part of the HIR,
// and therefore is not considered during generator auto-trait
// determination. See the comment about `box` at `yield_in_scope`.
let result = this.local_decls.push(LocalDecl::new(expr.ty, expr_span).internal());
let result = this.local_decls.push(LocalDecl::new(expr.ty, expr_span));
this.cfg.push(
block,
Statement { source_info, kind: StatementKind::StorageLive(result) },

View File

@ -52,12 +52,10 @@ fn as_temp_inner(
let local_info = match expr.kind {
ExprKind::StaticRef { def_id, .. } => {
assert!(!this.tcx.is_thread_local_static(def_id));
local_decl.internal = true;
LocalInfo::StaticRef { def_id, is_thread_local: false }
}
ExprKind::ThreadLocalRef(def_id) => {
assert!(this.tcx.is_thread_local_static(def_id));
local_decl.internal = true;
LocalInfo::StaticRef { def_id, is_thread_local: true }
}
ExprKind::NamedConst { def_id, .. } | ExprKind::ConstParam { def_id, .. } => {

View File

@ -1798,7 +1798,6 @@ fn calculate_fake_borrows<'b>(
let fake_borrow_ty =
Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, fake_borrow_deref_ty);
let mut fake_borrow_temp = LocalDecl::new(fake_borrow_ty, temp_span);
fake_borrow_temp.internal = self.local_decls[matched_place.local].internal;
fake_borrow_temp.local_info = ClearCrossCrate::Set(Box::new(LocalInfo::FakeBorrow));
let fake_borrow_temp = self.local_decls.push(fake_borrow_temp);
@ -2268,7 +2267,6 @@ fn declare_binding(
ty: var_ty,
user_ty: if user_ty.is_empty() { None } else { Some(Box::new(user_ty)) },
source_info,
internal: false,
local_info: ClearCrossCrate::Set(Box::new(LocalInfo::User(BindingForm::Var(
VarBindingForm {
binding_mode,
@ -2298,7 +2296,6 @@ fn declare_binding(
ty: Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, var_ty),
user_ty: None,
source_info,
internal: false,
local_info: ClearCrossCrate::Set(Box::new(LocalInfo::User(
BindingForm::RefForGuard,
))),

View File

@ -15,9 +15,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// N.B., **No cleanup is scheduled for this temporary.** You should
/// call `schedule_drop` once the temporary is initialized.
pub(crate) fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx> {
// Mark this local as internal to avoid temporaries with types not present in the
// user's code resulting in ICEs from the generator transform.
let temp = self.local_decls.push(LocalDecl::new(ty, span).internal());
let temp = self.local_decls.push(LocalDecl::new(ty, span));
let place = Place::from(temp);
debug!("temp: created temp {:?} with type {:?}", place, self.local_decls[temp].ty);
place

View File

@ -725,7 +725,7 @@ pub(crate) fn break_for_else(
// Add a dummy `Assign` statement to the CFG, with the span for the source code's `continue`
// statement.
fn add_dummy_assignment(&mut self, span: Span, block: BasicBlock, source_info: SourceInfo) {
let local_decl = LocalDecl::new(Ty::new_unit(self.tcx), span).internal();
let local_decl = LocalDecl::new(Ty::new_unit(self.tcx), span);
let temp_place = Place::from(self.local_decls.push(local_decl));
self.cfg.push_assign_unit(block, source_info, temp_place, self.tcx);
}

View File

@ -179,7 +179,7 @@ fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, _location:
// Check the base local: it might be an unsafe-to-access static. We only check derefs of the
// temporary holding the static pointer to avoid duplicate errors
// <https://github.com/rust-lang/rust/pull/78068#issuecomment-731753506>.
if decl.internal && place.projection.first() == Some(&ProjectionElem::Deref) {
if place.projection.first() == Some(&ProjectionElem::Deref) {
// If the projection root is an artificial local that we introduced when
// desugaring `static`, give a more specific error message
// (avoid the general "raw pointer" clause below, that would only be confusing).

View File

@ -37,7 +37,7 @@ fn visit_place(&mut self, place: &mut Place<'tcx>, cntxt: PlaceContext, loc: Loc
for (idx, (p_ref, p_elem)) in place.iter_projections().enumerate() {
if !p_ref.projection.is_empty() && p_elem == ProjectionElem::Deref {
let ty = p_ref.ty(self.local_decls, self.tcx).ty;
let temp = self.patcher.new_internal_with_info(
let temp = self.patcher.new_local_with_info(
ty,
self.local_decls[p_ref.local].source_info.span,
LocalInfo::DerefTemp,

View File

@ -69,7 +69,7 @@ fn visit_place(
let (unique_ty, nonnull_ty, ptr_ty) =
build_ptr_tys(tcx, base_ty.boxed_ty(), self.unique_did, self.nonnull_did);
let ptr_local = self.patch.new_internal(ptr_ty, source_info.span);
let ptr_local = self.patch.new_temp(ptr_ty, source_info.span);
self.patch.add_assign(
location,

View File

@ -271,7 +271,7 @@ fn create_drop_flag(&mut self, index: MovePathIndex, span: Span) {
let tcx = self.tcx;
let patch = &mut self.patch;
debug!("create_drop_flag({:?})", self.body.span);
self.drop_flags[index].get_or_insert_with(|| patch.new_internal(tcx.types.bool, span));
self.drop_flags[index].get_or_insert_with(|| patch.new_temp(tcx.types.bool, span));
}
fn drop_flag(&mut self, index: MovePathIndex) -> Option<Place<'tcx>> {

View File

@ -321,7 +321,7 @@ fn set_discr(&self, state_disc: VariantIdx, source_info: SourceInfo) -> Statemen
// Create a statement which reads the discriminant into a temporary
fn get_discr(&self, body: &mut Body<'tcx>) -> (Statement<'tcx>, Place<'tcx>) {
let temp_decl = LocalDecl::new(self.discr_ty, body.span).internal();
let temp_decl = LocalDecl::new(self.discr_ty, body.span);
let local_decls_len = body.local_decls.push(temp_decl);
let temp = Place::from(local_decls_len);

View File

@ -616,9 +616,7 @@ fn dest_needs_borrow(place: Place<'_>) -> bool {
// If there are any locals without storage markers, give them storage only for the
// duration of the call.
for local in callee_body.vars_and_temps_iter() {
if !callee_body.local_decls[local].internal
&& integrator.always_live_locals.contains(local)
{
if integrator.always_live_locals.contains(local) {
let new_local = integrator.map_local(local);
caller_body[callsite.block].statements.push(Statement {
source_info: callsite.source_info,
@ -641,9 +639,7 @@ fn dest_needs_borrow(place: Place<'_>) -> bool {
n += 1;
}
for local in callee_body.vars_and_temps_iter().rev() {
if !callee_body.local_decls[local].internal
&& integrator.always_live_locals.contains(local)
{
if integrator.always_live_locals.contains(local) {
let new_local = integrator.map_local(local);
caller_body[block].statements.push(Statement {
source_info: callsite.source_info,

View File

@ -20,6 +20,7 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
+ _4 = const (0_u8, true);
@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);

View File

@ -20,6 +20,7 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
+ _4 = const (0_u8, true);
@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);

View File

@ -20,6 +20,7 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
+ _4 = CheckedAdd(const u8::MAX, const 1_u8);
@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);

View File

@ -20,6 +20,7 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
+ _4 = CheckedAdd(const u8::MAX, const 1_u8);
@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);

View File

@ -41,6 +41,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_7 = (move _8,);
StorageLive(_9);
_9 = move (_7.0: i32);
StorageLive(_10);
StorageLive(_12);
StorageLive(_11);
_10 = ((*_6).0: &i32);
_11 = (*_10);
@ -50,6 +52,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_0 = (move _11, move _13);
StorageDead(_13);
StorageDead(_11);
StorageDead(_12);
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);

View File

@ -44,6 +44,8 @@
+ StorageDead(_3);
+ StorageLive(_6);
+ _6 = const false;
+ StorageLive(_7);
+ StorageLive(_8);
+ _7 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
+ _8 = discriminant((*_7));
+ switchInt(move _8) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
@ -52,6 +54,8 @@
bb1: {
- _3 = &mut _4;
- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_2);
+ drop(_4) -> [return: bb2, unwind unreachable];

View File

@ -52,6 +52,8 @@
- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
+ StorageLive(_6);
+ _6 = const false;
+ StorageLive(_7);
+ StorageLive(_8);
+ _7 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
+ _8 = discriminant((*_7));
+ switchInt(move _8) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
@ -59,6 +61,8 @@
- bb3: {
+ bb1: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
StorageDead(_2);
- drop(_4) -> [return: bb4, unwind: bb6];

View File

@ -122,9 +122,14 @@
+ _3 = const _;
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _4 = SizeOf(std::vec::Vec<u32>);
+ _5 = AlignOf(std::vec::Vec<u32>);
+ StorageLive(_8);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
@ -178,10 +183,15 @@
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_8);
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
+ (*_7) = move _2;
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind unreachable];

View File

@ -122,9 +122,14 @@
+ _3 = const _;
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _4 = SizeOf(std::vec::Vec<u32>);
+ _5 = AlignOf(std::vec::Vec<u32>);
+ StorageLive(_8);
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
@ -195,10 +200,15 @@
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_8);
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
+ (*_7) = move _2;
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];

View File

@ -18,6 +18,7 @@
bb0: {
- _0 = inner() -> [return: bb1, unwind unreachable];
+ StorageLive(_1);
+ StorageLive(_2);
+ _1 = const _;
+ _0 = index() -> [return: bb1, unwind unreachable];
}
@ -40,6 +41,7 @@
+
+ bb4: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
return;
}

View File

@ -18,6 +18,7 @@
bb0: {
- _0 = inner() -> [return: bb1, unwind continue];
+ StorageLive(_1);
+ StorageLive(_2);
+ _1 = const _;
+ _0 = index() -> [return: bb1, unwind continue];
}
@ -40,6 +41,7 @@
+
+ bb4: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
return;
}

View File

@ -17,9 +17,13 @@ fn b(_1: &mut Box<T>) -> &mut T {
StorageLive(_3);
StorageLive(_4);
_4 = &mut (*_1);
StorageLive(_5);
StorageLive(_6);
_5 = deref_copy (*_4);
_6 = (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
_3 = &mut (*_6);
StorageDead(_6);
StorageDead(_5);
_2 = &mut (*_3);
StorageDead(_4);
_0 = &mut (*_2);

View File

@ -15,9 +15,13 @@ fn d(_1: &Box<T>) -> &T {
StorageLive(_2);
StorageLive(_3);
_3 = &(*_1);
StorageLive(_4);
StorageLive(_5);
_4 = deref_copy (*_3);
_5 = (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
_2 = &(*_5);
StorageDead(_5);
StorageDead(_4);
_0 = &(*_2);
StorageDead(_3);
StorageDead(_2);

View File

@ -30,6 +30,7 @@
_2 = move _1;
- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable];
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
}
@ -40,6 +41,7 @@
+
+ bb2: {
+ _0 = move ((_2 as Some).0: T);
+ StorageDead(_4);
+ StorageDead(_3);
StorageDead(_2);
return;

View File

@ -30,6 +30,7 @@
_2 = move _1;
- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2];
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
}
@ -44,6 +45,7 @@
- resume;
+ bb2: {
+ _0 = move ((_2 as Some).0: T);
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ return;

View File

@ -25,12 +25,14 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
bb0: {
StorageLive(_3);
StorageLive(_2);
_2 = discriminant(_1);
switchInt(move _2) -> [1: bb1, otherwise: bb2];
}
bb1: {
_0 = move ((_1 as Some).0: T);
StorageDead(_2);
StorageDead(_3);
return;
}

View File

@ -25,12 +25,14 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
bb0: {
StorageLive(_3);
StorageLive(_2);
_2 = discriminant(_1);
switchInt(move _2) -> [1: bb1, otherwise: bb2];
}
bb1: {
_0 = move ((_1 as Some).0: T);
StorageDead(_2);
StorageDead(_3);
return;
}

View File

@ -30,6 +30,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb1: {
StorageLive(_3);
_3 = discriminant(_2);
StorageDead(_7);
StorageDead(_2);
@ -37,11 +38,13 @@ fn num_to_digit(_1: char) -> u32 {
}
bb2: {
StorageDead(_3);
StorageLive(_4);
_4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageLive(_5);
_5 = discriminant(_4);
switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
}
@ -52,6 +55,7 @@ fn num_to_digit(_1: char) -> u32 {
bb5: {
_0 = move ((_4 as Some).0: u32);
StorageDead(_5);
StorageDead(_4);
goto -> bb8;
}
@ -61,6 +65,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb7: {
StorageDead(_3);
_0 = const 0_u32;
goto -> bb8;
}

View File

@ -30,6 +30,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb1: {
StorageLive(_3);
_3 = discriminant(_2);
StorageDead(_7);
StorageDead(_2);
@ -37,11 +38,13 @@ fn num_to_digit(_1: char) -> u32 {
}
bb2: {
StorageDead(_3);
StorageLive(_4);
_4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue];
}
bb3: {
StorageLive(_5);
_5 = discriminant(_4);
switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
}
@ -52,6 +55,7 @@ fn num_to_digit(_1: char) -> u32 {
bb5: {
_0 = move ((_4 as Some).0: u32);
StorageDead(_5);
StorageDead(_4);
goto -> bb8;
}
@ -61,6 +65,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb7: {
StorageDead(_3);
_0 = const 0_u32;
goto -> bb8;
}

View File

@ -36,8 +36,10 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
bb1: {
StorageLive(_5);
StorageLive(_4);
_4 = discriminant(_3);
_5 = Eq(_4, const 1_isize);
StorageDead(_4);
_6 = Not(move _5);
StorageDead(_5);
switchInt(move _6) -> [0: bb2, otherwise: bb3];

View File

@ -18,6 +18,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb0: {
StorageLive(_2);
_2 = discriminant(_1);
switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@ -37,6 +38,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb3: {
StorageDead(_2);
return;
}

View File

@ -98,6 +98,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
StorageLive(_35);
StorageLive(_11);
_11 = _8;
StorageLive(_12);
StorageLive(_13);
_12 = deref_copy _4;
_13 = deref_copy _11;
StorageLive(_14);
@ -107,6 +109,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
_16 = Le(move _14, move _15);
StorageDead(_15);
StorageDead(_14);
StorageDead(_13);
StorageDead(_12);
switchInt(move _16) -> [0: bb1, otherwise: bb2];
}
@ -126,6 +130,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
StorageLive(_37);
StorageLive(_17);
_17 = _6;
StorageLive(_18);
StorageLive(_19);
_18 = deref_copy _10;
_19 = deref_copy _17;
StorageLive(_20);
@ -135,6 +141,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
_22 = Le(move _20, move _21);
StorageDead(_21);
StorageDead(_20);
StorageDead(_19);
StorageDead(_18);
switchInt(move _22) -> [0: bb3, otherwise: bb8];
}
@ -151,6 +159,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
StorageLive(_39);
StorageLive(_23);
_23 = _4;
StorageLive(_24);
StorageLive(_25);
_24 = deref_copy _8;
_25 = deref_copy _23;
StorageLive(_26);
@ -160,6 +170,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
_28 = Le(move _26, move _27);
StorageDead(_27);
StorageDead(_26);
StorageDead(_25);
StorageDead(_24);
switchInt(move _28) -> [0: bb5, otherwise: bb6];
}
@ -179,6 +191,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
StorageLive(_41);
StorageLive(_29);
_29 = _10;
StorageLive(_30);
StorageLive(_31);
_30 = deref_copy _6;
_31 = deref_copy _29;
StorageLive(_32);
@ -188,6 +202,8 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
_0 = Le(move _32, move _33);
StorageDead(_33);
StorageDead(_32);
StorageDead(_31);
StorageDead(_30);
StorageDead(_29);
StorageDead(_41);
StorageDead(_40);

View File

@ -48,6 +48,7 @@
bb0: {
StorageLive(_3);
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_9 = discriminant(_1);
@ -57,6 +58,7 @@
bb1: {
StorageDead(_11);
StorageDead(_10);
StorageDead(_9);
_5 = discriminant(_3);
switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
}