From 2e07961330d4545a3cdd2dd34ea63ee14cd50363 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 2 Jul 2026 20:55:59 +0200 Subject: [PATCH 1/2] duplicate_return: accept `StorageDead`s in the return block --- .../control_flow/duplicate_return.rs | 27 +++--- charon/tests/ui/arrays.out | 59 ++++++------ charon/tests/ui/assoc-const-with-generics.out | 4 +- .../mem-discriminant-from-derive.out | 80 +++++++++-------- .../ui/consts/pointer-cast-const-pattern.out | 4 +- .../tests/ui/control-flow/issue-507-cfg.out | 22 ++--- charon/tests/ui/control-flow/loops.out | 90 ++++++++++--------- charon/tests/ui/copy_nonoverlapping.out | 30 ++++--- charon/tests/ui/demo.out | 14 ++- charon/tests/ui/disambiguator.out | 4 +- .../issue-92-nonpositive-variant-indices.out | 6 +- .../tests/ui/ml-mono-name-matcher-tests.out | 4 +- charon/tests/ui/ml-mono-name-matcher-tests.rs | 12 +-- charon/tests/ui/ml-name-matcher-tests.out | 4 +- charon/tests/ui/ml-name-matcher-tests.rs | 12 +-- .../multi-target-from-symcrypt.out | 44 ++++----- .../multi-target/multi-targets-file-ids.out | 44 ++++----- charon/tests/ui/no_nested_borrows.out | 20 +++-- .../tests/ui/pointers-in-consts-no-warns.out | 4 +- charon/tests/ui/pointers-in-consts.out | 4 +- charon/tests/ui/polonius_map.out | 61 +++++++------ charon/tests/ui/raw-boxes.out | 66 ++++++++------ charon/tests/ui/rename_attribute.out | 12 +-- charon/tests/ui/simple/box-dyn-fnonce-raw.out | 44 ++++----- charon/tests/ui/simple/dyn-fn.out | 13 +-- charon/tests/ui/simple/match-on-char.out | 4 +- charon/tests/ui/simple/match-on-float.out | 8 +- charon/tests/ui/simple/slice_index_range.out | 36 ++++---- charon/tests/ui/slice-index-range.out | 16 ++-- charon/tests/ui/traits.out | 12 +-- .../tests/ui/traits/remove-unused-clauses.out | 24 +++-- 31 files changed, 441 insertions(+), 343 deletions(-) diff --git a/charon/src/transform/control_flow/duplicate_return.rs b/charon/src/transform/control_flow/duplicate_return.rs index 3c8f3ccf7..ba0749b24 100644 --- a/charon/src/transform/control_flow/duplicate_return.rs +++ b/charon/src/transform/control_flow/duplicate_return.rs @@ -34,15 +34,23 @@ use std::collections::HashMap; use crate::transform::ctx::UllbcPass; pub struct Transform; +fn is_return_block(block: &BlockData) -> bool { + block.terminator.kind.is_return() + && block + .statements + .iter() + .all(|st| matches!(st.kind, StatementKind::StorageDead(_))) +} + impl UllbcPass for Transform { fn transform_body(&self, _ctx: &mut TransformCtx, b: &mut ExprBody) { // Find the return block id (there should be one). - let returns: HashMap = b + let returns: HashMap = b .body .iter_enumerated() .filter_map(|(bid, block)| { - if block.statements.is_empty() && block.terminator.kind.is_return() { - Some((bid, block.terminator.span)) + if is_return_block(block) { + Some((bid, block.clone())) } else { None } @@ -54,20 +62,17 @@ impl UllbcPass for Transform { // We do this in two steps. // First, introduce fresh ids. let mut generator = Generator::new_with_init_value(b.body.next_idx()); - let mut new_spans = Vec::new(); + let mut new_blocks = Vec::new(); b.body.dyn_visit_in_body_mut(|bid: &mut BlockId| { - if let Some(span) = returns.get(bid) { + if let Some(block) = returns.get(bid) { *bid = generator.fresh_id(); - new_spans.push(*span); + new_blocks.push(block.clone()); } }); // Then introduce the new blocks - for span in new_spans { - let _ = b.body.push(BlockData { - statements: Vec::new(), - terminator: Terminator::new(span, TerminatorKind::Return), - }); + for block in new_blocks { + let _ = b.body.push(block); } } } diff --git a/charon/tests/ui/arrays.out b/charon/tests/ui/arrays.out index 9d5c431bc..05f37f2c2 100644 --- a/charon/tests/ui/arrays.out +++ b/charon/tests/ui/arrays.out @@ -1969,37 +1969,40 @@ pub fn ite() storage_live(_2) _2 = const true if move _2 { - storage_live(y) - y = @ArrayRepeat(const 0u32) - storage_live(_4) - storage_live(_5) - storage_live(_6) - storage_live(_7) - _7 = &mut x - _6 = &mut (*_7) - _5 = @ArrayToSliceMut<'_, u32, 2usize>(move _6) - storage_dead(_6) - _4 = index_mut_slice_u32_0<'10>(move _5) - storage_dead(_5) - storage_dead(_7) - storage_dead(_4) - storage_live(_8) - storage_live(_9) - storage_live(_10) - storage_live(_11) - _11 = &mut y - _10 = &mut (*_11) - _9 = @ArrayToSliceMut<'_, u32, 2usize>(move _10) - storage_dead(_10) - _8 = index_mut_slice_u32_0<'13>(move _9) - storage_dead(_9) - storage_dead(_11) - storage_dead(_8) - _0 = () - storage_dead(y) } else { _0 = () + storage_dead(_2) + storage_dead(x) + return } + storage_live(y) + y = @ArrayRepeat(const 0u32) + storage_live(_4) + storage_live(_5) + storage_live(_6) + storage_live(_7) + _7 = &mut x + _6 = &mut (*_7) + _5 = @ArrayToSliceMut<'_, u32, 2usize>(move _6) + storage_dead(_6) + _4 = index_mut_slice_u32_0<'10>(move _5) + storage_dead(_5) + storage_dead(_7) + storage_dead(_4) + storage_live(_8) + storage_live(_9) + storage_live(_10) + storage_live(_11) + _11 = &mut y + _10 = &mut (*_11) + _9 = @ArrayToSliceMut<'_, u32, 2usize>(move _10) + storage_dead(_10) + _8 = index_mut_slice_u32_0<'13>(move _9) + storage_dead(_9) + storage_dead(_11) + storage_dead(_8) + _0 = () + storage_dead(y) storage_dead(_2) storage_dead(x) return diff --git a/charon/tests/ui/assoc-const-with-generics.out b/charon/tests/ui/assoc-const-with-generics.out index 94178e389..e7835251f 100644 --- a/charon/tests/ui/assoc-const-with-generics.out +++ b/charon/tests/ui/assoc-const-with-generics.out @@ -161,10 +161,12 @@ pub fn {impl HasDefaultLen for [bool; N]}::LEN() -> usize storage_live(_1) _1 = const true if move _1 { - _0 = const N } else { _0 = copy {impl HasDefaultLen for [bool; N]}::LEN + storage_dead(_1) + return } + _0 = const N storage_dead(_1) return } diff --git a/charon/tests/ui/associated_types/mem-discriminant-from-derive.out b/charon/tests/ui/associated_types/mem-discriminant-from-derive.out index aad54c15a..00af7f589 100644 --- a/charon/tests/ui/associated_types/mem-discriminant-from-derive.out +++ b/charon/tests/ui/associated_types/mem-discriminant-from-derive.out @@ -86,49 +86,53 @@ pub fn impl_PartialEq_Enum_for_Enum::eq<'_0, '_1>(self: &'_0 Enum, other: &'_1 E _9 = copy __arg1_discr _7 = move _8 == move _9 if move _7 { - storage_dead(_9) - storage_dead(_8) - storage_live(_10) - storage_live(_11) - _11 = copy self - storage_live(_12) - _12 = copy other - _10 = (move _11, move _12) - storage_dead(_12) - storage_dead(_11) - match (*_10.0) { - Enum::Some => { - match (*_10.1) { - Enum::Some => { - storage_live(__self_0) - __self_0 = &((*_10.0) as variant Enum::Some).0 - storage_live(__arg1_0) - __arg1_0 = &((*_10.1) as variant Enum::Some).0 - storage_live(_15) - _15 = &__self_0 - storage_live(_16) - _16 = &__arg1_0 - _0 = {impl PartialEq<&'_0 B> for &'_1 A}::eq<'28, '29, '32, '33, u8, u8>[impl_PartialEq_u8_for_u8](move _15, move _16) - storage_dead(_16) - storage_dead(_15) - storage_dead(__arg1_0) - storage_dead(__self_0) - }, - _ => { - _0 = const true - }, - } - }, - _ => { - _0 = const true - }, - } - storage_dead(_10) } else { storage_dead(_9) storage_dead(_8) _0 = const false + storage_dead(_7) + storage_dead(__arg1_discr) + storage_dead(__self_discr) + return + } + storage_dead(_9) + storage_dead(_8) + storage_live(_10) + storage_live(_11) + _11 = copy self + storage_live(_12) + _12 = copy other + _10 = (move _11, move _12) + storage_dead(_12) + storage_dead(_11) + match (*_10.0) { + Enum::Some => { + match (*_10.1) { + Enum::Some => { + storage_live(__self_0) + __self_0 = &((*_10.0) as variant Enum::Some).0 + storage_live(__arg1_0) + __arg1_0 = &((*_10.1) as variant Enum::Some).0 + storage_live(_15) + _15 = &__self_0 + storage_live(_16) + _16 = &__arg1_0 + _0 = {impl PartialEq<&'_0 B> for &'_1 A}::eq<'28, '29, '32, '33, u8, u8>[impl_PartialEq_u8_for_u8](move _15, move _16) + storage_dead(_16) + storage_dead(_15) + storage_dead(__arg1_0) + storage_dead(__self_0) + }, + _ => { + _0 = const true + }, + } + }, + _ => { + _0 = const true + }, } + storage_dead(_10) storage_dead(_7) storage_dead(__arg1_discr) storage_dead(__self_discr) diff --git a/charon/tests/ui/consts/pointer-cast-const-pattern.out b/charon/tests/ui/consts/pointer-cast-const-pattern.out index 2884dd3c7..99d28bef2 100644 --- a/charon/tests/ui/consts/pointer-cast-const-pattern.out +++ b/charon/tests/ui/consts/pointer-cast-const-pattern.out @@ -29,10 +29,12 @@ pub fn pointer_pattern() _1 = cast(const 43usize) _2 = const no-provenance 42 == copy _1 if move _2 { - _0 = const () } else { _0 = const () + storage_dead(_1) + return } + _0 = const () storage_dead(_1) return } diff --git a/charon/tests/ui/control-flow/issue-507-cfg.out b/charon/tests/ui/control-flow/issue-507-cfg.out index 6e751a7e8..9336e442a 100644 --- a/charon/tests/ui/control-flow/issue-507-cfg.out +++ b/charon/tests/ui/control-flow/issue-507-cfg.out @@ -24,19 +24,21 @@ fn f0() storage_live(_1) _1 = const 0i32 < const 1i32 if move _1 { - storage_live(_2) - _2 = const 0i32 < const 1i32 - if move _2 { - } else { - } - storage_dead(_2) - storage_live(x) - x = copy CONST - _0 = () - storage_dead(x) } else { _0 = () + storage_dead(_1) + return } + storage_live(_2) + _2 = const 0i32 < const 1i32 + if move _2 { + } else { + } + storage_dead(_2) + storage_live(x) + x = copy CONST + _0 = () + storage_dead(x) storage_dead(_1) return } diff --git a/charon/tests/ui/control-flow/loops.out b/charon/tests/ui/control-flow/loops.out index 1ce87dafb..98fa898d8 100644 --- a/charon/tests/ui/control-flow/loops.out +++ b/charon/tests/ui/control-flow/loops.out @@ -1273,54 +1273,56 @@ pub fn loop_inside_if(b: bool, n: u32) -> u32 storage_live(_3) _3 = copy b if move _3 { - storage_live(s) - s = const 0u32 - storage_live(_5) - storage_live(_6) - storage_live(_7) - _7 = copy n - _6 = Range { start: const 0u32, end: move _7 } - storage_dead(_7) - _5 = into_iter[{built_in impl Sized for u32}]>[{built_in impl Sized for Range[{built_in impl Sized for u32}]}, impl_Iterator_for_Range[{built_in impl Sized for u32}, impl_Step_for_u32]](move _6) - storage_dead(_6) - storage_live(iter) - iter = move _5 - loop { - storage_live(_9) - storage_live(_10) - storage_live(_11) - _11 = &mut iter - _10 = &two-phase-mut (*_11) - _9 = next<'4, u32>[{built_in impl Sized for u32}, impl_Step_for_u32](move _10) - storage_dead(_10) - match _9 { - Option::None => { - break 0 - }, - Option::Some => { - storage_live(i) - i = copy (_9 as variant Option::Some).0 - storage_live(_13) - _13 = copy i - _14 = copy s panic.+ copy _13 - s = move _14 - storage_dead(_13) - storage_dead(i) - storage_dead(_11) - storage_dead(_9) - continue 0 - }, - } + } else { + _0 = const 0u32 + storage_dead(_3) + return + } + storage_live(s) + s = const 0u32 + storage_live(_5) + storage_live(_6) + storage_live(_7) + _7 = copy n + _6 = Range { start: const 0u32, end: move _7 } + storage_dead(_7) + _5 = into_iter[{built_in impl Sized for u32}]>[{built_in impl Sized for Range[{built_in impl Sized for u32}]}, impl_Iterator_for_Range[{built_in impl Sized for u32}, impl_Step_for_u32]](move _6) + storage_dead(_6) + storage_live(iter) + iter = move _5 + loop { + storage_live(_9) + storage_live(_10) + storage_live(_11) + _11 = &mut iter + _10 = &two-phase-mut (*_11) + _9 = next<'4, u32>[{built_in impl Sized for u32}, impl_Step_for_u32](move _10) + storage_dead(_10) + match _9 { + Option::None => { + break 0 + }, + Option::Some => { + }, } + storage_live(i) + i = copy (_9 as variant Option::Some).0 + storage_live(_13) + _13 = copy i + _14 = copy s panic.+ copy _13 + s = move _14 + storage_dead(_13) + storage_dead(i) storage_dead(_11) storage_dead(_9) - storage_dead(iter) - storage_dead(_5) - _0 = copy s - storage_dead(s) - } else { - _0 = const 0u32 + continue 0 } + storage_dead(_11) + storage_dead(_9) + storage_dead(iter) + storage_dead(_5) + _0 = copy s + storage_dead(s) storage_dead(_3) return } diff --git a/charon/tests/ui/copy_nonoverlapping.out b/charon/tests/ui/copy_nonoverlapping.out index 3df15f864..ed68901a0 100644 --- a/charon/tests/ui/copy_nonoverlapping.out +++ b/charon/tests/ui/copy_nonoverlapping.out @@ -398,12 +398,14 @@ fn check_language_ub() -> bool storage_live(_1) _1 = core::ub_checks::check_language_ub::runtime() if move _1 { - storage_live(_2) - _2 = ub_checks - _0 = move _2 } else { _0 = const false + storage_dead(_1) + return } + storage_live(_2) + _2 = ub_checks + _0 = move _2 storage_dead(_1) return } @@ -507,18 +509,20 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option _3 = copy align _2 = is_power_of_two(move _3) if move _2 { - storage_dead(_3) - storage_live(_4) - storage_live(_5) - _5 = copy align - _4 = new_unchecked(move _5) - storage_dead(_5) - _0 = Option::Some { 0: move _4 } - storage_dead(_4) } else { storage_dead(_3) _0 = Option::None { } + storage_dead(_2) + return } + storage_dead(_3) + storage_live(_4) + storage_live(_5) + _5 = copy align + _4 = new_unchecked(move _5) + storage_dead(_5) + _0 = Option::Some { 0: move _4 } + storage_dead(_4) storage_dead(_2) return } @@ -575,7 +579,6 @@ where _1 = const TraitClause0::SIZE switch copy _1 { 0usize => { - _0 = copy core::num::{usize}::MAX }, _ => { storage_live(n) @@ -588,8 +591,11 @@ where storage_dead(_4) storage_dead(_3) storage_dead(n) + storage_dead(_1) + return }, } + _0 = copy core::num::{usize}::MAX storage_dead(_1) return } diff --git a/charon/tests/ui/demo.out b/charon/tests/ui/demo.out index f38c49a46..1419883b9 100644 --- a/charon/tests/ui/demo.out +++ b/charon/tests/ui/demo.out @@ -212,8 +212,6 @@ where _6 = copy i _5 = move _6 == const 0u32 if move _5 { - storage_dead(_6) - _0 = &(*x) } else { storage_dead(_6) storage_live(_7) @@ -230,7 +228,13 @@ where storage_dead(_9) storage_dead(_8) storage_dead(_7) + storage_dead(_5) + storage_dead(tl) + storage_dead(x) + return } + storage_dead(_6) + _0 = &(*x) storage_dead(_5) storage_dead(tl) storage_dead(x) @@ -393,8 +397,6 @@ pub fn i32_id(i: i32) -> i32 _3 = copy i _2 = move _3 == const 0i32 if move _2 { - storage_dead(_3) - _0 = const 0i32 } else { storage_dead(_3) storage_live(_4) @@ -409,7 +411,11 @@ pub fn i32_id(i: i32) -> i32 _8 = copy _4 panic.+ const 1i32 _0 = move _8 storage_dead(_4) + storage_dead(_2) + return } + storage_dead(_3) + _0 = const 0i32 storage_dead(_2) return } diff --git a/charon/tests/ui/disambiguator.out b/charon/tests/ui/disambiguator.out index 1d9c1822e..89d44d90c 100644 --- a/charon/tests/ui/disambiguator.out +++ b/charon/tests/ui/disambiguator.out @@ -28,10 +28,12 @@ fn nonzero_disambiguator() storage_live(_1) _1 = const true if move _1 { - _0 = test_crate::nonzero_disambiguator::my_function() } else { _0 = test_crate::nonzero_disambiguator::my_function#1() + storage_dead(_1) + return } + _0 = test_crate::nonzero_disambiguator::my_function() storage_dead(_1) return } diff --git a/charon/tests/ui/issue-92-nonpositive-variant-indices.out b/charon/tests/ui/issue-92-nonpositive-variant-indices.out index 888f96d02..2fcd4f70e 100644 --- a/charon/tests/ui/issue-92-nonpositive-variant-indices.out +++ b/charon/tests/ui/issue-92-nonpositive-variant-indices.out @@ -18,15 +18,19 @@ fn main() _1 = Ordering::Less { } match _1 { Ordering::Less => { - _0 = () }, Ordering::Equal => { _0 = () + storage_dead(_1) + return }, Ordering::Greater => { _0 = () + storage_dead(_1) + return }, } + _0 = () storage_dead(_1) return } diff --git a/charon/tests/ui/ml-mono-name-matcher-tests.out b/charon/tests/ui/ml-mono-name-matcher-tests.out index a8ef6a565..8a5a8415a 100644 --- a/charon/tests/ui/ml-mono-name-matcher-tests.out +++ b/charon/tests/ui/ml-mono-name-matcher-tests.out @@ -127,10 +127,12 @@ fn funs_with_disambiguator(b: bool) -> u32 storage_live(_2) _2 = copy b if move _2 { - _0 = test_crate::funs_with_disambiguator::f() } else { _0 = test_crate::funs_with_disambiguator::f#1() + storage_dead(_2) + return } + _0 = test_crate::funs_with_disambiguator::f() storage_dead(_2) return } diff --git a/charon/tests/ui/ml-mono-name-matcher-tests.rs b/charon/tests/ui/ml-mono-name-matcher-tests.rs index 957a8b88a..d4eea55fa 100644 --- a/charon/tests/ui/ml-mono-name-matcher-tests.rs +++ b/charon/tests/ui/ml-mono-name-matcher-tests.rs @@ -69,12 +69,12 @@ fn foo() { let _ = &slice[1..]; } -#[pattern::pass(call[0], "test_crate::funs_with_disambiguator::f")] -#[pattern::pass(call[0], "test_crate::funs_with_disambiguator::f#0")] -#[pattern::fail(call[0], "test_crate::funs_with_disambiguator::f#1")] -#[pattern::pass(call[1], "test_crate::funs_with_disambiguator::f#1")] -#[pattern::fail(call[1], "test_crate::funs_with_disambiguator::f#0")] -#[pattern::fail(call[1], "test_crate::funs_with_disambiguator::f")] +#[pattern::pass(call[0], "test_crate::funs_with_disambiguator::f#1")] +#[pattern::fail(call[0], "test_crate::funs_with_disambiguator::f#0")] +#[pattern::fail(call[0], "test_crate::funs_with_disambiguator::f")] +#[pattern::pass(call[1], "test_crate::funs_with_disambiguator::f")] +#[pattern::pass(call[1], "test_crate::funs_with_disambiguator::f#0")] +#[pattern::fail(call[1], "test_crate::funs_with_disambiguator::f#1")] fn funs_with_disambiguator(b: bool) -> u32 { if b { fn f() -> u32 { diff --git a/charon/tests/ui/ml-name-matcher-tests.out b/charon/tests/ui/ml-name-matcher-tests.out index e84fd0402..1759dd72b 100644 --- a/charon/tests/ui/ml-name-matcher-tests.out +++ b/charon/tests/ui/ml-name-matcher-tests.out @@ -308,10 +308,12 @@ fn funs_with_disambiguator(b: bool) -> u32 storage_live(_2) _2 = copy b if move _2 { - _0 = test_crate::funs_with_disambiguator::f() } else { _0 = test_crate::funs_with_disambiguator::f#1() + storage_dead(_2) + return } + _0 = test_crate::funs_with_disambiguator::f() storage_dead(_2) return } diff --git a/charon/tests/ui/ml-name-matcher-tests.rs b/charon/tests/ui/ml-name-matcher-tests.rs index bf60bf0b8..a1486ee38 100644 --- a/charon/tests/ui/ml-name-matcher-tests.rs +++ b/charon/tests/ui/ml-name-matcher-tests.rs @@ -70,12 +70,12 @@ fn foo() { let _ = &slice[1..]; } -#[pattern::pass(call[0], "test_crate::funs_with_disambiguator::f")] -#[pattern::pass(call[0], "test_crate::funs_with_disambiguator::f#0")] -#[pattern::fail(call[0], "test_crate::funs_with_disambiguator::f#1")] -#[pattern::pass(call[1], "test_crate::funs_with_disambiguator::f#1")] -#[pattern::fail(call[1], "test_crate::funs_with_disambiguator::f#0")] -#[pattern::fail(call[1], "test_crate::funs_with_disambiguator::f")] +#[pattern::pass(call[0], "test_crate::funs_with_disambiguator::f#1")] +#[pattern::fail(call[0], "test_crate::funs_with_disambiguator::f#0")] +#[pattern::fail(call[0], "test_crate::funs_with_disambiguator::f")] +#[pattern::pass(call[1], "test_crate::funs_with_disambiguator::f")] +#[pattern::pass(call[1], "test_crate::funs_with_disambiguator::f#0")] +#[pattern::fail(call[1], "test_crate::funs_with_disambiguator::f#1")] fn funs_with_disambiguator(b: bool) -> u32 { if b { fn f() -> u32 { diff --git a/charon/tests/ui/multi-target/multi-target-from-symcrypt.out b/charon/tests/ui/multi-target/multi-target-from-symcrypt.out index 604977edd..13c601237 100644 --- a/charon/tests/ui/multi-target/multi-target-from-symcrypt.out +++ b/charon/tests/ui/multi-target/multi-target-from-symcrypt.out @@ -603,16 +603,6 @@ fn test_crate::poly_element_ntt_layer::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut storage_live(_3) _3 = test_crate::cpu_features_present(copy test_crate::SYMCRYPT_CPU_FEATURE_SSE2) if move _3 { - storage_live(_4) - storage_live(_5) - _5 = &two-phase-mut (*a) - storage_live(_6) - _6 = &(*b) - _4 = test_crate::ntt_layer_vec128<'10, '11, test_crate::ntt_xmm::NttIntrinsicsXmm>[{built_in impl core::marker::Sized for test_crate::ntt_xmm::NttIntrinsicsXmm}, test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate::ntt_xmm::NttIntrinsicsXmm}](move _5, move _6) - storage_dead(_6) - storage_dead(_5) - storage_dead(_4) - _0 = () } else { storage_live(_7) storage_live(_8) @@ -624,7 +614,19 @@ fn test_crate::poly_element_ntt_layer::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut storage_dead(_8) storage_dead(_7) _0 = () + storage_dead(_3) + return } + storage_live(_4) + storage_live(_5) + _5 = &two-phase-mut (*a) + storage_live(_6) + _6 = &(*b) + _4 = test_crate::ntt_layer_vec128<'10, '11, test_crate::ntt_xmm::NttIntrinsicsXmm>[{built_in impl core::marker::Sized for test_crate::ntt_xmm::NttIntrinsicsXmm}, test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate::ntt_xmm::NttIntrinsicsXmm}](move _5, move _6) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + _0 = () storage_dead(_3) return } @@ -646,16 +648,6 @@ fn test_crate::poly_element_ntt_layer::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mu storage_live(_3) _3 = test_crate::cpu_features_present(copy test_crate::SYMCRYPT_CPU_FEATURE_NEON) if move _3 { - storage_live(_4) - storage_live(_5) - _5 = &two-phase-mut (*a) - storage_live(_6) - _6 = &(*b) - _4 = test_crate::ntt_layer_vec128<'10, '11, test_crate::ntt_neon::NttIntrinsicsNeon>[{built_in impl core::marker::Sized for test_crate::ntt_neon::NttIntrinsicsNeon}, test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate::ntt_neon::NttIntrinsicsNeon}](move _5, move _6) - storage_dead(_6) - storage_dead(_5) - storage_dead(_4) - _0 = () } else { storage_live(_7) storage_live(_8) @@ -667,7 +659,19 @@ fn test_crate::poly_element_ntt_layer::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mu storage_dead(_8) storage_dead(_7) _0 = () + storage_dead(_3) + return } + storage_live(_4) + storage_live(_5) + _5 = &two-phase-mut (*a) + storage_live(_6) + _6 = &(*b) + _4 = test_crate::ntt_layer_vec128<'10, '11, test_crate::ntt_neon::NttIntrinsicsNeon>[{built_in impl core::marker::Sized for test_crate::ntt_neon::NttIntrinsicsNeon}, test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate::ntt_neon::NttIntrinsicsNeon}](move _5, move _6) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + _0 = () storage_dead(_3) return } diff --git a/charon/tests/ui/multi-target/multi-targets-file-ids.out b/charon/tests/ui/multi-target/multi-targets-file-ids.out index 8c45436d4..b583cc627 100644 --- a/charon/tests/ui/multi-target/multi-targets-file-ids.out +++ b/charon/tests/ui/multi-target/multi-targets-file-ids.out @@ -579,16 +579,6 @@ fn test_crate::add_dispatch::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8us storage_live(_3) _3 = test_crate::cpu_features_present(const 1u32) if move _3 { - storage_live(_4) - storage_live(_5) - _5 = &two-phase-mut (*a) - storage_live(_6) - _6 = &(*b) - _4 = test_crate::add_generic<'10, '11, test_crate::x86::Sse2>[{built_in impl core::marker::Sized for test_crate::x86::Sse2}, test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}](move _5, move _6) - storage_dead(_6) - storage_dead(_5) - storage_dead(_4) - _0 = () } else { storage_live(_7) storage_live(_8) @@ -600,7 +590,19 @@ fn test_crate::add_dispatch::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8us storage_dead(_8) storage_dead(_7) _0 = () + storage_dead(_3) + return } + storage_live(_4) + storage_live(_5) + _5 = &two-phase-mut (*a) + storage_live(_6) + _6 = &(*b) + _4 = test_crate::add_generic<'10, '11, test_crate::x86::Sse2>[{built_in impl core::marker::Sized for test_crate::x86::Sse2}, test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}](move _5, move _6) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + _0 = () storage_dead(_3) return } @@ -622,16 +624,6 @@ fn test_crate::add_dispatch::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8u storage_live(_3) _3 = test_crate::cpu_features_present(const 2u32) if move _3 { - storage_live(_4) - storage_live(_5) - _5 = &two-phase-mut (*a) - storage_live(_6) - _6 = &(*b) - _4 = test_crate::add_generic<'10, '11, test_crate::arm::Neon>[{built_in impl core::marker::Sized for test_crate::arm::Neon}, test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}](move _5, move _6) - storage_dead(_6) - storage_dead(_5) - storage_dead(_4) - _0 = () } else { storage_live(_7) storage_live(_8) @@ -643,7 +635,19 @@ fn test_crate::add_dispatch::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8u storage_dead(_8) storage_dead(_7) _0 = () + storage_dead(_3) + return } + storage_live(_4) + storage_live(_5) + _5 = &two-phase-mut (*a) + storage_live(_6) + _6 = &(*b) + _4 = test_crate::add_generic<'10, '11, test_crate::arm::Neon>[{built_in impl core::marker::Sized for test_crate::arm::Neon}, test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}](move _5, move _6) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + _0 = () storage_dead(_3) return } diff --git a/charon/tests/ui/no_nested_borrows.out b/charon/tests/ui/no_nested_borrows.out index 34d600ed5..5f430895c 100644 --- a/charon/tests/ui/no_nested_borrows.out +++ b/charon/tests/ui/no_nested_borrows.out @@ -367,14 +367,16 @@ pub fn get_max(x: u32, y: u32) -> u32 _5 = copy y _3 = move _4 >= move _5 if move _3 { - storage_dead(_5) - storage_dead(_4) - _0 = copy x } else { storage_dead(_5) storage_dead(_4) _0 = copy y + storage_dead(_3) + return } + storage_dead(_5) + storage_dead(_4) + _0 = copy x storage_dead(_3) return } @@ -578,8 +580,6 @@ pub fn even(x: u32) -> bool _3 = copy x _2 = move _3 == const 0u32 if move _2 { - storage_dead(_3) - _0 = const true } else { storage_dead(_3) storage_live(_4) @@ -590,7 +590,11 @@ pub fn even(x: u32) -> bool storage_dead(_5) _0 = odd(move _4) storage_dead(_4) + storage_dead(_2) + return } + storage_dead(_3) + _0 = const true storage_dead(_2) return } @@ -612,8 +616,6 @@ pub fn odd(x: u32) -> bool _3 = copy x _2 = move _3 == const 0u32 if move _2 { - storage_dead(_3) - _0 = const false } else { storage_dead(_3) storage_live(_4) @@ -624,7 +626,11 @@ pub fn odd(x: u32) -> bool storage_dead(_5) _0 = even(move _4) storage_dead(_4) + storage_dead(_2) + return } + storage_dead(_3) + _0 = const false storage_dead(_2) return } diff --git a/charon/tests/ui/pointers-in-consts-no-warns.out b/charon/tests/ui/pointers-in-consts-no-warns.out index 6ffc3776b..86e31ac7f 100644 --- a/charon/tests/ui/pointers-in-consts-no-warns.out +++ b/charon/tests/ui/pointers-in-consts-no-warns.out @@ -32,10 +32,12 @@ pub fn bar() _3 = cast(const 42usize) _2 = move _3 == copy _1 if move _2 { - _0 = () } else { _0 = () + storage_dead(_1) + return } + _0 = () storage_dead(_1) return } diff --git a/charon/tests/ui/pointers-in-consts.out b/charon/tests/ui/pointers-in-consts.out index 6ffc3776b..86e31ac7f 100644 --- a/charon/tests/ui/pointers-in-consts.out +++ b/charon/tests/ui/pointers-in-consts.out @@ -32,10 +32,12 @@ pub fn bar() _3 = cast(const 42usize) _2 = move _3 == copy _1 if move _2 { - _0 = () } else { _0 = () + storage_dead(_1) + return } + _0 = () storage_dead(_1) return } diff --git a/charon/tests/ui/polonius_map.out b/charon/tests/ui/polonius_map.out index 5b4799866..1cd38c99b 100644 --- a/charon/tests/ui/polonius_map.out +++ b/charon/tests/ui/polonius_map.out @@ -265,43 +265,46 @@ pub fn get_or_insert<'_0>(map: &'_0 mut HashMap[{ storage_dead(_3) match _2 { Option::None => { - storage_live(_7) - storage_live(_8) - _8 = &two-phase-mut (*map) - _7 = insert<'31, u32, u32, RandomState, Global>[{built_in impl Sized for u32}, {built_in impl Sized for u32}, {built_in impl Sized for RandomState}, {built_in impl Sized for Global}, impl_Eq_for_u32, impl_Hash_for_u32, impl_BuildHasher_for_RandomState](move _8, const 22u32, const 33u32) - storage_live(_17) - storage_live(_20) - storage_live(_21) - _21 = const 22u32 - _20 = &_21 - _17 = move _20 - storage_dead(_8) - storage_dead(_7) - storage_live(_9) - storage_live(_10) - storage_live(_11) - _11 = &(*map) - storage_live(_12) - storage_live(_13) - _14 = move _17 - _13 = &(*_14) - _12 = &(*_13) - _10 = index<'33, '35, u32, u32, u32, RandomState, Global>[{built_in impl Sized for u32}, {built_in impl MetaSized for u32}, {built_in impl Sized for u32}, {built_in impl Sized for RandomState}, {built_in impl Sized for Global}, impl_Eq_for_u32, impl_Hash_for_u32, impl_Borrow_for_T[{built_in impl MetaSized for u32}], impl_Eq_for_u32, impl_Hash_for_u32, impl_BuildHasher_for_RandomState](move _11, move _12) - storage_dead(_12) - storage_dead(_11) - _9 = &(*_10) - _0 = &(*_9) - storage_dead(_13) - storage_dead(_10) - storage_dead(_9) }, Option::Some => { storage_live(v) v = copy (_2 as variant Option::Some).0 _0 = &(*v) storage_dead(v) + storage_dead(_5) + storage_dead(_2) + return }, } + storage_live(_7) + storage_live(_8) + _8 = &two-phase-mut (*map) + _7 = insert<'31, u32, u32, RandomState, Global>[{built_in impl Sized for u32}, {built_in impl Sized for u32}, {built_in impl Sized for RandomState}, {built_in impl Sized for Global}, impl_Eq_for_u32, impl_Hash_for_u32, impl_BuildHasher_for_RandomState](move _8, const 22u32, const 33u32) + storage_live(_17) + storage_live(_20) + storage_live(_21) + _21 = const 22u32 + _20 = &_21 + _17 = move _20 + storage_dead(_8) + storage_dead(_7) + storage_live(_9) + storage_live(_10) + storage_live(_11) + _11 = &(*map) + storage_live(_12) + storage_live(_13) + _14 = move _17 + _13 = &(*_14) + _12 = &(*_13) + _10 = index<'33, '35, u32, u32, u32, RandomState, Global>[{built_in impl Sized for u32}, {built_in impl MetaSized for u32}, {built_in impl Sized for u32}, {built_in impl Sized for RandomState}, {built_in impl Sized for Global}, impl_Eq_for_u32, impl_Hash_for_u32, impl_Borrow_for_T[{built_in impl MetaSized for u32}], impl_Eq_for_u32, impl_Hash_for_u32, impl_BuildHasher_for_RandomState](move _11, move _12) + storage_dead(_12) + storage_dead(_11) + _9 = &(*_10) + _0 = &(*_9) + storage_dead(_13) + storage_dead(_10) + storage_dead(_9) storage_dead(_5) storage_dead(_2) return diff --git a/charon/tests/ui/raw-boxes.out b/charon/tests/ui/raw-boxes.out index 1314a887a..d7f194b74 100644 --- a/charon/tests/ui/raw-boxes.out +++ b/charon/tests/ui/raw-boxes.out @@ -308,7 +308,6 @@ where _1 = const TraitClause0::SIZE switch copy _1 { 0usize => { - _0 = copy core::num::{usize}::MAX }, _ => { storage_live(n) @@ -323,8 +322,11 @@ where storage_dead(_4) storage_dead(_3) storage_dead(n) + storage_dead(_1) + return }, } + _0 = copy core::num::{usize}::MAX storage_dead(_1) return } @@ -456,18 +458,20 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option _3 = copy align _2 = is_power_of_two(move _3) if move _2 { - storage_dead(_3) - storage_live(_4) - storage_live(_5) - _5 = copy align - _4 = core::mem::alignment::{Alignment}::new_unchecked(move _5) - storage_dead(_5) - _0 = Option::Some { 0: move _4 } - storage_dead(_4) } else { storage_dead(_3) _0 = Option::None { } + storage_dead(_2) + return } + storage_dead(_3) + storage_live(_4) + storage_live(_5) + _5 = copy align + _4 = core::mem::alignment::{Alignment}::new_unchecked(move _5) + storage_dead(_5) + _0 = Option::Some { 0: move _4 } + storage_dead(_4) storage_dead(_2) return } @@ -1928,30 +1932,34 @@ where storage_dead(_9) _7 = move _8 != const 0usize if move _7 { - storage_dead(_8) - storage_live(_10) - storage_live(_11) - _11 = &((*self)).1 with_metadata(copy self.metadata) - storage_live(_12) - storage_live(_13) - storage_live(_14) - _14 = copy ptr - _13 = core::ptr::unique::{Unique}::cast[{built_in impl Sized for u8}](move _14) - storage_dead(_14) - _12 = from(move _13) - storage_dead(_13) - storage_live(_15) - _15 = copy layout - _10 = TraitClause2::deallocate<'8>(move _11, move _12, move _15) - storage_dead(_15) - storage_dead(_12) - storage_dead(_11) - storage_dead(_10) - _0 = () } else { storage_dead(_8) _0 = () + storage_dead(_7) + storage_dead(layout) + storage_dead(ptr) + return } + storage_dead(_8) + storage_live(_10) + storage_live(_11) + _11 = &((*self)).1 with_metadata(copy self.metadata) + storage_live(_12) + storage_live(_13) + storage_live(_14) + _14 = copy ptr + _13 = core::ptr::unique::{Unique}::cast[{built_in impl Sized for u8}](move _14) + storage_dead(_14) + _12 = from(move _13) + storage_dead(_13) + storage_live(_15) + _15 = copy layout + _10 = TraitClause2::deallocate<'8>(move _11, move _12, move _15) + storage_dead(_15) + storage_dead(_12) + storage_dead(_11) + storage_dead(_10) + _0 = () storage_dead(_7) storage_dead(layout) storage_dead(ptr) diff --git a/charon/tests/ui/rename_attribute.out b/charon/tests/ui/rename_attribute.out index b50de9f26..50be2022c 100644 --- a/charon/tests/ui/rename_attribute.out +++ b/charon/tests/ui/rename_attribute.out @@ -76,15 +76,17 @@ where _3 = &x _2 = get_bool<'4>(move _3) if move _2 { - storage_dead(_3) - storage_live(_4) - _4 = &x - _0 = impl_BoolTrait_for_bool::ret_true<'6>(move _4) - storage_dead(_4) } else { storage_dead(_3) _0 = const false + storage_dead(_2) + return } + storage_dead(_3) + storage_live(_4) + _4 = &x + _0 = impl_BoolTrait_for_bool::ret_true<'6>(move _4) + storage_dead(_4) storage_dead(_2) return } diff --git a/charon/tests/ui/simple/box-dyn-fnonce-raw.out b/charon/tests/ui/simple/box-dyn-fnonce-raw.out index ec8faa805..9cbe317d2 100644 --- a/charon/tests/ui/simple/box-dyn-fnonce-raw.out +++ b/charon/tests/ui/simple/box-dyn-fnonce-raw.out @@ -304,30 +304,34 @@ where storage_dead(_9) _7 = move _8 != const 0usize if move _7 { - storage_dead(_8) - storage_live(_10) - storage_live(_11) - _11 = &((*self)).1 - storage_live(_12) - storage_live(_13) - storage_live(_14) - _14 = copy ptr - _13 = cast[{built_in impl Sized for u8}](move _14) - storage_dead(_14) - _12 = from(move _13) - storage_dead(_13) - storage_live(_15) - _15 = copy layout - _10 = TraitClause2::deallocate<'8>(move _11, move _12, move _15) - storage_dead(_15) - storage_dead(_12) - storage_dead(_11) - storage_dead(_10) - _0 = () } else { storage_dead(_8) _0 = () + storage_dead(_7) + storage_dead(layout) + storage_dead(ptr) + return } + storage_dead(_8) + storage_live(_10) + storage_live(_11) + _11 = &((*self)).1 + storage_live(_12) + storage_live(_13) + storage_live(_14) + _14 = copy ptr + _13 = cast[{built_in impl Sized for u8}](move _14) + storage_dead(_14) + _12 = from(move _13) + storage_dead(_13) + storage_live(_15) + _15 = copy layout + _10 = TraitClause2::deallocate<'8>(move _11, move _12, move _15) + storage_dead(_15) + storage_dead(_12) + storage_dead(_11) + storage_dead(_10) + _0 = () storage_dead(_7) storage_dead(layout) storage_dead(ptr) diff --git a/charon/tests/ui/simple/dyn-fn.out b/charon/tests/ui/simple/dyn-fn.out index 6236cb31f..fbf794daa 100644 --- a/charon/tests/ui/simple/dyn-fn.out +++ b/charon/tests/ui/simple/dyn-fn.out @@ -104,18 +104,21 @@ fn takes_fn<'_0>(f: &'_0 (dyn for<'a> Fn<(&'a mut u32,), ImpliedClause1::Implied _5 = (move _6,) _3 = (copy ((*_4.metadata)).method_call)(move _4, move _5) if move _3 { - storage_dead(_7) - storage_dead(_6) - storage_dead(_5) - storage_dead(_4) - _0 = () } else { storage_dead(_7) storage_dead(_6) storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(_3) + storage_dead(counter) + return } + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + _0 = () storage_dead(_3) storage_dead(counter) return diff --git a/charon/tests/ui/simple/match-on-char.out b/charon/tests/ui/simple/match-on-char.out index 18d0841e8..dde671d07 100644 --- a/charon/tests/ui/simple/match-on-char.out +++ b/charon/tests/ui/simple/match-on-char.out @@ -11,12 +11,14 @@ fn main() _1 = const 'x' switch copy _1 { 'a' => { - _0 = () }, _ => { _0 = () + storage_dead(_1) + return }, } + _0 = () storage_dead(_1) return } diff --git a/charon/tests/ui/simple/match-on-float.out b/charon/tests/ui/simple/match-on-float.out index 03c1b17ef..aaa4ac1f6 100644 --- a/charon/tests/ui/simple/match-on-float.out +++ b/charon/tests/ui/simple/match-on-float.out @@ -15,15 +15,19 @@ fn main() _1 = const 0.5f64 _3 = const 0.10000000000000001f64 == copy _1 if move _3 { - _0 = () } else { _2 = const 0.20000000000000001f64 == copy _1 if move _2 { - _0 = () } else { _0 = () + storage_dead(_1) + return } + _0 = () + storage_dead(_1) + return } + _0 = () storage_dead(_1) return } diff --git a/charon/tests/ui/simple/slice_index_range.out b/charon/tests/ui/simple/slice_index_range.out index 0c7b20f12..248bab699 100644 --- a/charon/tests/ui/simple/slice_index_range.out +++ b/charon/tests/ui/simple/slice_index_range.out @@ -699,19 +699,19 @@ where storage_dead(_11) storage_dead(new_len) storage_dead(_3) + storage_dead(_7) + return } else { storage_dead(_9) storage_dead(_8) storage_dead(new_len) - storage_dead(_3) - _0 = Option::None { } } }, _ => { - storage_dead(_3) - _0 = Option::None { } }, } + storage_dead(_3) + _0 = Option::None { } storage_dead(_7) return } @@ -784,19 +784,19 @@ where storage_dead(_11) storage_dead(new_len) storage_dead(_3) + storage_dead(_7) + return } else { storage_dead(_9) storage_dead(_8) storage_dead(new_len) - storage_dead(_3) - _0 = Option::None { } } }, _ => { - storage_dead(_3) - _0 = Option::None { } }, } + storage_dead(_3) + _0 = Option::None { } storage_dead(_7) return } @@ -1400,10 +1400,6 @@ where storage_dead(_8) _3 = move _4 >= move _7 if move _3 { - storage_dead(_7) - storage_dead(_5) - storage_dead(_4) - _0 = Option::None { } } else { storage_dead(_7) storage_dead(_5) @@ -1418,7 +1414,13 @@ where _0 = impl_SliceIndex_slice_for_Range_usize::get_mut<'27, T>[TraitClause0](move _9, move _11) storage_dead(_11) storage_dead(_9) + storage_dead(_3) + return } + storage_dead(_7) + storage_dead(_5) + storage_dead(_4) + _0 = Option::None { } storage_dead(_3) return } @@ -1456,10 +1458,6 @@ where storage_dead(_8) _3 = move _4 >= move _7 if move _3 { - storage_dead(_7) - storage_dead(_5) - storage_dead(_4) - _0 = Option::None { } } else { storage_dead(_7) storage_dead(_5) @@ -1474,7 +1472,13 @@ where _0 = impl_SliceIndex_slice_for_Range_usize::get<'26, T>[TraitClause0](move _9, move _11) storage_dead(_11) storage_dead(_9) + storage_dead(_3) + return } + storage_dead(_7) + storage_dead(_5) + storage_dead(_4) + _0 = Option::None { } storage_dead(_3) return } diff --git a/charon/tests/ui/slice-index-range.out b/charon/tests/ui/slice-index-range.out index 58a8341e4..3c0bb7cfc 100644 --- a/charon/tests/ui/slice-index-range.out +++ b/charon/tests/ui/slice-index-range.out @@ -1222,19 +1222,19 @@ where storage_dead(_11) storage_dead(new_len) storage_dead(_3) + storage_dead(_7) + return } else { storage_dead(_9) storage_dead(_8) storage_dead(new_len) - storage_dead(_3) - _0 = Option::None { } } }, _ => { - storage_dead(_3) - _0 = Option::None { } }, } + storage_dead(_3) + _0 = Option::None { } storage_dead(_7) return } @@ -1307,19 +1307,19 @@ where storage_dead(_11) storage_dead(new_len) storage_dead(_3) + storage_dead(_7) + return } else { storage_dead(_9) storage_dead(_8) storage_dead(new_len) - storage_dead(_3) - _0 = Option::None { } } }, _ => { - storage_dead(_3) - _0 = Option::None { } }, } + storage_dead(_3) + _0 = Option::None { } storage_dead(_7) return } diff --git a/charon/tests/ui/traits.out b/charon/tests/ui/traits.out index 61b1fcadc..dd5605221 100644 --- a/charon/tests/ui/traits.out +++ b/charon/tests/ui/traits.out @@ -181,15 +181,17 @@ pub fn test_bool_trait_bool(x: bool) -> bool _3 = &x _2 = impl_BoolTrait_for_bool::get_bool<'4>(move _3) if move _2 { - storage_dead(_3) - storage_live(_4) - _4 = &x - _0 = impl_BoolTrait_for_bool::ret_true<'6>(move _4) - storage_dead(_4) } else { storage_dead(_3) _0 = const false + storage_dead(_2) + return } + storage_dead(_3) + storage_live(_4) + _4 = &x + _0 = impl_BoolTrait_for_bool::ret_true<'6>(move _4) + storage_dead(_4) storage_dead(_2) return } diff --git a/charon/tests/ui/traits/remove-unused-clauses.out b/charon/tests/ui/traits/remove-unused-clauses.out index 46a325019..f9139f6db 100644 --- a/charon/tests/ui/traits/remove-unused-clauses.out +++ b/charon/tests/ui/traits/remove-unused-clauses.out @@ -54,13 +54,15 @@ pub fn recursive() storage_live(_1) _1 = const false if move _1 { - storage_live(_2) - _2 = recursive() - storage_dead(_2) - _0 = () } else { _0 = () + storage_dead(_1) + return } + storage_live(_2) + _2 = recursive() + storage_dead(_2) + _0 = () storage_dead(_1) return } @@ -76,13 +78,15 @@ pub fn swap_recursive() storage_live(_1) _1 = const false if move _1 { - storage_live(_2) - _2 = swap_recursive() - storage_dead(_2) - _0 = () } else { _0 = () + storage_dead(_1) + return } + storage_live(_2) + _2 = swap_recursive() + storage_dead(_2) + _0 = () storage_dead(_1) return } @@ -106,10 +110,12 @@ pub fn clause_dep() storage_live(_1) _1 = const false if move _1 { - _0 = clause_dep() } else { _0 = () + storage_dead(_1) + return } + _0 = clause_dep() storage_dead(_1) return } From e202358c66862c8a5cd00c6f9b913ba61861b7b5 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 2 Jul 2026 19:58:34 +0200 Subject: [PATCH 2/2] Insert `StorageDead`s for all locals --- charon-ml/src/generated/Generated_LlbcAst.ml | 12 +- charon-ml/src/generated/Generated_UllbcAst.ml | 12 +- charon/src/ast/llbc_ast.rs | 10 +- charon/src/ast/ullbc_ast.rs | 10 +- .../insert_storage_lives.rs | 96 ----- .../insert_storage_statements.rs | 176 +++++++++ charon/src/transform/mod.rs | 8 +- charon/tests/cargo/build-script.out | 2 + charon/tests/cargo/dependencies.out | 30 ++ charon/tests/cargo/issue-396-lib-bin.out | 5 + charon/tests/cargo/issue-412-dup-deps.out | 27 ++ charon/tests/cargo/multi-targets.out | 8 + charon/tests/cargo/toml.out | 9 + charon/tests/cargo/unsafe_.out | 1 + charon/tests/cargo/workspace.out | 3 + charon/tests/crate_data.rs | 14 +- charon/tests/ui/advanced-const-generics.out | 10 + charon/tests/ui/arrays.out | 268 +++++++++++++ charon/tests/ui/arrays_const_generics.out | 10 + .../ui/assert-kinds-reconstruct-fallible.out | 2 + charon/tests/ui/assert-kinds.out | 23 ++ charon/tests/ui/assoc-const-with-generics.out | 9 + .../assoc-constraint-on-assoc-ty-nested.out | 1 + .../assoc-constraint-on-assoc-ty.2.out | 1 + .../assoc-constraint-on-assoc-ty.out | 4 + .../assoc-ty-bound-refers-to-assoc-ty.out | 4 + .../assoc-ty-via-supertrait-and-bounds.out | 2 + .../assoc-type-with-fn-bound.out | 3 + .../ui/associated_types/associated-types.out | 15 + ...e-inside-impl-with-bound-with-assoc-ty.out | 15 + .../dictionary_passing_style_woes.out | 10 + ...ulted-method-with-clause-with-assoc-ty.out | 2 + .../issue-1068-double-visit.out | 2 + .../issue-1260-self-ref-assoc-const.out | 1 + .../issue-968-default-assoc-const.out | 1 + .../tests/ui/associated_types/iter-empty.out | 7 + .../mem-discriminant-from-derive.out | 5 + .../method-with-assoc-type-constraint.out | 2 + .../ui/associated_types/pointee_metadata.out | 12 + .../quantified-trait-type-constraint.out | 1 + .../supertrait-item-bound-has-assoc-ty.out | 2 + charon/tests/ui/bitwise.out | 13 + .../tests/ui/call-to-known-trait-method.out | 3 + charon/tests/ui/closure-as-fn.out | 17 + charon/tests/ui/closures.out | 270 +++++++++++++ charon/tests/ui/closures_with_where.out | 11 + charon/tests/ui/comments.out | 48 +++ charon/tests/ui/constants.out | 39 ++ .../ui/consts/evaluate-consts-inline.out | 29 ++ .../tests/ui/consts/evaluate-consts-mono.out | 4 + .../evaluate-consts-recursive-static.out | 4 + charon/tests/ui/consts/evaluate-consts.out | 5 + .../ui/consts/pointer-cast-const-pattern.out | 4 + .../tests/ui/consts/ptr-null-constevalval.out | 9 + .../ui/consts/string-new-constevalval.out | 9 + .../ui/control-flow/ambiguous-loop-exit.out | 4 + .../ui/control-flow/duplicated-statement.out | 8 + charon/tests/ui/control-flow/empty-loop.out | 1 + .../issue-1051-missing-loop-jump.out | 1 + .../control-flow/issue-1051-return-break.out | 7 + .../tests/ui/control-flow/issue-297-cfg.out | 24 ++ .../tests/ui/control-flow/issue-507-cfg.out | 4 + ...forward-jump-incorrectly-reconstructed.out | 5 + .../ui/control-flow/lazy-boolean-op-in-if.out | 7 + charon/tests/ui/control-flow/loop-break.out | 5 + charon/tests/ui/control-flow/loops.out | 84 ++++ .../ui/control-flow/simple-fallthrough.out | 6 + .../ui/control-flow/ullbc-control-flow.out | 43 +++ charon/tests/ui/copy_nonoverlapping.out | 81 ++++ charon/tests/ui/cross_compile_32_bit.out | 2 + charon/tests/ui/cross_compile_big_endian.out | 3 + charon/tests/ui/demo.out | 54 +++ charon/tests/ui/desugar_drops_to_calls.out | 27 ++ .../tests/ui/desugar_drops_to_calls_mono.out | 23 ++ charon/tests/ui/disambiguator.out | 3 + charon/tests/ui/diverging.out | 6 + charon/tests/ui/drop_after_overflow.out | 14 + charon/tests/ui/dyn-trait.out | 7 + .../tests/ui/dyn-with-diamond-supertraits.out | 83 ++++ charon/tests/ui/explicit-drop-bounds.out | 8 + charon/tests/ui/extern-abi-fn-pointer.out | 6 + charon/tests/ui/external.out | 11 + charon/tests/ui/filtering/inner-items.out | 9 + ...e-1270-start-from-pub-skip-foreign-pub.out | 3 + charon/tests/ui/filtering/opacity.out | 20 + charon/tests/ui/filtering/opaque-trait.out | 14 + .../tests/ui/filtering/opaque_attribute.out | 7 + .../ui/filtering/start-from-if-exists.out | 1 + charon/tests/ui/filtering/start_from.out | 6 + .../ui/filtering/start_from_attribute.out | 3 + charon/tests/ui/filtering/start_from_pub.out | 4 + charon/tests/ui/float.out | 6 + charon/tests/ui/foreign-constant.out | 1 + .../ui/gat-causes-unhandled-ty-clause.out | 1 + charon/tests/ui/gosim-demo.out | 10 + charon/tests/ui/hide-marker-traits.out | 2 + charon/tests/ui/impl-trait.out | 25 ++ charon/tests/ui/issue-114-opaque-bodies.out | 38 ++ charon/tests/ui/issue-118-generic-copy.out | 8 + .../ui/issue-120-bare-discriminant-read.out | 9 + ...59-heterogeneous-recursive-definitions.out | 3 + charon/tests/ui/issue-165-vec-macro.out | 10 + .../tests/ui/issue-166-self-constructors.out | 3 + charon/tests/ui/issue-320-slice-pattern.out | 93 ++++- .../ui/issue-322-macro-disambiguator.out | 1 + charon/tests/ui/issue-323-closure-borrow.out | 13 + .../ui/issue-372-type-param-out-of-range.out | 3 + charon/tests/ui/issue-378-ctor-as-fn.out | 14 + .../tests/ui/issue-394-rpit-with-lifetime.out | 10 + .../tests/ui/issue-4-slice-try-into-array.out | 2 + charon/tests/ui/issue-4-traits.out | 2 + charon/tests/ui/issue-45-misc.out | 36 ++ ...ue-70-override-provided-method.2-nodup.out | 10 + .../issue-70-override-provided-method.2.out | 16 + .../issue-70-override-provided-method.3.out | 11 + .../ui/issue-70-override-provided-method.out | 17 + .../tests/ui/issue-72-hash-missing-impl.out | 9 + charon/tests/ui/issue-73-extern.out | 2 + .../ui/issue-91-enum-to-discriminant-cast.out | 6 + .../issue-92-nonpositive-variant-indices.out | 1 + .../ui/issue-94-recursive-trait-defns.out | 2 + .../issue-97-missing-parent-item-clause.out | 4 + charon/tests/ui/iterator.out | 21 + charon/tests/ui/matches.out | 11 + charon/tests/ui/max_char.out | 2 + .../tests/ui/method-impl-generalization.out | 35 ++ charon/tests/ui/method-ref.out | 1 + .../tests/ui/ml-mono-name-matcher-tests.out | 22 ++ .../ui/ml-multi-target-name-matcher-tests.out | 3 + charon/tests/ui/ml-name-matcher-tests.out | 24 ++ .../ui/ml-partial-mono-name-matcher-tests.out | 8 + charon/tests/ui/monomorphization/adt_proj.out | 1 + .../ui/monomorphization/bound_lifetime.out | 8 + .../tests/ui/monomorphization/closure-fn.out | 9 + .../ui/monomorphization/closure-fnonce.out | 5 + charon/tests/ui/monomorphization/closures.out | 13 + .../tests/ui/monomorphization/dyn-trait.out | 3 + .../ui/monomorphization/fn_ptr_generics.out | 3 + .../ui/monomorphization/fndefs-casts.out | 19 + .../ui/monomorphization/generic-method.out | 2 + .../monomorphization/global_with_generics.out | 4 + .../issue-1159-assoc-const.out | 22 ++ ...ssue-1262-defaulted-method-indirection.out | 2 + .../issue-722-poly-items-in-names.out | 4 + .../issue-917-inline-const-with-poly-type.out | 16 + .../issue-922-assoc-const-with-default.out | 2 + .../monomorphization/lifetime-bound-call.out | 3 + charon/tests/ui/monomorphization/rec-adt.out | 2 + .../simpl-trait-assoc-types-2.out | 47 +++ .../simple-trait-assoc-types-3.out | 47 +++ .../simple-trait-assoc-types.out | 24 ++ .../simple-trait-generics-2.out | 47 +++ .../simple-trait-generics-assoc-2.out | 47 +++ .../simple-trait-generics-assoc.out | 24 ++ .../simple-trait-generics.out | 24 ++ .../simple-trait-two-methods.out | 32 ++ .../ui/monomorphization/simple_trait.out | 24 ++ .../simple_trait_with_trait_alias.out | 2 + ...simple_trait_with_trait_alias_generics.out | 2 + .../tests/ui/monomorphization/trait_impls.out | 5 + .../ui/monomorphization/trait_impls_ullbc.out | 8 + .../unsatisfied-method-bounds.out | 15 + .../monomorphization/vtable-blanket-impl.out | 19 + .../monomorphization/vtable-lifetime-impl.out | 21 + .../ui/monomorphization/vtable-ref-impl.out | 19 + charon/tests/ui/monomorphize-mut-no-types.out | 15 + charon/tests/ui/monomorphize-mut.out | 43 +++ charon/tests/ui/multi-target/cstr.out | 6 + .../default-trait-assoc-const.out | 1 + .../multi-target/evaluate-consts-size-of.out | 2 + .../multi-target/issue-1133-assoc-const.out | 10 + .../issue-1157-single-target-suffix.out | 2 + .../multi-target/issue-1158-partial-dedup.out | 3 + .../multi-target/issue-1182-dedup-impls.out | 3 + .../issue-1185-1-inline-const.out | 2 + .../issue-1185-2-generic-make.out | 4 + .../issue-1185-3-box-drop-glue.out | 1 + .../issue-1185-4-wrapping-add.out | 3 + ...1213-merge-methods-when-missing-simple.out | 8 + .../issue-1213-merge-methods-when-missing.out | 5 + .../issue-1248-const-initializers.out | 2 + .../issue-1307-required-method.out | 1 + .../multi-target-from-symcrypt.out | 42 ++ .../ui/multi-target/multi-targets-3-dedup.out | 8 + .../multi-target/multi-targets-file-ids.out | 40 ++ .../tests/ui/multi-target/multi-targets.out | 8 + charon/tests/ui/multi-target/sysroot.out | 2 + charon/tests/ui/no_nested_borrows.out | 96 ++++- charon/tests/ui/panics.out | 19 +- charon/tests/ui/params.out | 2 + .../issue-1204-partial-mono-tuples.out | 6 + charon/tests/ui/pattern-types.out | 4 + charon/tests/ui/plain-panic-str.out | 2 + .../tests/ui/pointers-in-consts-no-warns.out | 6 + charon/tests/ui/pointers-in-consts.out | 6 + charon/tests/ui/polonius_map.out | 19 + .../ui/predicates-on-late-bound-vars.out | 6 + charon/tests/ui/projection-index-from-end.out | 17 + charon/tests/ui/ptr-offset.out | 29 ++ charon/tests/ui/ptr_no_provenance.out | 2 + charon/tests/ui/quantified-clause.out | 5 + charon/tests/ui/raw-boxes.out | 233 ++++++++++++ charon/tests/ui/reconstruct_early_return.out | 5 + charon/tests/ui/region-inference-vars.out | 2 + .../invalid-reconstruct-assert.out | 192 ++++++++++ .../issue-1010-missing-lifetime.out | 35 ++ .../regressions/issue-1067-filename-ice.out | 3 + .../issue-1073-out-of-bounds-body-region.out | 2 + .../issue-1074-vtable-supertrait.out | 21 + .../issue-1089-inline-const-precise-drops.out | 4 + .../regressions/issue-1236-vtable-fn-ptr.out | 26 ++ .../issue-1294-remove-clause-underflow.out | 1 + .../issue-1296-exclude-needed-builtin-ty.out | 6 + .../issue-1297-box-new-allocator-ty.out | 5 + .../issue-393-vec-with-control-flow.out | 8 + ...issue-792-trait-ref-panic-when-tracing.out | 4 + .../issue-967-assoc-type-coherence.out | 1 + .../ui/regressions/reconstruct-fallible.out | 12 + charon/tests/ui/remove-dynamic-checks.out | 136 +++++++ charon/tests/ui/rename_attribute.out | 12 + charon/tests/ui/result-unwrap.out | 14 + charon/tests/ui/rust-name-matcher-tests.out | 9 + charon/tests/ui/rvalues.out | 42 ++ charon/tests/ui/send_bound.out | 3 + charon/tests/ui/simple-cmp.out | 1 + charon/tests/ui/simple/addition.out | 2 + charon/tests/ui/simple/additions.out | 18 + charon/tests/ui/simple/array_index.out | 4 + charon/tests/ui/simple/basic-mono.out | 3 + .../tests/ui/simple/box-deref-elaborated.out | 16 + .../tests/ui/simple/box-deref-optimized.out | 16 + charon/tests/ui/simple/box-dyn-fnonce-raw.out | 48 +++ charon/tests/ui/simple/box-new.out | 1 + charon/tests/ui/simple/builtin-drop-mono.out | 21 + charon/tests/ui/simple/builtin-drop.out | 21 + .../simple/call-foreign-defaulted-method.out | 10 + .../call-inherent-method-with-trait-bound.out | 12 + .../call-method-via-supertrait-bound.out | 4 + charon/tests/ui/simple/catch-unwind.out | 4 + .../ui/simple/closure-capture-ref-by-move.out | 11 + charon/tests/ui/simple/closure-fn.out | 25 ++ charon/tests/ui/simple/closure-fnmut.out | 15 + charon/tests/ui/simple/closure-fnonce.out | 10 + .../tests/ui/simple/closure-inside-impl.out | 15 + .../ui/simple/closure-inside-inline-const.out | 17 + .../closure-uses-ambient-self-clause.out | 23 ++ charon/tests/ui/simple/closure-with-drops.out | 21 + .../closure-with-non-upvar-lifetime.out | 19 + .../closure-with-remove-adt-clauses.out | 30 ++ .../ui/simple/comma-delimited-start-from.out | 2 + charon/tests/ui/simple/conditional-drop.out | 4 + charon/tests/ui/simple/const-subslice.out | 4 + charon/tests/ui/simple/const_pat_value.out | 1 + ...-method-with-clause-and-marker-trait.2.out | 2 + ...lt-method-with-clause-and-marker-trait.out | 3 + charon/tests/ui/simple/defaulted-rpitit.2.out | 2 + charon/tests/ui/simple/defaulted-rpitit.3.out | 4 + charon/tests/ui/simple/defaulted-rpitit.out | 2 + charon/tests/ui/simple/double-promotion.out | 9 + charon/tests/ui/simple/drop-cow.out | 5 + .../drop-glue-with-const-generic-silenced.out | 2 + .../simple/drop-glue-with-const-generic.out | 4 + .../tests/ui/simple/drop-string-desugar.out | 11 + charon/tests/ui/simple/drop-string.out | 5 + .../dyn-broken-assoc-type-constraint.out | 19 + .../ui/simple/dyn-cast-to-supertrait.out | 44 +++ charon/tests/ui/simple/dyn-fn.out | 24 ++ .../dyn-method-with-early-bound-lifetimes.out | 2 + .../ui/simple/explicit_destruct_bound.out | 2 + .../extern-same-name-across-modules.out | 6 + .../simple/fewer-clauses-in-method-impl.2.out | 2 + .../simple/fewer-clauses-in-method-impl.out | 2 + charon/tests/ui/simple/fn-ptr.out | 2 + charon/tests/ui/simple/fn_ptr_trait.out | 2 + .../tests/ui/simple/foreign-inline-const.out | 5 + .../tests/ui/simple/gat-complex-lifetimes.out | 2 + charon/tests/ui/simple/gat-default.out | 1 + charon/tests/ui/simple/gat-implied-clause.out | 4 + .../tests/ui/simple/generic-cast-to-dyn.out | 2 + .../tests/ui/simple/generic-discriminant.out | 4 + .../generic-impl-with-defaulted-method.out | 4 + .../ui/simple/generic-impl-with-method.out | 2 + charon/tests/ui/simple/generic-offset-of.out | 5 + charon/tests/ui/simple/hello-world.out | 1 + charon/tests/ui/simple/hide-drops.out | 3 + charon/tests/ui/simple/impl-trait-in-arg.out | 2 + charon/tests/ui/simple/inline-asm.out | 4 + .../intrinsic-same-name-across-modules.out | 2 + .../issue-1040-closure-upvar-lifetime.out | 15 + .../ui/simple/issue-988-closure-outlives.out | 19 + .../tests/ui/simple/lending-iterator-gat.out | 51 +++ .../lifetime-unification-from-trait-impl.out | 6 + charon/tests/ui/simple/manual-drop-impl.out | 8 + charon/tests/ui/simple/match-on-char.out | 1 + charon/tests/ui/simple/match-on-float.out | 7 + .../simple/metadata-without-marker-trait.out | 2 + charon/tests/ui/simple/min.out | 1 + .../simple/mono-enum-with-single-variant.out | 2 + .../ui/simple/monomorphized-intrinsic.out | 11 + charon/tests/ui/simple/multiple-promoteds.out | 15 + .../ui/simple/nested-closure-lifetime.out | 28 ++ .../ui/simple/nested-closure-trait-ref.out | 20 + charon/tests/ui/simple/nested-closure.out | 53 +++ .../tests/ui/simple/nested-inline-const.out | 2 + charon/tests/ui/simple/non-lifetime-gats.out | 5 + charon/tests/ui/simple/offset-of.out | 1 + .../opaque-trait-with-clause-in-method.out | 1 + charon/tests/ui/simple/opaque-vtable.out | 8 + charon/tests/ui/simple/partial-drop.out | 2 + .../pass-higher-kinded-fn-item-as-closure.out | 5 + charon/tests/ui/simple/place_mention.out | 6 + .../ui/simple/promoted-closure-no-warns.out | 20 + charon/tests/ui/simple/promoted-closure.out | 20 + .../ui/simple/promoted-in-generic-fn.out | 6 + .../tests/ui/simple/promoted-inside-impl.out | 6 + .../promoted-literal-addition-overflow.out | 8 + .../ui/simple/promoted-literal-addition.out | 8 + charon/tests/ui/simple/promoted-u32-slice.out | 6 + .../tests/ui/simple/promoted_in_closure.out | 19 + .../ui/simple/promoted_in_default_method.out | 6 + charon/tests/ui/simple/ptr-from-raw-parts.out | 4 + charon/tests/ui/simple/ptr_metadata.out | 1 + charon/tests/ui/simple/ptr_to_promoted.out | 6 + charon/tests/ui/simple/range-iter.out | 2 + charon/tests/ui/simple/ref-in-const.out | 7 + .../remove-adt-clauses-closure-keep-assoc.out | 5 + .../simple/remove-adt-clauses-keep-assoc.out | 10 + .../simple/remove-adt-clauses-supertrait.out | 5 + charon/tests/ui/simple/remove-adt-clauses.out | 2 + .../ui/simple/rpitit-with-const-generic.out | 1 + .../simple/single-variant-enum-drop-glue.out | 4 + charon/tests/ui/simple/slice_increment.out | 7 + charon/tests/ui/simple/slice_index.out | 4 + charon/tests/ui/simple/slice_index_range.out | 230 +++++++++++ charon/tests/ui/simple/struct-with-drops.out | 10 + ...rtrait-impl-with-assoc-type-constraint.out | 1 + charon/tests/ui/simple/thread-local.out | 44 +++ charon/tests/ui/simple/trait-alias.out | 5 + .../trait-default-const-cross-crate.out | 2 + .../tests/ui/simple/trait-default-const.out | 2 + .../ui/simple/trivial_generic_function.out | 2 + charon/tests/ui/simple/uncheck-ops.out | 1 + charon/tests/ui/simple/vec-push.out | 10 + charon/tests/ui/simple/vec-with-capacity.out | 22 ++ .../tests/ui/simple/well-formedness-bound.out | 2 + charon/tests/ui/simple/wrapping-ops.out | 10 + charon/tests/ui/skip-borrowck.out | 10 + charon/tests/ui/slice-index-range.out | 211 ++++++++++ charon/tests/ui/statics.out | 24 ++ charon/tests/ui/stealing.out | 5 + charon/tests/ui/string-literal.out | 5 + charon/tests/ui/traits.out | 87 +++++ .../default-method-with-item-bound.2.out | 3 + .../default-method-with-item-bound.3.out | 4 + .../default-method-with-item-bound.4.out | 2 + .../default-method-with-item-bound.5.out | 2 + .../default-method-with-item-bound.6.out | 6 + .../traits/default-method-with-item-bound.out | 6 + .../traits/issue-1242-dyn-send-supertrait.out | 2 + .../traits/issue-513-gat-clause-mismatch.out | 3 + ...ethod-clause-mismatch-and-default-call.out | 6 + .../issue-513-method-clause-mismatch.out | 4 + .../issue-513-method-late-bound-mismatch.out | 9 + .../ui/traits/pointee-metadata-bounds.out | 2 + .../traits/remove-self-clause-on-closure.out | 17 + .../tests/ui/traits/remove-unused-clauses.out | 5 + charon/tests/ui/traits_special.out | 2 + charon/tests/ui/type-id.out | 7 + .../ui/type_inference_is_order_dependent.out | 4 + charon/tests/ui/typenum.out | 2 + charon/tests/ui/unions.out | 1 + charon/tests/ui/unsafe.out | 8 + charon/tests/ui/unsize.out | 1 + charon/tests/ui/unsized-string-consts.out | 11 + .../ui/unsupported/issue-79-bound-regions.out | 6 + charon/tests/ui/variadics.out | 4 + .../tests/ui/vec-reconstruct-move-values.out | 10 + .../ui/vec-reconstruct-multiple-adjacent.out | 25 ++ charon/tests/ui/vec-reconstruct-nested.out | 22 ++ charon/tests/ui/vtable-simple.out | 24 ++ charon/tests/ui/vtable_drop.out | 27 ++ charon/tests/ui/vtables.out | 360 ++++++++++++++++++ 382 files changed, 6254 insertions(+), 133 deletions(-) delete mode 100644 charon/src/transform/finish_translation/insert_storage_lives.rs create mode 100644 charon/src/transform/finish_translation/insert_storage_statements.rs diff --git a/charon-ml/src/generated/Generated_LlbcAst.ml b/charon-ml/src/generated/Generated_LlbcAst.ml index c5309e479..fb3475d5c 100644 --- a/charon-ml/src/generated/Generated_LlbcAst.ml +++ b/charon-ml/src/generated/Generated_LlbcAst.ml @@ -33,15 +33,17 @@ and statement_kind = modelled as a function call as it cannot diverge *) | StorageLive of local_id (** Indicates that this local should be allocated; if it is already - allocated, this frees the local and re-allocates it. The return value - and arguments do not receive a [StorageLive]. We ensure in the - micro-pass [insert_storage_lives] that all other locals have a - [StorageLive] associated with them. *) + allocated, this frees the local and re-allocates it. The arguments do + not receive a [StorageLive]. We ensure in the micro-pass + [insert_storage_statements] that all other locals have a [StorageLive] + associated with them. *) | StorageDead of local_id (** Indicates that this local should be deallocated; if it is already deallocated, this is a no-op. A local may not have a [StorageDead] in the function's body, in which case it is implicitly deallocated at the - end of the function. *) + end of the function. The return local does not receive a + [StorageDead]. We ensure in the micro-pass [insert_storage_statements] + that all other locals have a [StorageDead] before function exits. *) | PlaceMention of place (** A place is mentioned, but not accessed. The place itself must still be valid though, so this statement is not a no-op: it can trigger UB if diff --git a/charon-ml/src/generated/Generated_UllbcAst.ml b/charon-ml/src/generated/Generated_UllbcAst.ml index 24bfdba46..f3dc2e282 100644 --- a/charon-ml/src/generated/Generated_UllbcAst.ml +++ b/charon-ml/src/generated/Generated_UllbcAst.ml @@ -27,15 +27,17 @@ and statement_kind = modelled as a function call as it cannot diverge *) | StorageLive of local_id (** Indicates that this local should be allocated; if it is already - allocated, this frees the local and re-allocates it. The return value - and arguments do not receive a [StorageLive]. We ensure in the - micro-pass [insert_storage_lives] that all other locals have a - [StorageLive] associated with them. *) + allocated, this frees the local and re-allocates it. The arguments do + not receive a [StorageLive]. We ensure in the micro-pass + [insert_storage_statements] that all other locals have a [StorageLive] + associated with them. *) | StorageDead of local_id (** Indicates that this local should be deallocated; if it is already deallocated, this is a no-op. A local may not have a [StorageDead] in the function's body, in which case it is implicitly deallocated at the - end of the function. *) + end of the function. The return local does not receive a + [StorageDead]. We ensure in the micro-pass [insert_storage_statements] + that all other locals have a [StorageDead] before function exits. *) | PlaceMention of place (** A place is mentioned, but not accessed. The place itself must still be valid though, so this statement is not a no-op: it can trigger UB if diff --git a/charon/src/ast/llbc_ast.rs b/charon/src/ast/llbc_ast.rs index 197c2be85..0ecabe20e 100644 --- a/charon/src/ast/llbc_ast.rs +++ b/charon/src/ast/llbc_ast.rs @@ -38,13 +38,15 @@ pub enum StatementKind { /// call as it cannot diverge CopyNonOverlapping(Box), /// Indicates that this local should be allocated; if it is already allocated, this frees - /// the local and re-allocates it. The return value and arguments do not receive a - /// `StorageLive`. We ensure in the micro-pass `insert_storage_lives` that all other locals - /// have a `StorageLive` associated with them. + /// the local and re-allocates it. The arguments do not receive a `StorageLive`. We ensure in + /// the micro-pass `insert_storage_statements` that all other locals have a `StorageLive` + /// associated with them. StorageLive(LocalId), /// Indicates that this local should be deallocated; if it is already deallocated, this is /// a no-op. A local may not have a `StorageDead` in the function's body, in which case it - /// is implicitly deallocated at the end of the function. + /// is implicitly deallocated at the end of the function. The return local does not receive a + /// `StorageDead`. We ensure in the micro-pass `insert_storage_statements` that all other locals + /// have a `StorageDead` before function exits. StorageDead(LocalId), /// A place is mentioned, but not accessed. The place itself must still be valid though, so /// this statement is not a no-op: it can trigger UB if the place's projections are not valid diff --git a/charon/src/ast/ullbc_ast.rs b/charon/src/ast/ullbc_ast.rs index f0677a118..128c8cced 100644 --- a/charon/src/ast/ullbc_ast.rs +++ b/charon/src/ast/ullbc_ast.rs @@ -38,13 +38,15 @@ pub enum StatementKind { /// call as it cannot diverge CopyNonOverlapping(Box), /// Indicates that this local should be allocated; if it is already allocated, this frees - /// the local and re-allocates it. The return value and arguments do not receive a - /// `StorageLive`. We ensure in the micro-pass `insert_storage_lives` that all other locals - /// have a `StorageLive` associated with them. + /// the local and re-allocates it. The arguments do not receive a `StorageLive`. We ensure in + /// the micro-pass `insert_storage_statements` that all other locals have a `StorageLive` + /// associated with them. StorageLive(LocalId), /// Indicates that this local should be deallocated; if it is already deallocated, this is /// a no-op. A local may not have a `StorageDead` in the function's body, in which case it - /// is implicitly deallocated at the end of the function. + /// is implicitly deallocated at the end of the function. The return local does not receive a + /// `StorageDead`. We ensure in the micro-pass `insert_storage_statements` that all other locals + /// have a `StorageDead` before function exits. StorageDead(LocalId), /// A place is mentioned, but not accessed. The place itself must still be valid though, so /// this statement is not a no-op: it can trigger UB if the place's projections are not valid diff --git a/charon/src/transform/finish_translation/insert_storage_lives.rs b/charon/src/transform/finish_translation/insert_storage_lives.rs deleted file mode 100644 index 62a67c0d0..000000000 --- a/charon/src/transform/finish_translation/insert_storage_lives.rs +++ /dev/null @@ -1,96 +0,0 @@ -//! Add missing StorageLives -- in MIR, some locals are considered "always" initialised, and have -//! no StorageLive and StorageDead instructions associated; this always includes the arguments -//! and the return value, but also sometimes includes other locals. We make sure these additional -//! locals get initialised at the start of the function if they're used anywhere. -use derive_generic_visitor::Visitor; - -use crate::ast::*; -use crate::ids::IndexVec; -use crate::transform::TransformCtx; -use crate::transform::ctx::UllbcPass; -use crate::ullbc_ast::BlockId; - -#[derive(Visitor)] -struct StorageVisitor { - local_status: IndexVec, -} - -enum LocalStatus { - Unused, - UsedAndNoExplicitStorage, - UsedAndHasExplicitStorage, -} - -impl StorageVisitor { - fn new(locals: &Locals) -> Self { - let local_status = locals.locals.map_ref(|local| { - if locals.is_return_or_arg(local.index) { - // The return and argument places count as having a `StorageLive` already. - LocalStatus::UsedAndHasExplicitStorage - } else { - LocalStatus::Unused - } - }); - Self { local_status } - } -} - -impl VisitBody for StorageVisitor { - fn visit_locals(&mut self, _: &Locals) -> ::std::ops::ControlFlow { - // Don't look inside the local declarations otherwise we'll think they're all used. - ControlFlow::Continue(()) - } - fn enter_local_id(&mut self, lid: &LocalId) { - let status = &mut self.local_status[*lid]; - if let LocalStatus::Unused = *status { - *status = LocalStatus::UsedAndNoExplicitStorage - } - } - fn enter_llbc_statement(&mut self, st: &llbc_ast::Statement) { - match &st.kind { - llbc_ast::StatementKind::StorageDead(lid) - | llbc_ast::StatementKind::StorageLive(lid) => { - self.local_status[*lid] = LocalStatus::UsedAndHasExplicitStorage - } - _ => {} - } - } - fn enter_ullbc_statement(&mut self, st: &ullbc_ast::Statement) { - match &st.kind { - ullbc_ast::StatementKind::StorageDead(lid) - | ullbc_ast::StatementKind::StorageLive(lid) => { - self.local_status[*lid] = LocalStatus::UsedAndHasExplicitStorage - } - _ => {} - } - } -} - -pub struct Transform; -impl UllbcPass for Transform { - fn transform_function(&self, _ctx: &mut TransformCtx, fun: &mut FunDecl) { - let Body::Unstructured(body) = &mut fun.body else { - return; - }; - - let mut storage_visitor = StorageVisitor::new(&body.locals); - let _ = storage_visitor.visit(body); - - // Insert StorageLive instructions for the always initialised locals. - let locals_with_missing_storage = storage_visitor - .local_status - .iter_enumerated() - .filter(|(_, status)| matches!(status, LocalStatus::UsedAndNoExplicitStorage)) - .map(|(local, _)| local); - let first_block = body.body.get_mut(BlockId::ZERO).unwrap(); - let first_span = if let Some(fst) = first_block.statements.first() { - fst.span - } else { - first_block.terminator.span - }; - let new_statements = locals_with_missing_storage.map(|local| { - ullbc_ast::Statement::new(first_span, ullbc_ast::StatementKind::StorageLive(local)) - }); - first_block.statements.splice(0..0, new_statements); - } -} diff --git a/charon/src/transform/finish_translation/insert_storage_statements.rs b/charon/src/transform/finish_translation/insert_storage_statements.rs new file mode 100644 index 000000000..557ce7590 --- /dev/null +++ b/charon/src/transform/finish_translation/insert_storage_statements.rs @@ -0,0 +1,176 @@ +//! Add missing storage markers -- in MIR, some locals are considered "always" initialised, and have +//! no StorageLive and StorageDead instructions associated; this always includes the arguments +//! and the return local, but also sometimes includes other locals. We make sure these additional +//! locals get initialised at the start of the function and deallocated before function exits if +//! they're used anywhere. +use derive_generic_visitor::Visitor; + +use crate::ast::*; +use crate::ids::IndexVec; +use crate::transform::TransformCtx; +use crate::transform::ctx::{TransformPass, UllbcPass}; +use crate::ullbc_ast::{BlockId, TerminatorKind}; + +#[derive(Visitor)] +struct StorageVisitor { + local_status: IndexVec, +} + +struct LocalStatus { + used: bool, + has_storage_live: bool, + has_storage_dead: bool, +} + +impl StorageVisitor { + fn new(locals: &Locals) -> Self { + let local_status = locals.locals.map_ref(|local| { + let is_return = local.index == LocalId::ZERO; + let is_argument = !is_return && locals.is_return_or_arg(local.index); + LocalStatus { + used: is_return || is_argument, + has_storage_live: is_argument, + has_storage_dead: is_return, + } + }); + Self { local_status } + } + + fn locals_missing_storage_lives(&self) -> Vec { + self.local_status + .iter_enumerated() + .filter(|(_, status)| status.used && !status.has_storage_live) + .map(|(local, _)| local) + .collect() + } + + fn locals_missing_storage_deads(&self) -> Vec { + self.local_status + .iter_enumerated() + .filter(|(_, status)| status.used && !status.has_storage_dead) + .map(|(local, _)| local) + .collect() + } +} + +impl VisitBody for StorageVisitor { + fn visit_locals(&mut self, _: &Locals) -> ::std::ops::ControlFlow { + // Don't look inside the local declarations otherwise we'll think they're all used. + ControlFlow::Continue(()) + } + fn enter_local_id(&mut self, lid: &LocalId) { + self.local_status[*lid].used = true; + } + fn enter_llbc_statement(&mut self, st: &llbc_ast::Statement) { + match &st.kind { + llbc_ast::StatementKind::StorageLive(lid) => { + self.local_status[*lid].has_storage_live = true; + } + llbc_ast::StatementKind::StorageDead(lid) => { + self.local_status[*lid].has_storage_dead = true; + } + _ => {} + } + } + fn enter_ullbc_statement(&mut self, st: &ullbc_ast::Statement) { + match &st.kind { + ullbc_ast::StatementKind::StorageLive(lid) => { + self.local_status[*lid].has_storage_live = true; + } + ullbc_ast::StatementKind::StorageDead(lid) => { + self.local_status[*lid].has_storage_dead = true; + } + _ => {} + } + } +} + +pub struct Transform; +impl Transform { + fn transform_ullbc_body(&self, body: &mut ullbc_ast::ExprBody) { + let mut storage_visitor = StorageVisitor::new(&body.locals); + let _ = storage_visitor.visit(body); + + // Insert StorageLive instructions for the always initialised locals. + let locals_with_missing_storage_lives = storage_visitor.locals_missing_storage_lives(); + let first_block = body.body.get_mut(BlockId::ZERO).unwrap(); + let first_span = if let Some(fst) = first_block.statements.first() { + fst.span + } else { + first_block.terminator.span + }; + let new_statements = locals_with_missing_storage_lives.iter().map(|local| { + ullbc_ast::Statement::new(first_span, ullbc_ast::StatementKind::StorageLive(*local)) + }); + first_block.statements.splice(0..0, new_statements); + + // Insert StorageDead instructions before every function exit. + let locals_with_missing_storage_deads = storage_visitor.locals_missing_storage_deads(); + for block in &mut body.body { + if matches!( + block.terminator.kind, + TerminatorKind::Abort(_) | TerminatorKind::Return | TerminatorKind::UnwindResume + ) { + let span = block.terminator.span; + block + .statements + .extend(locals_with_missing_storage_deads.iter().rev().map(|local| { + ullbc_ast::Statement::new( + span, + ullbc_ast::StatementKind::StorageDead(*local), + ) + })); + } + } + } + + fn transform_llbc_body(&self, body: &mut llbc_ast::ExprBody) { + let mut storage_visitor = StorageVisitor::new(&body.locals); + let _ = storage_visitor.visit(body); + + let locals_with_missing_storage_lives = storage_visitor.locals_missing_storage_lives(); + let first_span = if let Some(fst) = body.body.statements.first() { + fst.span + } else { + body.span + }; + let new_statements = locals_with_missing_storage_lives.iter().map(|local| { + llbc_ast::Statement::new(first_span, llbc_ast::StatementKind::StorageLive(*local)) + }); + body.body.statements.splice(0..0, new_statements); + + let locals_with_missing_storage_deads = storage_visitor.locals_missing_storage_deads(); + body.body.transform_sequences(|statements| { + if !matches!( + &statements[0].kind, + llbc_ast::StatementKind::Abort(_) | llbc_ast::StatementKind::Return + ) { + return Vec::new(); + } + let span = statements[0].span; + locals_with_missing_storage_deads + .iter() + .rev() + .map(|local| { + llbc_ast::Statement::new(span, llbc_ast::StatementKind::StorageDead(*local)) + }) + .collect() + }); + } +} + +impl UllbcPass for Transform { + fn transform_body(&self, _ctx: &mut TransformCtx, body: &mut ullbc_ast::ExprBody) { + self.transform_ullbc_body(body) + } +} + +impl TransformPass for Transform { + fn transform_ctx(&self, ctx: &mut TransformCtx) { + ctx.for_each_fun_decl(|_ctx, fun| match &mut fun.body { + Body::Unstructured(body) => self.transform_ullbc_body(body), + Body::Structured(body) => self.transform_llbc_body(body), + _ => {} + }); + } +} diff --git a/charon/src/transform/mod.rs b/charon/src/transform/mod.rs index 1f0ce464a..a6f66a1a1 100644 --- a/charon/src/transform/mod.rs +++ b/charon/src/transform/mod.rs @@ -7,7 +7,7 @@ pub mod finish_translation { pub mod filter_invisible_trait_impls; pub mod insert_assign_return_unit; pub mod insert_ptr_metadata; - pub mod insert_storage_lives; + pub mod insert_storage_statements; } /// Passes that compute extra info to be stored in the crate. @@ -115,8 +115,8 @@ pub fn run_transformation_passes(options: &CliOpts, ctx: &mut TransformCtx) { // contains ⊥ upon returning. For this reason, when the function has return type unit, we // insert an extra assignment just before returning. CowBox::Borrowed(&finish_translation::insert_assign_return_unit::Transform), - // Insert `StorageLive` for locals that don't have one (that's allowed in MIR). - CowBox::Borrowed(&finish_translation::insert_storage_lives::Transform), + // Insert storage markers for locals that don't have them (that's allowed in MIR). + CowBox::Borrowed(&finish_translation::insert_storage_statements::Transform), // Transform Drops into Calls to drop_glue. CowBox::Borrowed(&normalize::desugar_drops::Transform), // Whenever we reference a trait method on a known type, refer to the method `FunDecl` @@ -211,6 +211,8 @@ pub fn run_transformation_passes(options: &CliOpts, ctx: &mut TransformCtx) { } // Cleanup passes useful for both llbc and ullbc. ctx.run_passes([ + // Body passes may introduce fresh locals; make their storage markers explicit. + mixed_body(&finish_translation::insert_storage_statements::Transform), // Change trait associated types to be type parameters instead. See the module for details. // This also normalizes any use of an associated type that we can resolve. global(&normalize::expand_associated_types::Transform), diff --git a/charon/tests/cargo/build-script.out b/charon/tests/cargo/build-script.out index 6b4c84069..14999effa 100644 --- a/charon/tests/cargo/build-script.out +++ b/charon/tests/cargo/build-script.out @@ -5,6 +5,7 @@ pub fn FOO() -> u8 { let _0: u8; // return + storage_live(_0) _0 = const 42u8 return } @@ -17,6 +18,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/cargo/dependencies.out b/charon/tests/cargo/dependencies.out index de3a9a0de..4bd696a24 100644 --- a/charon/tests/cargo/dependencies.out +++ b/charon/tests/cargo/dependencies.out @@ -76,6 +76,7 @@ fn call_once(_1: closure, tupled_args: (u32,)) -> u32 let _4: u32; // anonymous local let _5: (u32, bool); // anonymous local + storage_live(_0) storage_live(y) storage_live(_5) y = move tupled_args.0 @@ -85,6 +86,10 @@ fn call_once(_1: closure, tupled_args: (u32,)) -> u32 assert(move _5.1 == false) (overflow) else panic _0 = move _5.0 storage_dead(_4) + storage_dead(_5) + storage_dead(y) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -108,6 +113,7 @@ fn silly_incr<'_0>(x: &'_0 mut u32) let _3: &'2 mut u32; // anonymous local let _4: closure; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -119,6 +125,7 @@ fn silly_incr<'_0>(x: &'_0 mut u32) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(x) return } @@ -150,6 +157,7 @@ fn main() let _22: &'36 u32; // anonymous local let _23: u32; // anonymous local + storage_live(_0) storage_live(_20) _0 = () storage_live(x) @@ -162,9 +170,11 @@ fn main() _2 = silly_incr<'27>(move _3) storage_live(_21) storage_live(_22) + storage_live(_22) storage_live(_23) _23 = const 1u32 _22 = &_23 + storage_dead(_23) _21 = move _22 storage_dead(_3) storage_dead(_4) @@ -206,6 +216,16 @@ fn main() _17 = &(*_18) storage_live(_19) _19 = Option::None { } + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) + storage_dead(_15) + storage_dead(_14) + storage_dead(kind) + storage_dead(_22) + storage_dead(_21) panic(core::panicking::assert_failed) } storage_dead(_12) @@ -216,6 +236,16 @@ fn main() storage_dead(_5) _0 = () storage_dead(x) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) + storage_dead(_15) + storage_dead(_14) + storage_dead(kind) + storage_dead(_22) + storage_dead(_21) return } diff --git a/charon/tests/cargo/issue-396-lib-bin.out b/charon/tests/cargo/issue-396-lib-bin.out index 5a905aa09..58a8e6c67 100644 --- a/charon/tests/cargo/issue-396-lib-bin.out +++ b/charon/tests/cargo/issue-396-lib-bin.out @@ -5,6 +5,7 @@ pub fn hello() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -91,6 +92,7 @@ pub fn hello() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -114,6 +116,7 @@ fn main() let _13: [u8; 4usize]; // anonymous local let _14: &'25 [u8; 4usize]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -156,6 +159,8 @@ fn main() storage_dead(args_3) storage_dead(_1) _0 = () + storage_dead(_14) + storage_dead(_13) return } diff --git a/charon/tests/cargo/issue-412-dup-deps.out b/charon/tests/cargo/issue-412-dup-deps.out index 67d55e7fb..3fc99932a 100644 --- a/charon/tests/cargo/issue-412-dup-deps.out +++ b/charon/tests/cargo/issue-412-dup-deps.out @@ -37,6 +37,7 @@ pub fn mydup::hello() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 1u32 return } @@ -45,6 +46,7 @@ pub fn mydup#1::hello() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 2u32 return } @@ -79,6 +81,7 @@ fn main() let _24: &'31 u32; // anonymous local let _25: u32; // anonymous local + storage_live(_0) storage_live(_8) storage_live(_22) _0 = () @@ -97,9 +100,11 @@ fn main() assert(move _8.1 == false) (overflow) else panic storage_live(_23) storage_live(_24) + storage_live(_24) storage_live(_25) _25 = const 3u32 _24 = &_25 + storage_dead(_25) _23 = move _24 _5 = move _8.0 storage_dead(_7) @@ -139,6 +144,17 @@ fn main() _19 = &(*_20) storage_live(_21) _21 = Option::None { } + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) + storage_dead(kind) + storage_dead(_8) + storage_dead(_24) + storage_dead(_23) panic(core::panicking::assert_failed) } storage_dead(_14) @@ -151,6 +167,17 @@ fn main() _0 = () storage_dead(b) storage_dead(a) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) + storage_dead(kind) + storage_dead(_8) + storage_dead(_24) + storage_dead(_23) return } diff --git a/charon/tests/cargo/multi-targets.out b/charon/tests/cargo/multi-targets.out index 23beee5c2..eb285161b 100644 --- a/charon/tests/cargo/multi-targets.out +++ b/charon/tests/cargo/multi-targets.out @@ -7,6 +7,7 @@ pub fn multi_targets::no_os(left: u64, right: u64) -> u64 let _4: u64; // anonymous local let _5: (u64, bool); // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy left @@ -17,6 +18,9 @@ pub fn multi_targets::no_os(left: u64, right: u64) -> u64 _0 = move _5.0 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(right) + storage_dead(left) return } @@ -29,6 +33,7 @@ pub fn multi_targets::on_unix(left: u64, right: u64) -> u64 let _4: u64; // anonymous local let _5: (u64, bool); // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy left @@ -39,6 +44,9 @@ pub fn multi_targets::on_unix(left: u64, right: u64) -> u64 _0 = move _5.0 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(right) + storage_dead(left) return } diff --git a/charon/tests/cargo/toml.out b/charon/tests/cargo/toml.out index 5155335dd..ee1a5853e 100644 --- a/charon/tests/cargo/toml.out +++ b/charon/tests/cargo/toml.out @@ -30,16 +30,19 @@ where let _0: bool; // return let self: &'1 Option[TraitClause0]; // arg #1 + storage_live(_0) _ = (*self) match (*self) { Option::Some => { }, _ => { _0 = const false + storage_dead(self) return }, } _0 = const true + storage_dead(self) return } @@ -56,10 +59,13 @@ pub fn run() storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) _6 = Option::Some { 0: const false } _5 = &_6 + storage_dead(_6) _4 = move _5 + storage_live(_0) storage_live(_3) _0 = () storage_live(_1) @@ -70,6 +76,9 @@ pub fn run() storage_dead(_2) storage_dead(_1) _0 = () + storage_dead(_3) + storage_dead(_5) + storage_dead(_4) return } diff --git a/charon/tests/cargo/unsafe_.out b/charon/tests/cargo/unsafe_.out index c552f00b0..cdd8f3bed 100644 --- a/charon/tests/cargo/unsafe_.out +++ b/charon/tests/cargo/unsafe_.out @@ -19,6 +19,7 @@ fn main() let _1: (); // anonymous local let _2: Arguments<'1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/cargo/workspace.out b/charon/tests/cargo/workspace.out index d07a1ec64..0e668e50d 100644 --- a/charon/tests/cargo/workspace.out +++ b/charon/tests/cargo/workspace.out @@ -5,6 +5,7 @@ pub fn random_number() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 4u32 return } @@ -16,6 +17,7 @@ pub fn extra_random_number() -> u32 let _1: u32; // anonymous local let _2: (u32, bool); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_1) // Even more random. @@ -24,6 +26,7 @@ pub fn extra_random_number() -> u32 assert(move _2.1 == false) (overflow) else panic _0 = move _2.0 storage_dead(_1) + storage_dead(_2) return } diff --git a/charon/tests/crate_data.rs b/charon/tests/crate_data.rs index cd3dc4578..719ac5f3b 100644 --- a/charon/tests/crate_data.rs +++ b/charon/tests/crate_data.rs @@ -681,12 +681,14 @@ fn known_trait_method_call() -> anyhow::Result<()> { "test_crate::use_default" ); let body = &function.body.as_structured().unwrap().body; - let [first_stmt, ..] = body.statements.as_slice() else { - panic!() - }; - let StatementKind::Call(call) = &first_stmt.kind else { - panic!() - }; + let call = body + .statements + .iter() + .find_map(|stmt| match &stmt.kind { + StatementKind::Call(call) => Some(call), + _ => None, + }) + .unwrap(); let FnOperand::Regular(fn_ptr) = &call.func else { panic!() }; diff --git a/charon/tests/ui/advanced-const-generics.out b/charon/tests/ui/advanced-const-generics.out index ca4ae32c6..241e68765 100644 --- a/charon/tests/ui/advanced-const-generics.out +++ b/charon/tests/ui/advanced-const-generics.out @@ -75,8 +75,10 @@ pub fn impl_Eq_for_Foo::assert_fields_are_eq<'_0>(self: &'_0 Foo) let _0: (); // return let self: &'1 Foo; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -93,6 +95,7 @@ pub fn eq<'_0, '_1>(self: &'_0 Foo, other: &'_1 Foo) -> bool let _7: isize; // anonymous local let _8: isize; // anonymous local + storage_live(_0) storage_live(__self_discr) storage_live(_4) _4 = &(*self) @@ -112,6 +115,8 @@ pub fn eq<'_0, '_1>(self: &'_0 Foo, other: &'_1 Foo) -> bool storage_dead(_7) storage_dead(__arg1_discr) storage_dead(__self_discr) + storage_dead(other) + storage_dead(self) return } @@ -153,6 +158,7 @@ pub fn fmt<'_0, '_1, '_2>(self: &'_0 Foo, f: &'_1 mut Formatter<'_2>) -> Result< let _5: &'11 str; // anonymous local let _6: &'12 str; // anonymous local + storage_live(_0) storage_live(_3) _3 = &two-phase-mut (*f) with_metadata(copy f.metadata) storage_live(_4) @@ -173,6 +179,8 @@ pub fn fmt<'_0, '_1, '_2>(self: &'_0 Foo, f: &'_1 mut Formatter<'_2>) -> Result< _0 = core::fmt::{Formatter<'a>}::write_str<'16, '19, '20>(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(f) + storage_dead(self) return } @@ -187,6 +195,7 @@ fn foo() -> Foo { let _0: Foo; // return + storage_live(_0) _0 = const X return } @@ -198,6 +207,7 @@ fn bar() let _1: [(); {const}]; // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/arrays.out b/charon/tests/ui/arrays.out index 05f37f2c2..07bb3a91e 100644 --- a/charon/tests/ui/arrays.out +++ b/charon/tests/ui/arrays.out @@ -86,8 +86,10 @@ where let ret: (); // return let _1: &'_0 mut T; // arg #1 + storage_live(ret) ret = () drop[TraitClause0::drop_glue<'0>] (*_1) + storage_dead(_1) return } @@ -240,6 +242,7 @@ where let _6: &'_ mut [T]; // anonymous local let _7: &'_ mut T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -262,6 +265,13 @@ where continue 0 } } + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) + storage_dead(_7) + storage_dead(_6) return } @@ -283,10 +293,13 @@ where let _1: &'1 mut [T; N]; // arg #1 let _2: &'3 mut [T]; // anonymous local + storage_live(_0) storage_live(_2) _0 = () _2 = @ArrayToSliceMut<'_, T, N>(move _1) _0 = core::ptr::drop_glue<'6, [T]>[impl_Destruct_for_slice[TraitClause0]](move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -312,11 +325,14 @@ pub fn incr<'_0>(x: &'_0 mut u32) let x: &'1 mut u32; // arg #1 let _2: u32; // anonymous local + storage_live(_0) storage_live(_2) _0 = () _2 = copy (*x) panic.+ const 1u32 (*x) = move _2 _0 = () + storage_dead(_2) + storage_dead(x) return } @@ -329,10 +345,12 @@ where let s: &'3 [T; 32usize]; // arg #1 let _2: &'4 [T; 32usize]; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*s) _0 = @ArrayToSliceShared<'_, T, 32usize>(move _2) storage_dead(_2) + storage_dead(s) return } @@ -346,6 +364,7 @@ where let _2: &'4 mut [T]; // anonymous local let _3: &'5 mut [T; 32usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &mut (*s) @@ -353,6 +372,7 @@ where storage_dead(_3) _0 = &mut (*_2) with_metadata(copy _2.metadata) storage_dead(_2) + storage_dead(s) return } @@ -366,6 +386,7 @@ where let _2: &'1 [T]; // anonymous local let _3: &'3 [T; 32usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &s @@ -374,6 +395,7 @@ where _0 = len<'6, T>[TraitClause0](move _2) storage_dead(_2) conditional_drop[impl_Destruct_for_array::drop_glue<'8, T, 32usize>[TraitClause0]] s + storage_dead(s) return } @@ -387,6 +409,7 @@ where let _2: &'3 [T]; // anonymous local let _3: &'4 [T; 32usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &(*s) @@ -394,6 +417,7 @@ where storage_dead(_3) _0 = len<'7, T>[TraitClause0](move _2) storage_dead(_2) + storage_dead(s) return } @@ -406,10 +430,12 @@ where let s: &'1 [T]; // arg #1 let _2: &'2 [T]; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*s) with_metadata(copy s.metadata) _0 = len<'4, T>[TraitClause0](move _2) storage_dead(_2) + storage_dead(s) return } @@ -426,6 +452,7 @@ where let _5: &'_ [T; 32usize]; // anonymous local let _6: &'_ T; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy i @@ -437,6 +464,10 @@ where _0 = &(*_3) storage_dead(_4) storage_dead(_3) + storage_dead(i) + storage_dead(s) + storage_dead(_6) + storage_dead(_5) return } @@ -450,6 +481,7 @@ pub fn index_array_u32(s: [u32; 32usize], i: usize) -> u32 let _4: &'_ [u32; 32usize]; // anonymous local let _5: &'_ u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy i storage_live(_4) @@ -458,6 +490,10 @@ pub fn index_array_u32(s: [u32; 32usize], i: usize) -> u32 _5 = @ArrayIndexShared<'_, u32, 32usize>(move _4, copy _3) _0 = copy (*_5) storage_dead(_3) + storage_dead(i) + storage_dead(s) + storage_dead(_5) + storage_dead(_4) return } @@ -470,6 +506,7 @@ pub fn index_array_copy<'_0>(x: &'_0 [u32; 32usize]) -> u32 let _3: &'_ [u32; 32usize]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -478,6 +515,9 @@ pub fn index_array_copy<'_0>(x: &'_0 [u32; 32usize]) -> u32 _4 = @ArrayIndexShared<'_, u32, 32usize>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -495,6 +535,7 @@ where let _6: &'_ mut [T; 32usize]; // anonymous local let _7: &'_ mut T; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) storage_live(_5) @@ -509,6 +550,10 @@ where storage_dead(_5) storage_dead(_4) storage_dead(_3) + storage_dead(i) + storage_dead(s) + storage_dead(_7) + storage_dead(_6) return } @@ -525,6 +570,7 @@ where let _5: &'_ [T]; // anonymous local let _6: &'_ T; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy i @@ -536,6 +582,10 @@ where _0 = &(*_3) storage_dead(_4) storage_dead(_3) + storage_dead(i) + storage_dead(s) + storage_dead(_6) + storage_dead(_5) return } @@ -553,6 +603,7 @@ where let _6: &'_ mut [T]; // anonymous local let _7: &'_ mut T; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) storage_live(_5) @@ -567,6 +618,10 @@ where storage_dead(_5) storage_dead(_4) storage_dead(_3) + storage_dead(i) + storage_dead(s) + storage_dead(_7) + storage_dead(_6) return } @@ -584,6 +639,7 @@ pub fn slice_subslice_shared_<'_0>(x: &'_0 [u32], y: usize, z: usize) -> &'_0 [u let _8: usize; // anonymous local let _9: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) storage_live(_6) @@ -603,6 +659,9 @@ pub fn slice_subslice_shared_<'_0>(x: &'_0 [u32], y: usize, z: usize) -> &'_0 [u _0 = &(*_4) with_metadata(copy _4.metadata) storage_dead(_5) storage_dead(_4) + storage_dead(z) + storage_dead(y) + storage_dead(x) return } @@ -621,6 +680,7 @@ pub fn slice_subslice_mut_<'_0>(x: &'_0 mut [u32], y: usize, z: usize) -> &'_0 m let _9: usize; // anonymous local let _10: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) storage_live(_6) @@ -643,6 +703,9 @@ pub fn slice_subslice_mut_<'_0>(x: &'_0 mut [u32], y: usize, z: usize) -> &'_0 m storage_dead(_6) storage_dead(_5) storage_dead(_4) + storage_dead(z) + storage_dead(y) + storage_dead(x) return } @@ -653,10 +716,12 @@ pub fn array_to_slice_shared_<'_0>(x: &'_0 [u32; 32usize]) -> &'_0 [u32] let x: &'3 [u32; 32usize]; // arg #1 let _2: &'4 [u32; 32usize]; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = @ArrayToSliceShared<'_, u32, 32usize>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -668,6 +733,7 @@ pub fn array_to_slice_mut_<'_0>(x: &'_0 mut [u32; 32usize]) -> &'_0 mut [u32] let _2: &'4 mut [u32]; // anonymous local let _3: &'5 mut [u32; 32usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &mut (*x) @@ -675,6 +741,7 @@ pub fn array_to_slice_mut_<'_0>(x: &'_0 mut [u32; 32usize]) -> &'_0 mut [u32] storage_dead(_3) _0 = &mut (*_2) with_metadata(copy _2.metadata) storage_dead(_2) + storage_dead(x) return } @@ -692,6 +759,7 @@ pub fn array_subslice_shared_<'_0>(x: &'_0 [u32; 32usize], y: usize, z: usize) - let _8: usize; // anonymous local let _9: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) storage_live(_6) @@ -711,6 +779,9 @@ pub fn array_subslice_shared_<'_0>(x: &'_0 [u32; 32usize], y: usize, z: usize) - _0 = &(*_4) with_metadata(copy _4.metadata) storage_dead(_5) storage_dead(_4) + storage_dead(z) + storage_dead(y) + storage_dead(x) return } @@ -729,6 +800,7 @@ pub fn array_subslice_mut_<'_0>(x: &'_0 mut [u32; 32usize], y: usize, z: usize) let _9: usize; // anonymous local let _10: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) storage_live(_6) @@ -751,6 +823,9 @@ pub fn array_subslice_mut_<'_0>(x: &'_0 mut [u32; 32usize], y: usize, z: usize) storage_dead(_6) storage_dead(_5) storage_dead(_4) + storage_dead(z) + storage_dead(y) + storage_dead(x) return } @@ -766,6 +841,7 @@ where let _4: &'_ [T]; // anonymous local let _5: &'_ T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = const 0usize @@ -777,6 +853,9 @@ where _0 = &(*_2) storage_dead(_3) storage_dead(_2) + storage_dead(s) + storage_dead(_5) + storage_dead(_4) return } @@ -792,6 +871,7 @@ where let _4: &'_ [T; 32usize]; // anonymous local let _5: &'_ T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = const 0usize @@ -803,6 +883,9 @@ where _0 = &(*_2) storage_dead(_3) storage_dead(_2) + storage_dead(s) + storage_dead(_5) + storage_dead(_4) return } @@ -820,6 +903,7 @@ pub fn index_index_array(s: [[u32; 32usize]; 32usize], i: usize, j: usize) -> u3 let _8: &'_ [u32; 32usize]; // anonymous local let _9: &'_ u32; // anonymous local + storage_live(_0) storage_live(_4) _4 = copy i storage_live(_5) @@ -835,6 +919,13 @@ pub fn index_index_array(s: [[u32; 32usize]; 32usize], i: usize, j: usize) -> u3 _0 = copy (*_9) storage_dead(_5) storage_dead(_4) + storage_dead(j) + storage_dead(i) + storage_dead(s) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) return } @@ -852,6 +943,7 @@ pub fn update_update_array(s: [[u32; 32usize]; 32usize], i: usize, j: usize) let _8: &'_ mut [u32; 32usize]; // anonymous local let _9: &'_ mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(_4) _4 = copy i @@ -869,6 +961,13 @@ pub fn update_update_array(s: [[u32; 32usize]; 32usize], i: usize, j: usize) storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(j) + storage_dead(i) + storage_dead(s) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) return } @@ -884,6 +983,7 @@ pub fn incr_array_self<'_0>(s: &'_0 mut [u32; 2usize]) let _6: &'_ mut [u32; 2usize]; // anonymous local let _7: &'_ mut u32; // anonymous local + storage_live(_0) storage_live(_3) _0 = () storage_live(_2) @@ -900,6 +1000,12 @@ pub fn incr_array_self<'_0>(s: &'_0 mut [u32; 2usize]) (*_7) = move _3 storage_dead(_2) _0 = () + storage_dead(_3) + storage_dead(s) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) return } @@ -915,6 +1021,7 @@ pub fn incr_slice_self<'_0>(s: &'_0 mut [u32]) let _6: &'_ mut [u32]; // anonymous local let _7: &'_ mut u32; // anonymous local + storage_live(_0) storage_live(_3) _0 = () storage_live(_2) @@ -931,6 +1038,12 @@ pub fn incr_slice_self<'_0>(s: &'_0 mut [u32]) (*_7) = move _3 storage_dead(_2) _0 = () + storage_dead(_3) + storage_dead(s) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) return } @@ -941,11 +1054,13 @@ pub fn array_local_deep_copy<'_0>(x: &'_0 [u32; 32usize]) let x: &'1 [u32; 32usize]; // arg #1 let _y: [u32; 32usize]; // local + storage_live(_0) _0 = () storage_live(_y) _y = copy (*x) _0 = () storage_dead(_y) + storage_dead(x) return } @@ -955,8 +1070,10 @@ pub fn take_array(_1: [u32; 2usize]) let _0: (); // return let _1: [u32; 2usize]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -966,8 +1083,10 @@ pub fn take_array_borrow<'_0>(_1: &'_0 [u32; 2usize]) let _0: (); // return let _1: &'1 [u32; 2usize]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -977,8 +1096,10 @@ pub fn take_slice<'_0>(_1: &'_0 [u32]) let _0: (); // return let _1: &'1 [u32]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -988,8 +1109,10 @@ pub fn take_mut_slice<'_0>(_1: &'_0 mut [u32]) let _0: (); // return let _1: &'1 mut [u32]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -998,6 +1121,7 @@ pub fn const_array() -> [u32; 2usize] { let _0: [u32; 2usize]; // return + storage_live(_0) _0 = @ArrayRepeat(const 0u32) return } @@ -1016,10 +1140,13 @@ pub fn const_slice() storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = @ArrayRepeat(const 0u32) _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_1) @@ -1033,6 +1160,9 @@ pub fn const_slice() storage_dead(_3) storage_dead(_1) _0 = () + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } @@ -1057,6 +1187,7 @@ pub fn take_all() let _15: &'10 mut [u32; 2usize]; // anonymous local let _16: &'11 mut [u32; 2usize]; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = @ArrayRepeat(const 0u32) @@ -1124,6 +1255,7 @@ pub fn index_array(x: [u32; 2usize]) -> u32 let _3: &'_ [u32; 2usize]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -1132,6 +1264,9 @@ pub fn index_array(x: [u32; 2usize]) -> u32 _4 = @ArrayIndexShared<'_, u32, 2usize>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1144,6 +1279,7 @@ pub fn index_array_borrow<'_0>(x: &'_0 [u32; 2usize]) -> u32 let _3: &'_ [u32; 2usize]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -1152,6 +1288,9 @@ pub fn index_array_borrow<'_0>(x: &'_0 [u32; 2usize]) -> u32 _4 = @ArrayIndexShared<'_, u32, 2usize>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1164,6 +1303,7 @@ pub fn index_slice_u32_0<'_0>(x: &'_0 [u32]) -> u32 let _3: &'_ [u32]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -1172,6 +1312,9 @@ pub fn index_slice_u32_0<'_0>(x: &'_0 [u32]) -> u32 _4 = @SliceIndexShared<'_, u32>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1184,6 +1327,7 @@ pub fn index_mut_slice_u32_0<'_0>(x: &'_0 mut [u32]) -> u32 let _3: &'_ [u32]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -1192,6 +1336,9 @@ pub fn index_mut_slice_u32_0<'_0>(x: &'_0 mut [u32]) -> u32 _4 = @SliceIndexShared<'_, u32>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1226,6 +1373,7 @@ pub fn index_all() -> u32 let _25: &'11 mut [u32; 2usize]; // anonymous local let _26: u32; // anonymous local + storage_live(_0) storage_live(_12) storage_live(_16) storage_live(_21) @@ -1304,6 +1452,10 @@ pub fn index_all() -> u32 storage_dead(_25) storage_dead(_20) storage_dead(_15) + storage_dead(_26) + storage_dead(_21) + storage_dead(_16) + storage_dead(_12) return } @@ -1316,6 +1468,7 @@ pub fn update_array(x: [u32; 2usize]) let _3: &'_ mut [u32; 2usize]; // anonymous local let _4: &'_ mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = const 0usize @@ -1326,6 +1479,9 @@ pub fn update_array(x: [u32; 2usize]) (*_4) = const 1u32 _0 = () storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1338,6 +1494,7 @@ pub fn update_array_mut_borrow<'_0>(x: &'_0 mut [u32; 2usize]) let _3: &'_ mut [u32; 2usize]; // anonymous local let _4: &'_ mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = const 0usize @@ -1348,6 +1505,9 @@ pub fn update_array_mut_borrow<'_0>(x: &'_0 mut [u32; 2usize]) (*_4) = const 1u32 _0 = () storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1360,6 +1520,7 @@ pub fn update_mut_slice<'_0>(x: &'_0 mut [u32]) let _3: &'_ mut [u32]; // anonymous local let _4: &'_ mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = const 0usize @@ -1370,6 +1531,9 @@ pub fn update_mut_slice<'_0>(x: &'_0 mut [u32]) (*_4) = const 1u32 _0 = () storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1390,6 +1554,7 @@ pub fn update_all() let _11: &'5 mut [u32; 2usize]; // anonymous local let _12: &'6 mut [u32; 2usize]; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = @ArrayRepeat(const 0u32) @@ -1443,6 +1608,7 @@ pub fn range_all() let _6: &'5 mut [u32; 4usize]; // anonymous local let _7: Range[{built_in impl Sized for usize}]; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = @ArrayRepeat(const 0u32) @@ -1480,6 +1646,7 @@ pub fn deref_array_borrow<'_0>(x_1: &'_0 [u32; 2usize]) -> u32 let _4: &'_ [u32; 2usize]; // anonymous local let _5: &'_ u32; // anonymous local + storage_live(_0) storage_live(x_2) x_2 = copy (*x_1) storage_live(_3) @@ -1491,6 +1658,9 @@ pub fn deref_array_borrow<'_0>(x_1: &'_0 [u32; 2usize]) -> u32 _0 = copy (*_5) storage_dead(x_2) storage_dead(_3) + storage_dead(x_1) + storage_dead(_5) + storage_dead(_4) return } @@ -1504,6 +1674,7 @@ pub fn deref_array_mut_borrow<'_0>(x_1: &'_0 mut [u32; 2usize]) -> u32 let _4: &'_ [u32; 2usize]; // anonymous local let _5: &'_ u32; // anonymous local + storage_live(_0) storage_live(x_2) x_2 = copy (*x_1) storage_live(_3) @@ -1515,6 +1686,9 @@ pub fn deref_array_mut_borrow<'_0>(x_1: &'_0 mut [u32; 2usize]) -> u32 _0 = copy (*_5) storage_dead(x_2) storage_dead(_3) + storage_dead(x_1) + storage_dead(_5) + storage_dead(_4) return } @@ -1524,8 +1698,10 @@ pub fn take_array_t(_1: [AB; 2usize]) let _0: (); // return let _1: [AB; 2usize]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -1539,6 +1715,7 @@ pub fn non_copyable_array() let _4: (); // anonymous local let _5: [AB; 2usize]; // anonymous local + storage_live(_0) _0 = () storage_live(x) storage_live(_2) @@ -1581,6 +1758,7 @@ pub fn sum<'_0>(s: &'_0 [u32]) -> u32 let _12: &'_ [u32]; // anonymous local let _13: &'_ u32; // anonymous local + storage_live(_0) storage_live(_10) storage_live(_11) storage_live(sum) @@ -1626,6 +1804,11 @@ pub fn sum<'_0>(s: &'_0 [u32]) -> u32 _0 = copy sum storage_dead(i) storage_dead(sum) + storage_dead(_11) + storage_dead(_10) + storage_dead(s) + storage_dead(_13) + storage_dead(_12) return } @@ -1659,6 +1842,7 @@ pub fn sum2<'_0, '_1>(s: &'_0 [u32], s2: &'_1 [u32]) -> u32 let _24: &'_ [u32]; // anonymous local let _25: &'_ u32; // anonymous local + storage_live(_0) storage_live(_19) storage_live(_20) storage_live(_21) @@ -1680,6 +1864,15 @@ pub fn sum2<'_0, '_1>(s: &'_0 [u32], s2: &'_1 [u32]) -> u32 } else { storage_dead(_7) storage_dead(_5) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(s2) + storage_dead(s) + storage_dead(_25) + storage_dead(_24) + storage_dead(_23) + storage_dead(_22) panic(core::panicking::panic) } storage_dead(_7) @@ -1740,6 +1933,15 @@ pub fn sum2<'_0, '_1>(s: &'_0 [u32], s2: &'_1 [u32]) -> u32 _0 = copy sum storage_dead(i) storage_dead(sum) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(s2) + storage_dead(s) + storage_dead(_25) + storage_dead(_24) + storage_dead(_23) + storage_dead(_22) return } @@ -1755,6 +1957,7 @@ pub fn f0() let _6: &'_ mut [u32]; // anonymous local let _7: &'_ mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(s) storage_live(_2) @@ -1777,6 +1980,8 @@ pub fn f0() _0 = () storage_dead(_4) storage_dead(s) + storage_dead(_7) + storage_dead(_6) return } @@ -1789,6 +1994,7 @@ pub fn f1() let _3: &'_ mut [u32; 2usize]; // anonymous local let _4: &'_ mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(s) s = [const 1u32, const 2u32] @@ -1802,6 +2008,8 @@ pub fn f1() storage_dead(_2) _0 = () storage_dead(s) + storage_dead(_4) + storage_dead(_3) return } @@ -1811,8 +2019,10 @@ pub fn f2(_1: u32) let _0: (); // return let _1: u32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -1830,6 +2040,7 @@ pub fn f4<'_0>(x: &'_0 [u32; 32usize], y: usize, z: usize) -> &'_0 [u32] let _8: usize; // anonymous local let _9: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) storage_live(_6) @@ -1849,6 +2060,9 @@ pub fn f4<'_0>(x: &'_0 [u32; 32usize], y: usize, z: usize) -> &'_0 [u32] _0 = &(*_4) with_metadata(copy _4.metadata) storage_dead(_5) storage_dead(_4) + storage_dead(z) + storage_dead(y) + storage_dead(x) return } @@ -1871,6 +2085,7 @@ pub fn f3() -> u32 let _13: &'_ [u32; 2usize]; // anonymous local let _14: &'_ u32; // anonymous local + storage_live(_0) storage_live(a) a = [const 1u32, const 2u32] storage_live(_2) @@ -1912,6 +2127,8 @@ pub fn f3() -> u32 storage_dead(_12) storage_dead(_10) storage_dead(_8) + storage_dead(_14) + storage_dead(_13) return } @@ -1920,6 +2137,7 @@ pub fn SZ() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 32usize return } @@ -1936,6 +2154,7 @@ pub fn f5<'_0>(x: &'_0 [u32; 32usize]) -> u32 let _3: &'_ [u32; 32usize]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -1944,6 +2163,9 @@ pub fn f5<'_0>(x: &'_0 [u32; 32usize]) -> u32 _4 = @ArrayIndexShared<'_, u32, 32usize>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -1963,6 +2185,7 @@ pub fn ite() let _10: &'6 mut [u32; 2usize]; // anonymous local let _11: &'7 mut [u32; 2usize]; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = @ArrayRepeat(const 0u32) @@ -2024,6 +2247,7 @@ pub fn zero_slice<'_0>(a: &'_0 mut [u8]) let _10: &'_ mut [u8]; // anonymous local let _11: &'_ mut u8; // anonymous local + storage_live(_0) storage_live(_9) _0 = () storage_live(i) @@ -2065,6 +2289,10 @@ pub fn zero_slice<'_0>(a: &'_0 mut [u8]) storage_dead(_5) storage_dead(len) storage_dead(i) + storage_dead(_9) + storage_dead(a) + storage_dead(_11) + storage_dead(_10) return } @@ -2081,6 +2309,7 @@ pub fn iter_mut_slice<'_0>(a: &'_0 mut [u8]) let _7: usize; // anonymous local let _8: usize; // anonymous local + storage_live(_0) storage_live(_8) _0 = () storage_live(len) @@ -2114,6 +2343,8 @@ pub fn iter_mut_slice<'_0>(a: &'_0 mut [u8]) storage_dead(_5) storage_dead(i) storage_dead(len) + storage_dead(_8) + storage_dead(a) return } @@ -2135,6 +2366,7 @@ pub fn sum_mut_slice<'_0>(a: &'_0 mut [u32]) -> u32 let _12: &'_ [u32]; // anonymous local let _13: &'_ u32; // anonymous local + storage_live(_0) storage_live(_10) storage_live(_11) storage_live(i) @@ -2180,6 +2412,11 @@ pub fn sum_mut_slice<'_0>(a: &'_0 mut [u32]) -> u32 _0 = copy s storage_dead(s) storage_dead(i) + storage_dead(_11) + storage_dead(_10) + storage_dead(a) + storage_dead(_13) + storage_dead(_12) return } @@ -2192,6 +2429,7 @@ fn slice_pattern_1(x: [(); 1usize]) let _3: &'_ [(); 1usize]; // anonymous local let _4: &'_ (); // anonymous local + storage_live(_0) _0 = () storage_live(_named) storage_live(_3) @@ -2201,6 +2439,9 @@ fn slice_pattern_1(x: [(); 1usize]) _named = copy (*_4) _0 = () storage_dead(_named) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -2221,6 +2462,7 @@ where let _9: &'_ mut [&'2 mut T; 3usize]; // anonymous local let _10: &'_ mut &'2 mut T; // anonymous local + storage_live(_0) _0 = () storage_live(_a) storage_live(_5) @@ -2244,6 +2486,13 @@ where storage_dead(_c) storage_dead(_b) storage_dead(_a) + storage_dead(x) + storage_dead(_10) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) return } @@ -2256,6 +2505,7 @@ fn slice_pattern_3<'_0>(x: &'_0 [(); 1usize]) let _3: &'_ [(); 1usize]; // anonymous local let _4: &'_ (); // anonymous local + storage_live(_0) _0 = () storage_live(_named) storage_live(_3) @@ -2265,6 +2515,9 @@ fn slice_pattern_3<'_0>(x: &'_0 [(); 1usize]) _named = &(*_4) _0 = () storage_dead(_named) + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -2281,6 +2534,7 @@ fn slice_pattern_4<'_0>(x: &'_0 [()]) let _7: &'_ [()]; // anonymous local let _8: &'_ (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -2293,6 +2547,13 @@ fn slice_pattern_4<'_0>(x: &'_0 [()]) if move _5 { } else { _0 = () + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_8) + storage_dead(_7) return } storage_live(_named) @@ -2303,6 +2564,13 @@ fn slice_pattern_4<'_0>(x: &'_0 [()]) _named = &(*_8) _0 = () storage_dead(_named) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/arrays_const_generics.out b/charon/tests/ui/arrays_const_generics.out index c8c72146b..d13b5e94e 100644 --- a/charon/tests/ui/arrays_const_generics.out +++ b/charon/tests/ui/arrays_const_generics.out @@ -10,6 +10,7 @@ pub fn index_array_generic(s: [u32; N], i: usize) -> u32 let _4: &'_ [u32; N]; // anonymous local let _5: &'_ u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy i storage_live(_4) @@ -18,6 +19,10 @@ pub fn index_array_generic(s: [u32; N], i: usize) -> u32 _5 = @ArrayIndexShared<'_, u32, N>(move _4, copy _3) _0 = copy (*_5) storage_dead(_3) + storage_dead(i) + storage_dead(s) + storage_dead(_5) + storage_dead(_4) return } @@ -30,6 +35,7 @@ pub fn index_array_generic_call(s: [u32; N], i: usize) -> u32 let _3: [u32; N]; // anonymous local let _4: usize; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy s storage_live(_4) @@ -37,6 +43,8 @@ pub fn index_array_generic_call(s: [u32; N], i: usize) -> u32 _0 = index_array_generic(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(i) + storage_dead(s) return } @@ -45,6 +53,7 @@ pub fn const_gen_ret() -> usize { let _0: usize; // return + storage_live(_0) _0 = const N return } @@ -54,6 +63,7 @@ pub fn init_array_variable_len() -> [u8; LEN] { let _0: [u8; LEN]; // return + storage_live(_0) _0 = @ArrayRepeat(const 0u8) return } diff --git a/charon/tests/ui/assert-kinds-reconstruct-fallible.out b/charon/tests/ui/assert-kinds-reconstruct-fallible.out index a90e80a03..e9f918b6e 100644 --- a/charon/tests/ui/assert-kinds-reconstruct-fallible.out +++ b/charon/tests/ui/assert-kinds-reconstruct-fallible.out @@ -15,6 +15,7 @@ fn main() let _9: i32; // anonymous local bb0: { + storage_live(_0); storage_live(_4); _0 = (); storage_live(_1); @@ -44,6 +45,7 @@ fn main() storage_dead(_9); _0 = (); storage_dead(x); + storage_dead(_4); return; } } diff --git a/charon/tests/ui/assert-kinds.out b/charon/tests/ui/assert-kinds.out index 2a3a23b47..26dbf0e05 100644 --- a/charon/tests/ui/assert-kinds.out +++ b/charon/tests/ui/assert-kinds.out @@ -25,6 +25,7 @@ fn main() let _19: bool; // anonymous local bb0: { + storage_live(_0); storage_live(_3); storage_live(_5); storage_live(_9); @@ -46,6 +47,17 @@ fn main() } bb1: { + storage_dead(_19); + storage_dead(_18); + storage_dead(_17); + storage_dead(_16); + storage_dead(_14); + storage_dead(_13); + storage_dead(_12); + storage_dead(_11); + storage_dead(_9); + storage_dead(_5); + storage_dead(_3); unwind_continue; } @@ -106,6 +118,17 @@ fn main() storage_dead(_15); _0 = (); storage_dead(x); + storage_dead(_19); + storage_dead(_18); + storage_dead(_17); + storage_dead(_16); + storage_dead(_14); + storage_dead(_13); + storage_dead(_12); + storage_dead(_11); + storage_dead(_9); + storage_dead(_5); + storage_dead(_3); return; } } diff --git a/charon/tests/ui/assoc-const-with-generics.out b/charon/tests/ui/assoc-const-with-generics.out index e7835251f..55bfcc206 100644 --- a/charon/tests/ui/assoc-const-with-generics.out +++ b/charon/tests/ui/assoc-const-with-generics.out @@ -26,6 +26,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const N return } @@ -48,6 +49,7 @@ fn {impl HasLen for [(); N]}::LEN() -> usize { let _0: usize; // return + storage_live(_0) _0 = const N return } @@ -68,9 +70,11 @@ fn {impl HasLen for [bool; N]}::LEN() -> usize let _0: usize; // return let _1: usize; // anonymous local + storage_live(_0) storage_live(_1) _1 = const N panic.+ const 1usize _0 = move _1 + storage_dead(_1) return } @@ -100,6 +104,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const TraitClause1::LEN return } @@ -136,6 +141,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const M return } @@ -158,6 +164,7 @@ pub fn {impl HasDefaultLen for [bool; N]}::LEN() -> usize let _0: usize; // return let _1: bool; // anonymous local + storage_live(_0) storage_live(_1) _1 = const true if move _1 { @@ -198,9 +205,11 @@ where let _0: usize; // return let _1: usize; // anonymous local + storage_live(_0) storage_live(_1) _1 = const TraitClause0::ImpliedClause1::LEN panic.+ const 1usize _0 = move _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty-nested.out b/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty-nested.out index 9dee3ccb2..14d8428ab 100644 --- a/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty-nested.out +++ b/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty-nested.out @@ -47,6 +47,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.2.out b/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.2.out index 3ce43e0b9..bd039bc85 100644 --- a/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.2.out +++ b/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.2.out @@ -38,6 +38,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.out b/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.out index 233fe9dd5..dfad7b00e 100644 --- a/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.out +++ b/charon/tests/ui/associated_types/assoc-constraint-on-assoc-ty.out @@ -37,9 +37,11 @@ where let _0: (); // return let it: I; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for I}::drop_glue<'0>] it + storage_dead(it) return } @@ -62,12 +64,14 @@ where let it: Clause1_IntoIter; // arg #1 let _2: Clause1_IntoIter; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = move it _0 = takes_trait[TraitClause1::ImpliedClause1, TraitClause1::ImpliedClause2](move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for Clause1_IntoIter}::drop_glue<'1>] it + storage_dead(it) return } diff --git a/charon/tests/ui/associated_types/assoc-ty-bound-refers-to-assoc-ty.out b/charon/tests/ui/associated_types/assoc-ty-bound-refers-to-assoc-ty.out index c87f965f0..5e861bac4 100644 --- a/charon/tests/ui/associated_types/assoc-ty-bound-refers-to-assoc-ty.out +++ b/charon/tests/ui/associated_types/assoc-ty-bound-refers-to-assoc-ty.out @@ -54,9 +54,11 @@ where let _0: (); // return let it: I; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for I}::drop_glue<'0>] it + storage_dead(it) return } @@ -81,6 +83,7 @@ where let _2: (); // anonymous local let _3: Clause1_IntoIter; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -90,6 +93,7 @@ where storage_dead(_2) _0 = () conditional_drop[{built_in impl Destruct for Clause1_IntoIter}::drop_glue<'1>] it + storage_dead(it) return } diff --git a/charon/tests/ui/associated_types/assoc-ty-via-supertrait-and-bounds.out b/charon/tests/ui/associated_types/assoc-ty-via-supertrait-and-bounds.out index 9e4d2c447..c06e02330 100644 --- a/charon/tests/ui/associated_types/assoc-ty-via-supertrait-and-bounds.out +++ b/charon/tests/ui/associated_types/assoc-ty-via-supertrait-and-bounds.out @@ -80,6 +80,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -90,6 +91,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = take[{built_in impl Sized for ()}], ()>[{built_in impl Sized for Wrapper<()>[{built_in impl Sized for ()}]}, impl_HasOutput2_for_Wrapper<(), ()>[{built_in impl Sized for ()}, impl_HasOutput2_for_unit]]() return diff --git a/charon/tests/ui/associated_types/assoc-type-with-fn-bound.out b/charon/tests/ui/associated_types/assoc-type-with-fn-bound.out index 87bf15b7d..13ed9e17a 100644 --- a/charon/tests/ui/associated_types/assoc-type-with-fn-bound.out +++ b/charon/tests/ui/associated_types/assoc-type-with-fn-bound.out @@ -77,6 +77,7 @@ where let _2: &'2 F; // anonymous local let _3: (); // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &(*self) @@ -85,6 +86,7 @@ where _0 = TraitClause0::call<'3>(move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(self) return } @@ -106,6 +108,7 @@ pub fn use_foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/associated_types/associated-types.out b/charon/tests/ui/associated_types/associated-types.out index de3744914..cfbd9910e 100644 --- a/charon/tests/ui/associated_types/associated-types.out +++ b/charon/tests/ui/associated_types/associated-types.out @@ -140,7 +140,9 @@ where let _0: Clause0_Item; // return let x: Clause0_Item; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -152,7 +154,9 @@ where let _0: Option<&'6 T>[{built_in impl Sized for &'6 T}]; // return let x: Option<&'9 T>[{built_in impl Sized for &'9 T}]; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -165,7 +169,9 @@ where let _0: Option<&'a T>[{built_in impl Sized for &'a T}]; // return let x: Option<&'a T>[{built_in impl Sized for &'a T}]; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -193,7 +199,9 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -208,7 +216,9 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -241,6 +251,7 @@ where let _3: Clause1_Item; // anonymous local let _4: Clause1_Item; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -251,6 +262,7 @@ where _0 = TraitClause2::ImpliedClause1::ImpliedClause1::clone<'17>(move _2) storage_dead(_2) storage_dead(_3) + storage_dead(x) return } @@ -261,6 +273,7 @@ fn call_fn() let _1: Option<&'6 bool>[{built_in impl Sized for &'6 bool}]; // anonymous local let _2: Option<&'9 bool>[{built_in impl Sized for &'9 bool}]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -283,8 +296,10 @@ where let _0: Clause2_Item; // return let x: Clause2_Item; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl Destruct for Clause2_Item}::drop_glue<'5>] x + storage_dead(x) return } diff --git a/charon/tests/ui/associated_types/closure-inside-impl-with-bound-with-assoc-ty.out b/charon/tests/ui/associated_types/closure-inside-impl-with-bound-with-assoc-ty.out index 0c74cf860..74f1dc23a 100644 --- a/charon/tests/ui/associated_types/closure-inside-impl-with-bound-with-assoc-ty.out +++ b/charon/tests/ui/associated_types/closure-inside-impl-with-bound-with-assoc-ty.out @@ -96,6 +96,7 @@ where let _0: (); // return let _closure: closure[TraitClause0, TraitClause1]; // local + storage_live(_0) _0 = () storage_live(_closure) _closure = closure { } @@ -113,7 +114,9 @@ where let _0: (); // return let _1: &'1 mut closure[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -128,10 +131,14 @@ where let tupled_args: ((),); // arg #2 let _x: (); // local + storage_live(_0) storage_live(_x) _0 = () _x = move tupled_args.0 _0 = () + storage_dead(_x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -146,10 +153,14 @@ where let args: ((),); // arg #2 let _3: &'0 closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = call<'2, F, Clause1_Repr>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -164,11 +175,15 @@ where let _2: ((),); // arg #2 let _3: &'1 mut closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'2, F, Clause1_Repr>[TraitClause0, TraitClause1](move _3, move _2) drop[drop_glue<'4, F, Clause1_Repr>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/associated_types/dictionary_passing_style_woes.out b/charon/tests/ui/associated_types/dictionary_passing_style_woes.out index 1b9a282bb..c104aebc7 100644 --- a/charon/tests/ui/associated_types/dictionary_passing_style_woes.out +++ b/charon/tests/ui/associated_types/dictionary_passing_style_woes.out @@ -78,8 +78,10 @@ where let _0: Clause1_Item; // return let t: Clause1_Item; // arg #1 + storage_live(_0) _0 = move t conditional_drop[{built_in impl Destruct for Clause1_Item}::drop_glue<'0>] t + storage_dead(t) return } @@ -94,11 +96,13 @@ where let t: Clause1_Item; // arg #1 let _2: Clause1_Item; // anonymous local + storage_live(_0) storage_live(_2) _2 = move t _0 = callee[TraitClause0, TraitClause1](move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for Clause1_Item}::drop_glue<'1>] t + storage_dead(t) return } @@ -137,11 +141,13 @@ where let x: T; // arg #1 let _2: &'1 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &x _0 = TraitClause1::ImpliedClause1::method<'2>(move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'4>] x + storage_dead(x) return } @@ -155,11 +161,13 @@ where let x: T; // arg #1 let _2: &'1 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &x _0 = TraitClause1::ImpliedClause1::method<'2>(move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'4>] x + storage_dead(x) return } @@ -178,6 +186,7 @@ where let _4: Clause1_Clause1_Assoc; // anonymous local let _5: T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy x @@ -193,6 +202,7 @@ where storage_dead(_4) conditional_drop[{built_in impl Destruct for Clause1_Clause1_Assoc}::drop_glue<'2>] _2 storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/associated_types/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out b/charon/tests/ui/associated_types/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out index 8a83f7c0d..0140f9572 100644 --- a/charon/tests/ui/associated_types/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out +++ b/charon/tests/ui/associated_types/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out @@ -45,6 +45,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -58,6 +59,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/associated_types/issue-1068-double-visit.out b/charon/tests/ui/associated_types/issue-1068-double-visit.out index 98b64b6e0..e6ca4a0a2 100644 --- a/charon/tests/ui/associated_types/issue-1068-double-visit.out +++ b/charon/tests/ui/associated_types/issue-1068-double-visit.out @@ -84,6 +84,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -94,6 +95,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = check[{built_in impl Sized for Witness1}, impl_HasType1_for_Witness1]>[{built_in impl Sized for Witness2}, impl_HasType3_for_T[{built_in impl Sized for Witness1}, impl_HasType1_for_Witness1]>[{built_in impl Sized for Witness2}, impl_HasType2_for_Witness2]]() return diff --git a/charon/tests/ui/associated_types/issue-1260-self-ref-assoc-const.out b/charon/tests/ui/associated_types/issue-1260-self-ref-assoc-const.out index 9f24249ee..4c0335b37 100644 --- a/charon/tests/ui/associated_types/issue-1260-self-ref-assoc-const.out +++ b/charon/tests/ui/associated_types/issue-1260-self-ref-assoc-const.out @@ -50,6 +50,7 @@ where let _0: (); // return let _1: TraitClause1::Sub; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const TraitClause1::ImpliedClause2::ImpliedClause1::ZERO diff --git a/charon/tests/ui/associated_types/issue-968-default-assoc-const.out b/charon/tests/ui/associated_types/issue-968-default-assoc-const.out index 69e10f3c9..93785a279 100644 --- a/charon/tests/ui/associated_types/issue-968-default-assoc-const.out +++ b/charon/tests/ui/associated_types/issue-968-default-assoc-const.out @@ -35,6 +35,7 @@ pub fn LEN2() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 32usize return } diff --git a/charon/tests/ui/associated_types/iter-empty.out b/charon/tests/ui/associated_types/iter-empty.out index daad9a64b..111605c73 100644 --- a/charon/tests/ui/associated_types/iter-empty.out +++ b/charon/tests/ui/associated_types/iter-empty.out @@ -60,9 +60,12 @@ where let self: &'1 mut Self; // arg #1 let _f: F; // arg #2 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for F}::drop_glue<'2>] _f + storage_dead(_f) + storage_dead(self) return } @@ -86,9 +89,12 @@ where let self: &'1 mut Empty[TraitClause0]; // arg #1 let _f: F; // arg #2 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for F}::drop_glue<'2>] _f + storage_dead(_f) + storage_dead(self) return } @@ -113,6 +119,7 @@ fn g() let _4: [(); 0usize]; // anonymous local let _5: F; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/associated_types/mem-discriminant-from-derive.out b/charon/tests/ui/associated_types/mem-discriminant-from-derive.out index 00af7f589..bd39beda3 100644 --- a/charon/tests/ui/associated_types/mem-discriminant-from-derive.out +++ b/charon/tests/ui/associated_types/mem-discriminant-from-derive.out @@ -69,6 +69,7 @@ pub fn impl_PartialEq_Enum_for_Enum::eq<'_0, '_1>(self: &'_0 Enum, other: &'_1 E let _15: &'16 &'17 u8; // anonymous local let _16: &'18 &'19 u8; // anonymous local + storage_live(_0) storage_live(__self_discr) storage_live(_4) _4 = &(*self) @@ -93,6 +94,8 @@ pub fn impl_PartialEq_Enum_for_Enum::eq<'_0, '_1>(self: &'_0 Enum, other: &'_1 E storage_dead(_7) storage_dead(__arg1_discr) storage_dead(__self_discr) + storage_dead(other) + storage_dead(self) return } storage_dead(_9) @@ -136,6 +139,8 @@ pub fn impl_PartialEq_Enum_for_Enum::eq<'_0, '_1>(self: &'_0 Enum, other: &'_1 E storage_dead(_7) storage_dead(__arg1_discr) storage_dead(__self_discr) + storage_dead(other) + storage_dead(self) return } diff --git a/charon/tests/ui/associated_types/method-with-assoc-type-constraint.out b/charon/tests/ui/associated_types/method-with-assoc-type-constraint.out index 391d613cc..429e726a1 100644 --- a/charon/tests/ui/associated_types/method-with-assoc-type-constraint.out +++ b/charon/tests/ui/associated_types/method-with-assoc-type-constraint.out @@ -46,9 +46,11 @@ where let _0: (); // return let iter: I; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for I}::drop_glue<'0>] iter + storage_dead(iter) return } diff --git a/charon/tests/ui/associated_types/pointee_metadata.out b/charon/tests/ui/associated_types/pointee_metadata.out index ba618bb2c..e6851df58 100644 --- a/charon/tests/ui/associated_types/pointee_metadata.out +++ b/charon/tests/ui/associated_types/pointee_metadata.out @@ -151,10 +151,13 @@ fn empty_metadata() storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = const 0u32 _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_1) @@ -168,6 +171,9 @@ fn empty_metadata() storage_dead(_3) storage_dead(_1) _0 = () + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } @@ -186,10 +192,13 @@ fn slice_metadata() storage_live(_6) storage_live(_7) + storage_live(_7) storage_live(_8) _8 = [const 0u32, const 1u32] _7 = &_8 + storage_dead(_8) _6 = move _7 + storage_live(_0) storage_live(_5) _0 = () storage_live(_1) @@ -206,6 +215,9 @@ fn slice_metadata() storage_dead(_4) storage_dead(_1) _0 = () + storage_dead(_5) + storage_dead(_7) + storage_dead(_6) return } diff --git a/charon/tests/ui/associated_types/quantified-trait-type-constraint.out b/charon/tests/ui/associated_types/quantified-trait-type-constraint.out index 3a687dc21..67e008a29 100644 --- a/charon/tests/ui/associated_types/quantified-trait-type-constraint.out +++ b/charon/tests/ui/associated_types/quantified-trait-type-constraint.out @@ -28,6 +28,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/associated_types/supertrait-item-bound-has-assoc-ty.out b/charon/tests/ui/associated_types/supertrait-item-bound-has-assoc-ty.out index bdbdbf565..97519528a 100644 --- a/charon/tests/ui/associated_types/supertrait-item-bound-has-assoc-ty.out +++ b/charon/tests/ui/associated_types/supertrait-item-bound-has-assoc-ty.out @@ -59,7 +59,9 @@ pub fn convert(x: u32) -> u32 let _0: u32; // return let x: u32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } diff --git a/charon/tests/ui/bitwise.out b/charon/tests/ui/bitwise.out index e2d7511b6..9083509ef 100644 --- a/charon/tests/ui/bitwise.out +++ b/charon/tests/ui/bitwise.out @@ -11,6 +11,7 @@ pub fn shift_u32(a: u32) -> u32 let _5: usize; // anonymous local let _6: usize; // anonymous local + storage_live(_0) storage_live(i) i = const 16usize storage_live(t) @@ -28,6 +29,7 @@ pub fn shift_u32(a: u32) -> u32 _0 = copy t storage_dead(t) storage_dead(i) + storage_dead(a) return } @@ -42,6 +44,7 @@ pub fn shift_i32(a: i32) -> i32 let _5: isize; // anonymous local let _6: isize; // anonymous local + storage_live(_0) storage_live(i) i = const 16isize storage_live(t) @@ -59,6 +62,7 @@ pub fn shift_i32(a: i32) -> i32 _0 = copy t storage_dead(t) storage_dead(i) + storage_dead(a) return } @@ -71,6 +75,7 @@ pub fn xor_u32(a: u32, b: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy a storage_live(_4) @@ -78,6 +83,8 @@ pub fn xor_u32(a: u32, b: u32) -> u32 _0 = move _3 ^ move _4 storage_dead(_4) storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -90,6 +97,7 @@ pub fn or_u32(a: u32, b: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy a storage_live(_4) @@ -97,6 +105,8 @@ pub fn or_u32(a: u32, b: u32) -> u32 _0 = move _3 | move _4 storage_dead(_4) storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -109,6 +119,7 @@ pub fn and_u32(a: u32, b: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy a storage_live(_4) @@ -116,6 +127,8 @@ pub fn and_u32(a: u32, b: u32) -> u32 _0 = move _3 & move _4 storage_dead(_4) storage_dead(_3) + storage_dead(b) + storage_dead(a) return } diff --git a/charon/tests/ui/call-to-known-trait-method.out b/charon/tests/ui/call-to-known-trait-method.out index 3a10b1a92..cd39637bc 100644 --- a/charon/tests/ui/call-to-known-trait-method.out +++ b/charon/tests/ui/call-to-known-trait-method.out @@ -99,6 +99,7 @@ where let _0: Struct[TraitClause0]; // return let _1: A; // anonymous local + storage_live(_0) storage_live(_1) _1 = TraitClause1::default() _0 = Struct { 0: move _1 } @@ -139,6 +140,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -167,6 +169,7 @@ fn main() let _y: Struct[{built_in impl Sized for bool}]; // local let _3: (); // anonymous local + storage_live(_0) _0 = () storage_live(_x) _x = (const 0u8, const false) diff --git a/charon/tests/ui/closure-as-fn.out b/charon/tests/ui/closure-as-fn.out index c57678676..6eb37510f 100644 --- a/charon/tests/ui/closure-as-fn.out +++ b/charon/tests/ui/closure-as-fn.out @@ -74,7 +74,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -86,11 +88,14 @@ fn call<'_0>(_1: &'_0 closure, tupled_args: ()) let tupled_args: (); // arg #2 let _3: i32; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = const 1i32 panic./ const 0i32 storage_dead(_3) _0 = () + storage_dead(tupled_args) + storage_dead(_1) return } @@ -102,10 +107,14 @@ fn call_mut<'_0>(state: &'_0 mut closure, args: ()) let args: (); // arg #2 let _3: &'0 closure; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -117,11 +126,15 @@ fn call_once(_1: closure, _2: ()) let _2: (); // arg #2 let _3: &'1 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'2>(move _3, move _2) drop[drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -132,12 +145,15 @@ fn as_fn() let args: (); // local let state: closure; // local + storage_live(_0) _0 = () storage_live(args) storage_live(state) args = () state = closure { } _0 = call_once(move state, move args) + storage_dead(state) + storage_dead(args) return } @@ -150,6 +166,7 @@ fn main() let _3: (); // anonymous local let _4: fn(); // anonymous local + storage_live(_0) _0 = () storage_live(f) storage_live(_2) diff --git a/charon/tests/ui/closures.out b/charon/tests/ui/closures.out index 3217a24dc..4f9baa2d7 100644 --- a/charon/tests/ui/closures.out +++ b/charon/tests/ui/closures.out @@ -118,8 +118,10 @@ unsafe fn impl_Destruct_for_tuple::drop_glue<'_0, A>(_1: &'_0 mut (A,)) let _0: (); // return let _1: &'1 mut (A,); // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for A}::drop_glue<'2>] (*_1).0 + storage_dead(_1) return } @@ -137,12 +139,15 @@ pub fn incr_u32(x: u32) -> u32 let _2: u32; // anonymous local let _3: u32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_2) _2 = copy x _3 = copy _2 panic.+ const 1u32 _0 = move _3 storage_dead(_2) + storage_dead(_3) + storage_dead(x) return } @@ -162,6 +167,7 @@ where let _6: (T,); // anonymous local let _7: T; // anonymous local + storage_live(_0) match x_1 { Option::None => { _0 = Option::None { } @@ -190,6 +196,8 @@ where } conditional_drop[{built_in impl Destruct for F}::drop_glue<'5>] f conditional_drop[impl_Destruct_for_Option::drop_glue<'9, T>[TraitClause0]] x_1 + storage_dead(f) + storage_dead(x_1) return } @@ -207,6 +215,7 @@ where let _5: fn<'_0_1>(&'_0_1 T) -> T; // anonymous local let _6: &'4 T; // anonymous local + storage_live(_0) match (*x_1) { Option::None => { }, @@ -225,10 +234,14 @@ where conditional_drop[{built_in impl Destruct for T}::drop_glue<'5>] _4 storage_dead(_4) storage_dead(x_3) + storage_dead(f) + storage_dead(x_1) return }, } _0 = Option::None { } + storage_dead(f) + storage_dead(x_1) return } @@ -239,10 +252,12 @@ pub fn test_map_option1(x: Option[{built_in impl Sized for u32}]) -> Option let x: Option[{built_in impl Sized for u32}]; // arg #1 let _2: Option[{built_in impl Sized for u32}]; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = map_option[{built_in impl Sized for u32}, {built_in impl Sized for incr_u32}, {built_in impl Fn<(u32,), u32> for incr_u32}](move _2, const incr_u32) storage_dead(_2) + storage_dead(x) return } @@ -254,7 +269,9 @@ unsafe fn {impl Destruct for test_crate::test_closure_u32::closure}::drop_glue<' let _0: (); // return let _1: &'1 mut test_crate::test_closure_u32::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -266,9 +283,13 @@ fn {impl Fn<(u32,), u32> for test_crate::test_closure_u32::closure}::call<'_0>(_ let tupled_args: (u32,); // arg #2 let x: u32; // local + storage_live(_0) storage_live(x) x = move tupled_args.0 _0 = copy x + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -280,9 +301,13 @@ fn {impl FnMut<(u32,), u32> for test_crate::test_closure_u32::closure}::call_mut let args: (u32,); // arg #2 let _3: &'0 test_crate::test_closure_u32::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(u32,), u32> for test_crate::test_closure_u32::closure}::call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -294,10 +319,14 @@ fn {impl FnOnce<(u32,), u32> for test_crate::test_closure_u32::closure}::call_on let _2: (u32,); // arg #2 let _3: &'1 mut test_crate::test_closure_u32::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(u32,), u32> for test_crate::test_closure_u32::closure}::call_mut<'2>(move _3, move _2) drop[{impl Destruct for test_crate::test_closure_u32::closure}::drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -308,11 +337,15 @@ fn test_crate::test_closure_u32::closure::as_fn(arg1: u32) -> u32 let args: (u32,); // local let state: test_crate::test_closure_u32::closure; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::test_closure_u32::closure { } _0 = {impl FnOnce<(u32,), u32> for test_crate::test_closure_u32::closure}::call_once(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -326,6 +359,7 @@ pub fn test_closure_u32(x: u32) -> u32 let _4: fn(u32) -> u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(f) storage_live(_3) _3 = test_crate::test_closure_u32::closure { } @@ -339,6 +373,7 @@ pub fn test_closure_u32(x: u32) -> u32 storage_dead(_5) storage_dead(_4) storage_dead(f) + storage_dead(x) return } @@ -386,7 +421,9 @@ unsafe fn {impl Destruct for test_crate::test_closure_u32s::closure}::drop_glue< let _0: (); // return let _1: &'1 mut test_crate::test_closure_u32s::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -402,6 +439,7 @@ fn {impl Fn<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call<' let _6: u32; // anonymous local let _7: u32; // anonymous local + storage_live(_0) storage_live(x) storage_live(y) storage_live(_7) @@ -415,6 +453,11 @@ fn {impl Fn<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call<' _0 = move _7 storage_dead(_6) storage_dead(_5) + storage_dead(_7) + storage_dead(y) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -426,9 +469,13 @@ fn {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::cal let args: (u32, u32); // arg #2 let _3: &'0 test_crate::test_closure_u32s::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -440,10 +487,14 @@ fn {impl FnOnce<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::ca let _2: (u32, u32); // arg #2 let _3: &'1 mut test_crate::test_closure_u32s::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call_mut<'2>(move _3, move _2) drop[{impl Destruct for test_crate::test_closure_u32s::closure}::drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -455,11 +506,16 @@ fn test_crate::test_closure_u32s::closure::as_fn(arg1: u32, arg2: u32) -> u32 let args: (u32, u32); // local let state: test_crate::test_closure_u32s::closure; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1, move arg2) state = test_crate::test_closure_u32s::closure { } _0 = {impl FnOnce<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call_once(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg2) + storage_dead(arg1) return } @@ -474,6 +530,7 @@ pub fn test_closure_u32s(x: u32) -> u32 let _5: u32; // anonymous local let _6: u32; // anonymous local + storage_live(_0) storage_live(f) storage_live(_3) _3 = test_crate::test_closure_u32s::closure { } @@ -490,6 +547,7 @@ pub fn test_closure_u32s(x: u32) -> u32 storage_dead(_5) storage_dead(_4) storage_dead(f) + storage_dead(x) return } @@ -537,7 +595,9 @@ unsafe fn {impl Destruct for test_crate::test_closure_ref_u32::closure}::drop_gl let _0: (); // return let _1: &'1 mut test_crate::test_closure_ref_u32::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -549,9 +609,13 @@ fn {impl Fn<(&'_ u32,), &'_ u32> for test_crate::test_closure_ref_u32::closure}: let tupled_args: (&'_0 u32,); // arg #2 let y: &'3 u32; // local + storage_live(_0) storage_live(y) y = move tupled_args.0 _0 = copy y + storage_dead(y) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -563,9 +627,13 @@ fn {impl FnMut<(&'_ u32,), &'_ u32> for test_crate::test_closure_ref_u32::closur let args: (&'_0 u32,); // arg #2 let _3: &'0 test_crate::test_closure_ref_u32::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ u32,), &'_ u32> for test_crate::test_closure_ref_u32::closure}::call<'_0, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -577,10 +645,14 @@ fn {impl FnOnce<(&'_ u32,), &'_ u32> for test_crate::test_closure_ref_u32::closu let _2: (&'1 u32,); // arg #2 let _3: &'3 mut test_crate::test_closure_ref_u32::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(&'_ u32,), &'_ u32> for test_crate::test_closure_ref_u32::closure}::call_mut<'_0, '8>(move _3, move _2) drop[{impl Destruct for test_crate::test_closure_ref_u32::closure}::drop_glue<'10>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -591,11 +663,15 @@ fn test_crate::test_closure_ref_u32::closure::as_fn<'_0>(arg1: &'_0 u32) -> &'_0 let args: (&'_0 u32,); // local let state: test_crate::test_closure_ref_u32::closure; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::test_closure_ref_u32::closure { } _0 = {impl FnOnce<(&'_ u32,), &'_ u32> for test_crate::test_closure_ref_u32::closure}::call_once<'_0>(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -610,6 +686,7 @@ pub fn test_closure_ref_u32<'a>(x: &'a u32) -> &'a u32 let _5: fn<'_0_1>(&'_0_1 u32) -> &'_0_1 u32; // anonymous local let _6: &'4 u32; // anonymous local + storage_live(_0) storage_live(f) storage_live(_3) _3 = test_crate::test_closure_ref_u32::closure { } @@ -626,6 +703,7 @@ pub fn test_closure_ref_u32<'a>(x: &'a u32) -> &'a u32 storage_dead(_5) storage_dead(f) storage_dead(_4) + storage_dead(x) return } @@ -678,7 +756,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::test_closure_ref_param::closure[TraitClause0]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -692,9 +772,13 @@ where let tupled_args: (&'_0 T,); // arg #2 let x: &'3 T; // local + storage_live(_0) storage_live(x) x = move tupled_args.0 _0 = copy x + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -708,9 +792,13 @@ where let args: (&'_0 T,); // arg #2 let _3: &'0 test_crate::test_closure_ref_param::closure[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ T,), &'_ T> for test_crate::test_closure_ref_param::closure[TraitClause0]}::call<'_0, '2, T>[TraitClause0](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -724,10 +812,14 @@ where let _2: (&'1 T,); // arg #2 let _3: &'3 mut test_crate::test_closure_ref_param::closure[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(&'_ T,), &'_ T> for test_crate::test_closure_ref_param::closure[TraitClause0]}::call_mut<'_0, '8, T>[TraitClause0](move _3, move _2) drop[{impl Destruct for test_crate::test_closure_ref_param::closure[TraitClause0]}::drop_glue<'10, T>[TraitClause0]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -740,11 +832,15 @@ where let args: (&'_0 T,); // local let state: test_crate::test_closure_ref_param::closure[TraitClause0]; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::test_closure_ref_param::closure { } _0 = {impl FnOnce<(&'_ T,), &'_ T> for test_crate::test_closure_ref_param::closure[TraitClause0]}::call_once<'_0, T>[TraitClause0](move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -761,6 +857,7 @@ where let _5: fn<'_0_1>(&'_0_1 T) -> &'_0_1 T; // anonymous local let _6: &'4 T; // anonymous local + storage_live(_0) storage_live(f) storage_live(_3) _3 = test_crate::test_closure_ref_param::closure { } @@ -777,6 +874,7 @@ where storage_dead(_5) storage_dead(f) storage_dead(_4) + storage_dead(x) return } @@ -850,7 +948,9 @@ where let _0: (); // return let _1: &'2 mut test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -865,9 +965,13 @@ where let tupled_args: (&'_1 T,); // arg #2 let y: &'5 T; // local + storage_live(_0) storage_live(y) y = move tupled_args.0 _0 = copy y + storage_dead(y) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -882,9 +986,13 @@ where let args: (&'_1 T,); // arg #2 let _3: &'1 test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ T,), &'_ T> for test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]}::call<'a, '_1, '7, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -899,10 +1007,14 @@ where let _2: (&'2 T,); // arg #2 let _3: &'5 mut test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(&'_ T,), &'_ T> for test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]}::call_mut<'a, '_1, '16, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]}::drop_glue<'a, '28, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -916,11 +1028,15 @@ where let args: (&'_1 T,); // local let state: test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::test_closure_ref_early_bound::closure { } _0 = {impl FnOnce<(&'_ T,), &'_ T> for test_crate::test_closure_ref_early_bound::closure<'a, T>[TraitClause0, TraitClause1]}::call_once<'a, '_1, T>[TraitClause0, TraitClause1](move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -938,6 +1054,7 @@ where let _5: fn<'_0_1>(&'_0_1 T) -> &'_0_1 T; // anonymous local let _6: &'8 T; // anonymous local + storage_live(_0) storage_live(f) storage_live(_3) _3 = test_crate::test_closure_ref_early_bound::closure { } @@ -954,6 +1071,7 @@ where storage_dead(_5) storage_dead(f) storage_dead(_4) + storage_dead(x) return } @@ -1017,7 +1135,9 @@ unsafe fn {impl Destruct for test_crate::test_map_option2::closure}::drop_glue<' let _0: (); // return let _1: &'1 mut test_crate::test_map_option2::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -1031,6 +1151,7 @@ fn {impl Fn<(u32,), u32> for test_crate::test_map_option2::closure}::call<'_0>(_ let _4: u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(x) storage_live(_5) x = move tupled_args.0 @@ -1039,6 +1160,10 @@ fn {impl Fn<(u32,), u32> for test_crate::test_map_option2::closure}::call<'_0>(_ _5 = copy _4 panic.+ const 1u32 _0 = move _5 storage_dead(_4) + storage_dead(_5) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -1050,9 +1175,13 @@ fn {impl FnMut<(u32,), u32> for test_crate::test_map_option2::closure}::call_mut let args: (u32,); // arg #2 let _3: &'0 test_crate::test_map_option2::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(u32,), u32> for test_crate::test_map_option2::closure}::call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -1064,10 +1193,14 @@ fn {impl FnOnce<(u32,), u32> for test_crate::test_map_option2::closure}::call_on let _2: (u32,); // arg #2 let _3: &'1 mut test_crate::test_map_option2::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(u32,), u32> for test_crate::test_map_option2::closure}::call_mut<'2>(move _3, move _2) drop[{impl Destruct for test_crate::test_map_option2::closure}::drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -1078,11 +1211,15 @@ fn test_crate::test_map_option2::closure::as_fn(arg1: u32) -> u32 let args: (u32,); // local let state: test_crate::test_map_option2::closure; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::test_map_option2::closure { } _0 = {impl FnOnce<(u32,), u32> for test_crate::test_map_option2::closure}::call_once(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -1096,6 +1233,7 @@ pub fn test_map_option2(x: Option[{built_in impl Sized for u32}]) -> Option let _4: Option[{built_in impl Sized for u32}]; // anonymous local let _5: fn(u32) -> u32; // anonymous local + storage_live(_0) storage_live(f) storage_live(_3) _3 = test_crate::test_map_option2::closure { } @@ -1109,6 +1247,7 @@ pub fn test_map_option2(x: Option[{built_in impl Sized for u32}]) -> Option storage_dead(_5) storage_dead(_4) storage_dead(f) + storage_dead(x) return } @@ -1156,8 +1295,10 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -1168,10 +1309,12 @@ pub fn test_map_option_id1(x: Option[{built_in impl Sized for u32}]) -> Opt let x: Option[{built_in impl Sized for u32}]; // arg #1 let _2: Option[{built_in impl Sized for u32}]; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = map_option[{built_in impl Sized for u32}]>[{built_in impl Sized for u32}, {built_in impl Sized for id[{built_in impl Sized for u32}]}, {built_in impl Fn<(u32,), u32> for id[{built_in impl Sized for u32}]}](move _2, const id[{built_in impl Sized for u32}]) storage_dead(_2) + storage_dead(x) return } @@ -1184,6 +1327,7 @@ pub fn test_map_option_id2(x: Option[{built_in impl Sized for u32}]) -> Opt let _3: Option[{built_in impl Sized for u32}]; // anonymous local let _4: id[{built_in impl Sized for u32}]; // anonymous local + storage_live(_0) storage_live(f) f = const id[{built_in impl Sized for u32}] storage_live(_3) @@ -1194,6 +1338,7 @@ pub fn test_map_option_id2(x: Option[{built_in impl Sized for u32}]) -> Opt storage_dead(_4) storage_dead(_3) storage_dead(f) + storage_dead(x) return } @@ -1207,11 +1352,13 @@ where let x: T; // arg #1 let _2: &'1 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &x _0 = TraitClause1::clone<'2>(move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'4>] x + storage_dead(x) return } @@ -1224,6 +1371,7 @@ pub fn test_id_clone(x: u32) -> u32 let _3: fn(u32) -> u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(f) f = cast[{built_in impl Sized for u32}, impl_Clone_for_u32], fn(u32) -> u32>(const id_clone[{built_in impl Sized for u32}, impl_Clone_for_u32]) storage_live(_3) @@ -1234,6 +1382,7 @@ pub fn test_id_clone(x: u32) -> u32 storage_dead(_4) storage_dead(_3) storage_dead(f) + storage_dead(x) return } @@ -1249,6 +1398,7 @@ where let _3: fn(T) -> T; // anonymous local let _4: T; // anonymous local + storage_live(_0) storage_live(f) f = cast[TraitClause0, TraitClause1], fn(T) -> T>(const id_clone[TraitClause0, TraitClause1]) storage_live(_3) @@ -1260,6 +1410,7 @@ where storage_dead(_3) storage_dead(f) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] x + storage_dead(x) return } @@ -1270,10 +1421,12 @@ pub fn test_map_option_id_clone(x: Option[{built_in impl Sized for u32}]) - let x: Option[{built_in impl Sized for u32}]; // arg #1 let _2: Option[{built_in impl Sized for u32}]; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = map_option[{built_in impl Sized for u32}, impl_Clone_for_u32]>[{built_in impl Sized for u32}, {built_in impl Sized for id_clone[{built_in impl Sized for u32}, impl_Clone_for_u32]}, {built_in impl Fn<(u32,), u32> for id_clone[{built_in impl Sized for u32}, impl_Clone_for_u32]}](move _2, const id_clone[{built_in impl Sized for u32}, impl_Clone_for_u32]) storage_dead(_2) + storage_dead(x) return } @@ -1289,6 +1442,7 @@ fn {impl Fn<(u32,), u32> for test_crate::test_map_option3::closure}::call<'_0>(_ let _4: u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(x) storage_live(_5) x = move tupled_args.0 @@ -1297,6 +1451,10 @@ fn {impl Fn<(u32,), u32> for test_crate::test_map_option3::closure}::call<'_0>(_ _5 = copy _4 panic.+ const 1u32 _0 = move _5 storage_dead(_4) + storage_dead(_5) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -1308,9 +1466,13 @@ fn {impl FnMut<(u32,), u32> for test_crate::test_map_option3::closure}::call_mut let args: (u32,); // arg #2 let _3: &'0 test_crate::test_map_option3::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(u32,), u32> for test_crate::test_map_option3::closure}::call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -1320,7 +1482,9 @@ unsafe fn {impl Destruct for test_crate::test_map_option3::closure}::drop_glue<' let _0: (); // return let _1: &'1 mut test_crate::test_map_option3::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -1332,10 +1496,14 @@ fn {impl FnOnce<(u32,), u32> for test_crate::test_map_option3::closure}::call_on let _2: (u32,); // arg #2 let _3: &'1 mut test_crate::test_map_option3::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(u32,), u32> for test_crate::test_map_option3::closure}::call_mut<'2>(move _3, move _2) drop[{impl Destruct for test_crate::test_map_option3::closure}::drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -1377,6 +1545,7 @@ pub fn test_map_option3(x: Option[{built_in impl Sized for u32}]) -> Option let _2: Option[{built_in impl Sized for u32}]; // anonymous local let _3: test_crate::test_map_option3::closure; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x storage_live(_3) @@ -1384,6 +1553,7 @@ pub fn test_map_option3(x: Option[{built_in impl Sized for u32}]) -> Option _0 = map_option[{built_in impl Sized for u32}, {built_in impl Sized for test_crate::test_map_option3::closure}, {impl Fn<(u32,), u32> for test_crate::test_map_option3::closure}](move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } @@ -1403,9 +1573,13 @@ fn {impl Fn<(&'_ &'_ u32,), u32> for test_crate::test_regions::closure}::call<'_ let tupled_args: (&'_0 &'_1 u32,); // arg #2 let x: &'2 &'3 u32; // local + storage_live(_0) storage_live(x) x = move tupled_args.0 _0 = copy (*(*x)) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -1420,6 +1594,7 @@ pub fn test_regions<'a>(x: &'a u32) -> u32 let _5: &'10 &'11 u32; // anonymous local let _6: &'12 &'13 u32; // anonymous local + storage_live(_0) storage_live(f) f = test_crate::test_regions::closure { } storage_live(_3) @@ -1436,6 +1611,7 @@ pub fn test_regions<'a>(x: &'a u32) -> u32 storage_dead(_3) storage_dead(f) storage_dead(_6) + storage_dead(x) return } @@ -1445,7 +1621,9 @@ unsafe fn {impl Destruct for test_crate::test_regions::closure}::drop_glue<'_0>( let _0: (); // return let _1: &'1 mut test_crate::test_regions::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -1457,9 +1635,13 @@ fn {impl FnMut<(&'_ &'_ u32,), u32> for test_crate::test_regions::closure}::call let args: (&'_0 &'_1 u32,); // arg #2 let _3: &'0 test_crate::test_regions::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ &'_ u32,), u32> for test_crate::test_regions::closure}::call<'_0, '_1, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -1471,10 +1653,14 @@ fn {impl FnOnce<(&'_ &'_ u32,), u32> for test_crate::test_regions::closure}::cal let _2: (&'0 &'1 u32,); // arg #2 let _3: &'3 mut test_crate::test_regions::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(&'_ &'_ u32,), u32> for test_crate::test_regions::closure}::call_mut<'_0, '_1, '13>(move _3, move _2) drop[{impl Destruct for test_crate::test_regions::closure}::drop_glue<'15>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -1522,7 +1708,9 @@ unsafe fn {impl Destruct for test_crate::test_regions_casted::closure}::drop_glu let _0: (); // return let _1: &'1 mut test_crate::test_regions_casted::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -1534,9 +1722,13 @@ fn {impl Fn<(&'_ &'_ u32,), u32> for test_crate::test_regions_casted::closure}:: let tupled_args: (&'_0 &'_1 u32,); // arg #2 let x: &'2 &'3 u32; // local + storage_live(_0) storage_live(x) x = move tupled_args.0 _0 = copy (*(*x)) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -1548,9 +1740,13 @@ fn {impl FnMut<(&'_ &'_ u32,), u32> for test_crate::test_regions_casted::closure let args: (&'_0 &'_1 u32,); // arg #2 let _3: &'0 test_crate::test_regions_casted::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ &'_ u32,), u32> for test_crate::test_regions_casted::closure}::call<'_0, '_1, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -1562,10 +1758,14 @@ fn {impl FnOnce<(&'_ &'_ u32,), u32> for test_crate::test_regions_casted::closur let _2: (&'0 &'1 u32,); // arg #2 let _3: &'3 mut test_crate::test_regions_casted::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(&'_ &'_ u32,), u32> for test_crate::test_regions_casted::closure}::call_mut<'_0, '_1, '13>(move _3, move _2) drop[{impl Destruct for test_crate::test_regions_casted::closure}::drop_glue<'15>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -1576,11 +1776,15 @@ fn test_crate::test_regions_casted::closure::as_fn<'_0, '_1>(arg1: &'_0 &'_1 u32 let args: (&'_0 &'_1 u32,); // local let state: test_crate::test_regions_casted::closure; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::test_regions_casted::closure { } _0 = {impl FnOnce<(&'_ &'_ u32,), u32> for test_crate::test_regions_casted::closure}::call_once<'_0, '_1>(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -1595,6 +1799,7 @@ pub fn test_regions_casted<'a>(x: &'a u32) -> u32 let _5: &'9 &'10 u32; // anonymous local let _6: &'11 &'12 u32; // anonymous local + storage_live(_0) storage_live(f) storage_live(_3) _3 = test_crate::test_regions_casted::closure { } @@ -1611,6 +1816,7 @@ pub fn test_regions_casted<'a>(x: &'a u32) -> u32 storage_dead(_4) storage_dead(f) storage_dead(_6) + storage_dead(x) return } @@ -1669,6 +1875,7 @@ fn {impl Fn<(u32,), u32> for test_crate::test_closure_capture::closure<'_0, '_1> let _8: u32; // anonymous local let _9: u32; // anonymous local + storage_live(_0) storage_live(z) storage_live(_7) storage_live(_9) @@ -1688,6 +1895,11 @@ fn {impl Fn<(u32,), u32> for test_crate::test_closure_capture::closure<'_0, '_1> _0 = move _9 storage_dead(_8) storage_dead(_4) + storage_dead(_9) + storage_dead(_7) + storage_dead(z) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -1704,6 +1916,7 @@ pub fn test_closure_capture(x: u32, y: u32) -> u32 let _7: &'13 test_crate::test_closure_capture::closure<'14, '15>; // anonymous local let _8: (u32,); // anonymous local + storage_live(_0) storage_live(f) storage_live(_4) storage_live(_5) @@ -1723,6 +1936,8 @@ pub fn test_closure_capture(x: u32, y: u32) -> u32 storage_dead(_7) storage_dead(_4) storage_dead(f) + storage_dead(y) + storage_dead(x) return } @@ -1732,7 +1947,9 @@ unsafe fn {impl Destruct for test_crate::test_closure_capture::closure<'_0, '_1> let _0: (); // return let _1: &'1 mut test_crate::test_closure_capture::closure<'_0, '_1>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -1744,9 +1961,13 @@ fn {impl FnMut<(u32,), u32> for test_crate::test_closure_capture::closure<'_0, ' let args: (u32,); // arg #2 let _3: &'0 test_crate::test_closure_capture::closure<'_0, '_1>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(u32,), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call<'_0, '_1, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -1758,10 +1979,14 @@ fn {impl FnOnce<(u32,), u32> for test_crate::test_closure_capture::closure<'_0, let _2: (u32,); // arg #2 let _3: &'1 mut test_crate::test_closure_capture::closure<'_0, '_1>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(u32,), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call_mut<'_0, '_1, '6>(move _3, move _2) drop[{impl Destruct for test_crate::test_closure_capture::closure<'_0, '_1>}::drop_glue<'_0, '_1, '16>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -1819,6 +2044,7 @@ where let x: T; // local let _4: &'3 T; // anonymous local + storage_live(_0) storage_live(x) x = move tupled_args.0 storage_live(_4) @@ -1826,6 +2052,9 @@ where _0 = TraitClause1::clone<'4>(move _4) storage_dead(_4) conditional_drop[{built_in impl Destruct for T}::drop_glue<'6>] x + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -1843,6 +2072,7 @@ where let _5: (T,); // anonymous local let _6: T; // anonymous local + storage_live(_0) storage_live(f) f = test_crate::test_closure_clone::closure { } storage_live(_3) @@ -1861,6 +2091,7 @@ where storage_dead(f) storage_dead(_4) conditional_drop[{built_in impl Destruct for T}::drop_glue<'7>] x + storage_dead(x) return } @@ -1873,7 +2104,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::test_closure_clone::closure[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -1888,9 +2121,13 @@ where let args: (T,); // arg #2 let _3: &'0 test_crate::test_closure_clone::closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(T,), T> for test_crate::test_closure_clone::closure[TraitClause0, TraitClause1]}::call<'2, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -1905,10 +2142,14 @@ where let _2: (T,); // arg #2 let _3: &'1 mut test_crate::test_closure_clone::closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(T,), T> for test_crate::test_closure_clone::closure[TraitClause0, TraitClause1]}::call_mut<'2, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::test_closure_clone::closure[TraitClause0, TraitClause1]}::drop_glue<'4, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -1972,7 +2213,9 @@ unsafe fn {impl Destruct for test_crate::test_array_map::closure}::drop_glue<'_0 let _0: (); // return let _1: &'1 mut test_crate::test_array_map::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -1990,9 +2233,13 @@ fn {impl FnMut<(i32,), i32> for test_crate::test_array_map::closure}::call_mut<' let tupled_args: (i32,); // arg #2 let v: i32; // local + storage_live(_0) storage_live(v) v = move tupled_args.0 _0 = copy v + storage_dead(v) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -2004,10 +2251,14 @@ fn {impl FnOnce<(i32,), i32> for test_crate::test_array_map::closure}::call_once let _2: (i32,); // arg #2 let _3: &'1 mut test_crate::test_array_map::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(i32,), i32> for test_crate::test_array_map::closure}::call_mut<'2>(move _3, move _2) drop[{impl Destruct for test_crate::test_array_map::closure}::drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -2039,6 +2290,7 @@ pub fn test_array_map(x: [i32; 256usize]) -> [i32; 256usize] let _2: [i32; 256usize]; // anonymous local let _3: test_crate::test_array_map::closure; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x storage_live(_3) @@ -2046,6 +2298,7 @@ pub fn test_array_map(x: [i32; 256usize]) -> [i32; 256usize] _0 = map[{built_in impl Sized for i32}, {built_in impl Sized for test_crate::test_array_map::closure}, {built_in impl Sized for i32}, {impl FnMut<(i32,), i32> for test_crate::test_array_map::closure}, {impl Destruct for test_crate::test_array_map::closure}, {built_in impl Destruct for i32}, {built_in impl Destruct for i32}](move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } @@ -2063,6 +2316,7 @@ fn {impl FnMut<(&'_ usize,), ()> for test_crate::test_fnmut_with_ref::closure<'_ let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(x) storage_live(_5) _0 = () @@ -2073,6 +2327,10 @@ fn {impl FnMut<(&'_ usize,), ()> for test_crate::test_fnmut_with_ref::closure<'_ (*((*_1)).0) = move _5 _0 = () storage_dead(_4) + storage_dead(_5) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -2095,10 +2353,13 @@ fn test_fnmut_with_ref() storage_live(_10) storage_live(_11) + storage_live(_11) storage_live(_12) _12 = const 15usize _11 = &_12 + storage_dead(_12) _10 = move _11 + storage_live(_0) storage_live(_9) _0 = () storage_live(sum) @@ -2127,6 +2388,9 @@ fn test_fnmut_with_ref() _0 = () storage_dead(closure) storage_dead(sum) + storage_dead(_9) + storage_dead(_11) + storage_dead(_10) return } @@ -2136,7 +2400,9 @@ unsafe fn {impl Destruct for test_crate::test_fnmut_with_ref::closure<'_0>}::dro let _0: (); // return let _1: &'1 mut test_crate::test_fnmut_with_ref::closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -2148,11 +2414,15 @@ fn {impl FnOnce<(&'_ usize,), ()> for test_crate::test_fnmut_with_ref::closure<' let _2: (&'0 usize,); // arg #2 let _3: &'2 mut test_crate::test_fnmut_with_ref::closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = {impl FnMut<(&'_ usize,), ()> for test_crate::test_fnmut_with_ref::closure<'_0>}::call_mut<'_0, '_1, '9>(move _3, move _2) drop[{impl Destruct for test_crate::test_fnmut_with_ref::closure<'_0>}::drop_glue<'_0, '15>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/closures_with_where.out b/charon/tests/ui/closures_with_where.out index ea7f0e108..97f856842 100644 --- a/charon/tests/ui/closures_with_where.out +++ b/charon/tests/ui/closures_with_where.out @@ -88,7 +88,9 @@ where let _0: (); // return let _1: &'1 mut closure[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -114,12 +116,16 @@ where let i: usize; // local let _4: usize; // anonymous local + storage_live(_0) storage_live(i) i = move tupled_args.0 storage_live(_4) _4 = copy i _0 = TraitClause1::of_usize(move _4) storage_dead(_4) + storage_dead(i) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -134,10 +140,14 @@ where let _2: (usize,); // arg #2 let _3: &'1 mut closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'2, T, K>[TraitClause0, TraitClause1](move _3, move _2) drop[drop_glue<'4, T, K>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -179,6 +189,7 @@ where let _0: [T; 1usize]; // return let _1: closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_1) _1 = closure { } _0 = from_fn[TraitClause0, TraitClause1], 1usize>[TraitClause0, {built_in impl Sized for closure[TraitClause0, TraitClause1]}, {built_in impl Destruct for T}, impl_FnMut_tuple_for_closure[TraitClause0, TraitClause1], impl_Destruct_for_closure[TraitClause0, TraitClause1]](move _1) diff --git a/charon/tests/ui/comments.out b/charon/tests/ui/comments.out index 47df06b15..ad820fd82 100644 --- a/charon/tests/ui/comments.out +++ b/charon/tests/ui/comments.out @@ -63,8 +63,10 @@ fn function_call(_1: u32) let _0: (); // return let _1: u32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -99,6 +101,7 @@ pub fn sum<'_0>(s: &'_0 [u32]) -> u32 let _25: &'_ [u32]; // anonymous local let _26: &'_ u32; // anonymous local + storage_live(_0) storage_live(_7) storage_live(_14) storage_live(_15) @@ -200,6 +203,14 @@ pub fn sum<'_0>(s: &'_0 [u32]) -> u32 _0 = copy sum storage_dead(i) storage_dead(sum) + storage_dead(_24) + storage_dead(_20) + storage_dead(_15) + storage_dead(_14) + storage_dead(_7) + storage_dead(s) + storage_dead(_26) + storage_dead(_25) return } @@ -216,6 +227,7 @@ pub fn impl_Default_for_Foo::default() -> Foo let _1: u32; // anonymous local let _2: u32; // anonymous local + storage_live(_0) storage_live(_1) _1 = impl_Default_for_u32::default() storage_live(_2) @@ -246,6 +258,7 @@ pub fn impl_Default_for_Bar::default() -> Bar let _1: u32; // anonymous local let _2: u32; // anonymous local + storage_live(_0) storage_live(_1) _1 = impl_Default_for_u32::default() storage_live(_2) @@ -271,9 +284,11 @@ where let _0: (); // return let _1: T; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _1 + storage_dead(_1) return } @@ -319,6 +334,7 @@ fn foo() let _36: &'_ [u32; 10usize]; // anonymous local let _37: &'_ u32; // anonymous local + storage_live(_0) storage_live(_32) _0 = () storage_live(_3) @@ -375,9 +391,11 @@ fn foo() _18 = const 9usize storage_live(_33) storage_live(_34) + storage_live(_34) storage_live(_35) _35 = const 9u32 _34 = &_35 + storage_dead(_35) _33 = move _34 storage_live(_36) _36 = &a @@ -418,6 +436,18 @@ fn foo() _29 = &(*_30) storage_live(_31) _31 = Option::None { } + storage_dead(_32) + storage_dead(_31) + storage_dead(_30) + storage_dead(_29) + storage_dead(_28) + storage_dead(_27) + storage_dead(_26) + storage_dead(kind) + storage_dead(_37) + storage_dead(_36) + storage_dead(_34) + storage_dead(_33) panic(core::panicking::assert_failed) } storage_dead(_24) @@ -433,6 +463,18 @@ fn foo() storage_dead(x_8) storage_dead(y) storage_dead(x_1) + storage_dead(_32) + storage_dead(_31) + storage_dead(_30) + storage_dead(_29) + storage_dead(_28) + storage_dead(_27) + storage_dead(_26) + storage_dead(kind) + storage_dead(_37) + storage_dead(_36) + storage_dead(_34) + storage_dead(_33) return } @@ -441,6 +483,7 @@ fn CONSTANT() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -458,6 +501,7 @@ pub fn thing() let _4: (); // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(_3) _0 = () storage_live(x) @@ -475,6 +519,7 @@ pub fn thing() storage_dead(_4) _0 = () storage_dead(x) + storage_dead(_3) return } @@ -484,9 +529,11 @@ pub fn fake_read(x: u32) let _0: (); // return let x: u32; // arg #1 + storage_live(_0) _0 = () _0 = () // This statement is translated to a `fake_read`. + storage_dead(x) return } @@ -496,6 +543,7 @@ fn fool() let _0: (); // return let _1: &'1 str; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const "\n // Fooled ya" diff --git a/charon/tests/ui/constants.out b/charon/tests/ui/constants.out index 9f37436c6..babc6ab8a 100644 --- a/charon/tests/ui/constants.out +++ b/charon/tests/ui/constants.out @@ -32,6 +32,7 @@ pub fn X0() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 0u32 return } @@ -44,6 +45,7 @@ pub fn X1() -> u32 { let _0: u32; // return + storage_live(_0) _0 = copy MAX return } @@ -57,6 +59,7 @@ pub fn X2() -> u32 let _0: u32; // return let x: u32; // local + storage_live(_0) storage_live(x) x = const 3u32 _0 = copy x @@ -75,12 +78,15 @@ pub fn incr(n: u32) -> u32 let _2: u32; // anonymous local let _3: u32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_2) _2 = copy n _3 = copy _2 panic.+ const 1u32 _0 = move _3 storage_dead(_2) + storage_dead(_3) + storage_dead(n) return } @@ -89,6 +95,7 @@ pub fn X3() -> u32 { let _0: u32; // return + storage_live(_0) _0 = incr(const 32u32) return } @@ -105,6 +112,7 @@ pub fn mk_pair0(x: u32, y: u32) -> (u32, u32) let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -112,6 +120,8 @@ pub fn mk_pair0(x: u32, y: u32) -> (u32, u32) _0 = (move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -134,6 +144,7 @@ pub fn mk_pair1(x: u32, y: u32) -> Pair[{built_in impl Sized for u32}, let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -141,6 +152,8 @@ pub fn mk_pair1(x: u32, y: u32) -> Pair[{built_in impl Sized for u32}, _0 = Pair { x: move _3, y: move _4 } storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -149,6 +162,7 @@ pub fn P0() -> (u32, u32) { let _0: (u32, u32); // return + storage_live(_0) _0 = mk_pair0(const 0u32, const 1u32) return } @@ -161,6 +175,7 @@ pub fn P1() -> Pair[{built_in impl Sized for u32}, {built_in impl Size { let _0: Pair[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // return + storage_live(_0) _0 = mk_pair1(const 0u32, const 1u32) return } @@ -173,6 +188,7 @@ pub fn P2() -> (u32, u32) { let _0: (u32, u32); // return + storage_live(_0) _0 = (const 0u32, const 1u32) return } @@ -185,6 +201,7 @@ pub fn P3() -> Pair[{built_in impl Sized for u32}, {built_in impl Size { let _0: Pair[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // return + storage_live(_0) _0 = Pair { x: const 0u32, y: const 1u32 } return } @@ -209,12 +226,14 @@ where let value: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move value _0 = Wrap { value: move _2 } conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _2 storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] value + storage_dead(value) return } @@ -223,6 +242,7 @@ pub fn Y() -> Wrap[{built_in impl Sized for i32}] { let _0: Wrap[{built_in impl Sized for i32}]; // return + storage_live(_0) _0 = new[{built_in impl Sized for i32}](const 2i32) return } @@ -236,6 +256,7 @@ pub fn unwrap_y() -> i32 let _0: i32; // return let _1: Wrap[{built_in impl Sized for i32}]; // anonymous local + storage_live(_0) storage_live(_1) _1 = copy Y _0 = copy (_1).value @@ -248,6 +269,7 @@ pub fn YVAL() -> i32 { let _0: i32; // return + storage_live(_0) _0 = unwrap_y() return } @@ -260,6 +282,7 @@ fn Z1() -> i32 { let _0: i32; // return + storage_live(_0) _0 = const 3i32 return } @@ -272,6 +295,7 @@ pub fn get_z1() -> i32 { let _0: i32; // return + storage_live(_0) _0 = copy Z1 return } @@ -286,6 +310,7 @@ pub fn add(a: i32, b: i32) -> i32 let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy a @@ -295,6 +320,9 @@ pub fn add(a: i32, b: i32) -> i32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(b) + storage_dead(a) return } @@ -303,6 +331,7 @@ pub fn Q1() -> i32 { let _0: i32; // return + storage_live(_0) _0 = const 5i32 return } @@ -315,6 +344,7 @@ pub fn Q2() -> i32 { let _0: i32; // return + storage_live(_0) _0 = copy Q1 return } @@ -327,6 +357,7 @@ pub fn Q3() -> i32 { let _0: i32; // return + storage_live(_0) _0 = add(copy Q2, const 3i32) return } @@ -341,6 +372,7 @@ pub fn get_z2() -> i32 let _1: i32; // anonymous local let _2: i32; // anonymous local + storage_live(_0) storage_live(_1) storage_live(_2) _2 = get_z1() @@ -356,6 +388,7 @@ pub fn S1() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 6u32 return } @@ -371,6 +404,7 @@ pub fn S2() -> u32 let _2: &'1 u32; // anonymous local let _3: &'2 u32; // anonymous local + storage_live(_0) storage_live(_1) storage_live(_2) storage_live(_3) @@ -380,6 +414,7 @@ pub fn S2() -> u32 _0 = incr(move _1) storage_dead(_2) storage_dead(_1) + storage_dead(_3) return } @@ -391,6 +426,7 @@ pub fn S3() -> Pair[{built_in impl Sized for u32}, {built_in impl Size { let _0: Pair[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // return + storage_live(_0) _0 = copy P3 return } @@ -403,6 +439,7 @@ pub fn S4() -> Pair[{built_in impl Sized for u32}, {built_in impl Size { let _0: Pair[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // return + storage_live(_0) _0 = mk_pair1(const 7u32, const 8u32) return } @@ -425,6 +462,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const N return } @@ -442,6 +480,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy LEN[TraitClause0] return } diff --git a/charon/tests/ui/consts/evaluate-consts-inline.out b/charon/tests/ui/consts/evaluate-consts-inline.out index 01ad6b003..346db0d6a 100644 --- a/charon/tests/ui/consts/evaluate-consts-inline.out +++ b/charon/tests/ui/consts/evaluate-consts-inline.out @@ -12,16 +12,22 @@ pub fn promoted_scalar() -> &'static i32 storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) _5 = const 42i32 _4 = &_5 + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) storage_live(_1) _2 = move _3 _1 = &(*_2) _0 = &(*_1) storage_dead(_1) + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } @@ -37,16 +43,22 @@ pub fn promoted_array() -> &'static [i32; 3usize] storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) _5 = [const 1i32, const 2i32, const 3i32] _4 = &_5 + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) storage_live(_1) _2 = move _3 _1 = &(*_2) _0 = &(*_1) storage_dead(_1) + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } @@ -62,22 +74,30 @@ pub fn promoted_local() -> i32 let _6: i32; // anonymous local let _7: i32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(r) _2 = const 2i32 panic.+ const 3i32 storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) storage_live(_7) _7 = const 2i32 wrap.+ const 3i32 _6 = move _7 _5 = &_6 + storage_dead(_7) + storage_dead(_6) _4 = move _5 _3 = move _4 r = &(*_3) _0 = copy (*r) storage_dead(r) + storage_dead(_3) + storage_dead(_2) + storage_dead(_5) + storage_dead(_4) return } @@ -88,11 +108,14 @@ pub fn inline_ref_scalar() -> &'static i32 let _1: i32; // anonymous local let _2: &'2 i32; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 42i32 storage_live(_2) _2 = &_1 _0 = move _2 + storage_dead(_2) + storage_dead(_1) return } @@ -103,11 +126,14 @@ pub fn inline_ref_array() -> &'static [i32; 3usize] let _1: [i32; 3usize]; // anonymous local let _2: &'2 [i32; 3usize]; // anonymous local + storage_live(_0) storage_live(_1) _1 = [const 1i32, const 2i32, const 3i32] storage_live(_2) _2 = &_1 _0 = move _2 + storage_dead(_2) + storage_dead(_1) return } @@ -116,6 +142,7 @@ pub fn inline_block() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 5u32 return } @@ -126,9 +153,11 @@ pub fn inline_pair() -> (u32, u32) let _0: (u32, u32); // return let _1: (u32, u32); // anonymous local + storage_live(_0) storage_live(_1) _1 = (const 1u32, const 2u32) _0 = move _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/consts/evaluate-consts-mono.out b/charon/tests/ui/consts/evaluate-consts-mono.out index f0e656a82..752e9d33a 100644 --- a/charon/tests/ui/consts/evaluate-consts-mono.out +++ b/charon/tests/ui/consts/evaluate-consts-mono.out @@ -28,6 +28,7 @@ pub fn use_len() -> usize { let _0: usize; // return + storage_live(_0) _0 = copy LEN:: return } @@ -74,6 +75,7 @@ pub fn use_size() -> usize let _2: usize; // anonymous local let _3: usize; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_1) @@ -82,6 +84,8 @@ pub fn use_size() -> usize _3 = copy _1 panic.+ copy impl_HasSize_for_array::SIZE::<[u32; 3usize]> _0 = move _3 storage_dead(_1) + storage_dead(_3) + storage_dead(_2) return } diff --git a/charon/tests/ui/consts/evaluate-consts-recursive-static.out b/charon/tests/ui/consts/evaluate-consts-recursive-static.out index cbc4d71af..78117e3aa 100644 --- a/charon/tests/ui/consts/evaluate-consts-recursive-static.out +++ b/charon/tests/ui/consts/evaluate-consts-recursive-static.out @@ -49,6 +49,7 @@ pub fn CYCLE_A() -> Node let _4: &'8 Node; // anonymous local let _5: &'9 Node; // anonymous local + storage_live(_0) storage_live(_1) storage_live(_2) storage_live(_3) @@ -64,6 +65,7 @@ pub fn CYCLE_A() -> Node storage_dead(_4) storage_dead(_3) storage_dead(_1) + storage_dead(_5) return } @@ -80,6 +82,7 @@ pub fn CYCLE_B() -> Node let _4: &'8 Node; // anonymous local let _5: &'9 Node; // anonymous local + storage_live(_0) storage_live(_1) storage_live(_2) storage_live(_3) @@ -95,6 +98,7 @@ pub fn CYCLE_B() -> Node storage_dead(_4) storage_dead(_3) storage_dead(_1) + storage_dead(_5) return } diff --git a/charon/tests/ui/consts/evaluate-consts.out b/charon/tests/ui/consts/evaluate-consts.out index 78e1288ff..a330e98b5 100644 --- a/charon/tests/ui/consts/evaluate-consts.out +++ b/charon/tests/ui/consts/evaluate-consts.out @@ -53,6 +53,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 4usize return } @@ -84,6 +85,7 @@ pub fn use_consts() -> u32 let _5: u32; // anonymous local let _6: &'2 u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_5) storage_live(_1) @@ -100,6 +102,9 @@ pub fn use_consts() -> u32 storage_dead(_3) storage_dead(_1) storage_dead(_4) + storage_dead(_5) + storage_dead(_2) + storage_dead(_6) return } diff --git a/charon/tests/ui/consts/pointer-cast-const-pattern.out b/charon/tests/ui/consts/pointer-cast-const-pattern.out index 99d28bef2..e3d8c948c 100644 --- a/charon/tests/ui/consts/pointer-cast-const-pattern.out +++ b/charon/tests/ui/consts/pointer-cast-const-pattern.out @@ -6,6 +6,7 @@ fn DISGUISED_INT() -> *const () let _0: *const (); // return let _1: *const (); // anonymous local + storage_live(_0) storage_live(_1) _1 = cast(const 42i32) _0 = copy _1 @@ -23,6 +24,7 @@ pub fn pointer_pattern() let _1: *const (); // anonymous local let _2: bool; // anonymous local + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -32,10 +34,12 @@ pub fn pointer_pattern() } else { _0 = const () storage_dead(_1) + storage_dead(_2) return } _0 = const () storage_dead(_1) + storage_dead(_2) return } diff --git a/charon/tests/ui/consts/ptr-null-constevalval.out b/charon/tests/ui/consts/ptr-null-constevalval.out index 2f3018402..f81b83434 100644 --- a/charon/tests/ui/consts/ptr-null-constevalval.out +++ b/charon/tests/ui/consts/ptr-null-constevalval.out @@ -9,6 +9,7 @@ pub fn from_raw_parts::(data_pointer: *const (), metadata: ()) -> *const let _3: *const (); // anonymous local let _4: (); // anonymous local + storage_live(_0) storage_live(_3) _3 = copy data_pointer storage_live(_4) @@ -16,6 +17,8 @@ pub fn from_raw_parts::(data_pointer: *const (), metadata: ()) -> *const _0 = *const (move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(metadata) + storage_dead(data_pointer) return } @@ -27,10 +30,12 @@ pub fn without_provenance_mut::<()>(addr: usize) -> *mut () let addr: usize; // arg #1 let _2: usize; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy addr _0 = transmute(move _2) storage_dead(_2) + storage_dead(addr) return } @@ -43,6 +48,7 @@ pub fn without_provenance::<()>(addr: usize) -> *const () let _2: *mut (); // anonymous local let _3: usize; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy addr @@ -50,6 +56,7 @@ pub fn without_provenance::<()>(addr: usize) -> *const () _0 = cast<*mut (), *const ()>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(addr) return } @@ -61,6 +68,7 @@ pub fn null::() -> *const u8 let _1: *const (); // anonymous local let _2: (); // anonymous local + storage_live(_0) storage_live(_1) _1 = without_provenance::<()>(const 0usize) storage_live(_2) @@ -77,6 +85,7 @@ pub fn null_ptr() let _0: (); // return let _1: *const u8; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = null::() diff --git a/charon/tests/ui/consts/string-new-constevalval.out b/charon/tests/ui/consts/string-new-constevalval.out index a60cb6014..8b2ae5206 100644 --- a/charon/tests/ui/consts/string-new-constevalval.out +++ b/charon/tests/ui/consts/string-new-constevalval.out @@ -31,6 +31,7 @@ where let _0: Vec[TraitClause0, {built_in impl Sized for Global}, {impl#1}]; // return let _1: RawVec[TraitClause0, {built_in impl Sized for Global}, {impl#1}]; // anonymous local + storage_live(_0) storage_live(_1) _1 = alloc::raw_vec::{RawVec[TraitClause0, {built_in impl Sized for Global}, {impl#1}]}::new[TraitClause0]() _0 = Vec { buf: move _1, len: const 0usize } @@ -44,6 +45,7 @@ pub fn alloc::string::{String}::new() -> String let _0: String; // return let _1: Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}, {impl#1}]; // anonymous local + storage_live(_0) storage_live(_1) _1 = alloc::vec::{Vec[TraitClause0, {built_in impl Sized for Global}, {impl#1}]}::new[{built_in impl Sized for u8}]() _0 = String { vec: move _1 } @@ -71,6 +73,7 @@ where let _4: *mut T; // anonymous local let _5: bool; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -89,6 +92,11 @@ where continue 0 } } + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -98,6 +106,7 @@ pub fn mk_string() let _0: (); // return let _1: String; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = alloc::string::{String}::new() diff --git a/charon/tests/ui/control-flow/ambiguous-loop-exit.out b/charon/tests/ui/control-flow/ambiguous-loop-exit.out index 7a833d50b..27994a40c 100644 --- a/charon/tests/ui/control-flow/ambiguous-loop-exit.out +++ b/charon/tests/ui/control-flow/ambiguous-loop-exit.out @@ -13,6 +13,7 @@ pub fn f(x: u32) -> u32 let _7: bool; // anonymous local let _8: u32; // anonymous local + storage_live(_0) loop { storage_live(_2) storage_live(_3) @@ -43,6 +44,7 @@ pub fn f(x: u32) -> u32 _ => { _0 = const 2u32 storage_dead(_4) + storage_dead(x) return }, } @@ -73,6 +75,7 @@ pub fn f(x: u32) -> u32 _ => { _0 = const 2u32 storage_dead(_4) + storage_dead(x) return }, } @@ -85,6 +88,7 @@ pub fn f(x: u32) -> u32 storage_dead(_3) _0 = const 3u32 storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/control-flow/duplicated-statement.out b/charon/tests/ui/control-flow/duplicated-statement.out index cc1175cf1..3a4d8f705 100644 --- a/charon/tests/ui/control-flow/duplicated-statement.out +++ b/charon/tests/ui/control-flow/duplicated-statement.out @@ -19,6 +19,7 @@ fn rej_sample<'_0>(a: &'_0 [u8]) -> usize let _13: &'_ [u8]; // anonymous local let _14: &'_ u8; // anonymous local + storage_live(_0) storage_live(_9) storage_live(_10) storage_live(sampled) @@ -68,6 +69,13 @@ fn rej_sample<'_0>(a: &'_0 [u8]) -> usize storage_dead(_3) _0 = copy sampled storage_dead(sampled) + storage_dead(_10) + storage_dead(_9) + storage_dead(a) + storage_dead(_14) + storage_dead(_13) + storage_dead(_12) + storage_dead(_11) return } diff --git a/charon/tests/ui/control-flow/empty-loop.out b/charon/tests/ui/control-flow/empty-loop.out index 3e9ac23fb..a6172664b 100644 --- a/charon/tests/ui/control-flow/empty-loop.out +++ b/charon/tests/ui/control-flow/empty-loop.out @@ -5,6 +5,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () loop { continue 0 diff --git a/charon/tests/ui/control-flow/issue-1051-missing-loop-jump.out b/charon/tests/ui/control-flow/issue-1051-missing-loop-jump.out index eb44b2d02..85bb40dbc 100644 --- a/charon/tests/ui/control-flow/issue-1051-missing-loop-jump.out +++ b/charon/tests/ui/control-flow/issue-1051-missing-loop-jump.out @@ -188,6 +188,7 @@ pub fn f() let _10: bool; // anonymous local let _11: i32; // anonymous local + storage_live(_0) _0 = () storage_live(_x) _x = const 0i32 diff --git a/charon/tests/ui/control-flow/issue-1051-return-break.out b/charon/tests/ui/control-flow/issue-1051-return-break.out index e9fabb617..14b60b167 100644 --- a/charon/tests/ui/control-flow/issue-1051-return-break.out +++ b/charon/tests/ui/control-flow/issue-1051-return-break.out @@ -13,6 +13,7 @@ pub fn f(y: u32) -> bool let _7: bool; // anonymous local let _8: u32; // anonymous local + storage_live(_0) storage_live(_6) storage_live(_2) storage_live(_3) @@ -41,6 +42,8 @@ pub fn f(y: u32) -> bool storage_dead(_7) storage_dead(_2) _0 = const false + storage_dead(_6) + storage_dead(y) return } else { storage_dead(_8) @@ -53,12 +56,16 @@ pub fn f(y: u32) -> bool _0 = const true storage_dead(_4) storage_dead(_2) + storage_dead(_6) + storage_dead(y) return } else { storage_dead(_3) } storage_dead(_2) _0 = const false + storage_dead(_6) + storage_dead(y) return } diff --git a/charon/tests/ui/control-flow/issue-297-cfg.out b/charon/tests/ui/control-flow/issue-297-cfg.out index 6af66f46b..71e415d07 100644 --- a/charon/tests/ui/control-flow/issue-297-cfg.out +++ b/charon/tests/ui/control-flow/issue-297-cfg.out @@ -90,6 +90,7 @@ fn f1<'_0>(a: &'_0 [u8]) -> usize let _13: &'_ [u8]; // anonymous local let _14: &'_ u8; // anonymous local + storage_live(_0) storage_live(_9) storage_live(_10) storage_live(sampled) @@ -136,6 +137,13 @@ fn f1<'_0>(a: &'_0 [u8]) -> usize sampled = move _10 _0 = copy sampled storage_dead(sampled) + storage_dead(_10) + storage_dead(_9) + storage_dead(a) + storage_dead(_14) + storage_dead(_13) + storage_dead(_12) + storage_dead(_11) return } @@ -144,6 +152,7 @@ fn FIELD_MODULUS() -> i16 { let _0: i16; // return + storage_live(_0) _0 = const 8i16 return } @@ -210,6 +219,7 @@ fn f2<'_0, '_1>(a: &'_0 [u8], result: &'_1 mut [i16]) -> usize let _53: &'_ [u8]; // anonymous local let _54: &'_ u8; // anonymous local + storage_live(_0) storage_live(_37) storage_live(_44) storage_live(sampled) @@ -387,6 +397,20 @@ fn f2<'_0, '_1>(a: &'_0 [u8], result: &'_1 mut [i16]) -> usize storage_dead(_4) _0 = copy sampled storage_dead(sampled) + storage_dead(_44) + storage_dead(_37) + storage_dead(result) + storage_dead(a) + storage_dead(_54) + storage_dead(_53) + storage_dead(_52) + storage_dead(_51) + storage_dead(_50) + storage_dead(_49) + storage_dead(_48) + storage_dead(_47) + storage_dead(_46) + storage_dead(_45) return } diff --git a/charon/tests/ui/control-flow/issue-507-cfg.out b/charon/tests/ui/control-flow/issue-507-cfg.out index 9336e442a..40e23a3ad 100644 --- a/charon/tests/ui/control-flow/issue-507-cfg.out +++ b/charon/tests/ui/control-flow/issue-507-cfg.out @@ -5,6 +5,7 @@ fn CONST() -> u8 { let _0: u8; // return + storage_live(_0) _0 = const 0u8 return } @@ -20,6 +21,7 @@ fn f0() let _2: bool; // anonymous local let x: u8; // local + storage_live(_0) _0 = () storage_live(_1) _1 = const 0i32 < const 1i32 @@ -59,6 +61,7 @@ fn f1<'_0>(serialized: &'_0 [u8; 1usize]) let _10: i32; // anonymous local let x: u8; // local + storage_live(_0) _0 = () storage_live(previous_true_hints_seen) previous_true_hints_seen = const 0usize @@ -115,6 +118,7 @@ fn f1<'_0>(serialized: &'_0 [u8; 1usize]) storage_dead(_4) storage_dead(i) storage_dead(previous_true_hints_seen) + storage_dead(serialized) return } diff --git a/charon/tests/ui/control-flow/issue-899-forward-jump-incorrectly-reconstructed.out b/charon/tests/ui/control-flow/issue-899-forward-jump-incorrectly-reconstructed.out index 85ed6bd9a..4e4a65d1c 100644 --- a/charon/tests/ui/control-flow/issue-899-forward-jump-incorrectly-reconstructed.out +++ b/charon/tests/ui/control-flow/issue-899-forward-jump-incorrectly-reconstructed.out @@ -6,7 +6,9 @@ fn condition(_x: u32) -> bool let _0: bool; // return let _x: u32; // arg #1 + storage_live(_0) _0 = const true + storage_dead(_x) return } @@ -15,6 +17,7 @@ fn foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -25,6 +28,7 @@ fn bar() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -39,6 +43,7 @@ fn absorb_full() let _3: bool; // anonymous local let _4: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/control-flow/lazy-boolean-op-in-if.out b/charon/tests/ui/control-flow/lazy-boolean-op-in-if.out index b0d4e739e..e5cd1c877 100644 --- a/charon/tests/ui/control-flow/lazy-boolean-op-in-if.out +++ b/charon/tests/ui/control-flow/lazy-boolean-op-in-if.out @@ -5,6 +5,7 @@ fn foo() -> bool { let _0: bool; // return + storage_live(_0) _0 = const true return } @@ -14,6 +15,7 @@ fn bar() -> bool { let _0: bool; // return + storage_live(_0) _0 = const false return } @@ -23,6 +25,7 @@ fn do_something() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -33,6 +36,7 @@ fn do_something_else() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -43,6 +47,7 @@ fn do_something_at_the_end() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -56,6 +61,7 @@ fn main() let _2: bool; // anonymous local let _3: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -94,6 +100,7 @@ fn main2() let _8: bool; // anonymous local let _9: bool; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 diff --git a/charon/tests/ui/control-flow/loop-break.out b/charon/tests/ui/control-flow/loop-break.out index aba3ea84e..7e1ea7d08 100644 --- a/charon/tests/ui/control-flow/loop-break.out +++ b/charon/tests/ui/control-flow/loop-break.out @@ -5,6 +5,7 @@ fn foo() -> bool { let _0: bool; // return + storage_live(_0) _0 = const false return } @@ -14,6 +15,7 @@ fn bar() -> bool { let _0: bool; // return + storage_live(_0) _0 = const true return } @@ -23,6 +25,7 @@ fn do_something() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -33,6 +36,7 @@ fn do_something_at_the_end() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -47,6 +51,7 @@ fn main() let _3: bool; // anonymous local let _4: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) // Needed a few convolutions to make it emit a `break` instead of moving the `return` diff --git a/charon/tests/ui/control-flow/loops.out b/charon/tests/ui/control-flow/loops.out index 98fa898d8..849f9c82a 100644 --- a/charon/tests/ui/control-flow/loops.out +++ b/charon/tests/ui/control-flow/loops.out @@ -408,6 +408,7 @@ pub fn test_loop1(max: u32) -> u32 let _9: u32; // anonymous local let _10: u32; // anonymous local + storage_live(_0) storage_live(_8) storage_live(_9) storage_live(_10) @@ -446,6 +447,10 @@ pub fn test_loop1(max: u32) -> u32 _0 = copy s storage_dead(s) storage_dead(i) + storage_dead(_10) + storage_dead(_9) + storage_dead(_8) + storage_dead(max) return } @@ -465,6 +470,7 @@ pub fn test_loop2(max: u32) -> u32 let _10: u32; // anonymous local let _11: u32; // anonymous local + storage_live(_0) storage_live(_10) storage_live(_11) storage_live(i) @@ -512,6 +518,9 @@ pub fn test_loop2(max: u32) -> u32 _0 = copy s storage_dead(s) storage_dead(i) + storage_dead(_11) + storage_dead(_10) + storage_dead(max) return } @@ -541,6 +550,7 @@ pub fn test_loop3(max: u32) -> u32 let _20: u32; // anonymous local let _21: u32; // anonymous local + storage_live(_0) storage_live(_15) storage_live(_17) storage_live(_18) @@ -630,6 +640,12 @@ pub fn test_loop3(max: u32) -> u32 storage_dead(s) storage_dead(j) storage_dead(i) + storage_dead(_21) + storage_dead(_20) + storage_dead(_18) + storage_dead(_17) + storage_dead(_15) + storage_dead(max) return } @@ -659,6 +675,7 @@ pub fn test_loop4(max: u32) -> u32 let _20: u32; // anonymous local let _21: u32; // anonymous local + storage_live(_0) storage_live(_15) storage_live(_17) storage_live(_18) @@ -747,6 +764,12 @@ pub fn test_loop4(max: u32) -> u32 storage_dead(s) storage_dead(j) storage_dead(i) + storage_dead(_21) + storage_dead(_20) + storage_dead(_18) + storage_dead(_17) + storage_dead(_15) + storage_dead(max) return } @@ -771,6 +794,7 @@ pub fn test_loop5(max: u32) -> u32 let _15: u32; // anonymous local let _16: u32; // anonymous local + storage_live(_0) storage_live(_12) storage_live(_13) storage_live(_15) @@ -837,6 +861,11 @@ pub fn test_loop5(max: u32) -> u32 storage_dead(s) storage_dead(j) storage_dead(i) + storage_dead(_16) + storage_dead(_15) + storage_dead(_13) + storage_dead(_12) + storage_dead(max) return } @@ -857,6 +886,7 @@ pub fn test_loop6(max: u32) -> u32 let _11: u32; // anonymous local let _12: u32; // anonymous local + storage_live(_0) storage_live(_10) storage_live(_11) storage_live(_12) @@ -908,6 +938,10 @@ pub fn test_loop6(max: u32) -> u32 _0 = copy s storage_dead(s) storage_dead(i) + storage_dead(_12) + storage_dead(_11) + storage_dead(_10) + storage_dead(max) return } @@ -931,6 +965,7 @@ pub fn test_loop7(max: u32) -> u32 let _14: u32; // anonymous local let _15: u32; // anonymous local + storage_live(_0) storage_live(_13) storage_live(_14) storage_live(_15) @@ -996,6 +1031,10 @@ pub fn test_loop7(max: u32) -> u32 _0 = copy s storage_dead(s) storage_dead(i) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(max) return } @@ -1022,6 +1061,7 @@ pub fn test_loops() let _17: bool; // anonymous local let _18: u32; // anonymous local + storage_live(_0) _0 = () storage_live(x_1) x_1 = test_loop1(const 2u32) @@ -1141,6 +1181,7 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize let _24: &'7 mut Range[{built_in impl Sized for usize}]; // anonymous local let _25: usize; // anonymous local + storage_live(_0) storage_live(_10) storage_live(_25) storage_live(s) @@ -1247,6 +1288,10 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize storage_dead(_11) _0 = copy s storage_dead(s) + storage_dead(_25) + storage_dead(_10) + storage_dead(step_in) + storage_dead(step_out) return } @@ -1269,6 +1314,7 @@ pub fn loop_inside_if(b: bool, n: u32) -> u32 let _13: u32; // anonymous local let _14: u32; // anonymous local + storage_live(_0) storage_live(_14) storage_live(_3) _3 = copy b @@ -1276,6 +1322,9 @@ pub fn loop_inside_if(b: bool, n: u32) -> u32 } else { _0 = const 0u32 storage_dead(_3) + storage_dead(_14) + storage_dead(n) + storage_dead(b) return } storage_live(s) @@ -1324,6 +1373,9 @@ pub fn loop_inside_if(b: bool, n: u32) -> u32 _0 = copy s storage_dead(s) storage_dead(_3) + storage_dead(_14) + storage_dead(n) + storage_dead(b) return } @@ -1341,6 +1393,7 @@ pub fn test_crate::sum(max: u32) -> u32 let _9: u32; // anonymous local let _10: u32; // anonymous local + storage_live(_0) storage_live(_8) storage_live(_9) storage_live(_10) @@ -1379,6 +1432,10 @@ pub fn test_crate::sum(max: u32) -> u32 _0 = copy s storage_dead(s) storage_dead(i) + storage_dead(_10) + storage_dead(_9) + storage_dead(_8) + storage_dead(max) return } @@ -1398,6 +1455,7 @@ pub fn sum_array(a: [u32; N]) -> u32 let _10: &'_ [u32; N]; // anonymous local let _11: &'_ u32; // anonymous local + storage_live(_0) storage_live(_8) storage_live(_9) storage_live(i) @@ -1436,6 +1494,11 @@ pub fn sum_array(a: [u32; N]) -> u32 _0 = copy s storage_dead(s) storage_dead(i) + storage_dead(_9) + storage_dead(_8) + storage_dead(a) + storage_dead(_11) + storage_dead(_10) return } @@ -1454,6 +1517,7 @@ pub fn clear<'_0>(v: &'_0 mut Vec[{built_in impl Sized for u32}, {built_in let _9: usize; // anonymous local let _10: usize; // anonymous local + storage_live(_0) storage_live(_10) _0 = () storage_live(i) @@ -1494,6 +1558,8 @@ pub fn clear<'_0>(v: &'_0 mut Vec[{built_in impl Sized for u32}, {built_in _0 = () storage_dead(_3) storage_dead(i) + storage_dead(_10) + storage_dead(v) return } @@ -1519,6 +1585,7 @@ pub fn get_elem_mut<'_0>(ls: &'_0 mut List[{built_in impl Sized for usize let _7: usize; // anonymous local let _8: &'7 mut List[{built_in impl Sized for usize}]; // anonymous local + storage_live(_0) loop { match (*ls) { List::Cons => { @@ -1539,6 +1606,8 @@ pub fn get_elem_mut<'_0>(ls: &'_0 mut List[{built_in impl Sized for usize storage_dead(_5) storage_dead(tl) storage_dead(y) + storage_dead(x) + storage_dead(ls) return } else { } @@ -1554,6 +1623,8 @@ pub fn get_elem_mut<'_0>(ls: &'_0 mut List[{built_in impl Sized for usize continue 0 }, List::Nil => { + storage_dead(x) + storage_dead(ls) panic(core::panicking::panic) }, } @@ -1575,6 +1646,7 @@ where let _7: &'7 mut List[TraitClause0]; // anonymous local let _8: u32; // anonymous local + storage_live(_0) storage_live(_8) loop { match (*ls) { @@ -1593,6 +1665,9 @@ where storage_dead(_5) storage_dead(tl) storage_dead(x) + storage_dead(_8) + storage_dead(i) + storage_dead(ls) return } else { } @@ -1613,6 +1688,9 @@ where }, } } + storage_dead(_8) + storage_dead(i) + storage_dead(ls) panic(core::panicking::panic) } @@ -1623,6 +1701,7 @@ pub fn loop_break_1() let x: i32; // local let _2: bool; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 @@ -1653,6 +1732,7 @@ pub fn loop_break_2() let x: i32; // local let _2: bool; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 @@ -1684,6 +1764,7 @@ pub fn interleaved_loops() let _2: bool; // anonymous local let _3: bool; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 @@ -1729,6 +1810,7 @@ pub fn interleaved_loops2() let _2: bool; // anonymous local let _3: bool; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 @@ -1779,6 +1861,7 @@ pub fn loop_after_loop() let _4: bool; // anonymous local let _5: i32; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 @@ -1827,6 +1910,7 @@ pub fn trick_exit_computation() let _0: (); // return let x: i32; // local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 diff --git a/charon/tests/ui/control-flow/simple-fallthrough.out b/charon/tests/ui/control-flow/simple-fallthrough.out index 25270c0d4..d3348bc4d 100644 --- a/charon/tests/ui/control-flow/simple-fallthrough.out +++ b/charon/tests/ui/control-flow/simple-fallthrough.out @@ -27,6 +27,7 @@ fn do_something() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -37,6 +38,7 @@ fn do_something_else() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -47,6 +49,7 @@ fn do_something_at_the_end() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -64,6 +67,7 @@ fn foo(opt: Option[{built_in impl Sized for u32}]) let _6: bool; // anonymous local let _7: u32; // anonymous local + storage_live(_0) storage_live(_3) _0 = () storage_live(_2) @@ -97,6 +101,8 @@ fn foo(opt: Option[{built_in impl Sized for u32}]) } storage_dead(_2) _0 = do_something_at_the_end() + storage_dead(_3) + storage_dead(opt) return } diff --git a/charon/tests/ui/control-flow/ullbc-control-flow.out b/charon/tests/ui/control-flow/ullbc-control-flow.out index d9a9fa673..f7edfac39 100644 --- a/charon/tests/ui/control-flow/ullbc-control-flow.out +++ b/charon/tests/ui/control-flow/ullbc-control-flow.out @@ -263,6 +263,7 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize let _30: usize; // anonymous local bb0: { + storage_live(_0); storage_live(_10); storage_live(_11); storage_live(_19); @@ -277,6 +278,13 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize } bb1: { + storage_dead(_28); + storage_dead(_27); + storage_dead(_19); + storage_dead(_11); + storage_dead(_10); + storage_dead(step_in); + storage_dead(step_out); unwind_continue; } @@ -325,6 +333,13 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize } bb7: { + storage_dead(_28); + storage_dead(_27); + storage_dead(_19); + storage_dead(_11); + storage_dead(_10); + storage_dead(step_in); + storage_dead(step_out); undefined_behavior; } @@ -358,6 +373,13 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize storage_dead(_12); _0 = copy s; storage_dead(s); + storage_dead(_28); + storage_dead(_27); + storage_dead(_19); + storage_dead(_11); + storage_dead(_10); + storage_dead(step_in); + storage_dead(step_out); return; } @@ -372,6 +394,13 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize } bb13: { + storage_dead(_28); + storage_dead(_27); + storage_dead(_19); + storage_dead(_11); + storage_dead(_10); + storage_dead(step_in); + storage_dead(step_out); undefined_behavior; } @@ -418,6 +447,13 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize } bb19: { + storage_dead(_28); + storage_dead(_27); + storage_dead(_19); + storage_dead(_11); + storage_dead(_10); + storage_dead(step_in); + storage_dead(step_out); undefined_behavior; } @@ -431,6 +467,13 @@ pub fn nested_loops_enum(step_out: usize, step_in: usize) -> usize bb21: { storage_dead(_30); + storage_dead(_28); + storage_dead(_27); + storage_dead(_19); + storage_dead(_11); + storage_dead(_10); + storage_dead(step_in); + storage_dead(step_out); panic(core::panicking::panic); } } diff --git a/charon/tests/ui/copy_nonoverlapping.out b/charon/tests/ui/copy_nonoverlapping.out index ed68901a0..f00bccb7a 100644 --- a/charon/tests/ui/copy_nonoverlapping.out +++ b/charon/tests/ui/copy_nonoverlapping.out @@ -49,6 +49,7 @@ where let _3: Self; // anonymous local let _4: &'4 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -59,6 +60,8 @@ where (*self) = move _3 _0 = () storage_dead(_3) + storage_dead(source) + storage_dead(self) return } @@ -68,7 +71,9 @@ pub fn clone<'_0>(self: &'_0 usize) -> usize let _0: usize; // return let self: &'1 usize; // arg #1 + storage_live(_0) _0 = copy (*self) + storage_dead(self) return } @@ -83,6 +88,7 @@ where let _3: usize; // anonymous local let _4: &'4 usize; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -93,6 +99,8 @@ where (*self) = move _3 _0 = () storage_dead(_3) + storage_dead(source) + storage_dead(self) return } @@ -151,6 +159,7 @@ fn core::ub_checks::check_language_ub::runtime() -> bool { let _0: bool; // return + storage_live(_0) _0 = ~(const true) return } @@ -183,6 +192,7 @@ fn core::panic::panic_info::{PanicInfo<'a>}::new<'a>(message: &'a Arguments<'a>, let _7: bool; // anonymous local let _8: bool; // anonymous local + storage_live(_0) storage_live(_5) _5 = &(*location) storage_live(_6) @@ -196,6 +206,10 @@ fn core::panic::panic_info::{PanicInfo<'a>}::new<'a>(message: &'a Arguments<'a>, storage_dead(_7) storage_dead(_6) storage_dead(_5) + storage_dead(force_no_backtrace) + storage_dead(can_unwind) + storage_dead(location) + storage_dead(message) return } @@ -204,6 +218,7 @@ pub fn caller<'a>() -> &'static Location<'static> { let _0: &'3 Location<'4>; // return + storage_live(_0) _0 = caller_location() return } @@ -224,6 +239,7 @@ fn core::panicking::panic_nounwind_fmt::runtime<'_0>(fmt: Arguments<'_0>, force_ let _11: &'19 PanicInfo<'20>; // anonymous local let _12: &'21 PanicInfo<'22>; // anonymous local + storage_live(_0) storage_live(_3) _3 = const false if move _3 { @@ -251,9 +267,23 @@ fn core::panicking::panic_nounwind_fmt::runtime<'_0>(fmt: Arguments<'_0>, force_ _12 = &pi _11 = &(*_12) _0 = panic_impl<'30, '31>(move _11) + storage_dead(_12) + storage_dead(_11) + storage_dead(pi) + storage_dead(_4) + storage_dead(force_no_backtrace) + storage_dead(fmt) + undefined_behavior } storage_live(_4) _4 = abort() + storage_dead(_12) + storage_dead(_11) + storage_dead(pi) + storage_dead(_4) + storage_dead(force_no_backtrace) + storage_dead(fmt) + undefined_behavior } pub fn core::intrinsics::size_of() -> usize @@ -363,10 +393,12 @@ pub fn count_ones(self: usize) -> u32 let self: usize; // arg #1 let _2: usize; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy self _0 = ctpop[{built_in impl Sized for usize}, impl_Copy_for_usize](move _2) storage_dead(_2) + storage_dead(self) return } @@ -378,6 +410,7 @@ pub fn is_power_of_two(self: usize) -> bool let _2: u32; // anonymous local let _3: usize; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy self @@ -385,6 +418,7 @@ pub fn is_power_of_two(self: usize) -> bool storage_dead(_3) _0 = move _2 == const 1u32 storage_dead(_2) + storage_dead(self) return } @@ -395,18 +429,21 @@ fn check_language_ub() -> bool let _1: bool; // anonymous local let _2: bool; // anonymous local + storage_live(_0) storage_live(_1) _1 = core::ub_checks::check_language_ub::runtime() if move _1 { } else { _0 = const false storage_dead(_1) + storage_dead(_2) return } storage_live(_2) _2 = ub_checks _0 = move _2 storage_dead(_1) + storage_dead(_2) return } @@ -420,6 +457,7 @@ pub fn panic_nounwind_fmt<'_0>(fmt: Arguments<'_0>, force_no_backtrace: bool) -> let _4: Arguments<'4>; // anonymous local let _5: bool; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy fmt @@ -429,6 +467,10 @@ pub fn panic_nounwind_fmt<'_0>(fmt: Arguments<'_0>, force_no_backtrace: bool) -> storage_dead(_5) storage_dead(_4) _0 = core::panicking::panic_nounwind_fmt::runtime<'6>(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(force_no_backtrace) + storage_dead(fmt) + undefined_behavior } fn core::mem::alignment::{Alignment}::new_unchecked::precondition_check(align: usize) @@ -442,6 +484,7 @@ fn core::mem::alignment::{Alignment}::new_unchecked::precondition_check(align: u let _6: Arguments<'3>; // anonymous local let _7: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -459,10 +502,19 @@ fn core::mem::alignment::{Alignment}::new_unchecked::precondition_check(align: u _6 = from_str<'6>(move _7) storage_dead(_7) _5 = panic_nounwind_fmt<'8>(move _6, const false) + storage_dead(_6) + storage_dead(_5) + storage_dead(msg) + storage_dead(align) + undefined_behavior } storage_dead(_3) _0 = () storage_dead(_2) + storage_dead(_6) + storage_dead(_5) + storage_dead(msg) + storage_dead(align) return } @@ -476,6 +528,7 @@ pub unsafe fn new_unchecked(align: usize) -> Alignment let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_2) _2 = check_language_ub() if move _2 { @@ -492,6 +545,7 @@ pub unsafe fn new_unchecked(align: usize) -> Alignment _5 = copy align _0 = transmute(move _5) storage_dead(_5) + storage_dead(align) return } @@ -504,6 +558,7 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option let _4: Alignment; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy align @@ -513,6 +568,7 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option storage_dead(_3) _0 = Option::None { } storage_dead(_2) + storage_dead(align) return } storage_dead(_3) @@ -524,6 +580,7 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option _0 = Option::Some { 0: move _4 } storage_dead(_4) storage_dead(_2) + storage_dead(align) return } @@ -531,6 +588,7 @@ pub fn core::num::{usize}::MAX() -> usize { let _0: usize; // return + storage_live(_0) _0 = ~(const 0usize) return } @@ -542,6 +600,7 @@ pub fn core::num::{isize}::MAX() -> isize let _0: isize; // return let _1: usize; // anonymous local + storage_live(_0) storage_live(_1) _1 = copy core::num::{usize}::MAX panic.>> const 1i32 _0 = cast(move _1) @@ -575,6 +634,7 @@ where let _3: usize; // anonymous local let _4: usize; // anonymous local + storage_live(_0) storage_live(_1) _1 = const TraitClause0::SIZE switch copy _1 { @@ -613,6 +673,7 @@ where { let _0: Layout; // return + storage_live(_0) _0 = from_size_align_unchecked(const TraitClause0::SIZE, const TraitClause0::ALIGN) return } @@ -630,6 +691,7 @@ where { let _0: bool; // return + storage_live(_0) _0 = const TraitClause0::SIZE == const 0usize return } @@ -645,6 +707,7 @@ fn unwrap_failed() -> ! { let _0: !; // return + storage_live(_0) panic(core::panicking::panic) } @@ -659,6 +722,7 @@ where let val: T; // local let _3: !; // anonymous local + storage_live(_0) match self { Option::None => { }, @@ -667,11 +731,16 @@ where val = move (self as variant Option::Some).0 _0 = move val storage_dead(val) + storage_dead(_3) + storage_dead(self) return }, } storage_live(_3) _3 = unwrap_failed() + storage_dead(_3) + storage_dead(self) + undefined_behavior } // Full name: core::mem::SizedTypeProperties::ALIGNMENT @@ -682,6 +751,7 @@ where let _0: Alignment; // return let _1: Option[{built_in impl Sized for Alignment}]; // anonymous local + storage_live(_0) storage_live(_1) _1 = core::mem::alignment::{Alignment}::new(const TraitClause0::ALIGN) _0 = unwrap[{built_in impl Sized for Alignment}](move _1) @@ -703,6 +773,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = core::intrinsics::align_of[TraitClause0::ImpliedClause0]() return } @@ -722,6 +793,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = core::intrinsics::size_of[TraitClause0::ImpliedClause0]() return } @@ -755,6 +827,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy SIZE[impl_SizedTypeProperties_for_T[TraitClause0]] return } @@ -766,6 +839,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy ALIGN[impl_SizedTypeProperties_for_T[TraitClause0]] return } @@ -796,6 +870,7 @@ where let _14: *mut T; // anonymous local let _15: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_4) _4 = check_language_ub() @@ -837,6 +912,9 @@ where storage_dead(_15) storage_dead(_14) storage_dead(_13) + storage_dead(count) + storage_dead(dst) + storage_dead(src) return } @@ -852,6 +930,7 @@ where let _4: *const T; // anonymous local let _5: *mut T; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -863,6 +942,8 @@ where storage_dead(_4) storage_dead(_3) _0 = () + storage_dead(y) + storage_dead(x) return } diff --git a/charon/tests/ui/cross_compile_32_bit.out b/charon/tests/ui/cross_compile_32_bit.out index e98accb3f..d05f00b41 100644 --- a/charon/tests/ui/cross_compile_32_bit.out +++ b/charon/tests/ui/cross_compile_32_bit.out @@ -35,6 +35,7 @@ fn main() let _8: NonNull; // anonymous local let _9: *mut usize; // anonymous local + storage_live(_0) storage_live(_6) _0 = () storage_live(x) @@ -63,6 +64,7 @@ fn main() storage_dead(z) storage_dead(y) storage_dead(x) + storage_dead(_6) return } diff --git a/charon/tests/ui/cross_compile_big_endian.out b/charon/tests/ui/cross_compile_big_endian.out index 460bb17c7..ac81c316b 100644 --- a/charon/tests/ui/cross_compile_big_endian.out +++ b/charon/tests/ui/cross_compile_big_endian.out @@ -16,6 +16,7 @@ fn S() -> [u8; 16usize] { let _0: [u8; 16usize]; // return + storage_live(_0) _0 = to_ne_bytes(const 24197857199965561741520400062332047378u128) return } @@ -42,6 +43,7 @@ fn main() let a: u128; // local let b: HasBEDiscr; // local + storage_live(_0) storage_live(_6) _0 = () storage_live(x) @@ -67,6 +69,7 @@ fn main() storage_dead(z) storage_dead(y) storage_dead(x) + storage_dead(_6) return } diff --git a/charon/tests/ui/demo.out b/charon/tests/ui/demo.out index 1419883b9..9e39a61c4 100644 --- a/charon/tests/ui/demo.out +++ b/charon/tests/ui/demo.out @@ -30,6 +30,7 @@ where let _6: bool; // anonymous local let _7: &'6 mut T; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) storage_live(_6) @@ -47,6 +48,9 @@ where _0 = &mut (*_4) storage_dead(_5) storage_dead(_4) + storage_dead(y) + storage_dead(x) + storage_dead(b) return } @@ -61,6 +65,7 @@ pub fn mul2_add1(x: u32) -> u32 let _5: u32; // anonymous local let _6: u32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_6) storage_live(_2) @@ -75,6 +80,9 @@ pub fn mul2_add1(x: u32) -> u32 _6 = copy _2 panic.+ const 1u32 _0 = move _6 storage_dead(_2) + storage_dead(_6) + storage_dead(_5) + storage_dead(x) return } @@ -89,6 +97,7 @@ pub fn use_mul2_add1(x: u32, y: u32) -> u32 let _5: u32; // anonymous local let _6: u32; // anonymous local + storage_live(_0) storage_live(_6) storage_live(_3) storage_live(_4) @@ -101,6 +110,9 @@ pub fn use_mul2_add1(x: u32, y: u32) -> u32 _0 = move _6 storage_dead(_5) storage_dead(_3) + storage_dead(_6) + storage_dead(y) + storage_dead(x) return } @@ -110,11 +122,14 @@ pub fn test_crate::incr<'a>(x: &'a mut u32) let x: &'1 mut u32; // arg #1 let _2: u32; // anonymous local + storage_live(_0) storage_live(_2) _0 = () _2 = copy (*x) panic.+ const 1u32 (*x) = move _2 _0 = () + storage_dead(_2) + storage_dead(x) return } @@ -133,6 +148,7 @@ pub fn use_incr() let _9: &'5 mut u32; // anonymous local let _10: &'6 mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0u32 @@ -195,11 +211,15 @@ where let _10: u32; // anonymous local let _11: u32; // anonymous local + storage_live(_0) storage_live(_11) match (*l) { CList::CCons => { }, CList::CNil => { + storage_dead(_11) + storage_dead(i) + storage_dead(l) panic(core::panicking::panic) }, } @@ -231,6 +251,9 @@ where storage_dead(_5) storage_dead(tl) storage_dead(x) + storage_dead(_11) + storage_dead(i) + storage_dead(l) return } storage_dead(_6) @@ -238,6 +261,9 @@ where storage_dead(_5) storage_dead(tl) storage_dead(x) + storage_dead(_11) + storage_dead(i) + storage_dead(l) return } @@ -264,6 +290,7 @@ where let _15: u32; // anonymous local let _16: u32; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_3) storage_live(_4) @@ -271,6 +298,9 @@ where CList::CCons => { }, CList::CNil => { + storage_dead(_16) + storage_dead(i) + storage_dead(l) panic(core::panicking::panic) }, } @@ -318,6 +348,9 @@ where _0 = &mut (*_3) storage_dead(_4) storage_dead(_3) + storage_dead(_16) + storage_dead(i) + storage_dead(l) return } @@ -336,6 +369,7 @@ where let _7: u32; // anonymous local let _8: &'7 mut CList[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_7) loop { match (*l) { @@ -354,6 +388,9 @@ where storage_dead(_5) storage_dead(tl) storage_dead(x) + storage_dead(_7) + storage_dead(i) + storage_dead(l) return } else { } @@ -374,6 +411,9 @@ where }, } } + storage_dead(_7) + storage_dead(i) + storage_dead(l) panic(core::panicking::panic) } @@ -390,6 +430,7 @@ pub fn i32_id(i: i32) -> i32 let _7: i32; // anonymous local let _8: i32; // anonymous local + storage_live(_0) storage_live(_7) storage_live(_8) storage_live(_2) @@ -412,11 +453,17 @@ pub fn i32_id(i: i32) -> i32 _0 = move _8 storage_dead(_4) storage_dead(_2) + storage_dead(_8) + storage_dead(_7) + storage_dead(i) return } storage_dead(_3) _0 = const 0i32 storage_dead(_2) + storage_dead(_8) + storage_dead(_7) + storage_dead(i) return } @@ -433,6 +480,7 @@ where let _5: &'7 mut CList[TraitClause0]; // anonymous local let _6: &'8 mut CList[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) match (*l) { @@ -456,6 +504,7 @@ where _0 = &mut (*_2) storage_dead(_3) storage_dead(_2) + storage_dead(l) return } @@ -475,6 +524,7 @@ pub fn impl_Counter_for_usize::incr<'_0>(self: &'_0 mut usize) -> usize let x: usize; // local let _3: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(x) x = copy (*self) @@ -482,6 +532,8 @@ pub fn impl_Counter_for_usize::incr<'_0>(self: &'_0 mut usize) -> usize (*self) = move _3 _0 = copy x storage_dead(x) + storage_dead(_3) + storage_dead(self) return } @@ -502,10 +554,12 @@ where let cnt: &'1 mut T; // arg #1 let _2: &'2 mut T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &two-phase-mut (*cnt) _0 = TraitClause1::incr<'3>(move _2) storage_dead(_2) + storage_dead(cnt) return } diff --git a/charon/tests/ui/desugar_drops_to_calls.out b/charon/tests/ui/desugar_drops_to_calls.out index 7ed4adbe2..d2a5c1dd4 100644 --- a/charon/tests/ui/desugar_drops_to_calls.out +++ b/charon/tests/ui/desugar_drops_to_calls.out @@ -96,12 +96,16 @@ fn use_string(_1: String) let drop_arg: &'_ mut String; // local let drop_ret: (); // local + storage_live(_0) _0 = () _0 = () storage_live(drop_arg) drop_arg = &mut _1 storage_live(drop_ret) drop_ret = impl_Destruct_for_String::drop_glue<'0>(move drop_arg) + storage_dead(_1) + storage_dead(drop_ret) + storage_dead(drop_arg) return } @@ -113,12 +117,16 @@ fn use_vec(_1: Vec[{built_in impl Sized for i32}, {built_in impl Sized for let drop_arg: &'_ mut Vec[{built_in impl Sized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]; // local let drop_ret: (); // local + storage_live(_0) _0 = () _0 = () storage_live(drop_arg) drop_arg = &mut _1 storage_live(drop_ret) drop_ret = impl_Destruct_for_Vec::drop_glue<'0, i32, Global>[{built_in impl Sized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global](move drop_arg) + storage_dead(_1) + storage_dead(drop_ret) + storage_dead(drop_arg) return } @@ -133,12 +141,16 @@ where let drop_arg: &'_ mut T; // local let drop_ret: (); // local + storage_live(_0) _0 = () _0 = () storage_live(drop_arg) drop_arg = &mut _1 storage_live(drop_ret) drop_ret = TraitClause1::drop_glue<'0>(move drop_arg) + storage_dead(_1) + storage_dead(drop_ret) + storage_dead(drop_arg) return } @@ -148,8 +160,10 @@ fn skip_drop_scalar(_1: i32) let _0: (); // return let _1: i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -167,6 +181,7 @@ pub fn impl_Drop_for_Point::drop<'_0>(self: &'_0 mut Point) let _2: (); // anonymous local let _3: Arguments<'3>; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -175,6 +190,7 @@ pub fn impl_Drop_for_Point::drop<'_0>(self: &'_0 mut Point) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -190,6 +206,7 @@ unsafe fn impl_Destruct_for_Point::drop_glue<'_0>(_1: &'_0 mut Point) let drop_arg_6: &'_ mut alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]; // local let drop_ret_7: (); // local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = () @@ -203,6 +220,13 @@ unsafe fn impl_Destruct_for_Point::drop_glue<'_0>(_1: &'_0 mut Point) drop_arg_6 = &mut ((*_1)).y storage_live(drop_ret_7) drop_ret_7 = impl_Destruct_for_Box::drop_glue<'8, i32, Global>[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global](move drop_arg_6) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) + storage_dead(drop_ret_7) + storage_dead(drop_arg_6) + storage_dead(drop_ret_5) + storage_dead(drop_arg_4) return } @@ -230,6 +254,7 @@ fn main() let drop_arg: &'_ mut Point; // local let drop_ret: (); // local + storage_live(_0) _0 = () storage_live(p) storage_live(_2) @@ -245,6 +270,8 @@ fn main() storage_live(drop_ret) drop_ret = impl_Destruct_for_Point::drop_glue<'1>(move drop_arg) storage_dead(p) + storage_dead(drop_ret) + storage_dead(drop_arg) return } diff --git a/charon/tests/ui/desugar_drops_to_calls_mono.out b/charon/tests/ui/desugar_drops_to_calls_mono.out index 752e9586b..14d4d1b79 100644 --- a/charon/tests/ui/desugar_drops_to_calls_mono.out +++ b/charon/tests/ui/desugar_drops_to_calls_mono.out @@ -79,12 +79,16 @@ fn use_string(_1: String) let drop_arg: &'_ mut String; // local let drop_ret: (); // local + storage_live(_0) _0 = () _0 = () storage_live(drop_arg) drop_arg = &mut _1 storage_live(drop_ret) drop_ret = impl_Destruct_for_String::drop_glue<'0>(move drop_arg) + storage_dead(_1) + storage_dead(drop_ret) + storage_dead(drop_arg) return } @@ -96,12 +100,16 @@ fn use_vec(_1: Vec::) let drop_arg: &'_ mut Vec::; // local let drop_ret: (); // local + storage_live(_0) _0 = () _0 = () storage_live(drop_arg) drop_arg = &mut _1 storage_live(drop_ret) drop_ret = {impl Destruct for Vec::}::drop_glue::<'0>(move drop_arg) + storage_dead(_1) + storage_dead(drop_ret) + storage_dead(drop_arg) return } @@ -111,8 +119,10 @@ fn skip_drop_scalar(_1: i32) let _0: (); // return let _1: i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -130,6 +140,7 @@ pub fn drop<'_0>(self: &'_0 mut Point) let _2: (); // anonymous local let _3: Arguments::<'_>; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -138,6 +149,7 @@ pub fn drop<'_0>(self: &'_0 mut Point) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -153,6 +165,7 @@ unsafe fn impl_Destruct_for_Point::drop_glue<'_0>(_1: &'_0 mut Point) let drop_arg_6: &'_ mut alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]; // local let drop_ret_7: (); // local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = () @@ -166,6 +179,13 @@ unsafe fn impl_Destruct_for_Point::drop_glue<'_0>(_1: &'_0 mut Point) drop_arg_6 = &mut ((*_1)).y storage_live(drop_ret_7) drop_ret_7 = impl_Destruct_for_Box_i32_Global::drop_glue::<'8>(move drop_arg_6) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) + storage_dead(drop_ret_7) + storage_dead(drop_arg_6) + storage_dead(drop_ret_5) + storage_dead(drop_arg_4) return } @@ -192,6 +212,7 @@ fn main() let drop_arg: &'_ mut Point; // local let drop_ret: (); // local + storage_live(_0) _0 = () storage_live(p) storage_live(_2) @@ -207,6 +228,8 @@ fn main() storage_live(drop_ret) drop_ret = impl_Destruct_for_Point::drop_glue<'1>(move drop_arg) storage_dead(p) + storage_dead(drop_ret) + storage_dead(drop_arg) return } diff --git a/charon/tests/ui/disambiguator.out b/charon/tests/ui/disambiguator.out index 89d44d90c..b74aee98c 100644 --- a/charon/tests/ui/disambiguator.out +++ b/charon/tests/ui/disambiguator.out @@ -4,6 +4,7 @@ fn test_crate::nonzero_disambiguator::my_function#1() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -13,6 +14,7 @@ fn test_crate::nonzero_disambiguator::my_function() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -24,6 +26,7 @@ fn nonzero_disambiguator() let _0: (); // return let _1: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const true diff --git a/charon/tests/ui/diverging.out b/charon/tests/ui/diverging.out index f4bfd52fc..64c225623 100644 --- a/charon/tests/ui/diverging.out +++ b/charon/tests/ui/diverging.out @@ -6,6 +6,8 @@ fn my_panic(_x: u32) -> ! let _0: !; // return let _x: u32; // arg #1 + storage_live(_0) + storage_dead(_x) panic(core::panicking::panic) } @@ -14,6 +16,7 @@ fn do_something_else() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -25,9 +28,12 @@ fn call_my_panic() let _0: (); // return let _1: !; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = my_panic(const 0u32) + storage_dead(_1) + undefined_behavior } diff --git a/charon/tests/ui/drop_after_overflow.out b/charon/tests/ui/drop_after_overflow.out index 34a86fbfe..6d4b8b127 100644 --- a/charon/tests/ui/drop_after_overflow.out +++ b/charon/tests/ui/drop_after_overflow.out @@ -50,6 +50,7 @@ pub fn impl_Drop_for_Foo::drop<'_0>(self: &'_0 mut Foo) let _3: Arguments<'3>; // anonymous local bb0: { + storage_live(_0); _0 = (); storage_live(_2); storage_live(_3); @@ -57,6 +58,7 @@ pub fn impl_Drop_for_Foo::drop<'_0>(self: &'_0 mut Foo) } bb1: { + storage_dead(self); unwind_continue; } @@ -68,6 +70,7 @@ pub fn impl_Drop_for_Foo::drop<'_0>(self: &'_0 mut Foo) storage_dead(_3); storage_dead(_2); _0 = (); + storage_dead(self); return; } } @@ -81,6 +84,7 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut Foo) let _3: (); // anonymous local bb0: { + storage_live(_0); storage_live(_2); storage_live(_3); _0 = (); @@ -89,10 +93,16 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut Foo) } bb1: { + storage_dead(_3); + storage_dead(_2); + storage_dead(_1); unwind_continue; } bb2: { + storage_dead(_3); + storage_dead(_2); + storage_dead(_1); return; } } @@ -120,6 +130,7 @@ fn main() let f_ref: &'1 Foo; // local bb0: { + storage_live(_0); storage_live(_3); _0 = (); storage_live(f); @@ -144,15 +155,18 @@ fn main() } bb3: { + storage_dead(_3); unwind_continue; } bb4: { + storage_dead(_3); unwind_terminate; } bb5: { storage_dead(f); + storage_dead(_3); return; } } diff --git a/charon/tests/ui/dyn-trait.out b/charon/tests/ui/dyn-trait.out index c19aed61d..8255ecdb9 100644 --- a/charon/tests/ui/dyn-trait.out +++ b/charon/tests/ui/dyn-trait.out @@ -109,10 +109,12 @@ fn destruct<'_0>(x: &'_0 (dyn Display + '_0)) -> String let x: &'3 (dyn Display + '4); // arg #1 let _2: &'5 (dyn Display + '6); // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) with_metadata(copy x.metadata) _0 = to_string<'15, (dyn Display + '9)>[{built_in impl MetaSized for (dyn Display + '11)}, Display<(dyn Display + '13)>](move _2) storage_dead(_2) + storage_dead(x) return } @@ -129,8 +131,11 @@ where let _1: &'7 (dyn for<'a> Fn<(&'a T,), ImpliedClause1::ImpliedClause1::Output = T> + '8); // arg #1 let _2: &'13 (dyn PartialEq[TraitClause0]> + '14); // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(_2) + storage_dead(_1) return } @@ -140,8 +145,10 @@ fn bar<'_0>(_1: &'_0 (dyn for<'_0_2> Fn<(&'_0_2 (dyn Display + '_0_2),), Implied let _0: (); // return let _1: &'12 (dyn for<'_0_2> Fn<(&'_0_2 (dyn Display + '_0_2),), ImpliedClause1::ImpliedClause1::Output = ()> + '13); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } diff --git a/charon/tests/ui/dyn-with-diamond-supertraits.out b/charon/tests/ui/dyn-with-diamond-supertraits.out index aadac9595..232e97ff8 100644 --- a/charon/tests/ui/dyn-with-diamond-supertraits.out +++ b/charon/tests/ui/dyn-with-diamond-supertraits.out @@ -126,6 +126,7 @@ fn super_method<'_0>(self: &'_0 i32, arg: i32) -> i32 let _3: &'2 i32; // anonymous local let _4: i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy self storage_live(_4) @@ -133,6 +134,8 @@ fn super_method<'_0>(self: &'_0 i32, arg: i32) -> i32 _0 = add<'3>(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(arg) + storage_dead(self) return } @@ -144,9 +147,13 @@ fn impl_Super_i32_for_i32::super_method::{vtable_method}<'_0>(_1: &'_0 (dyn Supe let _2: i32; // arg #2 let _3: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = concretize<&'_0 (dyn Super + '1), &'_0 i32>(move _1) _0 = super_method<'_0>(move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -157,9 +164,12 @@ unsafe fn impl_Super_i32_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dy let dyn_self: &'_0 mut (dyn Super + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Super + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -172,6 +182,7 @@ fn impl_Super_i32_for_i32::{vtable}() -> test_crate::Super::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Super + '1)); // anonymous local let _4: fn<'_0_1>(&'_0_1 (dyn Super + '3), i32) -> i32; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -181,6 +192,10 @@ fn impl_Super_i32_for_i32::{vtable}() -> test_crate::Super::{vtable} storage_live(_4) _4 = cast impl_Super_i32_for_i32::super_method::{vtable_method}<'2>, fn<'_0_1>(&'_0_1 (dyn Super + '3), i32) -> i32>(const impl_Super_i32_for_i32::super_method::{vtable_method}<'2>) ret = test_crate::Super::{vtable} { size: move size, align: move align, drop: move _3, method_super_method: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -203,12 +218,15 @@ fn internal_method<'_0>(self: &'_0 i32) -> i32 let _2: i32; // anonymous local let _3: i32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_2) _2 = copy (*self) _3 = copy _2 panic.+ const 1i32 _0 = move _3 storage_dead(_2) + storage_dead(_3) + storage_dead(self) return } @@ -219,9 +237,12 @@ fn impl_Internal_for_i32::internal_method::{vtable_method}<'_0>(_1: &'_0 (dyn In let _1: &'_0 (dyn Internal + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Internal + '1), &'_0 i32>(move _1) _0 = internal_method<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -232,9 +253,12 @@ unsafe fn impl_Internal_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn let dyn_self: &'_0 mut (dyn Internal + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Internal + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -247,6 +271,7 @@ fn impl_Internal_for_i32::{vtable}() -> test_crate::Internal::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Internal + '1)); // anonymous local let _4: fn<'_0_1>(&'_0_1 (dyn Internal + '3)) -> i32; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -256,6 +281,10 @@ fn impl_Internal_for_i32::{vtable}() -> test_crate::Internal::{vtable} storage_live(_4) _4 = cast impl_Internal_for_i32::internal_method::{vtable_method}<'2>, fn<'_0_1>(&'_0_1 (dyn Internal + '3)) -> i32>(const impl_Internal_for_i32::internal_method::{vtable_method}<'2>) ret = test_crate::Internal::{vtable} { size: move size, align: move align, drop: move _3, method_internal_method: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -279,12 +308,15 @@ fn left_method<'_0>(self: &'_0 i32) -> i32 let _2: i32; // anonymous local let _3: i32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_2) _2 = copy (*self) _3 = copy _2 panic.+ const 2i32 _0 = move _3 storage_dead(_2) + storage_dead(_3) + storage_dead(self) return } @@ -295,9 +327,12 @@ fn impl_Left_for_i32::left_method::{vtable_method}<'_0>(_1: &'_0 (dyn Left + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Left + '1), &'_0 i32>(move _1) _0 = left_method<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -308,9 +343,12 @@ unsafe fn impl_Left_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Lef let dyn_self: &'_0 mut (dyn Left + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Left + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -324,6 +362,7 @@ fn impl_Left_for_i32::{vtable}() -> test_crate::Left::{vtable} let _4: fn<'_0_1>(&'_0_1 (dyn Left + '3)) -> i32; // anonymous local let _5: &'static test_crate::Internal::{vtable}; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -335,6 +374,11 @@ fn impl_Left_for_i32::{vtable}() -> test_crate::Left::{vtable} storage_live(_5) _5 = &impl_Internal_for_i32::{vtable} ret = test_crate::Left::{vtable} { size: move size, align: move align, drop: move _3, method_left_method: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}), super_trait_1: move _5 } + storage_dead(align) + storage_dead(size) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) return } @@ -367,6 +411,7 @@ fn right_method<'_0>(self: &'_0 i32) -> i32 let _10: &'3 i32; // anonymous local let _11: i32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_8) storage_live(_11) @@ -395,6 +440,10 @@ fn right_method<'_0>(self: &'_0 i32) -> i32 _0 = move _11 storage_dead(_9) storage_dead(_2) + storage_dead(_11) + storage_dead(_8) + storage_dead(_5) + storage_dead(self) return } @@ -405,9 +454,12 @@ fn impl_Right_i32_for_i32::right_method::{vtable_method}<'_0>(_1: &'_0 (dyn Righ let _1: &'_0 (dyn Right + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Right + '1), &'_0 i32>(move _1) _0 = right_method<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -418,9 +470,12 @@ unsafe fn impl_Right_i32_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dy let dyn_self: &'_0 mut (dyn Right + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Right + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -435,6 +490,7 @@ fn impl_Right_i32_for_i32::{vtable}() -> test_crate::Right::{vtable}; // anonymous local let _6: &'static test_crate::Super::{vtable}; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -448,6 +504,12 @@ fn impl_Right_i32_for_i32::{vtable}() -> test_crate::Right::{vtable}(self: &'_0 i32) -> (i32, i32) let _4: i32; // anonymous local let _5: &'3 i32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &(*self) @@ -489,6 +552,7 @@ fn join_method<'_0>(self: &'_0 i32) -> (i32, i32) _0 = (move _2, move _4) storage_dead(_4) storage_dead(_2) + storage_dead(self) return } @@ -499,9 +563,12 @@ fn impl_Join_i32_for_i32::join_method::{vtable_method}<'_0>(_1: &'_0 (dyn Join + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Join + '1), &'_0 i32>(move _1) _0 = join_method<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -512,9 +579,12 @@ unsafe fn impl_Join_i32_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn let dyn_self: &'_0 mut (dyn Join + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Join + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -529,6 +599,7 @@ fn impl_Join_i32_for_i32::{vtable}() -> test_crate::Join::{vtable}; // anonymous local let _6: &'static test_crate::Right::{vtable}; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -542,6 +613,12 @@ fn impl_Join_i32_for_i32::{vtable}() -> test_crate::Join::{vtable}] x + storage_dead(x) return } @@ -72,9 +74,11 @@ where let _0: (); // return let x: U; // arg #1 + storage_live(_0) _0 = () _0 = () drop[TraitClause1::drop_glue<'0>] x + storage_dead(x) return } @@ -104,10 +108,13 @@ where let _x: T; // arg #1 let _y: X; // arg #2 + storage_live(_0) _0 = () _0 = () drop[TraitClause4::drop_glue<'0>] _y drop[TraitClause3::drop_glue<'1>] _x + storage_dead(_y) + storage_dead(_x) return } @@ -118,6 +125,7 @@ fn main() let _1: (); // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/extern-abi-fn-pointer.out b/charon/tests/ui/extern-abi-fn-pointer.out index c490530ea..612386ce5 100644 --- a/charon/tests/ui/extern-abi-fn-pointer.out +++ b/charon/tests/ui/extern-abi-fn-pointer.out @@ -6,7 +6,9 @@ pub fn rust_id(x: u32) -> u32 let _0: u32; // return let x: u32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -16,7 +18,9 @@ pub extern "C" fn c_id(x: u32) -> u32 let _0: u32; // return let x: u32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -25,6 +29,7 @@ pub fn get_rust_fn() -> fn(u32) -> u32 { let _0: fn(u32) -> u32; // return + storage_live(_0) _0 = cast u32>(const rust_id) return } @@ -34,6 +39,7 @@ pub fn get_c_fn() -> extern "C" fn(u32) -> u32 { let _0: extern "C" fn(u32) -> u32; // return + storage_live(_0) _0 = cast u32>(const c_id) return } diff --git a/charon/tests/ui/external.out b/charon/tests/ui/external.out index 292eeef37..b1ff77249 100644 --- a/charon/tests/ui/external.out +++ b/charon/tests/ui/external.out @@ -220,6 +220,7 @@ where let _3: &'3 mut T; // anonymous local let _4: &'4 mut T; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &two-phase-mut (*x) @@ -228,6 +229,8 @@ where _0 = core::mem::swap<'7, '8, T>[TraitClause0](move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -239,6 +242,7 @@ pub fn test_new_non_zero_u32(x: u32) -> NonZero[{built_in impl Sized for u3 let _2: Option[{built_in impl Sized for u32}, impl_ZeroablePrimitive_for_u32]>[{built_in impl Sized for NonZero[{built_in impl Sized for u32}, impl_ZeroablePrimitive_for_u32]}]; // anonymous local let _3: u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy x @@ -246,6 +250,7 @@ pub fn test_new_non_zero_u32(x: u32) -> NonZero[{built_in impl Sized for u3 storage_dead(_3) _0 = unwrap[{built_in impl Sized for u32}, impl_ZeroablePrimitive_for_u32]>[{built_in impl Sized for NonZero[{built_in impl Sized for u32}, impl_ZeroablePrimitive_for_u32]}](move _2) storage_dead(_2) + storage_dead(x) return } @@ -257,6 +262,7 @@ pub fn test_vec_push() let _2: (); // anonymous local let _3: &'1 mut Vec[{built_in impl Sized for u32}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(v) v = alloc::vec::{Vec[TraitClause0, {built_in impl Sized for Global}]}::new[{built_in impl Sized for u32}]() @@ -279,10 +285,12 @@ pub fn use_get<'_0>(rc: &'_0 Cell[{built_in impl MetaSized for u32}]) -> u3 let rc: &'1 Cell[{built_in impl MetaSized for u32}]; // arg #1 let _2: &'2 Cell[{built_in impl MetaSized for u32}]; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*rc) _0 = get<'4, u32>[{built_in impl Sized for u32}, impl_Copy_for_u32](move _2) storage_dead(_2) + storage_dead(rc) return } @@ -295,6 +303,7 @@ pub fn incr<'_0>(rc: &'_0 mut Cell[{built_in impl MetaSized for u32}]) let _3: &'4 mut Cell[{built_in impl MetaSized for u32}]; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_4) _0 = () storage_live(_2) @@ -306,6 +315,8 @@ pub fn incr<'_0>(rc: &'_0 mut Cell[{built_in impl MetaSized for u32}]) (*_2) = move _4 storage_dead(_2) _0 = () + storage_dead(_4) + storage_dead(rc) return } diff --git a/charon/tests/ui/filtering/inner-items.out b/charon/tests/ui/filtering/inner-items.out index a21e67c02..66e5d15fa 100644 --- a/charon/tests/ui/filtering/inner-items.out +++ b/charon/tests/ui/filtering/inner-items.out @@ -9,6 +9,7 @@ fn foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -19,6 +20,7 @@ fn inner1() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -46,8 +48,10 @@ fn bar<'_0>(self: &'_0 Bar) let _0: (); // return let self: &'1 Bar; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -56,6 +60,7 @@ fn inner2() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -66,6 +71,7 @@ fn _() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -79,6 +85,7 @@ fn inner3() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -89,6 +96,7 @@ fn baz() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -99,6 +107,7 @@ fn inner4() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/filtering/issue-1270-start-from-pub-skip-foreign-pub.out b/charon/tests/ui/filtering/issue-1270-start-from-pub-skip-foreign-pub.out index 0ee8af740..883edd33c 100644 --- a/charon/tests/ui/filtering/issue-1270-start-from-pub-skip-foreign-pub.out +++ b/charon/tests/ui/filtering/issue-1270-start-from-pub-skip-foreign-pub.out @@ -111,6 +111,7 @@ pub fn example(x: Result[{built_in impl Sized for u32}, {built_in i let _6: Result[{built_in impl Sized for Infallible}, {built_in impl Sized for String}]; // anonymous local let val: u32; // local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -133,6 +134,7 @@ pub fn example(x: Result[{built_in impl Sized for u32}, {built_in i conditional_drop[impl_Destruct_for_ControlFlow::drop_glue<'7, Result[{built_in impl Sized for Infallible}, {built_in impl Sized for String}], u32>[{built_in impl Sized for Result[{built_in impl Sized for Infallible}, {built_in impl Sized for String}]}, {built_in impl Sized for u32}]] _3 storage_dead(_3) conditional_drop[impl_Destruct_for_Result::drop_glue<'9, u32, String>[{built_in impl Sized for u32}, {built_in impl Sized for String}]] x + storage_dead(x) return }, } @@ -145,6 +147,7 @@ pub fn example(x: Result[{built_in impl Sized for u32}, {built_in i conditional_drop[impl_Destruct_for_ControlFlow::drop_glue<'2, Result[{built_in impl Sized for Infallible}, {built_in impl Sized for String}], u32>[{built_in impl Sized for Result[{built_in impl Sized for Infallible}, {built_in impl Sized for String}]}, {built_in impl Sized for u32}]] _3 storage_dead(_3) conditional_drop[impl_Destruct_for_Result::drop_glue<'3, u32, String>[{built_in impl Sized for u32}, {built_in impl Sized for String}]] x + storage_dead(x) return } diff --git a/charon/tests/ui/filtering/opacity.out b/charon/tests/ui/filtering/opacity.out index 2dd204b35..5fb9a981a 100644 --- a/charon/tests/ui/filtering/opacity.out +++ b/charon/tests/ui/filtering/opacity.out @@ -33,10 +33,12 @@ where let self: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move self _0 = TraitClause2::from(move _2) storage_dead(_2) + storage_dead(self) return } @@ -75,6 +77,7 @@ pub fn from(small: u32) -> u64 let _9: u128; // anonymous local let _10: u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const false if move _2 { @@ -88,6 +91,7 @@ pub fn from(small: u32) -> u64 } else { storage_dead(_5) storage_dead(_4) + storage_dead(small) panic(core::panicking::panic) } storage_dead(_5) @@ -109,6 +113,7 @@ pub fn from(small: u32) -> u64 } else { storage_dead(_9) storage_dead(_8) + storage_dead(small) panic(core::panicking::panic) } storage_dead(_9) @@ -121,6 +126,7 @@ pub fn from(small: u32) -> u64 _10 = copy small _0 = cast(move _10) storage_dead(_10) + storage_dead(small) return } @@ -150,16 +156,19 @@ where let _0: bool; // return let self: &'1 Option[TraitClause0]; // arg #1 + storage_live(_0) _ = (*self) match (*self) { Option::Some => { }, _ => { _0 = const false + storage_dead(self) return }, } _0 = const true + storage_dead(self) return } @@ -184,10 +193,13 @@ fn foo() storage_live(_9) storage_live(_11) + storage_live(_11) storage_live(_12) _12 = Option::Some { 0: const 0i32 } _11 = &_12 + storage_dead(_12) _9 = move _11 + storage_live(_0) storage_live(_7) storage_live(_8) _0 = () @@ -202,9 +214,11 @@ fn foo() _3 = into[{built_in impl Sized for u32}, {built_in impl Sized for u64}, impl_From_u32_for_u64](const 42u32) storage_live(_10) storage_live(_13) + storage_live(_13) storage_live(_14) _14 = const 0i32 _13 = &_14 + storage_dead(_14) _10 = move _13 storage_dead(_3) storage_live(_4) @@ -218,6 +232,12 @@ fn foo() storage_dead(_6) storage_dead(_4) _0 = () + storage_dead(_8) + storage_dead(_7) + storage_dead(_13) + storage_dead(_11) + storage_dead(_10) + storage_dead(_9) return } diff --git a/charon/tests/ui/filtering/opaque-trait.out b/charon/tests/ui/filtering/opaque-trait.out index e2b493bd8..cd2af4a82 100644 --- a/charon/tests/ui/filtering/opaque-trait.out +++ b/charon/tests/ui/filtering/opaque-trait.out @@ -30,6 +30,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -45,6 +46,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -60,6 +62,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -75,6 +78,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -86,6 +90,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -96,6 +101,7 @@ fn impl_Trait_for_unit::method2() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -106,6 +112,7 @@ fn impl_Trait_for_unit::method1() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -116,6 +123,7 @@ fn impl_Trait_for_unit::CONST3() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 1usize return } @@ -128,6 +136,7 @@ fn impl_Trait_for_unit::CONST2() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 1usize return } @@ -140,6 +149,7 @@ fn impl_Trait_for_unit::CONST1() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 1usize return } @@ -163,6 +173,7 @@ fn impl_Trait_for_u8::method2() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -173,6 +184,7 @@ fn impl_Trait_for_u8::CONST2() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 2usize return } @@ -185,6 +197,7 @@ fn impl_Trait_for_u8::method1() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -211,6 +224,7 @@ where let _1: (); // anonymous local let _2: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = TraitClause1::method1() diff --git a/charon/tests/ui/filtering/opaque_attribute.out b/charon/tests/ui/filtering/opaque_attribute.out index 32f03113f..5ca3c1766 100644 --- a/charon/tests/ui/filtering/opaque_attribute.out +++ b/charon/tests/ui/filtering/opaque_attribute.out @@ -36,7 +36,9 @@ pub fn impl_BoolTrait_for_bool::get_bool<'_0>(self: &'_0 bool) -> bool let _0: bool; // return let self: &'1 bool; // arg #1 + storage_live(_0) _0 = copy (*self) + storage_dead(self) return } @@ -58,6 +60,7 @@ where let x: &'3 T; // local let _3: &'4 T; // anonymous local + storage_live(_0) match (*self) { Option::None => { }, @@ -69,10 +72,12 @@ where _0 = TraitClause1::get_bool<'5>(move _3) storage_dead(_3) storage_dead(x) + storage_dead(self) return }, } _0 = const false + storage_dead(self) return } @@ -115,6 +120,7 @@ pub fn fn_in_opaque_module() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -125,6 +131,7 @@ fn call_fn_in_opaque_module() let _0: (); // return let _1: u32; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = fn_in_opaque_module() diff --git a/charon/tests/ui/filtering/start-from-if-exists.out b/charon/tests/ui/filtering/start-from-if-exists.out index a2b4de68c..be8f47e4e 100644 --- a/charon/tests/ui/filtering/start-from-if-exists.out +++ b/charon/tests/ui/filtering/start-from-if-exists.out @@ -5,6 +5,7 @@ fn bar() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/filtering/start_from.out b/charon/tests/ui/filtering/start_from.out index 32f2f53e0..7f8f620c7 100644 --- a/charon/tests/ui/filtering/start_from.out +++ b/charon/tests/ui/filtering/start_from.out @@ -8,6 +8,7 @@ fn test_crate::module1::do_translate() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -17,6 +18,7 @@ fn test_crate::module1::do_translate_glob() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -26,6 +28,7 @@ fn test_crate::module2::do_translate() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -35,6 +38,7 @@ fn test_crate::module2::do_translate_glob() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -44,6 +48,7 @@ fn test_crate::hidden_module::do_translate_glob() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -57,6 +62,7 @@ fn method() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/filtering/start_from_attribute.out b/charon/tests/ui/filtering/start_from_attribute.out index 5ec094fda..155038dac 100644 --- a/charon/tests/ui/filtering/start_from_attribute.out +++ b/charon/tests/ui/filtering/start_from_attribute.out @@ -9,6 +9,7 @@ fn do_translate() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -19,6 +20,7 @@ fn also_translate() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -32,6 +34,7 @@ fn method() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/filtering/start_from_pub.out b/charon/tests/ui/filtering/start_from_pub.out index e86d25b98..ba520990a 100644 --- a/charon/tests/ui/filtering/start_from_pub.out +++ b/charon/tests/ui/filtering/start_from_pub.out @@ -12,6 +12,7 @@ pub fn test_crate::module1::do_translate() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -21,6 +22,7 @@ pub fn test_crate::module2::do_translate() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -42,6 +44,7 @@ pub fn impl_Trait1_for_Type1::method() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -54,6 +57,7 @@ pub fn impl_Trait1_for_Type2::method() let _1: (); // anonymous local let _2: Arguments<'1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/float.out b/charon/tests/ui/float.out index a2c49704f..81e643051 100644 --- a/charon/tests/ui/float.out +++ b/charon/tests/ui/float.out @@ -6,7 +6,9 @@ fn test_float(x: f64) -> f64 let _0: f64; // return let x: f64; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -19,6 +21,7 @@ fn sum_float(x: f64, y: f64) -> f64 let _3: f64; // anonymous local let _4: f64; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -26,6 +29,8 @@ fn sum_float(x: f64, y: f64) -> f64 _0 = move _3 wrap.+ move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -38,6 +43,7 @@ fn literal_float() -> f64 let _3: f64; // anonymous local let _4: f64; // anonymous local + storage_live(_0) storage_live(x) x = const 1f64 storage_live(y) diff --git a/charon/tests/ui/foreign-constant.out b/charon/tests/ui/foreign-constant.out index c1922db9b..1d9dab1fd 100644 --- a/charon/tests/ui/foreign-constant.out +++ b/charon/tests/ui/foreign-constant.out @@ -12,6 +12,7 @@ fn foo() -> u8 { let _0: u8; // return + storage_live(_0) _0 = copy CONSTANT return } diff --git a/charon/tests/ui/gat-causes-unhandled-ty-clause.out b/charon/tests/ui/gat-causes-unhandled-ty-clause.out index b82f59d63..f5304d046 100644 --- a/charon/tests/ui/gat-causes-unhandled-ty-clause.out +++ b/charon/tests/ui/gat-causes-unhandled-ty-clause.out @@ -43,6 +43,7 @@ where { let _0: TraitClause1::ImpliedClause2::Assoc; // return + storage_live(_0) panic(core::panicking::panic) } diff --git a/charon/tests/ui/gosim-demo.out b/charon/tests/ui/gosim-demo.out index 7e2eb1939..dd20b2b80 100644 --- a/charon/tests/ui/gosim-demo.out +++ b/charon/tests/ui/gosim-demo.out @@ -75,6 +75,7 @@ where let _20: [u8; 7usize]; // anonymous local let _21: &'72 [u8; 7usize]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -147,6 +148,9 @@ where storage_dead(_5) storage_dead(iter) storage_dead(_2) + storage_dead(slice) + storage_dead(_21) + storage_dead(_20) return } @@ -165,10 +169,13 @@ fn main() storage_live(_6) storage_live(_7) + storage_live(_7) storage_live(_8) _8 = [const 0i32, const 1i32, const 2i32] _7 = &_8 + storage_dead(_8) _6 = move _7 + storage_live(_0) storage_live(_5) _0 = () storage_live(_1) @@ -185,6 +192,9 @@ fn main() storage_dead(_4) storage_dead(_1) _0 = () + storage_dead(_5) + storage_dead(_7) + storage_dead(_6) return } diff --git a/charon/tests/ui/hide-marker-traits.out b/charon/tests/ui/hide-marker-traits.out index c8fa4db02..134b7713e 100644 --- a/charon/tests/ui/hide-marker-traits.out +++ b/charon/tests/ui/hide-marker-traits.out @@ -33,9 +33,11 @@ fn foo(_x: T) let _0: (); // return let _x: T; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _x + storage_dead(_x) return } diff --git a/charon/tests/ui/impl-trait.out b/charon/tests/ui/impl-trait.out index cfb073521..3b4efb217 100644 --- a/charon/tests/ui/impl-trait.out +++ b/charon/tests/ui/impl-trait.out @@ -97,16 +97,23 @@ pub fn get_ty<'_0>(self: &'_0 ()) -> &'_0 u32 storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) _6 = const 42u32 _5 = &_6 + storage_dead(_6) _4 = move _5 + storage_live(_0) storage_live(_3) storage_live(_2) _3 = move _4 _2 = &(*_3) _0 = &(*_2) storage_dead(_2) + storage_dead(_3) + storage_dead(self) + storage_dead(_5) + storage_dead(_4) return } @@ -125,6 +132,7 @@ fn mk_foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -140,6 +148,7 @@ fn use_foo() let _4: &'2 u32; // anonymous local let _5: &'4 (); // anonymous local + storage_live(_0) _0 = () storage_live(foo) foo = mk_foo() @@ -177,6 +186,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -187,6 +197,7 @@ pub fn impl_RPITIT_for_unit::make_foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -215,6 +226,7 @@ where let _4: &'2 TraitClause1::ImpliedClause2::Type; // anonymous local let _5: &'4 TraitClause1::make_foo_ty; // anonymous local + storage_live(_0) _0 = () storage_live(foo) foo = TraitClause1::make_foo() @@ -259,6 +271,7 @@ where { let _0: closure[TraitClause0]; // return + storage_live(_0) _0 = closure { } return } @@ -274,12 +287,16 @@ where let x: &'13 U; // local let _4: &'14 U; // anonymous local + storage_live(_0) storage_live(x) x = move tupled_args.0 storage_live(_4) _4 = &(*x) _0 = WrapClone { 0: move _4 } storage_dead(_4) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -305,7 +322,9 @@ where let _0: (); // return let _1: &'1 mut closure[TraitClause0]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -333,15 +352,18 @@ pub fn use_wrap() let _9: &'27 u32; // anonymous local let _10: u32; // anonymous local + storage_live(_0) storage_live(_7) _0 = () storage_live(f) f = wrap[{built_in impl Sized for u32}]() storage_live(_8) storage_live(_9) + storage_live(_9) storage_live(_10) _10 = const 42u32 _9 = &_10 + storage_dead(_10) _8 = move _9 storage_live(_2) storage_live(_3) @@ -362,6 +384,9 @@ pub fn use_wrap() _0 = () conditional_drop[drop_glue<'25, u32>[{built_in impl Sized for u32}]] f storage_dead(f) + storage_dead(_7) + storage_dead(_9) + storage_dead(_8) return } diff --git a/charon/tests/ui/issue-114-opaque-bodies.out b/charon/tests/ui/issue-114-opaque-bodies.out index 1c99791ee..dab3067da 100644 --- a/charon/tests/ui/issue-114-opaque-bodies.out +++ b/charon/tests/ui/issue-114-opaque-bodies.out @@ -43,6 +43,7 @@ where let _4: T; // anonymous local let _5: bool; // anonymous local + storage_live(_0) storage_live(_5) _5 = const false _5 = const true @@ -60,9 +61,15 @@ where storage_dead(_3) if copy _5 { } else { + storage_dead(_5) + storage_dead(t) + storage_dead(self) return } drop[TraitClause1::drop_glue<'0>] t + storage_dead(_5) + storage_dead(t) + storage_dead(self) return } @@ -88,6 +95,7 @@ where let _4: &'4 Self; // anonymous local let _5: &'5 Rhs; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = &(*self) with_metadata(copy self.metadata) @@ -98,6 +106,8 @@ where storage_dead(_4) _0 = ~(move _3) storage_dead(_3) + storage_dead(other) + storage_dead(self) return } @@ -105,6 +115,7 @@ pub fn core::num::{u64}::MAX() -> u64 { let _0: u64; // return + storage_live(_0) _0 = ~(const 0u64) return } @@ -116,6 +127,7 @@ pub fn core::num::{i64}::MAX() -> i64 let _0: i64; // return let _1: u64; // anonymous local + storage_live(_0) storage_live(_1) _1 = copy core::num::{u64}::MAX panic.>> const 1i32 _0 = cast(move _1) @@ -129,6 +141,7 @@ pub fn core::num::{u32}::MAX() -> u32 { let _0: u32; // return + storage_live(_0) _0 = ~(const 0u32) return } @@ -140,6 +153,7 @@ pub fn core::num::{i32}::MAX() -> i32 let _0: i32; // return let _1: u32; // anonymous local + storage_live(_0) storage_live(_1) _1 = copy core::num::{u32}::MAX panic.>> const 1i32 _0 = cast(move _1) @@ -153,6 +167,7 @@ pub fn core::num::{i32}::MIN() -> i32 { let _0: i32; // return + storage_live(_0) _0 = ~(copy core::num::{i32}::MAX) return } @@ -163,6 +178,7 @@ pub fn core::num::{i64}::MIN() -> i64 { let _0: i64; // return + storage_live(_0) _0 = ~(copy core::num::{i64}::MAX) return } @@ -184,6 +200,7 @@ pub fn from(small: i32) -> i64 let _9: u128; // anonymous local let _10: i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const false if move _2 { @@ -197,6 +214,7 @@ pub fn from(small: i32) -> i64 } else { storage_dead(_5) storage_dead(_4) + storage_dead(small) panic(core::panicking::panic) } storage_dead(_5) @@ -218,6 +236,7 @@ pub fn from(small: i32) -> i64 } else { storage_dead(_9) storage_dead(_8) + storage_dead(small) panic(core::panicking::panic) } storage_dead(_9) @@ -230,6 +249,7 @@ pub fn from(small: i32) -> i64 _10 = copy small _0 = cast(move _10) storage_dead(_10) + storage_dead(small) return } @@ -246,6 +266,7 @@ pub fn core::num::{usize}::MAX() -> usize { let _0: usize; // return + storage_live(_0) _0 = ~(const 0usize) return } @@ -311,6 +332,7 @@ pub fn inline_always() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -320,6 +342,7 @@ pub fn inline_sometimes() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -329,6 +352,7 @@ pub fn inline_never() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -340,6 +364,7 @@ where { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -358,6 +383,7 @@ fn use_inlines() -> u32 let _8: u32; // anonymous local let _9: u32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_7) storage_live(_9) @@ -383,6 +409,9 @@ fn use_inlines() -> u32 _0 = move _9 storage_dead(_8) storage_dead(_1) + storage_dead(_9) + storage_dead(_7) + storage_dead(_5) return } @@ -394,6 +423,7 @@ fn bool_to_opt(b: bool) -> Option<()>[{built_in impl Sized for ()}] let _2: bool; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) _2 = copy b storage_live(_3) @@ -401,6 +431,7 @@ fn bool_to_opt(b: bool) -> Option<()>[{built_in impl Sized for ()}] _0 = then_some<()>[{built_in impl Sized for ()}, {built_in impl Destruct for ()}](move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(b) return } @@ -411,10 +442,12 @@ fn convert(x: i32) -> i64 let x: i32; // arg #1 let _2: i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = from(move _2) storage_dead(_2) + storage_dead(x) return } @@ -424,9 +457,11 @@ fn vec(_x: Vec[{built_in impl Sized for u32}, {built_in impl Sized for Glob let _0: (); // return let _x: Vec[{built_in impl Sized for u32}, {built_in impl Sized for Global}]; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[drop_glue<'0, u32, Global>[{built_in impl Sized for u32}, {built_in impl Sized for Global}]] _x + storage_dead(_x) return } @@ -435,6 +470,7 @@ fn max() -> usize { let _0: usize; // return + storage_live(_0) _0 = copy core::num::{usize}::MAX return } @@ -448,9 +484,11 @@ where let _0: (); // return let _x: T; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _x + storage_dead(_x) return } diff --git a/charon/tests/ui/issue-118-generic-copy.out b/charon/tests/ui/issue-118-generic-copy.out index 533138702..0763d656e 100644 --- a/charon/tests/ui/issue-118-generic-copy.out +++ b/charon/tests/ui/issue-118-generic-copy.out @@ -48,7 +48,9 @@ pub fn clone<'_0>(self: &'_0 Foo) -> Foo let _0: Foo; // return let self: &'1 Foo; // arg #1 + storage_live(_0) _0 = copy (*self) + storage_dead(self) return } @@ -81,6 +83,7 @@ fn copy_foo(x: Foo) let y: Foo; // local let z: Foo; // local + storage_live(_0) _0 = () storage_live(y) y = copy x @@ -89,6 +92,7 @@ fn copy_foo(x: Foo) _0 = () storage_dead(z) storage_dead(y) + storage_dead(x) return } @@ -103,6 +107,7 @@ where let y: T; // local let z: T; // local + storage_live(_0) _0 = () storage_live(y) y = copy x @@ -111,6 +116,7 @@ where _0 = () storage_dead(z) storage_dead(y) + storage_dead(x) return } @@ -135,6 +141,7 @@ where let y: TraitClause1::Ty; // local let z: TraitClause1::Ty; // local + storage_live(_0) _0 = () storage_live(y) y = copy x @@ -143,6 +150,7 @@ where _0 = () storage_dead(z) storage_dead(y) + storage_dead(x) return } diff --git a/charon/tests/ui/issue-120-bare-discriminant-read.out b/charon/tests/ui/issue-120-bare-discriminant-read.out index 75632ed64..8bc46292b 100644 --- a/charon/tests/ui/issue-120-bare-discriminant-read.out +++ b/charon/tests/ui/issue-120-bare-discriminant-read.out @@ -38,15 +38,18 @@ where let _0: (); // return let _1: &'1 mut Option[TraitClause0]; // arg #1 + storage_live(_0) _0 = () match (*_1) { Option::None => { }, _ => { drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1) as variant Option::Some).0 + storage_dead(_1) return }, } + storage_dead(_1) return } @@ -59,10 +62,12 @@ where let opt: &'1 Option[TraitClause0]; // arg #1 let _2: &'2 Option[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*opt) _0 = @discriminant((*_2)) storage_dead(_2) + storage_dead(opt) return } @@ -77,6 +82,7 @@ where let _3: &'1 Option[TraitClause0]; // anonymous local let _4: &'2 Option[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -88,6 +94,7 @@ where storage_dead(_2) storage_dead(_4) drop[drop_glue<'6, T>[TraitClause0]] opt + storage_dead(opt) return } @@ -99,6 +106,7 @@ where let _0: isize; // return let opt: Option[TraitClause0]; // arg #1 + storage_live(_0) match opt { Option::None => { _0 = const 0isize @@ -108,6 +116,7 @@ where }, } drop[drop_glue<'0, T>[TraitClause0]] opt + storage_dead(opt) return } diff --git a/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out b/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out index a09d5e9b5..2344b25c3 100644 --- a/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out +++ b/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out @@ -21,6 +21,7 @@ fn ZERO() -> Portable { let _0: Portable; // return + storage_live(_0) _0 = Portable { } return } @@ -29,6 +30,7 @@ fn test_crate::ntt_multiply() -> Portable { let _0: Portable; // return + storage_live(_0) _0 = ZERO() return } @@ -38,6 +40,7 @@ fn impl_Ops_for_Portable::ntt_multiply() -> Portable { let _0: Portable; // return + storage_live(_0) _0 = test_crate::ntt_multiply() return } diff --git a/charon/tests/ui/issue-165-vec-macro.out b/charon/tests/ui/issue-165-vec-macro.out index f1716cc94..dee6bf39f 100644 --- a/charon/tests/ui/issue-165-vec-macro.out +++ b/charon/tests/ui/issue-165-vec-macro.out @@ -77,6 +77,7 @@ fn foo() let _6: [i32; 1usize]; // anonymous local let _7: alloc::boxed::Box<[i32; 1usize]>[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_v) storage_live(_6) @@ -84,6 +85,7 @@ fn foo() storage_live(_7) _7 = @BoxNew<[i32; 1usize]>[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}](move _6) storage_live(ret) + storage_live(ret) storage_live(x) storage_live(y) storage_dead(_6) @@ -91,6 +93,8 @@ fn foo() storage_dead(_7) y = unsize_cast[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[i32]>[{built_in impl MetaSized for [i32]}, {built_in impl Sized for Global}], 1usize>(move x) ret = into_vec[{built_in impl Sized for i32}, {built_in impl Sized for Global}](move y) + storage_dead(y) + storage_dead(x) _v = move ret storage_live(_v2) _v2 = from_elem[{built_in impl Sized for i32}, impl_Clone_for_i32](const 1i32, const 10usize) @@ -99,6 +103,7 @@ fn foo() storage_dead(_v2) conditional_drop[impl_Destruct_for_Vec::drop_glue<'4, i32, Global>[{built_in impl Sized for i32}, {built_in impl Sized for Global}]] _v storage_dead(_v) + storage_dead(ret) return } @@ -117,6 +122,7 @@ pub fn bar() let _6: [Foo; 1usize]; // anonymous local let _7: alloc::boxed::Box<[Foo; 1usize]>[{built_in impl MetaSized for [Foo; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -127,6 +133,7 @@ pub fn bar() storage_live(_7) _7 = @BoxNew<[Foo; 1usize]>[{built_in impl MetaSized for [Foo; 1usize]}, {built_in impl Sized for Global}](move _6) storage_live(ret) + storage_live(ret) storage_live(x) storage_live(y) storage_dead(_6) @@ -134,10 +141,13 @@ pub fn bar() storage_dead(_7) y = unsize_cast[{built_in impl MetaSized for [Foo; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[Foo]>[{built_in impl MetaSized for [Foo]}, {built_in impl Sized for Global}], 1usize>(move x) ret = into_vec[{built_in impl Sized for Foo}, {built_in impl Sized for Global}](move y) + storage_dead(y) + storage_dead(x) _1 = move ret conditional_drop[impl_Destruct_for_Vec::drop_glue<'2, Foo, Global>[{built_in impl Sized for Foo}, {built_in impl Sized for Global}]] _1 storage_dead(_1) _0 = () + storage_dead(ret) return } diff --git a/charon/tests/ui/issue-166-self-constructors.out b/charon/tests/ui/issue-166-self-constructors.out index ef46a4824..af431b666 100644 --- a/charon/tests/ui/issue-166-self-constructors.out +++ b/charon/tests/ui/issue-166-self-constructors.out @@ -11,6 +11,7 @@ pub fn b() -> Foo { let _0: Foo; // return + storage_live(_0) _0 = Foo::B { 0: const 0usize } return } @@ -27,10 +28,12 @@ fn new<'a>(r: &'a i32) -> Bar<'a> let r: &'3 i32; // arg #1 let _2: &'4 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy r _0 = Bar { r: move _2 } storage_dead(_2) + storage_dead(r) return } diff --git a/charon/tests/ui/issue-320-slice-pattern.out b/charon/tests/ui/issue-320-slice-pattern.out index 93c38508c..5f6f713c1 100644 --- a/charon/tests/ui/issue-320-slice-pattern.out +++ b/charon/tests/ui/issue-320-slice-pattern.out @@ -15,6 +15,7 @@ fn slice_pat1() let _9: &'_ [i32; 4usize]; // anonymous local let _10: &'_ i32; // anonymous local + storage_live(_0) _0 = () storage_live(array) array = @ArrayRepeat(const 0i32) @@ -41,6 +42,12 @@ fn slice_pat1() storage_dead(_b) storage_dead(_a) storage_dead(array) + storage_dead(_10) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) return } @@ -66,10 +73,13 @@ fn slice_pat2() storage_live(_7) storage_live(_8) + storage_live(_8) storage_live(_9) _9 = @ArrayRepeat(const 0i32) _8 = &_9 + storage_dead(_9) _7 = move _8 + storage_live(_0) storage_live(_6) _0 = () storage_live(array_ref) @@ -101,6 +111,15 @@ fn slice_pat2() storage_dead(_b) storage_dead(_a) storage_dead(array_ref) + storage_dead(_6) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_12) + storage_dead(_11) + storage_dead(_10) + storage_dead(_8) + storage_dead(_7) return } @@ -138,10 +157,13 @@ fn slice_pat3() storage_live(_15) storage_live(_16) + storage_live(_16) storage_live(_17) _17 = @ArrayRepeat(const 0i32) _16 = &_17 + storage_dead(_17) _15 = move _16 + storage_live(_0) storage_live(_7) storage_live(_8) storage_live(_9) @@ -161,7 +183,27 @@ fn slice_pat3() _7 = move _8 _9 = const 2usize _10 = move _7 >= move _9 - assert(move _10 == true) else panic(core::panicking::panic) + if move _10 { + } else { + storage_dead(_14) + storage_dead(_13) + storage_dead(_11) + storage_dead(_10) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(_27) + storage_dead(_26) + storage_dead(_24) + storage_dead(_23) + storage_dead(_22) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_16) + storage_dead(_15) + panic(core::panicking::panic) + } storage_live(_a) storage_live(_18) _18 = &(*slice) with_metadata(copy slice.metadata) @@ -202,6 +244,23 @@ fn slice_pat3() storage_dead(_b) storage_dead(_a) storage_dead(slice) + storage_dead(_14) + storage_dead(_13) + storage_dead(_11) + storage_dead(_10) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(_27) + storage_dead(_26) + storage_dead(_24) + storage_dead(_23) + storage_dead(_22) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_16) + storage_dead(_15) return } @@ -218,6 +277,7 @@ fn slice_pat4<'_0>(x: &'_0 [u32]) let _7: &'_ [u32]; // anonymous local let _8: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -230,6 +290,13 @@ fn slice_pat4<'_0>(x: &'_0 [u32]) if move _5 { } else { _0 = () + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_8) + storage_dead(_7) return } storage_live(_y) @@ -240,6 +307,13 @@ fn slice_pat4<'_0>(x: &'_0 [u32]) _y = &(*_8) _0 = () storage_dead(_y) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_8) + storage_dead(_7) return } @@ -262,6 +336,7 @@ fn slice_pat5<'_0>(x: &'_0 Unsized) let _8: &'_ [u32]; // anonymous local let _9: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -277,6 +352,14 @@ fn slice_pat5<'_0>(x: &'_0 Unsized) if move _6 { } else { _0 = () + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_9) + storage_dead(_8) return } storage_live(_y) @@ -287,6 +370,14 @@ fn slice_pat5<'_0>(x: &'_0 Unsized) _y = copy (*_9) _0 = () storage_dead(_y) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_9) + storage_dead(_8) return } diff --git a/charon/tests/ui/issue-322-macro-disambiguator.out b/charon/tests/ui/issue-322-macro-disambiguator.out index 69d24f18c..1f0cd9bb8 100644 --- a/charon/tests/ui/issue-322-macro-disambiguator.out +++ b/charon/tests/ui/issue-322-macro-disambiguator.out @@ -11,6 +11,7 @@ fn main() let _1: test_crate::main::AssertIsAsBytes; // anonymous local let _2: test_crate::main::AssertIsAsBytes#1; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = test_crate::main::AssertIsAsBytes { } diff --git a/charon/tests/ui/issue-323-closure-borrow.out b/charon/tests/ui/issue-323-closure-borrow.out index a1dec8780..bfa9ce401 100644 --- a/charon/tests/ui/issue-323-closure-borrow.out +++ b/charon/tests/ui/issue-323-closure-borrow.out @@ -62,8 +62,10 @@ fn next_u64<'_0>(self: &'_0 mut Rng) let _0: (); // return let self: &'1 mut Rng; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -80,6 +82,7 @@ fn new<'_0>(rng: &'_0 mut Rng) let _2: closure<'3>; // anonymous local let _3: &'4 mut Rng; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -88,6 +91,7 @@ fn new<'_0>(rng: &'_0 mut Rng) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(rng) return } @@ -97,7 +101,9 @@ unsafe fn drop_glue<'_0, '_1>(_1: &'_1 mut closure<'_0>) let _0: (); // return let _1: &'1 mut closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -110,6 +116,7 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure<'_0>, tupled_args: ()) let _3: (); // anonymous local let _4: &'2 mut Rng; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -118,6 +125,8 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure<'_0>, tupled_args: ()) storage_dead(_4) storage_dead(_3) _0 = () + storage_dead(tupled_args) + storage_dead(_1) return } @@ -129,11 +138,15 @@ fn call_once<'_0>(_1: closure<'_0>, _2: ()) let _2: (); // arg #2 let _3: &'1 mut closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'_0, '4>(move _3, move _2) drop[drop_glue<'_0, '10>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/issue-372-type-param-out-of-range.out b/charon/tests/ui/issue-372-type-param-out-of-range.out index 99247b4d8..e7c0758aa 100644 --- a/charon/tests/ui/issue-372-type-param-out-of-range.out +++ b/charon/tests/ui/issue-372-type-param-out-of-range.out @@ -63,6 +63,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -78,6 +79,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -94,6 +96,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/issue-378-ctor-as-fn.out b/charon/tests/ui/issue-378-ctor-as-fn.out index 56b81aab7..708721995 100644 --- a/charon/tests/ui/issue-378-ctor-as-fn.out +++ b/charon/tests/ui/issue-378-ctor-as-fn.out @@ -54,6 +54,7 @@ fn F() -> fn(u8) -> Option[{built_in impl Sized for u8}] { let _0: fn(u8) -> Option[{built_in impl Sized for u8}]; // return + storage_live(_0) _0 = cast[{built_in impl Sized for u8}], fn(u8) -> Option[{built_in impl Sized for u8}]>(const Some[{built_in impl Sized for u8}]) return } @@ -73,8 +74,10 @@ unsafe fn impl_Destruct_for_Foo::drop_glue<'_0>(_1: &'_0 mut Foo) let _0: (); // return let _1: &'1 mut Foo; // arg #1 + storage_live(_0) _0 = () drop[impl_Destruct_for_String::drop_glue<'2>] ((*_1)).1 + storage_dead(_1) return } @@ -91,7 +94,10 @@ fn Foo(_1: u32, _2: String) -> Foo let _1: u32; // arg #1 let _2: String; // arg #2 + storage_live(_0) _0 = Foo { 0: move _1, 1: move _2 } + storage_dead(_2) + storage_dead(_1) return } @@ -113,7 +119,9 @@ where let _0: Bar<'a, T>[TraitClause0]; // return let _1: &'a T; // arg #1 + storage_live(_0) _0 = Bar::Variant { 0: move _1 } + storage_dead(_1) return } @@ -142,6 +150,7 @@ fn main() let _19: &'15 i32; // anonymous local let _20: i32; // anonymous local + storage_live(_0) storage_live(_17) _0 = () storage_live(f_1) @@ -176,9 +185,11 @@ fn main() conditional_drop[impl_Destruct_for_Foo::drop_glue<'10>] _9 storage_live(_18) storage_live(_19) + storage_live(_19) storage_live(_20) _20 = const 42i32 _19 = &_20 + storage_dead(_20) _18 = move _19 storage_dead(_9) storage_live(f_12) @@ -201,6 +212,9 @@ fn main() storage_dead(f_8) storage_dead(f_4) storage_dead(f_1) + storage_dead(_17) + storage_dead(_19) + storage_dead(_18) return } diff --git a/charon/tests/ui/issue-394-rpit-with-lifetime.out b/charon/tests/ui/issue-394-rpit-with-lifetime.out index 3337d77c5..2ebe1d6fa 100644 --- a/charon/tests/ui/issue-394-rpit-with-lifetime.out +++ b/charon/tests/ui/issue-394-rpit-with-lifetime.out @@ -87,7 +87,10 @@ fn call_mut<'a, '_1>(_1: &'_1 mut closure<'a>, tupled_args: ()) -> Option[{b let _1: &'1 mut closure<'a>; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = Option::None { } + storage_dead(tupled_args) + storage_dead(_1) return } @@ -97,7 +100,9 @@ unsafe fn drop_glue<'a, '_1>(_1: &'_1 mut closure<'a>) let _0: (); // return let _1: &'1 mut closure<'a>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -109,10 +114,14 @@ fn call_once<'a>(_1: closure<'a>, _2: ()) -> Option[{built_in impl Sized for let _2: (); // arg #2 let _3: &'1 mut closure<'a>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'a, '4>(move _3, move _2) drop[drop_glue<'a, '10>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -143,6 +152,7 @@ fn sparse_transitions<'a>() -> FromFn>[{built_in impl Sized for clos let _0: FromFn>[{built_in impl Sized for closure<'6>}]; // return let _1: closure<'9>; // anonymous local + storage_live(_0) storage_live(_1) _1 = closure { } _0 = from_fn>[{built_in impl Sized for u8}, {built_in impl Sized for closure<'12>}, impl_FnMut_unit_for_closure<'12>](move _1) diff --git a/charon/tests/ui/issue-4-slice-try-into-array.out b/charon/tests/ui/issue-4-slice-try-into-array.out index 72fb211c4..3ede90fc4 100644 --- a/charon/tests/ui/issue-4-slice-try-into-array.out +++ b/charon/tests/ui/issue-4-slice-try-into-array.out @@ -125,6 +125,7 @@ pub fn trait_error<'_0>(s: &'_0 [u8]) let _3: Result<[u8; 4usize], TryFromSliceError>[{built_in impl Sized for [u8; 4usize]}, {built_in impl Sized for TryFromSliceError}]; // anonymous local let _4: &'2 [u8]; // anonymous local + storage_live(_0) _0 = () storage_live(_array) storage_live(_3) @@ -136,6 +137,7 @@ pub fn trait_error<'_0>(s: &'_0 [u8]) storage_dead(_3) _0 = () storage_dead(_array) + storage_dead(s) return } diff --git a/charon/tests/ui/issue-4-traits.out b/charon/tests/ui/issue-4-traits.out index ee874872f..81a25837c 100644 --- a/charon/tests/ui/issue-4-traits.out +++ b/charon/tests/ui/issue-4-traits.out @@ -125,6 +125,7 @@ fn trait_error<'_0>(s: &'_0 [u8]) let _3: Result<[u8; 4usize], TryFromSliceError>[{built_in impl Sized for [u8; 4usize]}, {built_in impl Sized for TryFromSliceError}]; // anonymous local let _4: &'2 [u8]; // anonymous local + storage_live(_0) _0 = () storage_live(_array) storage_live(_3) @@ -136,6 +137,7 @@ fn trait_error<'_0>(s: &'_0 [u8]) storage_dead(_3) _0 = () storage_dead(_array) + storage_dead(s) return } diff --git a/charon/tests/ui/issue-45-misc.out b/charon/tests/ui/issue-45-misc.out index 144c6df0c..ed53d5178 100644 --- a/charon/tests/ui/issue-45-misc.out +++ b/charon/tests/ui/issue-45-misc.out @@ -247,7 +247,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -265,9 +267,13 @@ fn call_mut<'_0>(_1: &'_0 mut closure, tupled_args: (i32,)) -> i32 let tupled_args: (i32,); // arg #2 let v: i32; // local + storage_live(_0) storage_live(v) v = move tupled_args.0 _0 = copy v + storage_dead(v) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -279,10 +285,14 @@ fn call_once(_1: closure, _2: (i32,)) -> i32 let _2: (i32,); // arg #2 let _3: &'1 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'2>(move _3, move _2) drop[drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -314,6 +324,7 @@ pub fn test_crate::map(x: [i32; 256usize]) -> [i32; 256usize] let _2: [i32; 256usize]; // anonymous local let _3: closure; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x storage_live(_3) @@ -321,6 +332,7 @@ pub fn test_crate::map(x: [i32; 256usize]) -> [i32; 256usize] _0 = core::array::{[T; N]}::map[{built_in impl Sized for i32}, {built_in impl Sized for closure}, {built_in impl Sized for i32}, impl_FnMut_tuple_for_closure, impl_Destruct_for_closure, {built_in impl Destruct for i32}, {built_in impl Destruct for i32}](move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } @@ -329,6 +341,7 @@ pub fn array() -> [u8; LEN] { let _0: [u8; LEN]; // return + storage_live(_0) _0 = @ArrayRepeat(const 0u8) return } @@ -350,6 +363,7 @@ fn cbd(prf_input: [u8; 33usize]) let _11: &'_ mut [u8; 33usize]; // anonymous local let _12: &'_ mut u8; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -396,6 +410,9 @@ fn cbd(prf_input: [u8; 33usize]) storage_dead(_5) storage_dead(iter) storage_dead(_2) + storage_dead(prf_input) + storage_dead(_12) + storage_dead(_11) return } @@ -426,6 +443,7 @@ fn select<'_0, '_1>(lhs: &'_0 [u8], rhs: &'_1 [u8]) let _21: &'17 usize; // anonymous local let _22: Option>[{built_in impl Sized for Arguments<'24>}]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = const true @@ -476,6 +494,15 @@ fn select<'_0, '_1>(lhs: &'_0 [u8], rhs: &'_1 [u8]) _20 = &(*_21) storage_live(_22) _22 = Option::None { } + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(kind) + storage_dead(rhs) + storage_dead(lhs) panic(core::panicking::assert_failed) } storage_dead(_15) @@ -490,6 +517,15 @@ fn select<'_0, '_1>(lhs: &'_0 [u8], rhs: &'_1 [u8]) } storage_dead(_3) _0 = () + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(kind) + storage_dead(rhs) + storage_dead(lhs) return } diff --git a/charon/tests/ui/issue-70-override-provided-method.2-nodup.out b/charon/tests/ui/issue-70-override-provided-method.2-nodup.out index 47dec436f..8a8d4ee1c 100644 --- a/charon/tests/ui/issue-70-override-provided-method.2-nodup.out +++ b/charon/tests/ui/issue-70-override-provided-method.2-nodup.out @@ -25,6 +25,7 @@ where let _4: (); // anonymous local let _5: &'3 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -39,6 +40,7 @@ where storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(self) return } @@ -54,6 +56,7 @@ where let _4: (); // anonymous local let _5: &'3 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -68,6 +71,7 @@ where storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(self) return } @@ -82,6 +86,7 @@ fn impl_Trait_for_Foo::required<'_0>(self: &'_0 Foo) let _2: (); // anonymous local let _3: &'2 Foo; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -90,6 +95,7 @@ fn impl_Trait_for_Foo::required<'_0>(self: &'_0 Foo) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -113,6 +119,7 @@ fn impl_Trait_for_Bar::provided1<'_0>(self: &'_0 Bar) let _2: (); // anonymous local let _3: &'2 Bar; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -121,6 +128,7 @@ fn impl_Trait_for_Bar::provided1<'_0>(self: &'_0 Bar) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -132,6 +140,7 @@ fn impl_Trait_for_Bar::required<'_0>(self: &'_0 Bar) let _2: (); // anonymous local let _3: &'2 Bar; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -140,6 +149,7 @@ fn impl_Trait_for_Bar::required<'_0>(self: &'_0 Bar) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/issue-70-override-provided-method.2.out b/charon/tests/ui/issue-70-override-provided-method.2.out index 0614a3ceb..2385e0450 100644 --- a/charon/tests/ui/issue-70-override-provided-method.2.out +++ b/charon/tests/ui/issue-70-override-provided-method.2.out @@ -25,6 +25,7 @@ where let _4: (); // anonymous local let _5: &'3 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -39,6 +40,7 @@ where storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(self) return } @@ -53,6 +55,7 @@ where let _4: (); // anonymous local let _5: &'3 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -67,6 +70,7 @@ where storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(self) return } @@ -83,6 +87,7 @@ fn impl_Trait_for_Foo::provided1<'_0>(self: &'_0 Foo) let _4: (); // anonymous local let _5: &'3 Foo; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -97,6 +102,7 @@ fn impl_Trait_for_Foo::provided1<'_0>(self: &'_0 Foo) storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(self) return } @@ -110,6 +116,7 @@ fn impl_Trait_for_Foo::provided2<'_0>(self: &'_0 Foo) let _4: (); // anonymous local let _5: &'3 Foo; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -124,6 +131,7 @@ fn impl_Trait_for_Foo::provided2<'_0>(self: &'_0 Foo) storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(self) return } @@ -135,6 +143,7 @@ fn impl_Trait_for_Foo::required<'_0>(self: &'_0 Foo) let _2: (); // anonymous local let _3: &'2 Foo; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -143,6 +152,7 @@ fn impl_Trait_for_Foo::required<'_0>(self: &'_0 Foo) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -168,6 +178,7 @@ fn impl_Trait_for_Bar::provided2<'_0>(self: &'_0 Bar) let _4: (); // anonymous local let _5: &'3 Bar; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -182,6 +193,7 @@ fn impl_Trait_for_Bar::provided2<'_0>(self: &'_0 Bar) storage_dead(_5) storage_dead(_4) _0 = () + storage_dead(self) return } @@ -193,6 +205,7 @@ fn impl_Trait_for_Bar::required<'_0>(self: &'_0 Bar) let _2: (); // anonymous local let _3: &'2 Bar; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -201,6 +214,7 @@ fn impl_Trait_for_Bar::required<'_0>(self: &'_0 Bar) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -212,6 +226,7 @@ fn impl_Trait_for_Bar::provided1<'_0>(self: &'_0 Bar) let _2: (); // anonymous local let _3: &'2 Bar; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -220,6 +235,7 @@ fn impl_Trait_for_Bar::provided1<'_0>(self: &'_0 Bar) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/issue-70-override-provided-method.3.out b/charon/tests/ui/issue-70-override-provided-method.3.out index e476570fc..0224473ed 100644 --- a/charon/tests/ui/issue-70-override-provided-method.3.out +++ b/charon/tests/ui/issue-70-override-provided-method.3.out @@ -100,6 +100,7 @@ where let _4: &'1 U; // anonymous local let _5: &'3 T; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -119,6 +120,8 @@ where storage_dead(_3) conditional_drop[{built_in impl Destruct for U}::drop_glue<'8>] y conditional_drop[{built_in impl Destruct for T}::drop_glue<'9>] x + storage_dead(y) + storage_dead(x) return } @@ -138,6 +141,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -158,6 +162,7 @@ where let _4: &'1 U; // anonymous local let _5: &'3 Option[TraitClause0]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -176,6 +181,8 @@ where } storage_dead(_3) conditional_drop[{built_in impl Destruct for U}::drop_glue<'7>] y + storage_dead(y) + storage_dead(x) return } @@ -209,6 +216,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -229,6 +237,7 @@ where let _4: &'1 U; // anonymous local let _5: &'3 Option[TraitClause0]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -248,6 +257,8 @@ where storage_dead(_3) conditional_drop[{built_in impl Destruct for U}::drop_glue<'8>] y conditional_drop[{built_in impl Destruct for Option[TraitClause0]}::drop_glue<'9>] x + storage_dead(y) + storage_dead(x) return } diff --git a/charon/tests/ui/issue-70-override-provided-method.out b/charon/tests/ui/issue-70-override-provided-method.out index 08ad8e16c..03d9d7acd 100644 --- a/charon/tests/ui/issue-70-override-provided-method.out +++ b/charon/tests/ui/issue-70-override-provided-method.out @@ -94,16 +94,21 @@ fn main() storage_live(_7) storage_live(_10) + storage_live(_10) storage_live(_11) _11 = Option::Some { 0: const 1i32 } _10 = &_11 + storage_dead(_11) _7 = move _10 storage_live(_6) storage_live(_8) + storage_live(_8) storage_live(_9) _9 = Option::Some { 0: const 1i32 } _8 = &_9 + storage_dead(_9) _6 = move _8 + storage_live(_0) storage_live(_4) storage_live(_5) _0 = () @@ -119,6 +124,12 @@ fn main() storage_dead(_2) storage_dead(_1) _0 = () + storage_dead(_5) + storage_dead(_4) + storage_dead(_10) + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) return } @@ -142,6 +153,7 @@ pub fn impl_PartialEq_Foo_for_Foo::eq<'_0, '_1>(self: &'_0 Foo, other: &'_1 Foo) let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy ((*self)).0 storage_live(_4) @@ -149,6 +161,8 @@ pub fn impl_PartialEq_Foo_for_Foo::eq<'_0, '_1>(self: &'_0 Foo, other: &'_1 Foo) _0 = move _3 == move _4 storage_dead(_4) storage_dead(_3) + storage_dead(other) + storage_dead(self) return } @@ -169,6 +183,7 @@ pub fn impl_PartialOrd_Foo_for_Foo::partial_cmp<'_0, '_1>(self: &'_0 Foo, other: let _5: &'6 u32; // anonymous local let _6: &'7 u32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = &((*self)).0 @@ -182,6 +197,8 @@ pub fn impl_PartialOrd_Foo_for_Foo::partial_cmp<'_0, '_1>(self: &'_0 Foo, other: storage_dead(_5) storage_dead(_4) storage_dead(_3) + storage_dead(other) + storage_dead(self) return } diff --git a/charon/tests/ui/issue-72-hash-missing-impl.out b/charon/tests/ui/issue-72-hash-missing-impl.out index 6939e1f26..bc876e1aa 100644 --- a/charon/tests/ui/issue-72-hash-missing-impl.out +++ b/charon/tests/ui/issue-72-hash-missing-impl.out @@ -46,8 +46,11 @@ where let self: &'1 u32; // arg #1 let _state: &'3 mut H; // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(_state) + storage_dead(self) return } @@ -74,10 +77,13 @@ fn main() storage_live(_7) storage_live(_8) + storage_live(_8) storage_live(_9) _9 = const 0u32 _8 = &_9 + storage_dead(_9) _7 = move _8 + storage_live(_0) storage_live(_6) _0 = () storage_live(hasher) @@ -97,6 +103,9 @@ fn main() storage_dead(_2) _0 = () storage_dead(hasher) + storage_dead(_6) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/issue-73-extern.out b/charon/tests/ui/issue-73-extern.out index df4dadec6..4a21558be 100644 --- a/charon/tests/ui/issue-73-extern.out +++ b/charon/tests/ui/issue-73-extern.out @@ -20,8 +20,10 @@ fn use_type<'_0>(_x: &'_0 Type) let _0: (); // return let _x: &'1 Type; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_x) return } diff --git a/charon/tests/ui/issue-91-enum-to-discriminant-cast.out b/charon/tests/ui/issue-91-enum-to-discriminant-cast.out index 7275c482a..14d3bcdcf 100644 --- a/charon/tests/ui/issue-91-enum-to-discriminant-cast.out +++ b/charon/tests/ui/issue-91-enum-to-discriminant-cast.out @@ -51,7 +51,9 @@ pub fn clone<'_0>(self: &'_0 Foo) -> Foo let _0: Foo; // return let self: &'1 Foo; // arg #1 + storage_live(_0) _0 = copy (*self) + storage_dead(self) return } @@ -99,6 +101,7 @@ fn main() let _10: Ordering; // anonymous local let _11: isize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_7) storage_live(_11) @@ -131,6 +134,9 @@ fn main() _0 = () storage_dead(x_8) storage_dead(x_1) + storage_dead(_11) + storage_dead(_7) + storage_dead(_4) return } diff --git a/charon/tests/ui/issue-92-nonpositive-variant-indices.out b/charon/tests/ui/issue-92-nonpositive-variant-indices.out index 2fcd4f70e..1a2a62fde 100644 --- a/charon/tests/ui/issue-92-nonpositive-variant-indices.out +++ b/charon/tests/ui/issue-92-nonpositive-variant-indices.out @@ -13,6 +13,7 @@ fn main() let _0: (); // return let _1: Ordering; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = Ordering::Less { } diff --git a/charon/tests/ui/issue-94-recursive-trait-defns.out b/charon/tests/ui/issue-94-recursive-trait-defns.out index fcee3faa1..67f93ff70 100644 --- a/charon/tests/ui/issue-94-recursive-trait-defns.out +++ b/charon/tests/ui/issue-94-recursive-trait-defns.out @@ -104,11 +104,13 @@ where let x: u64; // arg #1 let _2: u64; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = copy x _0 = TraitClause0::ImpliedClause2::g(move _2) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/issue-97-missing-parent-item-clause.out b/charon/tests/ui/issue-97-missing-parent-item-clause.out index 580c454c8..fbd759bd4 100644 --- a/charon/tests/ui/issue-97-missing-parent-item-clause.out +++ b/charon/tests/ui/issue-97-missing-parent-item-clause.out @@ -36,7 +36,9 @@ where let _0: (); // return let self: &'1 mut AVLTree[TraitClause0]; // arg #1 + storage_live(_0) _0 = () + storage_dead(self) panic(core::panicking::panic) } @@ -54,6 +56,7 @@ pub fn test(tree: AVLTree[{built_in impl Sized for u32}]) let _2: (); // anonymous local let _3: &'1 mut AVLTree[{built_in impl Sized for u32}]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -62,6 +65,7 @@ pub fn test(tree: AVLTree[{built_in impl Sized for u32}]) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(tree) return } diff --git a/charon/tests/ui/iterator.out b/charon/tests/ui/iterator.out index bc6ccd5cd..3473ca17e 100644 --- a/charon/tests/ui/iterator.out +++ b/charon/tests/ui/iterator.out @@ -5068,6 +5068,7 @@ fn main() let _57: &'76 i32; // anonymous local let _58: Option>[{built_in impl Sized for Arguments<'83>}]; // anonymous local + storage_live(_0) storage_live(_12) storage_live(_33) storage_live(_42) @@ -5281,6 +5282,16 @@ fn main() _56 = &(*_57) storage_live(_58) _58 = Option::None { } + storage_dead(_58) + storage_dead(_57) + storage_dead(_56) + storage_dead(_55) + storage_dead(_54) + storage_dead(_53) + storage_dead(kind) + storage_dead(_42) + storage_dead(_33) + storage_dead(_12) panic(core::panicking::assert_failed) } storage_dead(_51) @@ -5293,6 +5304,16 @@ fn main() storage_dead(expected) storage_dead(i) storage_dead(a) + storage_dead(_58) + storage_dead(_57) + storage_dead(_56) + storage_dead(_55) + storage_dead(_54) + storage_dead(_53) + storage_dead(kind) + storage_dead(_42) + storage_dead(_33) + storage_dead(_12) return } diff --git a/charon/tests/ui/matches.out b/charon/tests/ui/matches.out index 0fafbecb3..cdef77d85 100644 --- a/charon/tests/ui/matches.out +++ b/charon/tests/ui/matches.out @@ -33,15 +33,18 @@ pub fn test1(x: E1) -> bool let _0: bool; // return let x: E1; // arg #1 + storage_live(_0) match x { E1::V1 | E1::V2 => { }, E1::V3 => { _0 = const false + storage_dead(x) return }, } _0 = const true + storage_dead(x) return } @@ -53,8 +56,10 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -72,6 +77,7 @@ pub fn test2(x: E2) -> u32 let x: E2; // arg #1 let n: u32; // local + storage_live(_0) match x { E2::V1 => { storage_live(n) @@ -83,11 +89,13 @@ pub fn test2(x: E2) -> u32 }, E2::V3 => { _0 = const 0u32 + storage_dead(x) return }, } _0 = copy n storage_dead(n) + storage_dead(x) return } @@ -103,6 +111,7 @@ pub fn test3(x: E2) -> u32 let _6: u32; // anonymous local let _7: u32; // anonymous local + storage_live(_0) storage_live(_7) storage_live(y) match x { @@ -134,6 +143,8 @@ pub fn test3(x: E2) -> u32 storage_dead(_5) storage_dead(z) storage_dead(y) + storage_dead(_7) + storage_dead(x) return } diff --git a/charon/tests/ui/max_char.out b/charon/tests/ui/max_char.out index f80984094..b297522c3 100644 --- a/charon/tests/ui/max_char.out +++ b/charon/tests/ui/max_char.out @@ -5,6 +5,7 @@ pub fn MAX() -> char { let _0: char; // return + storage_live(_0) _0 = const '\u{10ffff}' return } @@ -18,6 +19,7 @@ fn main() let _0: (); // return let _max_char: char; // local + storage_live(_0) _0 = () storage_live(_max_char) _max_char = copy MAX diff --git a/charon/tests/ui/method-impl-generalization.out b/charon/tests/ui/method-impl-generalization.out index 02baadbf5..d142e3f6c 100644 --- a/charon/tests/ui/method-impl-generalization.out +++ b/charon/tests/ui/method-impl-generalization.out @@ -56,9 +56,12 @@ where let self: (); // arg #1 let _other: T; // arg #2 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _other + storage_dead(_other) + storage_dead(self) return } @@ -69,7 +72,10 @@ fn method1(self: (), _other: &'static u32) -> bool let self: (); // arg #1 let _other: &'1 u32; // arg #2 + storage_live(_0) _0 = const true + storage_dead(_other) + storage_dead(self) return } @@ -97,7 +103,10 @@ fn compare<'a>(self: &'a (), _other: &'a ()) -> bool let self: &'1 (); // arg #1 let _other: &'2 (); // arg #2 + storage_live(_0) _0 = const true + storage_dead(_other) + storage_dead(self) return } @@ -138,10 +147,13 @@ fn main() storage_live(_14) storage_live(_17) + storage_live(_17) storage_live(_18) _18 = const 1u32 _17 = &_18 + storage_dead(_18) _14 = move _17 + storage_live(_0) storage_live(_11) storage_live(_12) storage_live(_13) @@ -165,17 +177,21 @@ fn main() _5 = method2[{built_in impl Sized for bool}](move _6, const false) storage_live(_16) storage_live(_21) + storage_live(_21) storage_live(_22) // Not allowed to use the more precise signature. // let _ = ().method2(String::new()); _22 = () _21 = &_22 + storage_dead(_22) _16 = move _21 storage_live(_15) storage_live(_19) + storage_live(_19) storage_live(_20) _20 = () _19 = &_20 + storage_dead(_20) _15 = move _19 storage_dead(_6) storage_dead(_5) @@ -194,6 +210,15 @@ fn main() storage_dead(_10) storage_dead(_7) _0 = () + storage_dead(_13) + storage_dead(_12) + storage_dead(_11) + storage_dead(_21) + storage_dead(_19) + storage_dead(_17) + storage_dead(_16) + storage_dead(_15) + storage_dead(_14) return } @@ -212,7 +237,10 @@ fn foo<'a, 'b>(x: &'a (), y: &'b ()) -> &'a () let x: &'2 (); // arg #1 let y: &'3 (); // arg #2 + storage_live(_0) _0 = copy x + storage_dead(y) + storage_dead(x) return } @@ -239,11 +267,14 @@ fn call_foo<'e>(x: &'e ()) -> &'e () storage_live(_7) storage_live(_8) + storage_live(_8) storage_live(_9) // Calls have erased lifetimes so we can't notice the discrepancy if there is one. _9 = () _8 = &_9 + storage_dead(_9) _7 = move _8 + storage_live(_0) storage_live(_6) storage_live(_2) storage_live(_3) @@ -259,6 +290,10 @@ fn call_foo<'e>(x: &'e ()) -> &'e () storage_dead(_3) storage_dead(_5) storage_dead(_2) + storage_dead(_6) + storage_dead(x) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/method-ref.out b/charon/tests/ui/method-ref.out index 29f170133..57f20ac93 100644 --- a/charon/tests/ui/method-ref.out +++ b/charon/tests/ui/method-ref.out @@ -37,6 +37,7 @@ where let _0: (); // return let _1: for<'_0_1, '_1_1> TraitClause1::cmp<'_0_1, '_1_1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const TraitClause1::cmp<'0, '1> diff --git a/charon/tests/ui/ml-mono-name-matcher-tests.out b/charon/tests/ui/ml-mono-name-matcher-tests.out index 8a5a8415a..9f9bdff55 100644 --- a/charon/tests/ui/ml-mono-name-matcher-tests.out +++ b/charon/tests/ui/ml-mono-name-matcher-tests.out @@ -26,6 +26,7 @@ fn bar() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -55,10 +56,13 @@ fn foo() storage_live(_12) storage_live(_14) + storage_live(_14) storage_live(_15) _15 = Option::::Some { 0: const 0i32 } _14 = &_15 + storage_dead(_15) _12 = move _14 + storage_live(_0) storage_live(_10) storage_live(_11) _0 = () @@ -69,9 +73,11 @@ fn foo() _1 = is_some::<'14>(move _2) storage_live(_13) storage_live(_16) + storage_live(_16) storage_live(_17) _17 = [const false] _16 = &_17 + storage_dead(_17) _13 = move _16 storage_dead(_2) storage_dead(_1) @@ -98,6 +104,12 @@ fn foo() _0 = () storage_dead(_7) storage_dead(slice) + storage_dead(_11) + storage_dead(_10) + storage_dead(_16) + storage_dead(_14) + storage_dead(_13) + storage_dead(_12) return } @@ -105,6 +117,7 @@ fn test_crate::funs_with_disambiguator::f#1() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 1u32 return } @@ -113,6 +126,7 @@ fn test_crate::funs_with_disambiguator::f() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 0u32 return } @@ -124,16 +138,19 @@ fn funs_with_disambiguator(b: bool) -> u32 let b: bool; // arg #1 let _2: bool; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy b if move _2 { } else { _0 = test_crate::funs_with_disambiguator::f#1() storage_dead(_2) + storage_dead(b) return } _0 = test_crate::funs_with_disambiguator::f() storage_dead(_2) + storage_dead(b) return } @@ -153,10 +170,12 @@ fn test_crate::{MonoContainer::}::create::(item: i32) -> MonoContainer let item: i32; // arg #1 let _2: i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = move item _0 = MonoContainer:: { item: move _2 } storage_dead(_2) + storage_dead(item) return } @@ -166,10 +185,12 @@ fn test_crate::{MonoContainer::<&'_ str>}::create::<&'_ str>(item: &'_ str) -> M let item: &'0 str; // arg #1 let _2: &'1 str; // anonymous local + storage_live(_0) storage_live(_2) _2 = move item _0 = MonoContainer::<&'_ str> { item: move _2 } storage_dead(_2) + storage_dead(item) return } @@ -180,6 +201,7 @@ fn mono_usage() let _container1: MonoContainer::; // local let _container2: MonoContainer::<&'_ str>; // local + storage_live(_0) _0 = () storage_live(_container1) _container1 = test_crate::{MonoContainer::}::create::(const 42i32) diff --git a/charon/tests/ui/ml-multi-target-name-matcher-tests.out b/charon/tests/ui/ml-multi-target-name-matcher-tests.out index 78e49498b..0585a1240 100644 --- a/charon/tests/ui/ml-multi-target-name-matcher-tests.out +++ b/charon/tests/ui/ml-multi-target-name-matcher-tests.out @@ -2,6 +2,7 @@ fn test_crate::x86_only() -> u64 { let _0: u64; // return + storage_live(_0) _0 = const 42u64 return } @@ -10,6 +11,7 @@ fn test_crate::arm_only() -> u64 { let _0: u64; // return + storage_live(_0) _0 = const 99u64 return } @@ -18,6 +20,7 @@ fn test_crate::shared_fn() -> u64 { let _0: u64; // return + storage_live(_0) _0 = const 0u64 return } diff --git a/charon/tests/ui/ml-name-matcher-tests.out b/charon/tests/ui/ml-name-matcher-tests.out index 1759dd72b..d54c0d286 100644 --- a/charon/tests/ui/ml-name-matcher-tests.out +++ b/charon/tests/ui/ml-name-matcher-tests.out @@ -148,6 +148,7 @@ fn bar() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -170,6 +171,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -195,6 +197,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -236,10 +239,13 @@ fn foo() storage_live(_12) storage_live(_14) + storage_live(_14) storage_live(_15) _15 = Option::Some { 0: const 0i32 } _14 = &_15 + storage_dead(_15) _12 = move _14 + storage_live(_0) storage_live(_10) storage_live(_11) _0 = () @@ -250,9 +256,11 @@ fn foo() _1 = is_some<'14, i32>[{built_in impl Sized for i32}](move _2) storage_live(_13) storage_live(_16) + storage_live(_16) storage_live(_17) _17 = [const false] _16 = &_17 + storage_dead(_17) _13 = move _16 storage_dead(_2) storage_dead(_1) @@ -279,6 +287,12 @@ fn foo() _0 = () storage_dead(_7) storage_dead(slice) + storage_dead(_11) + storage_dead(_10) + storage_dead(_16) + storage_dead(_14) + storage_dead(_13) + storage_dead(_12) return } @@ -286,6 +300,7 @@ fn test_crate::funs_with_disambiguator::f#1() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 1u32 return } @@ -294,6 +309,7 @@ fn test_crate::funs_with_disambiguator::f() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 0u32 return } @@ -305,16 +321,19 @@ fn funs_with_disambiguator(b: bool) -> u32 let b: bool; // arg #1 let _2: bool; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy b if move _2 { } else { _0 = test_crate::funs_with_disambiguator::f#1() storage_dead(_2) + storage_dead(b) return } _0 = test_crate::funs_with_disambiguator::f() storage_dead(_2) + storage_dead(b) return } @@ -335,12 +354,14 @@ where let item: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move item _0 = MonoContainer { item: move _2 } conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _2 storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] item + storage_dead(item) return } @@ -351,6 +372,7 @@ fn mono_usage() let _container1: MonoContainer[{built_in impl Sized for i32}]; // local let _container2: MonoContainer<&'6 str>[{built_in impl Sized for &'6 str}]; // local + storage_live(_0) _0 = () storage_live(_container1) _container1 = create[{built_in impl Sized for i32}](const 42i32) @@ -380,10 +402,12 @@ where let self: &'3 MonoContainer[TraitClause0]; // arg #1 let _2: &'4 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &((*self)).item _0 = &(*_2) storage_dead(_2) + storage_dead(self) return } diff --git a/charon/tests/ui/ml-partial-mono-name-matcher-tests.out b/charon/tests/ui/ml-partial-mono-name-matcher-tests.out index 515dc559a..561fd6854 100644 --- a/charon/tests/ui/ml-partial-mono-name-matcher-tests.out +++ b/charon/tests/ui/ml-partial-mono-name-matcher-tests.out @@ -69,8 +69,10 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -81,8 +83,10 @@ where let _0: &'_0 mut T0; // return let x: &'_0 mut T0; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::<&_ mut _><'_0> for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -93,8 +97,10 @@ where let _0: Option<&'_0 mut T0>; // return let x: Option<&'_0 mut T0>; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::><'_0> for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -111,6 +117,7 @@ where let _5: Option<&'11 mut A>; // anonymous local let _6: &'14 mut A; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -129,6 +136,7 @@ where storage_dead(_4) _0 = () conditional_drop[{built_in impl Destruct for A}::drop_glue<'54>] x + storage_dead(x) return } diff --git a/charon/tests/ui/monomorphization/adt_proj.out b/charon/tests/ui/monomorphization/adt_proj.out index b4575b0fd..98a5b5335 100644 --- a/charon/tests/ui/monomorphization/adt_proj.out +++ b/charon/tests/ui/monomorphization/adt_proj.out @@ -14,6 +14,7 @@ fn main() let res: Result::; // local let n: u32; // local + storage_live(_0) _0 = () storage_live(res) res = Result::::Ok { 0: const 0u32 } diff --git a/charon/tests/ui/monomorphization/bound_lifetime.out b/charon/tests/ui/monomorphization/bound_lifetime.out index 2afc00f0f..06bdd6368 100644 --- a/charon/tests/ui/monomorphization/bound_lifetime.out +++ b/charon/tests/ui/monomorphization/bound_lifetime.out @@ -14,10 +14,12 @@ fn foo<'_0>(x: &'_0 u32) -> Option::<&'_ u32> let x: &'1 u32; // arg #1 let _2: &'2 u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = Option::<&'_ u32>::Some { 0: move _2 } storage_dead(_2) + storage_dead(x) return } @@ -35,10 +37,13 @@ fn main() storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = const 42u32 _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_1) @@ -52,6 +57,9 @@ fn main() storage_dead(_3) storage_dead(_1) _0 = () + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } diff --git a/charon/tests/ui/monomorphization/closure-fn.out b/charon/tests/ui/monomorphization/closure-fn.out index 1c5eb8339..097fccc16 100644 --- a/charon/tests/ui/monomorphization/closure-fn.out +++ b/charon/tests/ui/monomorphization/closure-fn.out @@ -108,6 +108,7 @@ fn apply_to::><'_0>(f: &'_0 closure<'_, '_>) -> u8 let _2: &'6 closure<'7, '8>; // anonymous local let _3: (u8, u8); // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*f) storage_live(_3) @@ -115,6 +116,7 @@ fn apply_to::><'_0>(f: &'_0 closure<'_, '_>) -> u8 _0 = impl_Fn_tuple_for_closure<'15, '16>::call<'17>(move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(f) return } @@ -126,6 +128,7 @@ fn apply_to_mut::><'_0>(f: &'_0 mut closure<'_, '_>) -> u8 let _2: &'6 mut closure<'7, '8>; // anonymous local let _3: (u8, u8); // anonymous local + storage_live(_0) storage_live(_2) _2 = &mut (*f) storage_live(_3) @@ -133,6 +136,7 @@ fn apply_to_mut::><'_0>(f: &'_0 mut closure<'_, '_>) -> u8 _0 = impl_FnMut_tuple_for_closure<'15, '16>::call_mut<'17>(move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(f) return } @@ -142,7 +146,9 @@ unsafe fn drop_glue<'_0, '_1, '_2>(_1: &'_2 mut closure<'_0, '_1>) let _0: (); // return let _1: &'1 mut closure<'_0, '_1>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -154,6 +160,7 @@ fn apply_to_once::>(f: closure<'_, '_>) -> u8 let _2: closure<'2, '3>; // anonymous local let _3: (u8, u8); // anonymous local + storage_live(_0) storage_live(_2) _2 = move f storage_live(_3) @@ -162,6 +169,7 @@ fn apply_to_once::>(f: closure<'_, '_>) -> u8 storage_dead(_3) storage_dead(_2) conditional_drop[drop_glue<'21, '22, '23>] f + storage_dead(f) return } @@ -186,6 +194,7 @@ fn main() let _15: u8; // anonymous local let _16: closure<'28, '29>; // anonymous local + storage_live(_0) _0 = () storage_live(v) v = const 5u8 diff --git a/charon/tests/ui/monomorphization/closure-fnonce.out b/charon/tests/ui/monomorphization/closure-fnonce.out index a205e1787..675146296 100644 --- a/charon/tests/ui/monomorphization/closure-fnonce.out +++ b/charon/tests/ui/monomorphization/closure-fnonce.out @@ -56,7 +56,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -76,6 +78,7 @@ fn apply_to_zero_once::(f: closure) -> u8 let _2: closure; // anonymous local let _3: (u8,); // anonymous local + storage_live(_0) storage_live(_2) _2 = move f storage_live(_3) @@ -84,6 +87,7 @@ fn apply_to_zero_once::(f: closure) -> u8 storage_dead(_3) storage_dead(_2) conditional_drop[drop_glue<'1>] f + storage_dead(f) return } @@ -95,6 +99,7 @@ fn main() let _2: u8; // anonymous local let _3: closure; // anonymous local + storage_live(_0) _0 = () storage_live(z) z = NotCopy { } diff --git a/charon/tests/ui/monomorphization/closures.out b/charon/tests/ui/monomorphization/closures.out index 5c95ae5ca..29206a193 100644 --- a/charon/tests/ui/monomorphization/closures.out +++ b/charon/tests/ui/monomorphization/closures.out @@ -81,7 +81,9 @@ unsafe fn {impl Destruct for test_crate::main::closure<'_0>}::drop_glue<'_0, '_1 let _0: (); // return let _1: &'1 mut test_crate::main::closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -119,6 +121,7 @@ fn apply_to_zero::>(f: test_crate::main::closure<' let _2: &'3 test_crate::main::closure<'4>; // anonymous local let _3: (u8,); // anonymous local + storage_live(_0) storage_live(_2) _2 = &f storage_live(_3) @@ -127,6 +130,7 @@ fn apply_to_zero::>(f: test_crate::main::closure<' storage_dead(_3) storage_dead(_2) conditional_drop[{impl Destruct for test_crate::main::closure<'_0>}::drop_glue<'15, '16>] f + storage_dead(f) return } @@ -140,7 +144,9 @@ unsafe fn {impl Destruct for test_crate::main::closure#1<'_0>}::drop_glue<'_0, ' let _0: (); // return let _1: &'1 mut test_crate::main::closure#1<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -169,6 +175,7 @@ fn apply_to_zero_mut::>(f: test_crate::main::clo let _2: &'3 mut test_crate::main::closure#1<'4>; // anonymous local let _3: (u8,); // anonymous local + storage_live(_0) storage_live(_2) _2 = &mut f storage_live(_3) @@ -177,6 +184,7 @@ fn apply_to_zero_mut::>(f: test_crate::main::clo storage_dead(_3) storage_dead(_2) conditional_drop[{impl Destruct for test_crate::main::closure#1<'_0>}::drop_glue<'15, '16>] f + storage_dead(f) return } @@ -190,7 +198,9 @@ unsafe fn {impl Destruct for test_crate::main::closure#2}::drop_glue<'_0>(_1: &' let _0: (); // return let _1: &'1 mut test_crate::main::closure#2; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -210,6 +220,7 @@ fn apply_to_zero_once::(f: test_crate::main::closur let _2: test_crate::main::closure#2; // anonymous local let _3: (u8,); // anonymous local + storage_live(_0) storage_live(_2) _2 = move f storage_live(_3) @@ -218,6 +229,7 @@ fn apply_to_zero_once::(f: test_crate::main::closur storage_dead(_3) storage_dead(_2) conditional_drop[{impl Destruct for test_crate::main::closure#2}::drop_glue<'1>] f + storage_dead(f) return } @@ -237,6 +249,7 @@ fn main() let _10: u8; // anonymous local let _11: test_crate::main::closure#2; // anonymous local + storage_live(_0) _0 = () storage_live(z_1) z_1 = const 1u8 diff --git a/charon/tests/ui/monomorphization/dyn-trait.out b/charon/tests/ui/monomorphization/dyn-trait.out index 6292d77fa..63f4ac5ee 100644 --- a/charon/tests/ui/monomorphization/dyn-trait.out +++ b/charon/tests/ui/monomorphization/dyn-trait.out @@ -35,10 +35,12 @@ fn dyn_to_string<'_0>(x: &'_0 (dyn Display + '_0)) -> String let x: &'3 (dyn Display + '4); // arg #1 let _2: &'5 (dyn Display + '6); // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) with_metadata(copy x.metadata) _0 = {impl ToString for (dyn Display)}::to_string::<(dyn Display)><'9>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -54,6 +56,7 @@ fn main() let _6: &'9 String; // anonymous local let _7: &'10 String; // anonymous local + storage_live(_0) _0 = () storage_live(str) storage_live(_2) diff --git a/charon/tests/ui/monomorphization/fn_ptr_generics.out b/charon/tests/ui/monomorphization/fn_ptr_generics.out index 5da77539e..66cb90f93 100644 --- a/charon/tests/ui/monomorphization/fn_ptr_generics.out +++ b/charon/tests/ui/monomorphization/fn_ptr_generics.out @@ -18,6 +18,7 @@ fn init_option() let _5: &'_ [Option::; 6usize]; // anonymous local let _6: &'_ Option::; // anonymous local + storage_live(_0) _0 = () storage_live(a) storage_live(_2) @@ -36,6 +37,8 @@ fn init_option() _0 = () storage_dead(b) storage_dead(a) + storage_dead(_6) + storage_dead(_5) return } diff --git a/charon/tests/ui/monomorphization/fndefs-casts.out b/charon/tests/ui/monomorphization/fndefs-casts.out index 779a4ee1c..85ebbba63 100644 --- a/charon/tests/ui/monomorphization/fndefs-casts.out +++ b/charon/tests/ui/monomorphization/fndefs-casts.out @@ -66,8 +66,10 @@ fn foo::<'a>(x: &'a u8) let _0: (); // return let x: &'1 u8; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(x) return } @@ -77,8 +79,10 @@ fn foo::<'a>(x: &'a char) let _0: (); // return let x: &'1 char; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(x) return } @@ -88,8 +92,10 @@ fn foo::<'a>(x: &'a u32) let _0: (); // return let x: &'1 u32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(x) return } @@ -109,10 +115,13 @@ fn takes_closure:: foo::<'a>>(c: for<'a> foo::<'a>) storage_live(_7) storage_live(_8) + storage_live(_8) storage_live(_9) _9 = const 13u32 _8 = &_9 + storage_dead(_9) _7 = move _8 + storage_live(_0) storage_live(_6) _0 = () storage_live(_2) @@ -129,6 +138,10 @@ fn takes_closure:: foo::<'a>>(c: for<'a> foo::<'a>) storage_dead(_3) storage_dead(_2) storage_dead(_5) + storage_dead(_6) + storage_dead(c) + storage_dead(_8) + storage_dead(_7) return } @@ -167,6 +180,7 @@ fn main() let _29: &'25 char; // anonymous local let _30: char; // anonymous local + storage_live(_0) storage_live(_27) _0 = () storage_live(fooint1) @@ -225,9 +239,11 @@ fn main() _18 = (move _19)(move _20) storage_live(_28) storage_live(_29) + storage_live(_29) storage_live(_30) _30 = const 'x' _29 = &_30 + storage_dead(_30) _28 = move _29 storage_dead(_20) storage_dead(_19) @@ -255,6 +271,9 @@ fn main() storage_dead(foochar) storage_dead(fooint2) storage_dead(fooint1) + storage_dead(_27) + storage_dead(_29) + storage_dead(_28) return } diff --git a/charon/tests/ui/monomorphization/generic-method.out b/charon/tests/ui/monomorphization/generic-method.out index 33e22daa5..47c5a4734 100644 --- a/charon/tests/ui/monomorphization/generic-method.out +++ b/charon/tests/ui/monomorphization/generic-method.out @@ -25,6 +25,7 @@ fn bar::() -> u64 { let _0: u64; // return + storage_live(_0) _0 = const 0u64 return } @@ -35,6 +36,7 @@ fn main() let _0: (); // return let _1: u64; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = bar::() diff --git a/charon/tests/ui/monomorphization/global_with_generics.out b/charon/tests/ui/monomorphization/global_with_generics.out index 892e67790..364649cdd 100644 --- a/charon/tests/ui/monomorphization/global_with_generics.out +++ b/charon/tests/ui/monomorphization/global_with_generics.out @@ -15,6 +15,7 @@ fn FooInt() -> Foo:: { let _0: Foo::; // return + storage_live(_0) _0 = Foo:: { value: const 0i32 } return } @@ -27,6 +28,7 @@ fn FooBool() -> Foo:: { let _0: Foo::; // return + storage_live(_0) _0 = Foo:: { value: const false } return } @@ -42,6 +44,7 @@ fn main() let _2: &'1 Foo::; // anonymous local let _3: &'2 Foo::; // anonymous local + storage_live(_0) _0 = () storage_live(_b) storage_live(_2) @@ -52,6 +55,7 @@ fn main() storage_dead(_2) _0 = () storage_dead(_b) + storage_dead(_3) return } diff --git a/charon/tests/ui/monomorphization/issue-1159-assoc-const.out b/charon/tests/ui/monomorphization/issue-1159-assoc-const.out index 665b4b486..8671a66e5 100644 --- a/charon/tests/ui/monomorphization/issue-1159-assoc-const.out +++ b/charon/tests/ui/monomorphization/issue-1159-assoc-const.out @@ -63,6 +63,7 @@ fn ARR() -> [u64; 1usize] { let _0: [u64; 1usize]; // return + storage_live(_0) _0 = [const 7u64] return } @@ -84,10 +85,13 @@ pub fn {impl MyConfig for Concrete}::SLICE_HOLDER() -> Option::<&'_ [u64]> storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = copy ARR _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) storage_live(_1) storage_live(_2) @@ -100,6 +104,9 @@ pub fn {impl MyConfig for Concrete}::SLICE_HOLDER() -> Option::<&'_ [u64]> _0 = Option::<&'_ [u64]>::Some { 0: move _1 } storage_dead(_1) storage_dead(_3) + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } @@ -108,6 +115,7 @@ fn ARR() -> [u64; 1usize] { let _0: [u64; 1usize]; // return + storage_live(_0) _0 = [const 7u64] return } @@ -129,10 +137,13 @@ pub fn {impl MyConfig for Concrete}::SLICE_HOLDER() -> Option<&'static [u64]>[{b storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = copy ARR _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) storage_live(_1) storage_live(_2) @@ -145,6 +156,9 @@ pub fn {impl MyConfig for Concrete}::SLICE_HOLDER() -> Option<&'static [u64]>[{b _0 = Option::Some { 0: move _1 } storage_dead(_1) storage_dead(_3) + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } @@ -162,12 +176,15 @@ pub fn {impl MyConfig for Concrete}::op(x: u64) -> u64 let _2: u64; // anonymous local let _3: u64; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_2) _2 = copy x _3 = copy _2 panic.+ const 1u64 _0 = move _3 storage_dead(_2) + storage_dead(_3) + storage_dead(x) return } @@ -179,12 +196,15 @@ pub fn {impl MyConfig for Concrete}::op(x: u64) -> u64 let _2: u64; // anonymous local let _3: u64; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_2) _2 = copy x _3 = copy _2 panic.+ const 1u64 _0 = move _3 storage_dead(_2) + storage_dead(_3) + storage_dead(x) return } @@ -195,10 +215,12 @@ pub fn entry(x: u64) -> u64 let x: u64; // arg #1 let _2: u64; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = {impl MyConfig for Concrete}::op(move _2) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/monomorphization/issue-1262-defaulted-method-indirection.out b/charon/tests/ui/monomorphization/issue-1262-defaulted-method-indirection.out index 14b05051b..abe129ead 100644 --- a/charon/tests/ui/monomorphization/issue-1262-defaulted-method-indirection.out +++ b/charon/tests/ui/monomorphization/issue-1262-defaulted-method-indirection.out @@ -19,6 +19,7 @@ pub fn bar::() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -36,6 +37,7 @@ fn main() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = bar::() diff --git a/charon/tests/ui/monomorphization/issue-722-poly-items-in-names.out b/charon/tests/ui/monomorphization/issue-722-poly-items-in-names.out index 0b594e0cc..988c8caa3 100644 --- a/charon/tests/ui/monomorphization/issue-722-poly-items-in-names.out +++ b/charon/tests/ui/monomorphization/issue-722-poly-items-in-names.out @@ -19,6 +19,7 @@ fn some_method<'_0>(self: &'_0 Point::) let _6: bool; // anonymous local let _7: i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -42,6 +43,7 @@ fn some_method<'_0>(self: &'_0 Point::) storage_dead(_4) storage_dead(_2) _0 = () + storage_dead(self) return } else { storage_dead(_7) @@ -52,6 +54,7 @@ fn some_method<'_0>(self: &'_0 Point::) } else { storage_dead(_3) } + storage_dead(self) panic(core::panicking::panic) } @@ -63,6 +66,7 @@ fn main() let _2: (); // anonymous local let _3: &'1 Point::; // anonymous local + storage_live(_0) _0 = () storage_live(p) p = Point:: { x: const 10i32, y: const 50u64, z: const 1i32 } diff --git a/charon/tests/ui/monomorphization/issue-917-inline-const-with-poly-type.out b/charon/tests/ui/monomorphization/issue-917-inline-const-with-poly-type.out index d1a38c758..2b51e5400 100644 --- a/charon/tests/ui/monomorphization/issue-917-inline-const-with-poly-type.out +++ b/charon/tests/ui/monomorphization/issue-917-inline-const-with-poly-type.out @@ -77,7 +77,9 @@ unsafe fn drop_glue::<()><'_0>(_1: &'_0 mut closure::<()>) let _0: (); // return let _1: &'1 mut closure::<()>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -106,11 +108,15 @@ fn call_once::<()>(_1: closure::<()>, _2: ((),)) let _2: ((),); // arg #2 let _3: &'1 mut closure::<()>; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = {impl FnMut<((),)> for closure::<()>}::call_mut<'2>(move _3, move _2) drop[drop_glue::<()><'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -122,12 +128,16 @@ fn as_fn::<()>(arg1: ()) let args: ((),); // local let state: closure::<()>; // local + storage_live(_0) _0 = () storage_live(args) storage_live(state) args = (move arg1,) state = closure::<()> { } _0 = call_once::<()>(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -145,11 +155,13 @@ fn foo::<()>(x: ()) storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = closure::<()> { } _6 = cast, fn(())>(const as_fn::<()>) storage_dead(_7) _5 = move _6 + storage_live(_0) _0 = () storage_live(f) f = move _5 @@ -161,6 +173,9 @@ fn foo::<()>(x: ()) storage_dead(_4) storage_dead(_3) storage_dead(f) + storage_dead(x) + storage_dead(_6) + storage_dead(_5) return } @@ -186,6 +201,7 @@ pub fn main() let _1: (); // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/monomorphization/issue-922-assoc-const-with-default.out b/charon/tests/ui/monomorphization/issue-922-assoc-const-with-default.out index bde889dee..4df8ecb49 100644 --- a/charon/tests/ui/monomorphization/issue-922-assoc-const-with-default.out +++ b/charon/tests/ui/monomorphization/issue-922-assoc-const-with-default.out @@ -33,6 +33,7 @@ pub fn IS_ZST::<()>() -> bool let _0: bool; // return let _1: usize; // anonymous local + storage_live(_0) storage_live(_1) _1 = size_of::<()>() _0 = move _1 == const 0usize @@ -49,6 +50,7 @@ fn main() let _0: (); // return let _1: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = copy IS_ZST::<()> diff --git a/charon/tests/ui/monomorphization/lifetime-bound-call.out b/charon/tests/ui/monomorphization/lifetime-bound-call.out index 351a33272..0755f89af 100644 --- a/charon/tests/ui/monomorphization/lifetime-bound-call.out +++ b/charon/tests/ui/monomorphization/lifetime-bound-call.out @@ -5,6 +5,7 @@ fn callee::<'_>() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -16,6 +17,7 @@ fn caller::<'_>() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = callee::<'_>() @@ -29,6 +31,7 @@ pub fn f() { let _0: (); // return + storage_live(_0) _0 = () _0 = caller::<'_>() return diff --git a/charon/tests/ui/monomorphization/rec-adt.out b/charon/tests/ui/monomorphization/rec-adt.out index efed24163..884058c2c 100644 --- a/charon/tests/ui/monomorphization/rec-adt.out +++ b/charon/tests/ui/monomorphization/rec-adt.out @@ -22,6 +22,7 @@ fn new::() -> LinkedList:: let _0: LinkedList::; // return let _1: Option::>>; // anonymous local + storage_live(_0) storage_live(_1) _1 = Option::>>::None { } _0 = LinkedList:: { head: move _1 } @@ -35,6 +36,7 @@ fn main() let _0: (); // return let list: LinkedList::; // local + storage_live(_0) _0 = () storage_live(list) list = new::() diff --git a/charon/tests/ui/monomorphization/simpl-trait-assoc-types-2.out b/charon/tests/ui/monomorphization/simpl-trait-assoc-types-2.out index 8c44ec84a..aec0d15d9 100644 --- a/charon/tests/ui/monomorphization/simpl-trait-assoc-types-2.out +++ b/charon/tests/ui/monomorphization/simpl-trait-assoc-types-2.out @@ -27,8 +27,10 @@ fn impl_Trait_for_i32::comsume<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -39,10 +41,13 @@ fn impl_Trait_for_i32::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = impl_Trait_for_i32::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -53,9 +58,12 @@ unsafe fn impl_Trait_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Tr let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -72,6 +80,7 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -89,6 +98,14 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -107,8 +124,10 @@ fn impl_Trait_for_usize::comsume<'_0>(self: &'_0 usize) let _0: (); // return let self: &'1 usize; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -119,10 +138,13 @@ fn impl_Trait_for_usize::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 usize; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 usize>(move _1) _0 = impl_Trait_for_usize::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -133,9 +155,12 @@ unsafe fn impl_Trait_for_usize::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut usize; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut usize>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -152,6 +177,7 @@ fn impl_Trait_for_usize::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -169,6 +195,14 @@ fn impl_Trait_for_usize::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for usize}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -208,10 +242,13 @@ fn main() storage_live(_15) storage_live(_17) + storage_live(_17) storage_live(_18) _18 = const 42i32 _17 = &_18 + storage_dead(_18) _15 = move _17 + storage_live(_0) storage_live(_11) storage_live(_12) _0 = () @@ -232,9 +269,11 @@ fn main() _4 = (copy _13)(move _5) storage_live(_16) storage_live(_19) + storage_live(_19) storage_live(_20) _20 = const 42usize _19 = &_20 + storage_dead(_20) _16 = move _19 storage_dead(_5) storage_dead(_4) @@ -258,6 +297,14 @@ fn main() _0 = () storage_dead(b) storage_dead(a) + storage_dead(_12) + storage_dead(_11) + storage_dead(_19) + storage_dead(_17) + storage_dead(_16) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) return } diff --git a/charon/tests/ui/monomorphization/simple-trait-assoc-types-3.out b/charon/tests/ui/monomorphization/simple-trait-assoc-types-3.out index f183b9f4f..f88e26f94 100644 --- a/charon/tests/ui/monomorphization/simple-trait-assoc-types-3.out +++ b/charon/tests/ui/monomorphization/simple-trait-assoc-types-3.out @@ -27,8 +27,10 @@ fn impl_Trait_for_i32::comsume<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -39,10 +41,13 @@ fn impl_Trait_for_i32::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = impl_Trait_for_i32::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -53,9 +58,12 @@ unsafe fn impl_Trait_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Tr let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -72,6 +80,7 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -89,6 +98,14 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -107,8 +124,10 @@ fn impl_Trait_for_usize::comsume<'_0>(self: &'_0 usize) let _0: (); // return let self: &'1 usize; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -119,10 +138,13 @@ fn impl_Trait_for_usize::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 usize; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 usize>(move _1) _0 = impl_Trait_for_usize::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -133,9 +155,12 @@ unsafe fn impl_Trait_for_usize::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut usize; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut usize>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -152,6 +177,7 @@ fn impl_Trait_for_usize::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -169,6 +195,14 @@ fn impl_Trait_for_usize::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for usize}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -208,10 +242,13 @@ fn main() storage_live(_15) storage_live(_17) + storage_live(_17) storage_live(_18) _18 = const 42i32 _17 = &_18 + storage_dead(_18) _15 = move _17 + storage_live(_0) storage_live(_11) storage_live(_12) _0 = () @@ -232,9 +269,11 @@ fn main() _4 = (copy _13)(move _5) storage_live(_16) storage_live(_19) + storage_live(_19) storage_live(_20) _20 = const 42usize _19 = &_20 + storage_dead(_20) _16 = move _19 storage_dead(_5) storage_dead(_4) @@ -258,6 +297,14 @@ fn main() _0 = () storage_dead(b) storage_dead(a) + storage_dead(_12) + storage_dead(_11) + storage_dead(_19) + storage_dead(_17) + storage_dead(_16) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) return } diff --git a/charon/tests/ui/monomorphization/simple-trait-assoc-types.out b/charon/tests/ui/monomorphization/simple-trait-assoc-types.out index b6ed207e8..55c90f303 100644 --- a/charon/tests/ui/monomorphization/simple-trait-assoc-types.out +++ b/charon/tests/ui/monomorphization/simple-trait-assoc-types.out @@ -27,8 +27,10 @@ fn comsume<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -39,10 +41,13 @@ fn {vtable_method}<'_0>(_1: &'_0 (dyn Trait)) let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -53,9 +58,12 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Trait)) let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -72,6 +80,7 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -89,6 +98,14 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -118,10 +135,13 @@ fn main() storage_live(_8) storage_live(_9) + storage_live(_9) storage_live(_10) _10 = const 42i32 _9 = &_10 + storage_dead(_10) _8 = move _9 + storage_live(_0) storage_live(_6) _0 = () storage_live(a) @@ -143,6 +163,10 @@ fn main() storage_dead(_4) _0 = () storage_dead(a) + storage_dead(_6) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/monomorphization/simple-trait-generics-2.out b/charon/tests/ui/monomorphization/simple-trait-generics-2.out index 2e2f9776d..58debe6e1 100644 --- a/charon/tests/ui/monomorphization/simple-trait-generics-2.out +++ b/charon/tests/ui/monomorphization/simple-trait-generics-2.out @@ -36,7 +36,9 @@ fn impl_Trait_bool_for_i32::comsume<'_0>(self: &'_0 i32) -> bool let _0: bool; // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = const true + storage_dead(self) return } @@ -47,9 +49,12 @@ fn impl_Trait_bool_for_i32::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = impl_Trait_bool_for_i32::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -60,9 +65,12 @@ unsafe fn impl_Trait_bool_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (d let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -79,6 +87,7 @@ fn impl_Trait_bool_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)) -> bool; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -96,6 +105,14 @@ fn impl_Trait_bool_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)) -> bool, *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -115,7 +132,9 @@ fn impl_Trait_usize_for_u32::comsume<'_0>(self: &'_0 u32) -> usize let _0: usize; // return let self: &'1 u32; // arg #1 + storage_live(_0) _0 = const 1usize + storage_dead(self) return } @@ -126,9 +145,12 @@ fn impl_Trait_usize_for_u32::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 u32>(move _1) _0 = impl_Trait_usize_for_u32::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -139,9 +161,12 @@ unsafe fn impl_Trait_usize_for_u32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut ( let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut u32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut u32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -158,6 +183,7 @@ fn impl_Trait_usize_for_u32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)) -> usize; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -175,6 +201,14 @@ fn impl_Trait_usize_for_u32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)) -> usize, *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for u32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -215,10 +249,13 @@ fn main() storage_live(_15) storage_live(_17) + storage_live(_17) storage_live(_18) _18 = const 42i32 _17 = &_18 + storage_dead(_18) _15 = move _17 + storage_live(_0) storage_live(_11) storage_live(_12) _0 = () @@ -239,9 +276,11 @@ fn main() _4 = (copy _13)(move _5) storage_live(_16) storage_live(_19) + storage_live(_19) storage_live(_20) _20 = const 100u32 _19 = &_20 + storage_dead(_20) _16 = move _19 storage_dead(_5) storage_dead(_4) @@ -265,6 +304,14 @@ fn main() _0 = () storage_dead(b) storage_dead(a) + storage_dead(_12) + storage_dead(_11) + storage_dead(_19) + storage_dead(_17) + storage_dead(_16) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) return } diff --git a/charon/tests/ui/monomorphization/simple-trait-generics-assoc-2.out b/charon/tests/ui/monomorphization/simple-trait-generics-assoc-2.out index dfa27919b..c0f33fbec 100644 --- a/charon/tests/ui/monomorphization/simple-trait-generics-assoc-2.out +++ b/charon/tests/ui/monomorphization/simple-trait-generics-assoc-2.out @@ -36,8 +36,10 @@ fn impl_Trait_usize_for_i32::comsume<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -48,10 +50,13 @@ fn impl_Trait_usize_for_i32::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = impl_Trait_usize_for_i32::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -62,9 +67,12 @@ unsafe fn impl_Trait_usize_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut ( let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -81,6 +89,7 @@ fn impl_Trait_usize_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -98,6 +107,14 @@ fn impl_Trait_usize_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -117,8 +134,10 @@ fn impl_Trait_bool_for_bool::comsume<'_0>(self: &'_0 bool) let _0: (); // return let self: &'1 bool; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -129,10 +148,13 @@ fn impl_Trait_bool_for_bool::comsume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 bool; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 bool>(move _1) _0 = impl_Trait_bool_for_bool::comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -143,9 +165,12 @@ unsafe fn impl_Trait_bool_for_bool::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut ( let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut bool; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut bool>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -162,6 +187,7 @@ fn impl_Trait_bool_for_bool::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -179,6 +205,14 @@ fn impl_Trait_bool_for_bool::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for bool}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -219,10 +253,13 @@ fn main() storage_live(_15) storage_live(_17) + storage_live(_17) storage_live(_18) _18 = const 42i32 _17 = &_18 + storage_dead(_18) _15 = move _17 + storage_live(_0) storage_live(_11) storage_live(_12) _0 = () @@ -243,9 +280,11 @@ fn main() _4 = (copy _13)(move _5) storage_live(_16) storage_live(_19) + storage_live(_19) storage_live(_20) _20 = const true _19 = &_20 + storage_dead(_20) _16 = move _19 storage_dead(_5) storage_dead(_4) @@ -269,6 +308,14 @@ fn main() _0 = () storage_dead(b) storage_dead(a) + storage_dead(_12) + storage_dead(_11) + storage_dead(_19) + storage_dead(_17) + storage_dead(_16) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) return } diff --git a/charon/tests/ui/monomorphization/simple-trait-generics-assoc.out b/charon/tests/ui/monomorphization/simple-trait-generics-assoc.out index 8736fef59..ab7c95081 100644 --- a/charon/tests/ui/monomorphization/simple-trait-generics-assoc.out +++ b/charon/tests/ui/monomorphization/simple-trait-generics-assoc.out @@ -36,8 +36,10 @@ fn comsume<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -48,10 +50,13 @@ fn {vtable_method}<'_0>(_1: &'_0 (dyn Trait)) let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -62,9 +67,12 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -81,6 +89,7 @@ fn impl_Trait_usize_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -98,6 +107,14 @@ fn impl_Trait_usize_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -128,10 +145,13 @@ fn main() storage_live(_8) storage_live(_9) + storage_live(_9) storage_live(_10) _10 = const 42i32 _9 = &_10 + storage_dead(_10) _8 = move _9 + storage_live(_0) storage_live(_6) _0 = () storage_live(a) @@ -153,6 +173,10 @@ fn main() storage_dead(_4) _0 = () storage_dead(a) + storage_dead(_6) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/monomorphization/simple-trait-generics.out b/charon/tests/ui/monomorphization/simple-trait-generics.out index 8d44ed374..1fc58523d 100644 --- a/charon/tests/ui/monomorphization/simple-trait-generics.out +++ b/charon/tests/ui/monomorphization/simple-trait-generics.out @@ -36,7 +36,9 @@ fn comsume<'_0>(self: &'_0 i32) -> bool let _0: bool; // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = const true + storage_dead(self) return } @@ -47,9 +49,12 @@ fn {vtable_method}<'_0>(_1: &'_0 (dyn Trait)) -> bool let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -60,9 +65,12 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Trait)) let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -79,6 +87,7 @@ fn impl_Trait_bool_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)) -> bool; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -96,6 +105,14 @@ fn impl_Trait_bool_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)) -> bool, *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -126,10 +143,13 @@ fn main() storage_live(_8) storage_live(_9) + storage_live(_9) storage_live(_10) _10 = const 42i32 _9 = &_10 + storage_dead(_10) _8 = move _9 + storage_live(_0) storage_live(_6) _0 = () storage_live(a) @@ -151,6 +171,10 @@ fn main() storage_dead(_4) _0 = () storage_dead(a) + storage_dead(_6) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/monomorphization/simple-trait-two-methods.out b/charon/tests/ui/monomorphization/simple-trait-two-methods.out index 64cf09e33..7e411acf1 100644 --- a/charon/tests/ui/monomorphization/simple-trait-two-methods.out +++ b/charon/tests/ui/monomorphization/simple-trait-two-methods.out @@ -28,8 +28,10 @@ fn another<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -40,10 +42,13 @@ fn impl_Trait_for_i32::another::{vtable_method}<'_0>(_1: &'_0 (dyn Trait)) let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = another<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -53,8 +58,10 @@ fn consume<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -65,10 +72,13 @@ fn impl_Trait_for_i32::consume::{vtable_method}<'_0>(_1: &'_0 (dyn Trait)) let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = consume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -79,9 +89,12 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Trait)) let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -101,6 +114,7 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _10: fn<'_0_1>(&'_0_1 (dyn Trait + '10)); // anonymous local let _11: fn<'_0_1>(&'_0_1 (dyn Trait + '15)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -124,6 +138,17 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} another = move _11 erased_another = cast(&'_0_1 (dyn Trait + '16)), *const ()>(move another) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_consume: move erased_consume, method_another: move erased_another, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_another) + storage_dead(another) + storage_dead(erased_consume) + storage_dead(consume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_11) + storage_dead(_10) + storage_dead(_9) return } @@ -153,10 +178,13 @@ fn main() storage_live(_8) storage_live(_9) + storage_live(_9) storage_live(_10) _10 = const 42i32 _9 = &_10 + storage_dead(_10) _8 = move _9 + storage_live(_0) storage_live(_6) _0 = () storage_live(b) @@ -178,6 +206,10 @@ fn main() storage_dead(_4) _0 = () storage_dead(b) + storage_dead(_6) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/monomorphization/simple_trait.out b/charon/tests/ui/monomorphization/simple_trait.out index c9bee476f..2aad5a576 100644 --- a/charon/tests/ui/monomorphization/simple_trait.out +++ b/charon/tests/ui/monomorphization/simple_trait.out @@ -27,8 +27,10 @@ fn comsume<'_0>(self: &'_0 i32) let _0: (); // return let self: &'1 i32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -39,10 +41,13 @@ fn {vtable_method}<'_0>(_1: &'_0 (dyn Trait)) let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 i32>(move _1) _0 = comsume<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -53,9 +58,12 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Trait)) let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -72,6 +80,7 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -89,6 +98,14 @@ fn impl_Trait_for_i32::{vtable}() -> test_crate::Trait::{vtable} comsume = move _8 erased_comsume = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move comsume) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_comsume: move erased_comsume, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(erased_comsume) + storage_dead(comsume) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -118,10 +135,13 @@ fn main() storage_live(_8) storage_live(_9) + storage_live(_9) storage_live(_10) _10 = const 42i32 _9 = &_10 + storage_dead(_10) _8 = move _9 + storage_live(_0) storage_live(_6) _0 = () storage_live(b) @@ -143,6 +163,10 @@ fn main() storage_dead(_4) _0 = () storage_dead(b) + storage_dead(_6) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/monomorphization/simple_trait_with_trait_alias.out b/charon/tests/ui/monomorphization/simple_trait_with_trait_alias.out index e80fabf58..27d6beb77 100644 --- a/charon/tests/ui/monomorphization/simple_trait_with_trait_alias.out +++ b/charon/tests/ui/monomorphization/simple_trait_with_trait_alias.out @@ -31,6 +31,7 @@ fn f::() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -42,6 +43,7 @@ fn main() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = f::() diff --git a/charon/tests/ui/monomorphization/simple_trait_with_trait_alias_generics.out b/charon/tests/ui/monomorphization/simple_trait_with_trait_alias_generics.out index bfe8b3848..4e9179cda 100644 --- a/charon/tests/ui/monomorphization/simple_trait_with_trait_alias_generics.out +++ b/charon/tests/ui/monomorphization/simple_trait_with_trait_alias_generics.out @@ -41,6 +41,7 @@ fn f::() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -52,6 +53,7 @@ fn main() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = f::() diff --git a/charon/tests/ui/monomorphization/trait_impls.out b/charon/tests/ui/monomorphization/trait_impls.out index 98d921c0b..6e379bc5c 100644 --- a/charon/tests/ui/monomorphization/trait_impls.out +++ b/charon/tests/ui/monomorphization/trait_impls.out @@ -6,8 +6,10 @@ pub fn method<'_0>(self: &'_0 bool) let _0: (); // return let self: &'1 bool; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -18,11 +20,13 @@ fn do_test::(x: bool) let x: bool; // arg #1 let _2: &'1 bool; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &x _0 = method<'3>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -32,6 +36,7 @@ fn main() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = do_test::(const true) diff --git a/charon/tests/ui/monomorphization/trait_impls_ullbc.out b/charon/tests/ui/monomorphization/trait_impls_ullbc.out index 396dad052..aedabfa48 100644 --- a/charon/tests/ui/monomorphization/trait_impls_ullbc.out +++ b/charon/tests/ui/monomorphization/trait_impls_ullbc.out @@ -15,6 +15,7 @@ fn do_test::(init: bool, expected: bool) let _5: &'2 bool; // anonymous local bb0: { + storage_live(_0); _0 = (); storage_live(_3); storage_live(_4); @@ -25,6 +26,8 @@ fn do_test::(init: bool, expected: bool) } bb1: { + storage_dead(expected); + storage_dead(init); unwind_continue; } @@ -37,12 +40,16 @@ fn do_test::(init: bool, expected: bool) storage_dead(_4); storage_dead(_3); _0 = (); + storage_dead(expected); + storage_dead(init); return; } bb4: { storage_dead(_5); storage_dead(_4); + storage_dead(expected); + storage_dead(init); panic(core::panicking::panic); } } @@ -54,6 +61,7 @@ fn main() let _1: (); // anonymous local bb0: { + storage_live(_0); _0 = (); storage_live(_1); _1 = do_test::(const true, const true) -> bb2 (unwind: bb1); diff --git a/charon/tests/ui/monomorphization/unsatisfied-method-bounds.out b/charon/tests/ui/monomorphization/unsatisfied-method-bounds.out index ec15c193d..f37f2dec4 100644 --- a/charon/tests/ui/monomorphization/unsatisfied-method-bounds.out +++ b/charon/tests/ui/monomorphization/unsatisfied-method-bounds.out @@ -30,8 +30,10 @@ fn method::<'_0>(self: &'_0 A) let _0: (); // return let self: &'1 A; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -44,8 +46,10 @@ fn method::<'_0>(self: &'_0 B) let _0: (); // return let self: &'1 B; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -68,10 +72,13 @@ fn main() storage_live(_7) storage_live(_9) + storage_live(_9) storage_live(_10) _10 = A { } _9 = &_10 + storage_dead(_10) _7 = move _9 + storage_live(_0) storage_live(_5) storage_live(_6) _0 = () @@ -82,9 +89,11 @@ fn main() _1 = method::<'8>(move _2) storage_live(_8) storage_live(_11) + storage_live(_11) storage_live(_12) _12 = B { } _11 = &_12 + storage_dead(_12) _8 = move _11 storage_dead(_2) storage_dead(_1) @@ -96,6 +105,12 @@ fn main() storage_dead(_4) storage_dead(_3) _0 = () + storage_dead(_6) + storage_dead(_5) + storage_dead(_11) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/monomorphization/vtable-blanket-impl.out b/charon/tests/ui/monomorphization/vtable-blanket-impl.out index 249605136..2de1d3cb8 100644 --- a/charon/tests/ui/monomorphization/vtable-blanket-impl.out +++ b/charon/tests/ui/monomorphization/vtable-blanket-impl.out @@ -27,7 +27,9 @@ pub fn method::<()><'_0>(self: &'_0 ()) -> usize let _0: usize; // return let self: &'1 (); // arg #1 + storage_live(_0) _0 = const 0usize + storage_dead(self) return } @@ -38,9 +40,12 @@ fn {vtable_method}::<()><'_0>(_1: &'_0 (dyn Trait)) -> usize let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 (); // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 ()>(move _1) _0 = method::<()><'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -51,9 +56,12 @@ unsafe fn {vtable_drop_shim}::<()><'_0>(dyn_self: &'_0 mut (dyn Trait)) let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut (); // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut ()>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -70,6 +78,7 @@ fn impl_Trait_for_unit::{vtable}::<()>() -> test_crate::Trait::{vtable} let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)) -> usize; // anonymous local + storage_live(ret) storage_live(size) size = size_of<()> storage_live(align) @@ -87,6 +96,14 @@ fn impl_Trait_for_unit::{vtable}::<()>() -> test_crate::Trait::{vtable} method = move _8 erased_method = cast(&'_0_1 (dyn Trait + '10)) -> usize, *const ()>(move method) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_method: move erased_method, super_trait_0: const &vtable_of({built_in impl MetaSized for ()}) } + storage_dead(erased_method) + storage_dead(method) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -108,6 +125,7 @@ pub fn f<'_0>(x: &'_0 ()) -> &'_0 (dyn Trait + '_0) let _3: &'9 (dyn Trait + '10); // anonymous local let _4: &'11 (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -118,6 +136,7 @@ pub fn f<'_0>(x: &'_0 ()) -> &'_0 (dyn Trait + '_0) _0 = unsize_cast<&'7 (dyn Trait + '8), &'15 (dyn Trait + '16), at []>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/monomorphization/vtable-lifetime-impl.out b/charon/tests/ui/monomorphization/vtable-lifetime-impl.out index 5d4392390..fe751d75d 100644 --- a/charon/tests/ui/monomorphization/vtable-lifetime-impl.out +++ b/charon/tests/ui/monomorphization/vtable-lifetime-impl.out @@ -40,7 +40,9 @@ unsafe fn drop_glue::<'_><'_0>(_1: &'_0 mut Pattern::<'_>) let _0: (); // return let _1: &'1 mut Pattern::<'_>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -56,8 +58,10 @@ pub fn method::<'_><'_0>(self: &'_0 Pattern::<'_>) let _0: (); // return let self: &'1 Pattern::<'_>; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -68,10 +72,13 @@ fn {vtable_method}::<'_><'_0>(_1: &'_0 (dyn Trait)) let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 Pattern::<'_>; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '1), &'_0 Pattern::<'_>>(move _1) _0 = method::<'_><'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -82,10 +89,13 @@ unsafe fn {vtable_drop_shim}::<'_><'_0>(dyn_self: &'_0 mut (dyn Trait)) let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut Pattern::<'_>; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '1), &'_0 mut Pattern::<'_>>(move dyn_self) drop[drop_glue::<'_><'3>] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -102,6 +112,7 @@ fn {impl Trait for Pattern::<'_>}::{vtable}::<'_>() -> test_crate::Trait::{vtabl let _7: unsafe fn(*mut (dyn Trait + '4)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '9)); // anonymous local + storage_live(ret) storage_live(size) size = size_of> storage_live(align) @@ -119,6 +130,14 @@ fn {impl Trait for Pattern::<'_>}::{vtable}::<'_>() -> test_crate::Trait::{vtabl method = move _8 erased_method = cast(&'_0_1 (dyn Trait + '10)), *const ()>(move method) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_method: move erased_method, super_trait_0: const &vtable_of({built_in impl MetaSized for Pattern::<'_>}) } + storage_dead(erased_method) + storage_dead(method) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -140,6 +159,7 @@ pub fn f<'a>(x: &'a Pattern::<'_>) -> &'a (dyn Trait + 'a) let _3: &'9 (dyn Trait + '10); // anonymous local let _4: &'11 Pattern::<'_>; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -150,6 +170,7 @@ pub fn f<'a>(x: &'a Pattern::<'_>) -> &'a (dyn Trait + 'a) _0 = unsize_cast<&'7 (dyn Trait + '8), &'15 (dyn Trait + '16), at []>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/monomorphization/vtable-ref-impl.out b/charon/tests/ui/monomorphization/vtable-ref-impl.out index 6df401472..f367607e3 100644 --- a/charon/tests/ui/monomorphization/vtable-ref-impl.out +++ b/charon/tests/ui/monomorphization/vtable-ref-impl.out @@ -27,8 +27,10 @@ pub fn method::<'_, u32><'_0>(self: &'_0 &'_ u32) let _0: (); // return let self: &'2 &'3 u32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -39,10 +41,13 @@ fn {vtable_method}::<'_, u32><'_0>(_1: &'_0 (dyn Trait)) let _1: &'_0 (dyn Trait + '0); // arg #1 let _2: &'_0 &'1 u32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Trait + '3), &'_0 &'4 u32>(move _1) _0 = method::<'_, u32><'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -53,9 +58,12 @@ unsafe fn {vtable_drop_shim}::<'_, u32><'_0>(dyn_self: &'_0 mut (dyn Trait)) let dyn_self: &'_0 mut (dyn Trait + '0); // arg #1 let target_self: &'_0 mut &'1 u32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Trait + '3), &'_0 mut &'4 u32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -72,6 +80,7 @@ fn {impl Trait for &'_ u32}::{vtable}::<'_, u32>() -> test_crate::Trait::{vtable let _7: unsafe fn(*mut (dyn Trait + '6)); // anonymous local let _8: fn<'_0_1>(&'_0_1 (dyn Trait + '11)); // anonymous local + storage_live(ret) storage_live(size) size = size_of<&'2 u32> storage_live(align) @@ -89,6 +98,14 @@ fn {impl Trait for &'_ u32}::{vtable}::<'_, u32>() -> test_crate::Trait::{vtable method = move _8 erased_method = cast(&'_0_1 (dyn Trait + '12)), *const ()>(move method) ret = test_crate::Trait::{vtable} { size: move size, align: move align, drop: move erased_drop, method_method: move erased_method, super_trait_0: const &vtable_of({built_in impl MetaSized for &'14 u32}) } + storage_dead(erased_method) + storage_dead(method) + storage_dead(erased_drop) + storage_dead(drop) + storage_dead(align) + storage_dead(size) + storage_dead(_8) + storage_dead(_7) return } @@ -110,6 +127,7 @@ pub fn f<'a>(x: &'a &'a u32) -> &'a (dyn Trait + 'a) let _3: &'12 (dyn Trait + '13); // anonymous local let _4: &'14 &'15 u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -120,6 +138,7 @@ pub fn f<'a>(x: &'a &'a u32) -> &'a (dyn Trait + 'a) _0 = unsize_cast<&'10 (dyn Trait + '11), &'22 (dyn Trait + '23), at []>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/monomorphize-mut-no-types.out b/charon/tests/ui/monomorphize-mut-no-types.out index 640ac564d..f8ae1da21 100644 --- a/charon/tests/ui/monomorphize-mut-no-types.out +++ b/charon/tests/ui/monomorphize-mut-no-types.out @@ -86,8 +86,10 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -98,8 +100,10 @@ where let _0: &'_0 mut T0; // return let x: &'_0 mut T0; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::<&_ mut _><'_0> for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -110,8 +114,10 @@ where let _0: Option<&'_0 mut T0>; // return let x: Option<&'_0 mut T0>; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::><'_0> for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -122,8 +128,10 @@ where let _0: Option>; // return let x: Option>; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::>><'_0> for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -155,10 +163,13 @@ where storage_live(_16) storage_live(_17) + storage_live(_17) storage_live(_18) _18 = const 0u32 _17 = &_18 + storage_dead(_18) _16 = move _17 + storage_live(_0) storage_live(_15) _0 = () storage_live(_2) @@ -203,6 +214,10 @@ where storage_dead(_11) _0 = () conditional_drop[{built_in impl Destruct for A}::drop_glue<'248>] x + storage_dead(_15) + storage_dead(x) + storage_dead(_17) + storage_dead(_16) return } diff --git a/charon/tests/ui/monomorphize-mut.out b/charon/tests/ui/monomorphize-mut.out index 36778b499..f073a5357 100644 --- a/charon/tests/ui/monomorphize-mut.out +++ b/charon/tests/ui/monomorphize-mut.out @@ -305,6 +305,7 @@ where let _12: &'76 mut u32; // anonymous local let _13: u32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -344,6 +345,7 @@ where storage_dead(_12) storage_dead(_4) conditional_drop[{built_in impl Destruct for A}::drop_glue<'125>] x + storage_dead(x) return } @@ -355,8 +357,10 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -367,8 +371,10 @@ where let _0: &'_0 mut T0; // return let x: &'_0 mut T0; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::<&_ mut _><'_0> for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -380,8 +386,10 @@ where let _0: core::option::Option::<&_ mut _><'_0, T0>[TraitClause1]; // return let x: core::option::Option::<&_ mut _><'_0, T0>[TraitClause1]; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::<_, _>[TraitClause0]><'_0>[TraitClause1] for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -394,8 +402,10 @@ where let _0: core::option::Option::<_, _>[TraitClause1]><'_0, T0>[TraitClause1, TraitClause2]; // return let x: core::option::Option::<_, _>[TraitClause1]><'_0, T0>[TraitClause1, TraitClause2]; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::<_, _>[TraitClause1]><_, _>[TraitClause0, TraitClause1]><'_0>[TraitClause1, TraitClause2] for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -409,8 +419,10 @@ where let _0: IterMut<'_0, T0>[TraitClause1]; // return let x: IterMut<'_0, T0>[TraitClause1]; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::[TraitClause0]><'_0>[TraitClause1] for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -425,6 +437,7 @@ where let _3: &'4 mut T; // anonymous local let _4: &'5 mut T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -435,6 +448,7 @@ where _0 = &mut (*_2) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } @@ -473,10 +487,13 @@ where storage_live(_20) storage_live(_22) + storage_live(_22) storage_live(_23) _23 = const 0u32 _22 = &_23 + storage_dead(_23) _20 = move _22 + storage_live(_0) storage_live(_18) storage_live(_19) _0 = () @@ -521,10 +538,12 @@ where _11 = test_crate::identity::<_, _>[TraitClause1]><_, _>[TraitClause1, TraitClause2]><'180, A>[{built_in impl core::marker::Sized::<_, _>[TraitClause1]><_, _>[TraitClause0, TraitClause1]><'180>[{built_in impl core::marker::Sized::<_, _>[TraitClause0]><'180>[{built_in impl core::marker::Sized::<&_ mut _><'180> for A}] for A}, {built_in impl core::marker::Sized::<&_ mut _><'180> for A}] for A}, {built_in impl core::marker::Sized::<_, _>[TraitClause0]><'180>[{built_in impl core::marker::Sized::<&_ mut _><'180> for A}] for A}, {built_in impl core::marker::Sized::<&_ mut _><'180> for A}](move _12) storage_live(_21) storage_live(_24) + storage_live(_24) storage_live(_25) // Use a function pointer. _25 = const 0u32 _24 = &_25 + storage_dead(_25) _21 = move _24 storage_dead(_12) storage_dead(_11) @@ -543,6 +562,13 @@ where // let _ = Some(&mut 0u32).map(identity); // let _ = Some(&mut 0u32).map(mutable_identity); conditional_drop[{built_in impl Destruct for A}::drop_glue<'367>] x + storage_dead(_19) + storage_dead(_18) + storage_dead(x) + storage_dead(_24) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) return } @@ -597,8 +623,10 @@ fn use_foo<'_0>(_1: test_crate::Foo3::<&_ mut _><'_0, u32>[{built_in impl core:: let _0: (); // return let _1: test_crate::Foo3::<&_ mut _><'6, u32>[{built_in impl core::marker::Sized::<&_ mut _><'6> for u32}]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -639,8 +667,10 @@ where let _0: (); // return let _1: test_crate::Triple::<_, &_ mut &_ mut _, core::option::Option::<&_ mut _><_, _>[TraitClause3]><'42, '43, '44, u32, T, bool>[{built_in impl Sized for u32}, {built_in impl core::marker::Sized::<&_ mut &_ mut _><'42, '43> for T}, {built_in impl core::marker::Sized::<_, _>[TraitClause0]><'44>[{built_in impl core::marker::Sized::<&_ mut _><'44> for bool}] for bool}, {built_in impl core::marker::Sized::<&_ mut _><'44> for bool}]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -684,8 +714,10 @@ fn use_list_mut<'_0, '_1>(_1: &'_0 test_crate::List::<&_ mut _><'_1, u32>[{built let _0: (); // return let _1: &'10 test_crate::List::<&_ mut _><'11, u32>[{built_in impl core::marker::Sized::<&_ mut _><'11> for u32}]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -706,8 +738,10 @@ where let _0: (); // return let _1: core::option::Option::[TraitClause1]><'6, bool>[{built_in impl core::marker::Sized::[TraitClause0]><'6>[{built_in impl Sized for bool}] for bool}, {built_in impl Sized for bool}]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -719,8 +753,10 @@ where let _0: (); // return let _1: test_crate::Iter::<_, &_ mut _><'7, '8, T>[{built_in impl core::marker::Sized::<&_ mut _><'8> for T}]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -732,8 +768,10 @@ where let _0: (); // return let _1: core::option::Option::[TraitClause1]><'6, bool>[{built_in impl core::marker::Sized::[TraitClause0]><'6>[{built_in impl Sized for bool}] for bool}, {built_in impl Sized for bool}]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -766,8 +804,11 @@ fn use_const_generic<'_0, '_1>(_1: test_crate::ArrayWrapper::<&_ mut _, 1usize>< let _1: test_crate::ArrayWrapper::<&_ mut _, 1usize><'6, u32>[{built_in impl core::marker::Sized::<&_ mut _><'6> for u32}]; // arg #1 let _2: test_crate::ArrayWrapper::<&_ mut _, 2usize><'14, u32>[{built_in impl core::marker::Sized::<&_ mut _><'14> for u32}]; // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(_2) + storage_dead(_1) return } @@ -781,6 +822,7 @@ where let _2: IterMut<'2, bool>[{built_in impl Sized for bool}]; // anonymous local let _3: IterMut<'3, bool>[{built_in impl Sized for bool}]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -789,6 +831,7 @@ where storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(x) return } diff --git a/charon/tests/ui/multi-target/cstr.out b/charon/tests/ui/multi-target/cstr.out index aff75fb8e..137881b4a 100644 --- a/charon/tests/ui/multi-target/cstr.out +++ b/charon/tests/ui/multi-target/cstr.out @@ -15,6 +15,7 @@ fn test_crate::main::x86_64-unknown-linux-gnu() let _2: core::ffi::c_str::CStr::x86_64-unknown-linux-gnu; // anonymous local let _3: &'2 core::ffi::c_str::CStr::x86_64-unknown-linux-gnu; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -24,6 +25,8 @@ fn test_crate::main::x86_64-unknown-linux-gnu() _1 = move _3 storage_dead(_1) _0 = () + storage_dead(_3) + storage_dead(_2) return } @@ -34,6 +37,7 @@ fn test_crate::main::powerpc64-unknown-linux-gnu() let _2: core::ffi::c_str::CStr::powerpc64-unknown-linux-gnu; // anonymous local let _3: &'2 core::ffi::c_str::CStr::powerpc64-unknown-linux-gnu; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -43,6 +47,8 @@ fn test_crate::main::powerpc64-unknown-linux-gnu() _1 = move _3 storage_dead(_1) _0 = () + storage_dead(_3) + storage_dead(_2) return } diff --git a/charon/tests/ui/multi-target/default-trait-assoc-const.out b/charon/tests/ui/multi-target/default-trait-assoc-const.out index beb5f9aae..128b51e90 100644 --- a/charon/tests/ui/multi-target/default-trait-assoc-const.out +++ b/charon/tests/ui/multi-target/default-trait-assoc-const.out @@ -14,6 +14,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 1usize return } diff --git a/charon/tests/ui/multi-target/evaluate-consts-size-of.out b/charon/tests/ui/multi-target/evaluate-consts-size-of.out index 2e79ea406..6f7531ec9 100644 --- a/charon/tests/ui/multi-target/evaluate-consts-size-of.out +++ b/charon/tests/ui/multi-target/evaluate-consts-size-of.out @@ -27,6 +27,7 @@ pub fn test_crate::usize_size::x86_64-unknown-linux-gnu() -> usize { let _0: usize; // return + storage_live(_0) _0 = copy test_crate::{impl test_crate::HasSize for usize}::SIZE::::x86_64-unknown-linux-gnu return } @@ -35,6 +36,7 @@ pub fn test_crate::usize_size::i686-unknown-linux-gnu() -> usize { let _0: usize; // return + storage_live(_0) _0 = copy test_crate::{impl test_crate::HasSize for usize}::SIZE::::i686-unknown-linux-gnu return } diff --git a/charon/tests/ui/multi-target/issue-1133-assoc-const.out b/charon/tests/ui/multi-target/issue-1133-assoc-const.out index a460fd4b8..3096d1df0 100644 --- a/charon/tests/ui/multi-target/issue-1133-assoc-const.out +++ b/charon/tests/ui/multi-target/issue-1133-assoc-const.out @@ -10,6 +10,7 @@ fn test_crate::{test_crate::Foo::x86_64-pc-windows-msvc}::uses_const::TABLE::x86 { let _0: [u32; 4usize]; // return + storage_live(_0) _0 = [const 10u32, const 20u32, const 30u32, const 40u32] return } @@ -25,6 +26,7 @@ pub fn test_crate::{test_crate::Foo::x86_64-pc-windows-msvc}::uses_const::x86_64 let _4: &'_ [u32; 4usize]; // anonymous local let _5: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy test_crate::{test_crate::Foo::x86_64-pc-windows-msvc}::uses_const::TABLE::x86_64-pc-windows-msvc storage_live(_3) @@ -36,6 +38,9 @@ pub fn test_crate::{test_crate::Foo::x86_64-pc-windows-msvc}::uses_const::x86_64 _0 = copy (*_5) storage_dead(_3) storage_dead(_2) + storage_dead(self) + storage_dead(_5) + storage_dead(_4) return } @@ -43,6 +48,7 @@ fn test_crate::{test_crate::Foo::i686-unknown-linux-gnu}::uses_const::TABLE::i68 { let _0: [u32; 4usize]; // return + storage_live(_0) _0 = [const 10u32, const 20u32, const 30u32, const 40u32] return } @@ -58,6 +64,7 @@ pub fn test_crate::{test_crate::Foo::i686-unknown-linux-gnu}::uses_const::i686-u let _4: &'_ [u32; 4usize]; // anonymous local let _5: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy test_crate::{test_crate::Foo::i686-unknown-linux-gnu}::uses_const::TABLE::i686-unknown-linux-gnu storage_live(_3) @@ -69,6 +76,9 @@ pub fn test_crate::{test_crate::Foo::i686-unknown-linux-gnu}::uses_const::i686-u _0 = copy (*_5) storage_dead(_3) storage_dead(_2) + storage_dead(self) + storage_dead(_5) + storage_dead(_4) return } diff --git a/charon/tests/ui/multi-target/issue-1157-single-target-suffix.out b/charon/tests/ui/multi-target/issue-1157-single-target-suffix.out index 33dcc8854..ce979c3bf 100644 --- a/charon/tests/ui/multi-target/issue-1157-single-target-suffix.out +++ b/charon/tests/ui/multi-target/issue-1157-single-target-suffix.out @@ -2,6 +2,7 @@ fn test_crate::aarch64_only() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 1u32 return } @@ -10,6 +11,7 @@ fn test_crate::x86_64_only() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 2u32 return } diff --git a/charon/tests/ui/multi-target/issue-1158-partial-dedup.out b/charon/tests/ui/multi-target/issue-1158-partial-dedup.out index 423c51a2b..70c32a963 100644 --- a/charon/tests/ui/multi-target/issue-1158-partial-dedup.out +++ b/charon/tests/ui/multi-target/issue-1158-partial-dedup.out @@ -2,6 +2,7 @@ fn test_crate::x86_common() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -10,6 +11,7 @@ fn test_crate::x86_different::x86_64-pc-windows-msvc() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 64u32 return } @@ -18,6 +20,7 @@ fn test_crate::x86_different::i686-unknown-linux-gnu() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 32u32 return } diff --git a/charon/tests/ui/multi-target/issue-1182-dedup-impls.out b/charon/tests/ui/multi-target/issue-1182-dedup-impls.out index d512f36ef..51b090740 100644 --- a/charon/tests/ui/multi-target/issue-1182-dedup-impls.out +++ b/charon/tests/ui/multi-target/issue-1182-dedup-impls.out @@ -14,6 +14,7 @@ pub fn test_crate::{impl test_crate::Foo for test_crate::Struct}::method::i686-u { let _0: u32; // return + storage_live(_0) _0 = const 32u32 return } @@ -22,6 +23,7 @@ pub fn test_crate::{impl test_crate::Foo for test_crate::Struct}::method::x86_64 { let _0: u32; // return + storage_live(_0) _0 = const 64u32 return } @@ -43,6 +45,7 @@ pub fn test_crate::call_method() -> u32 { let _0: u32; // return + storage_live(_0) _0 = test_crate::{impl test_crate::Foo for test_crate::Struct}::method() return } diff --git a/charon/tests/ui/multi-target/issue-1185-1-inline-const.out b/charon/tests/ui/multi-target/issue-1185-1-inline-const.out index 933cfbb3c..7b7611944 100644 --- a/charon/tests/ui/multi-target/issue-1185-1-inline-const.out +++ b/charon/tests/ui/multi-target/issue-1185-1-inline-const.out @@ -21,8 +21,10 @@ pub fn test_crate::const_time_array_copy_mwe<'_0, const N : usize>(_a: &'_0 mut } storage_dead(_3) storage_dead(_2) + storage_live(_0) _0 = () _0 = () + storage_dead(_a) return } diff --git a/charon/tests/ui/multi-target/issue-1185-2-generic-make.out b/charon/tests/ui/multi-target/issue-1185-2-generic-make.out index e3d483a65..be570e8e4 100644 --- a/charon/tests/ui/multi-target/issue-1185-2-generic-make.out +++ b/charon/tests/ui/multi-target/issue-1185-2-generic-make.out @@ -14,8 +14,10 @@ unsafe fn test_crate::State::{impl core::marker::Destruct for test_crate::State< let _0: (); // return let _1: &'1 mut test_crate::State; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl core::marker::Destruct for H}::drop_glue<'2>] ((*_1))._h + storage_dead(_1) return } @@ -32,6 +34,7 @@ pub fn test_crate::caller(h: H) let _2: test_crate::State; // anonymous local let _3: H; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -43,6 +46,7 @@ pub fn test_crate::caller(h: H) storage_dead(_2) _0 = () conditional_drop[{built_in impl core::marker::Destruct for H}::drop_glue<'3>] h + storage_dead(h) return } diff --git a/charon/tests/ui/multi-target/issue-1185-3-box-drop-glue.out b/charon/tests/ui/multi-target/issue-1185-3-box-drop-glue.out index 2837c7fb1..cb1d6156e 100644 --- a/charon/tests/ui/multi-target/issue-1185-3-box-drop-glue.out +++ b/charon/tests/ui/multi-target/issue-1185-3-box-drop-glue.out @@ -9,6 +9,7 @@ pub fn test_crate::mono() -> u32 let _0: u32; // return let _b: alloc::boxed::Box; // local + storage_live(_0) storage_live(_b) _b = @BoxNew(const 0u32) _0 = const 0u32 diff --git a/charon/tests/ui/multi-target/issue-1185-4-wrapping-add.out b/charon/tests/ui/multi-target/issue-1185-4-wrapping-add.out index 2ecbac8ed..a1b729b67 100644 --- a/charon/tests/ui/multi-target/issue-1185-4-wrapping-add.out +++ b/charon/tests/ui/multi-target/issue-1185-4-wrapping-add.out @@ -9,6 +9,7 @@ pub fn test_crate::mod_reduce(a: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy a @@ -16,6 +17,7 @@ pub fn test_crate::mod_reduce(a: u32) -> u32 if move _2 { } else { storage_dead(_3) + storage_dead(a) panic(core::panicking::panic) } storage_dead(_3) @@ -24,6 +26,7 @@ pub fn test_crate::mod_reduce(a: u32) -> u32 _4 = copy a _0 = core::num::{u32}::wrapping_add(move _4, const 1u32) storage_dead(_4) + storage_dead(a) return } diff --git a/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing-simple.out b/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing-simple.out index 57ed70168..814930e61 100644 --- a/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing-simple.out +++ b/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing-simple.out @@ -23,8 +23,10 @@ where let _0: (); // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -35,8 +37,10 @@ where let _0: (); // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -49,11 +53,13 @@ where let x: &'1 T0; // arg #1 let _2: &'2 T0; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &(*x) _0 = TraitClause1::method1<'3>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -66,11 +72,13 @@ where let x: &'1 T0; // arg #1 let _2: &'2 T0; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &(*x) _0 = TraitClause1::method2<'3>(move _2) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing.out b/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing.out index 4ee3d709d..51fb51dd2 100644 --- a/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing.out +++ b/charon/tests/ui/multi-target/issue-1213-merge-methods-when-missing.out @@ -201,6 +201,7 @@ fn test_crate::f<'_0>(blocks: &'_0 mut [u8]) let _7: &'18 mut core::slice::iter::IterMut<'19, u8>[{built_in impl core::marker::Sized for u8}]; // anonymous local let _8: &'20 mut core::slice::iter::IterMut<'21, u8>[{built_in impl core::marker::Sized for u8}]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -236,6 +237,7 @@ fn test_crate::f<'_0>(blocks: &'_0 mut [u8]) storage_dead(_6) storage_dead(iter) storage_dead(_2) + storage_dead(blocks) return } @@ -255,6 +257,7 @@ fn test_crate::g<'_0, '_1>(s0: &'_0 [u8], s1: &'_1 [u8]) let _11: &'64 mut core::iter::adapters::zip::Zip[{built_in impl core::marker::Sized for u8}], core::slice::iter::Iter<'66, u8>[{built_in impl core::marker::Sized for u8}]>[{built_in impl core::marker::Sized for core::slice::iter::Iter<'65, u8>[{built_in impl core::marker::Sized for u8}]}, {built_in impl core::marker::Sized for core::slice::iter::Iter<'66, u8>[{built_in impl core::marker::Sized for u8}]}]; // anonymous local let _12: &'71 mut core::iter::adapters::zip::Zip[{built_in impl core::marker::Sized for u8}], core::slice::iter::Iter<'73, u8>[{built_in impl core::marker::Sized for u8}]>[{built_in impl core::marker::Sized for core::slice::iter::Iter<'72, u8>[{built_in impl core::marker::Sized for u8}]}, {built_in impl core::marker::Sized for core::slice::iter::Iter<'73, u8>[{built_in impl core::marker::Sized for u8}]}]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -299,6 +302,8 @@ fn test_crate::g<'_0, '_1>(s0: &'_0 [u8], s1: &'_1 [u8]) storage_dead(_10) storage_dead(iter) storage_dead(_3) + storage_dead(s1) + storage_dead(s0) return } diff --git a/charon/tests/ui/multi-target/issue-1248-const-initializers.out b/charon/tests/ui/multi-target/issue-1248-const-initializers.out index ad4bf9a80..5a75ed148 100644 --- a/charon/tests/ui/multi-target/issue-1248-const-initializers.out +++ b/charon/tests/ui/multi-target/issue-1248-const-initializers.out @@ -2,6 +2,7 @@ fn test_crate::ARCH_TAG::x86_64-unknown-linux-gnu() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 64u32 return } @@ -10,6 +11,7 @@ fn test_crate::ARCH_TAG::i686-unknown-linux-gnu() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 32u32 return } diff --git a/charon/tests/ui/multi-target/issue-1307-required-method.out b/charon/tests/ui/multi-target/issue-1307-required-method.out index 9b380686b..b2f309cde 100644 --- a/charon/tests/ui/multi-target/issue-1307-required-method.out +++ b/charon/tests/ui/multi-target/issue-1307-required-method.out @@ -23,6 +23,7 @@ pub fn test_crate::{impl core::clone::Clone for test_crate::Foo}::clone<'_0>(sel let _0: test_crate::Foo; // return let self: &'1 test_crate::Foo; // arg #1 + storage_live(_0) loop { continue 0 } diff --git a/charon/tests/ui/multi-target/multi-target-from-symcrypt.out b/charon/tests/ui/multi-target/multi-target-from-symcrypt.out index 13c601237..5edea1bc6 100644 --- a/charon/tests/ui/multi-target/multi-target-from-symcrypt.out +++ b/charon/tests/ui/multi-target/multi-target-from-symcrypt.out @@ -251,6 +251,7 @@ fn test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate: let _3: core::core_arch::x86::__m128i; // anonymous local let _4: core::core_arch::x86::__m128i; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy a storage_live(_4) @@ -258,6 +259,8 @@ fn test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate: _0 = core::core_arch::x86::sse2::_mm_add_epi16(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -272,6 +275,7 @@ fn test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate: let _6: &'4 mut [u16; 8usize]; // anonymous local let _7: core::core_arch::x86::__m128i; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -289,6 +293,8 @@ fn test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate: _0 = core::core_arch::x86::sse2::_mm_storeu_si128(move _3, move _7) storage_dead(_7) storage_dead(_3) + storage_dead(val) + storage_dead(dst) return } @@ -301,6 +307,7 @@ fn test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate: let _4: &'3 [u16]; // anonymous local let _5: &'4 [u16; 8usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -314,6 +321,7 @@ fn test_crate::ntt_xmm::{impl test_crate::NttIntrinsicsInterface for test_crate: storage_dead(_3) _0 = core::core_arch::x86::sse2::_mm_loadu_si128(move _2) storage_dead(_2) + storage_dead(src) return } @@ -339,6 +347,7 @@ fn test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate let _3: core::core_arch::arm_shared::neon::uint16x8_t; // anonymous local let _4: core::core_arch::arm_shared::neon::uint16x8_t; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy a storage_live(_4) @@ -346,6 +355,8 @@ fn test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate _0 = core::core_arch::arm_shared::neon::generated::vaddq_u16(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -359,6 +370,7 @@ fn test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate let _5: &'4 mut [u16; 8usize]; // anonymous local let _6: core::core_arch::arm_shared::neon::uint16x8_t; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -373,6 +385,8 @@ fn test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate _0 = core::core_arch::aarch64::neon::generated::vst1q_u16(move _3, move _6) storage_dead(_6) storage_dead(_3) + storage_dead(val) + storage_dead(dst) return } @@ -384,6 +398,7 @@ fn test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate let _3: &'3 [u16]; // anonymous local let _4: &'4 [u16; 8usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -394,6 +409,7 @@ fn test_crate::ntt_neon::{impl test_crate::NttIntrinsicsInterface for test_crate storage_dead(_3) _0 = core::core_arch::aarch64::neon::generated::vld1q_u16(move _2) storage_dead(_2) + storage_dead(src) return } @@ -434,6 +450,7 @@ fn test_crate::ntt_layer_generic<'_0, '_1>(a: &'_0 mut [u16; 8usize], b: &'_1 [u let _20: &'_ mut [u16; 8usize]; // anonymous local let _21: &'_ mut u16; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -500,6 +517,14 @@ fn test_crate::ntt_layer_generic<'_0, '_1>(a: &'_0 mut [u16; 8usize], b: &'_1 [u storage_dead(_6) storage_dead(iter) storage_dead(_3) + storage_dead(b) + storage_dead(a) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) return } @@ -522,6 +547,7 @@ where let _11: &'6 mut [u16; 8usize]; // anonymous local let _12: TraitClause1::Vec128; // anonymous local + storage_live(_0) _0 = () storage_live(va) storage_live(_4) @@ -554,6 +580,8 @@ where storage_dead(vr) storage_dead(vb) storage_dead(va) + storage_dead(b) + storage_dead(a) return } @@ -561,6 +589,7 @@ fn test_crate::SYMCRYPT_CPU_FEATURE_SSE2() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 1u32 return } @@ -571,6 +600,7 @@ fn test_crate::SYMCRYPT_CPU_FEATURE_NEON() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 2u32 return } @@ -582,7 +612,9 @@ fn test_crate::cpu_features_present(_mask: u32) -> bool let _0: bool; // return let _mask: u32; // arg #1 + storage_live(_0) _0 = const true + storage_dead(_mask) return } @@ -599,6 +631,7 @@ fn test_crate::poly_element_ntt_layer::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut let _8: &'6 mut [u16; 8usize]; // anonymous local let _9: &'7 [u16; 8usize]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = test_crate::cpu_features_present(copy test_crate::SYMCRYPT_CPU_FEATURE_SSE2) @@ -615,6 +648,8 @@ fn test_crate::poly_element_ntt_layer::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut storage_dead(_7) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } storage_live(_4) @@ -628,6 +663,8 @@ fn test_crate::poly_element_ntt_layer::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut storage_dead(_4) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -644,6 +681,7 @@ fn test_crate::poly_element_ntt_layer::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mu let _8: &'6 mut [u16; 8usize]; // anonymous local let _9: &'7 [u16; 8usize]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = test_crate::cpu_features_present(copy test_crate::SYMCRYPT_CPU_FEATURE_NEON) @@ -660,6 +698,8 @@ fn test_crate::poly_element_ntt_layer::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mu storage_dead(_7) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } storage_live(_4) @@ -673,6 +713,8 @@ fn test_crate::poly_element_ntt_layer::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mu storage_dead(_4) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } diff --git a/charon/tests/ui/multi-target/multi-targets-3-dedup.out b/charon/tests/ui/multi-target/multi-targets-3-dedup.out index 9a30df1df..88fdbaf67 100644 --- a/charon/tests/ui/multi-target/multi-targets-3-dedup.out +++ b/charon/tests/ui/multi-target/multi-targets-3-dedup.out @@ -7,10 +7,12 @@ fn test_crate::clone_it<'_0>(x: &'_0 u32) -> u32 let x: &'1 u32; // arg #1 let _2: &'2 u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = core::clone::impls::{impl core::clone::Clone for u32}::clone<'4>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -18,6 +20,7 @@ fn test_crate::platform_specific::x86_64-pc-windows-msvc() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 42u32 return } @@ -26,6 +29,7 @@ fn test_crate::platform_specific::i686-unknown-linux-gnu() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 44u32 return } @@ -34,6 +38,7 @@ fn test_crate::platform_specific::aarch64-apple-darwin() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 43u32 return } @@ -54,6 +59,7 @@ pub fn test_crate::call_both<'_0>(x: &'_0 u32) -> u32 let _4: u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_2) storage_live(_3) @@ -66,6 +72,8 @@ pub fn test_crate::call_both<'_0>(x: &'_0 u32) -> u32 _0 = move _5 storage_dead(_4) storage_dead(_2) + storage_dead(_5) + storage_dead(x) return } diff --git a/charon/tests/ui/multi-target/multi-targets-file-ids.out b/charon/tests/ui/multi-target/multi-targets-file-ids.out index b583cc627..bc60c04bb 100644 --- a/charon/tests/ui/multi-target/multi-targets-file-ids.out +++ b/charon/tests/ui/multi-target/multi-targets-file-ids.out @@ -251,6 +251,7 @@ fn test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}::add(a: let _3: core::core_arch::x86::__m128i; // anonymous local let _4: core::core_arch::x86::__m128i; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy a storage_live(_4) @@ -258,6 +259,8 @@ fn test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}::add(a: _0 = core::core_arch::x86::sse2::_mm_add_epi16(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -272,6 +275,7 @@ fn test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}::store< let _6: &'4 mut [u16; 8usize]; // anonymous local let _7: core::core_arch::x86::__m128i; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -289,6 +293,8 @@ fn test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}::store< _0 = core::core_arch::x86::sse2::_mm_storeu_si128(move _3, move _7) storage_dead(_7) storage_dead(_3) + storage_dead(val) + storage_dead(dst) return } @@ -301,6 +307,7 @@ fn test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}::load<' let _4: &'3 [u16]; // anonymous local let _5: &'4 [u16; 8usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -314,6 +321,7 @@ fn test_crate::x86::{impl test_crate::SimdOps for test_crate::x86::Sse2}::load<' storage_dead(_3) _0 = core::core_arch::x86::sse2::_mm_loadu_si128(move _2) storage_dead(_2) + storage_dead(src) return } @@ -339,6 +347,7 @@ fn test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}::add(a: let _3: core::core_arch::arm_shared::neon::uint16x8_t; // anonymous local let _4: core::core_arch::arm_shared::neon::uint16x8_t; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy a storage_live(_4) @@ -346,6 +355,8 @@ fn test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}::add(a: _0 = core::core_arch::arm_shared::neon::generated::vaddq_u16(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -359,6 +370,7 @@ fn test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}::store< let _5: &'4 mut [u16; 8usize]; // anonymous local let _6: core::core_arch::arm_shared::neon::uint16x8_t; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -373,6 +385,8 @@ fn test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}::store< _0 = core::core_arch::aarch64::neon::generated::vst1q_u16(move _3, move _6) storage_dead(_6) storage_dead(_3) + storage_dead(val) + storage_dead(dst) return } @@ -384,6 +398,7 @@ fn test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}::load<' let _3: &'3 [u16]; // anonymous local let _4: &'4 [u16; 8usize]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -394,6 +409,7 @@ fn test_crate::arm::{impl test_crate::SimdOps for test_crate::arm::Neon}::load<' storage_dead(_3) _0 = core::core_arch::aarch64::neon::generated::vld1q_u16(move _2) storage_dead(_2) + storage_dead(src) return } @@ -427,6 +443,7 @@ where let _10: TraitClause1::V128; // anonymous local let _11: TraitClause1::V128; // anonymous local + storage_live(_0) _0 = () storage_live(va) storage_live(_4) @@ -456,6 +473,8 @@ where _0 = () storage_dead(vb) storage_dead(va) + storage_dead(b) + storage_dead(a) return } @@ -484,6 +503,7 @@ fn test_crate::add_scalar<'_0, '_1>(a: &'_0 mut [u16; 8usize], b: &'_1 [u16; 8us let _20: &'_ mut [u16; 8usize]; // anonymous local let _21: &'_ mut u16; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -550,6 +570,14 @@ fn test_crate::add_scalar<'_0, '_1>(a: &'_0 mut [u16; 8usize], b: &'_1 [u16; 8us storage_dead(_6) storage_dead(iter) storage_dead(_3) + storage_dead(b) + storage_dead(a) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) return } @@ -558,7 +586,9 @@ fn test_crate::cpu_features_present(_mask: u32) -> bool let _0: bool; // return let _mask: u32; // arg #1 + storage_live(_0) _0 = const true + storage_dead(_mask) return } @@ -575,6 +605,7 @@ fn test_crate::add_dispatch::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8us let _8: &'6 mut [u16; 8usize]; // anonymous local let _9: &'7 [u16; 8usize]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = test_crate::cpu_features_present(const 1u32) @@ -591,6 +622,8 @@ fn test_crate::add_dispatch::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8us storage_dead(_7) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } storage_live(_4) @@ -604,6 +637,8 @@ fn test_crate::add_dispatch::x86_64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8us storage_dead(_4) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } @@ -620,6 +655,7 @@ fn test_crate::add_dispatch::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8u let _8: &'6 mut [u16; 8usize]; // anonymous local let _9: &'7 [u16; 8usize]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = test_crate::cpu_features_present(const 2u32) @@ -636,6 +672,8 @@ fn test_crate::add_dispatch::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8u storage_dead(_7) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } storage_live(_4) @@ -649,6 +687,8 @@ fn test_crate::add_dispatch::aarch64-apple-darwin<'_0, '_1>(a: &'_0 mut [u16; 8u storage_dead(_4) _0 = () storage_dead(_3) + storage_dead(b) + storage_dead(a) return } diff --git a/charon/tests/ui/multi-target/multi-targets.out b/charon/tests/ui/multi-target/multi-targets.out index 8fb3fa5bb..f80d4c626 100644 --- a/charon/tests/ui/multi-target/multi-targets.out +++ b/charon/tests/ui/multi-target/multi-targets.out @@ -7,6 +7,7 @@ fn test_crate::make_pair_same() -> test_crate::StructTargetIndep { let _0: test_crate::StructTargetIndep; // return + storage_live(_0) _0 = test_crate::StructTargetIndep { x: const 1u64, y: const 2u64 } return } @@ -15,6 +16,7 @@ pub fn test_crate::f1_same() -> u64 { let _0: u64; // return + storage_live(_0) _0 = const 0u64 return } @@ -23,6 +25,7 @@ fn test_crate::f2_same() -> u64 { let _0: u64; // return + storage_live(_0) _0 = test_crate::f1_same() return } @@ -33,12 +36,14 @@ pub fn test_crate::f3_different::i686-unknown-linux-gnu() -> u64 let _1: u64; // anonymous local let _2: u64; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_1) _1 = test_crate::f2_same() _2 = const 1u64 panic.+ copy _1 _0 = move _2 storage_dead(_1) + storage_dead(_2) return } @@ -46,6 +51,7 @@ pub fn test_crate::f3_different::x86_64-apple-darwin() -> u64 { let _0: u64; // return + storage_live(_0) _0 = const 2u64 return } @@ -63,6 +69,7 @@ fn test_crate::foo_same() -> u64 let _2: u64; // anonymous local let _3: u64; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_1) _1 = test_crate::f2_same() @@ -72,6 +79,7 @@ fn test_crate::foo_same() -> u64 _0 = move _3 storage_dead(_2) storage_dead(_1) + storage_dead(_3) return } diff --git a/charon/tests/ui/multi-target/sysroot.out b/charon/tests/ui/multi-target/sysroot.out index 7d214e8a0..fb415f7c3 100644 --- a/charon/tests/ui/multi-target/sysroot.out +++ b/charon/tests/ui/multi-target/sysroot.out @@ -9,10 +9,12 @@ pub fn core::ascii::escape_default(c: u8) -> core::ascii::EscapeDefault let c: u8; // arg #1 let _2: u8; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy c _0 = core::ascii::{core::ascii::EscapeDefault}::new(move _2) storage_dead(_2) + storage_dead(c) return } diff --git a/charon/tests/ui/no_nested_borrows.out b/charon/tests/ui/no_nested_borrows.out index 5f430895c..e145f72b5 100644 --- a/charon/tests/ui/no_nested_borrows.out +++ b/charon/tests/ui/no_nested_borrows.out @@ -72,16 +72,19 @@ where let _0: (); // return let _1: &'1 mut List[TraitClause0]; // arg #1 + storage_live(_0) _0 = () match (*_1) { List::Cons => { }, _ => { + storage_dead(_1) return }, } drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1) as variant List::Cons).0 drop[impl_Destruct_for_Box::drop_glue<'3, List[TraitClause0], Global>[{built_in impl MetaSized for List[TraitClause0]}, {built_in impl Sized for Global}]] ((*_1) as variant List::Cons).1 + storage_dead(_1) return } @@ -142,9 +145,11 @@ pub fn use_tuple_struct<'_0>(x: &'_0 mut Tuple[{built_in impl Sized fo let _0: (); // return let x: &'1 mut Tuple[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // arg #1 + storage_live(_0) _0 = () ((*x)).0 = const 1u32 _0 = () + storage_dead(x) return } @@ -157,6 +162,7 @@ pub fn create_tuple_struct(x: u32, y: u64) -> Tuple[{built_in impl Siz let _3: u32; // anonymous local let _4: u64; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -164,6 +170,8 @@ pub fn create_tuple_struct(x: u32, y: u64) -> Tuple[{built_in impl Siz _0 = Tuple { 0: move _3, 1: move _4 } storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -176,6 +184,7 @@ pub fn create_pair(x: u32, y: u64) -> Pair[{built_in impl Sized for u3 let _3: u32; // anonymous local let _4: u64; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -183,6 +192,8 @@ pub fn create_pair(x: u32, y: u64) -> Pair[{built_in impl Sized for u3 _0 = Pair { x: move _3, y: move _4 } storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -202,8 +213,10 @@ where let _0: (); // return let _1: &'1 mut IdType[TraitClause0]; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -224,8 +237,10 @@ where let _0: T; // return let x: IdType[TraitClause0]; // arg #1 + storage_live(_0) _0 = move (x).0 conditional_drop[impl_Destruct_for_IdType::drop_glue<'0, T>[TraitClause0]] x + storage_dead(x) return } @@ -238,12 +253,14 @@ where let x: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = IdType { 0: move _2 } conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _2 storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] x + storage_dead(x) return } @@ -254,10 +271,12 @@ pub fn cast_u32_to_i32(x: u32) -> i32 let x: u32; // arg #1 let _2: u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = cast(move _2) storage_dead(_2) + storage_dead(x) return } @@ -268,10 +287,12 @@ pub fn cast_bool_to_i32(x: bool) -> i32 let x: bool; // arg #1 let _2: bool; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = cast(move _2) storage_dead(_2) + storage_dead(x) return } @@ -281,7 +302,9 @@ pub fn cast_bool_to_bool(x: bool) -> bool let _0: bool; // return let x: bool; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -304,6 +327,7 @@ pub fn test2() let e1: EmptyEnum; // local let enum0: Enum; // local + storage_live(_0) storage_live(_6) _0 = () storage_live(x) @@ -347,6 +371,7 @@ pub fn test2() storage_dead(z) storage_dead(y) storage_dead(x) + storage_dead(_6) return } @@ -360,6 +385,7 @@ pub fn get_max(x: u32, y: u32) -> u32 let _4: u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy x @@ -372,12 +398,16 @@ pub fn get_max(x: u32, y: u32) -> u32 storage_dead(_4) _0 = copy y storage_dead(_3) + storage_dead(y) + storage_dead(x) return } storage_dead(_5) storage_dead(_4) _0 = copy x storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -389,6 +419,7 @@ pub fn test_list1() let _2: alloc::boxed::Box[{built_in impl Sized for i32}]>[{built_in impl MetaSized for List[{built_in impl Sized for i32}]}, {built_in impl Sized for Global}]; // anonymous local let _3: List[{built_in impl Sized for i32}]; // anonymous local + storage_live(_0) _0 = () storage_live(l) storage_live(_2) @@ -417,6 +448,7 @@ pub fn test_box1() let _6: bool; // anonymous local let _7: i32; // anonymous local + storage_live(_0) _0 = () storage_live(b) b = @BoxNew[{built_in impl Sized for i32}](const 0i32) @@ -456,7 +488,9 @@ pub fn copy_int(x: i32) -> i32 let _0: i32; // return let x: i32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -467,13 +501,19 @@ pub fn test_unreachable(b: bool) let b: bool; // arg #1 let _2: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = copy b - assert(move _2 == false) else panic(core::panicking::panic) - _0 = () - storage_dead(_2) - return + if move _2 { + } else { + _0 = () + storage_dead(_2) + storage_dead(b) + return + } + storage_dead(b) + panic(core::panicking::panic) } // Full name: test_crate::is_cons @@ -484,15 +524,18 @@ where let _0: bool; // return let l: &'1 List[TraitClause0]; // arg #1 + storage_live(_0) match (*l) { List::Cons => { }, List::Nil => { _0 = const false + storage_dead(l) return }, } _0 = const true + storage_dead(l) return } @@ -508,10 +551,12 @@ where let _4: T; // anonymous local let _5: List[TraitClause0]; // anonymous local + storage_live(_0) match l { List::Cons => { }, _ => { + storage_dead(l) panic(core::panicking::panic) }, } @@ -533,6 +578,7 @@ where conditional_drop[{built_in impl Destruct for T}::drop_glue<'6>] hd storage_dead(hd) conditional_drop[impl_Destruct_for_List::drop_glue<'8, T>[TraitClause0]] l + storage_dead(l) return } @@ -541,6 +587,7 @@ pub fn test_char() -> char { let _0: char; // return + storage_live(_0) _0 = const 'a' return } @@ -574,6 +621,7 @@ pub fn even(x: u32) -> bool let _5: u32; // anonymous local let _6: u32; // anonymous local + storage_live(_0) storage_live(_6) storage_live(_2) storage_live(_3) @@ -591,11 +639,15 @@ pub fn even(x: u32) -> bool _0 = odd(move _4) storage_dead(_4) storage_dead(_2) + storage_dead(_6) + storage_dead(x) return } storage_dead(_3) _0 = const true storage_dead(_2) + storage_dead(_6) + storage_dead(x) return } @@ -610,6 +662,7 @@ pub fn odd(x: u32) -> bool let _5: u32; // anonymous local let _6: u32; // anonymous local + storage_live(_0) storage_live(_6) storage_live(_2) storage_live(_3) @@ -627,11 +680,15 @@ pub fn odd(x: u32) -> bool _0 = even(move _4) storage_dead(_4) storage_dead(_2) + storage_dead(_6) + storage_dead(x) return } storage_dead(_3) _0 = const false storage_dead(_2) + storage_dead(_6) + storage_dead(x) return } @@ -644,22 +701,35 @@ pub fn test_even_odd() let _3: bool; // anonymous local let _4: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = even(const 0u32) - assert(move _1 == true) else panic(core::panicking::panic) + if move _1 { + } else { + panic(core::panicking::panic) + } storage_dead(_1) storage_live(_2) _2 = even(const 4u32) - assert(move _2 == true) else panic(core::panicking::panic) + if move _2 { + } else { + panic(core::panicking::panic) + } storage_dead(_2) storage_live(_3) _3 = odd(const 1u32) - assert(move _3 == true) else panic(core::panicking::panic) + if move _3 { + } else { + panic(core::panicking::panic) + } storage_dead(_3) storage_live(_4) _4 = odd(const 5u32) - assert(move _4 == true) else panic(core::panicking::panic) + if move _4 { + } else { + panic(core::panicking::panic) + } storage_dead(_4) _0 = () return @@ -680,6 +750,7 @@ pub fn new_tuple1() -> StructWithTuple[{built_in impl Sized for u32}, let _0: StructWithTuple[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // return let _1: (u32, u32); // anonymous local + storage_live(_0) storage_live(_1) _1 = (const 1u32, const 2u32) _0 = StructWithTuple { p: move _1 } @@ -693,6 +764,7 @@ pub fn new_tuple2() -> StructWithTuple[{built_in impl Sized for i16}, let _0: StructWithTuple[{built_in impl Sized for i16}, {built_in impl Sized for i16}]; // return let _1: (i16, i16); // anonymous local + storage_live(_0) storage_live(_1) _1 = (const 1i16, const 2i16) _0 = StructWithTuple { p: move _1 } @@ -706,6 +778,7 @@ pub fn new_tuple3() -> StructWithTuple[{built_in impl Sized for u64}, let _0: StructWithTuple[{built_in impl Sized for u64}, {built_in impl Sized for i64}]; // return let _1: (u64, i64); // anonymous local + storage_live(_0) storage_live(_1) _1 = (const 1u64, const 2i64) _0 = StructWithTuple { p: move _1 } @@ -728,6 +801,7 @@ pub fn new_pair1() -> StructWithPair[{built_in impl Sized for u32}, {b let _0: StructWithPair[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // return let _1: Pair[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // anonymous local + storage_live(_0) storage_live(_1) // This actually doesn't make rustc generate a constant... // I guess it only happens for tuples. @@ -744,11 +818,14 @@ pub fn incr<'_0>(x: &'_0 mut u32) let x: &'1 mut u32; // arg #1 let _2: u32; // anonymous local + storage_live(_0) storage_live(_2) _0 = () _2 = copy (*x) panic.+ const 1u32 (*x) = move _2 _0 = () + storage_dead(_2) + storage_dead(x) return } @@ -760,6 +837,7 @@ pub fn read_then_incr<'_0>(x: &'_0 mut u32) -> u32 let r: u32; // local let _3: u32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(r) r = copy (*x) @@ -767,6 +845,8 @@ pub fn read_then_incr<'_0>(x: &'_0 mut u32) -> u32 (*x) = move _3 _0 = copy r storage_dead(r) + storage_dead(_3) + storage_dead(x) return } diff --git a/charon/tests/ui/panics.out b/charon/tests/ui/panics.out index 308a61a2a..fa436a5ca 100644 --- a/charon/tests/ui/panics.out +++ b/charon/tests/ui/panics.out @@ -5,6 +5,7 @@ fn panic1() { let _0: (); // return + storage_live(_0) _0 = () panic(core::panicking::panic) } @@ -15,9 +16,11 @@ fn panic2() let _0: (); // return let _1: Arguments<'1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = from_str<'2>(const "O no!") + storage_dead(_1) panic(core::panicking::panic_fmt) } @@ -27,9 +30,11 @@ fn panic3() let _0: (); // return let _1: Arguments<'1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = from_str_nonconst<'2>(const "O no!") + storage_dead(_1) panic(core::panicking::panic_fmt) } @@ -39,10 +44,14 @@ fn panic4() let _0: (); // return let _1: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const false - assert(move _1 == true) else panic(core::panicking::panic) + if move _1 { + } else { + panic(core::panicking::panic) + } storage_dead(_1) _0 = () return @@ -55,6 +64,7 @@ fn panic5() let _1: bool; // anonymous local let _2: Arguments<'1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const false @@ -62,10 +72,12 @@ fn panic5() } else { storage_live(_2) _2 = from_str<'2>(const "assert failed") + storage_dead(_2) panic(core::panicking::panic_fmt) } storage_dead(_1) _0 = () + storage_dead(_2) return } @@ -74,6 +86,7 @@ fn panic6() { let _0: (); // return + storage_live(_0) _0 = () panic(core::panicking::panic) } @@ -84,9 +97,11 @@ fn panic7() let _0: (); // return let _1: Arguments<'1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = from_str_nonconst<'2>(const "internal error: entered unreachable code: can't reach this") + storage_dead(_1) panic(core::panicking::panic_fmt) } @@ -95,6 +110,7 @@ fn panic8() { let _0: (); // return + storage_live(_0) _0 = () panic(core::panicking::panic) } @@ -104,6 +120,7 @@ fn panic9() { let _0: (); // return + storage_live(_0) _0 = () panic(std::panicking::begin_panic) } diff --git a/charon/tests/ui/params.out b/charon/tests/ui/params.out index f2ed84526..49edd567f 100644 --- a/charon/tests/ui/params.out +++ b/charon/tests/ui/params.out @@ -22,7 +22,9 @@ fn test_static(x: &'static u32) -> &'static u32 let _0: &'1 u32; // return let x: &'2 u32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } diff --git a/charon/tests/ui/partial-monomorphization/issue-1204-partial-mono-tuples.out b/charon/tests/ui/partial-monomorphization/issue-1204-partial-mono-tuples.out index 1006ed5cf..aebda9e7c 100644 --- a/charon/tests/ui/partial-monomorphization/issue-1204-partial-mono-tuples.out +++ b/charon/tests/ui/partial-monomorphization/issue-1204-partial-mono-tuples.out @@ -45,8 +45,10 @@ where let _0: T; // return let x: T; // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -57,8 +59,10 @@ where let _0: (&'_0 mut T0, &'_1 mut T1); // return let x: (&'_0 mut T0, &'_1 mut T1); // arg #1 + storage_live(_0) _0 = move x conditional_drop[{built_in impl core::marker::Destruct::<(&_ mut _, &_ mut _)><'_0, '_1, T1> for T0}::drop_glue<'0>] x + storage_dead(x) return } @@ -72,10 +76,12 @@ where let x: (&'6 mut T, &'7 mut U); // arg #1 let _2: (&'8 mut T, &'9 mut U); // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = test_crate::id::<(&_ mut _, &_ mut _)><'14, '15, T, U>[{built_in impl core::marker::Sized::<(&_ mut _, &_ mut _)><'14, '15, U> for T}](move _2) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/pattern-types.out b/charon/tests/ui/pattern-types.out index 8d3afc8c2..3c911acc8 100644 --- a/charon/tests/ui/pattern-types.out +++ b/charon/tests/ui/pattern-types.out @@ -12,7 +12,9 @@ pub fn keep_positive(x: i32 is 1i32..=2147483647i32) -> i32 is 1i32..=2147483647 let _0: i32 is 1i32..=2147483647i32; // return let x: i32 is 1i32..=2147483647i32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -22,7 +24,9 @@ pub fn keep_non_null_ptr(x: *const u8 is !null) -> *const u8 is !null let _0: *const u8 is !null; // return let x: *const u8 is !null; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } diff --git a/charon/tests/ui/plain-panic-str.out b/charon/tests/ui/plain-panic-str.out index a8dac5b83..ec045146e 100644 --- a/charon/tests/ui/plain-panic-str.out +++ b/charon/tests/ui/plain-panic-str.out @@ -6,9 +6,11 @@ fn main() let _0: (); // return let _1: Arguments<'1>; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = from_str<'2>(const "O no") + storage_dead(_1) panic(core::panicking::panic_fmt) } diff --git a/charon/tests/ui/pointers-in-consts-no-warns.out b/charon/tests/ui/pointers-in-consts-no-warns.out index 86e31ac7f..d9de245b4 100644 --- a/charon/tests/ui/pointers-in-consts-no-warns.out +++ b/charon/tests/ui/pointers-in-consts-no-warns.out @@ -6,6 +6,7 @@ fn DISGUISED_INT() -> *const () let _0: *const (); // return let _1: *const (); // anonymous local + storage_live(_0) storage_live(_1) _1 = cast(const 42i32) _0 = copy _1 @@ -24,6 +25,7 @@ pub fn bar() let _2: bool; // anonymous local let _3: *const (); // anonymous local + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -35,10 +37,14 @@ pub fn bar() } else { _0 = () storage_dead(_1) + storage_dead(_2) + storage_dead(_3) return } _0 = () storage_dead(_1) + storage_dead(_2) + storage_dead(_3) return } diff --git a/charon/tests/ui/pointers-in-consts.out b/charon/tests/ui/pointers-in-consts.out index 86e31ac7f..d9de245b4 100644 --- a/charon/tests/ui/pointers-in-consts.out +++ b/charon/tests/ui/pointers-in-consts.out @@ -6,6 +6,7 @@ fn DISGUISED_INT() -> *const () let _0: *const (); // return let _1: *const (); // anonymous local + storage_live(_0) storage_live(_1) _1 = cast(const 42i32) _0 = copy _1 @@ -24,6 +25,7 @@ pub fn bar() let _2: bool; // anonymous local let _3: *const (); // anonymous local + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -35,10 +37,14 @@ pub fn bar() } else { _0 = () storage_dead(_1) + storage_dead(_2) + storage_dead(_3) return } _0 = () storage_dead(_1) + storage_dead(_2) + storage_dead(_3) return } diff --git a/charon/tests/ui/polonius_map.out b/charon/tests/ui/polonius_map.out index 1cd38c99b..24c17393f 100644 --- a/charon/tests/ui/polonius_map.out +++ b/charon/tests/ui/polonius_map.out @@ -246,10 +246,13 @@ pub fn get_or_insert<'_0>(map: &'_0 mut HashMap[{ storage_live(_16) storage_live(_18) + storage_live(_18) storage_live(_19) _19 = const 22u32 _18 = &_19 + storage_dead(_19) _16 = move _18 + storage_live(_0) storage_live(_14) storage_live(_15) storage_live(_2) @@ -273,6 +276,13 @@ pub fn get_or_insert<'_0>(map: &'_0 mut HashMap[{ storage_dead(v) storage_dead(_5) storage_dead(_2) + storage_dead(_15) + storage_dead(_14) + storage_dead(map) + storage_dead(_20) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) return }, } @@ -282,9 +292,11 @@ pub fn get_or_insert<'_0>(map: &'_0 mut HashMap[{ _7 = insert<'31, u32, u32, RandomState, Global>[{built_in impl Sized for u32}, {built_in impl Sized for u32}, {built_in impl Sized for RandomState}, {built_in impl Sized for Global}, impl_Eq_for_u32, impl_Hash_for_u32, impl_BuildHasher_for_RandomState](move _8, const 22u32, const 33u32) storage_live(_17) storage_live(_20) + storage_live(_20) storage_live(_21) _21 = const 22u32 _20 = &_21 + storage_dead(_21) _17 = move _20 storage_dead(_8) storage_dead(_7) @@ -307,6 +319,13 @@ pub fn get_or_insert<'_0>(map: &'_0 mut HashMap[{ storage_dead(_9) storage_dead(_5) storage_dead(_2) + storage_dead(_15) + storage_dead(_14) + storage_dead(map) + storage_dead(_20) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) return } diff --git a/charon/tests/ui/predicates-on-late-bound-vars.out b/charon/tests/ui/predicates-on-late-bound-vars.out index 34b4f9dba..d87b8f7e7 100644 --- a/charon/tests/ui/predicates-on-late-bound-vars.out +++ b/charon/tests/ui/predicates-on-late-bound-vars.out @@ -84,10 +84,12 @@ fn wrap<'a>(x: &'a u32) -> Option<&'a u32>[{built_in impl Sized for &'a u32}] let x: &'9 u32; // arg #1 let _2: &'10 u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = Option::Some { 0: move _2 } storage_dead(_2) + storage_dead(x) return } @@ -100,10 +102,12 @@ where let x: &'9 u32; // arg #1 let _2: &'10 u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = Option::Some { 0: move _2 } storage_dead(_2) + storage_dead(x) return } @@ -115,6 +119,7 @@ fn foo() let _2: Result[{built_in impl MetaSized for bool}], BorrowError>[{built_in impl Sized for Ref<'6, bool>[{built_in impl MetaSized for bool}]}, {built_in impl Sized for BorrowError}]; // anonymous local let _3: &'10 RefCell[{built_in impl MetaSized for bool}]; // anonymous local + storage_live(_0) _0 = () storage_live(ref_b) ref_b = new[{built_in impl Sized for bool}](const false) @@ -151,6 +156,7 @@ where { let _0: Option[TraitClause3::ImpliedClause1]; // return + storage_live(_0) panic(core::panicking::panic) } diff --git a/charon/tests/ui/projection-index-from-end.out b/charon/tests/ui/projection-index-from-end.out index 0c0af0639..0f656dd24 100644 --- a/charon/tests/ui/projection-index-from-end.out +++ b/charon/tests/ui/projection-index-from-end.out @@ -15,6 +15,7 @@ fn slice_pattern_end<'_0>(x: &'_0 [()]) let _9: usize; // anonymous local let _10: &'_ (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -27,6 +28,14 @@ fn slice_pattern_end<'_0>(x: &'_0 [()]) if move _5 { } else { _0 = () + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_10) + storage_dead(_9) + storage_dead(_7) return } storage_live(_named) @@ -42,6 +51,14 @@ fn slice_pattern_end<'_0>(x: &'_0 [()]) _named = &(*_10) _0 = () storage_dead(_named) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(x) + storage_dead(_10) + storage_dead(_9) + storage_dead(_7) return } diff --git a/charon/tests/ui/ptr-offset.out b/charon/tests/ui/ptr-offset.out index 2bd4a7c98..967077be2 100644 --- a/charon/tests/ui/ptr-offset.out +++ b/charon/tests/ui/ptr-offset.out @@ -53,6 +53,7 @@ fn runtime(this: *const (), count: isize, size: usize) -> bool let _13: isize; // anonymous local let _14: bool; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_6) _6 = copy count @@ -70,6 +71,9 @@ fn runtime(this: *const (), count: isize, size: usize) -> bool _ => { storage_dead(_5) _0 = const false + storage_dead(size) + storage_dead(count) + storage_dead(this) return }, } @@ -96,6 +100,9 @@ fn runtime(this: *const (), count: isize, size: usize) -> bool storage_dead(_14) storage_dead(overflow) storage_dead(byte_offset) + storage_dead(size) + storage_dead(count) + storage_dead(this) return } @@ -126,6 +133,7 @@ fn runtime_offset_nowrap(this: *const (), count: isize, size: usize) -> bool let _6: isize; // anonymous local let _7: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) _5 = copy this @@ -139,6 +147,9 @@ fn runtime_offset_nowrap(this: *const (), count: isize, size: usize) -> bool storage_dead(_5) _0 = runtime(move _4.0, move _4.1, move _4.2) storage_dead(_4) + storage_dead(size) + storage_dead(count) + storage_dead(this) return } @@ -158,6 +169,7 @@ fn precondition_check(this: *const (), count: isize, size: usize) let _10: Arguments<'3>; // anonymous local let _11: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -181,12 +193,25 @@ fn precondition_check(this: *const (), count: isize, size: usize) _10 = from_str<'6>(move _11) storage_dead(_11) _9 = panic_nounwind_fmt<'8>(move _10, const false) + storage_dead(_10) + storage_dead(_9) + storage_dead(msg) + storage_dead(size) + storage_dead(count) + storage_dead(this) + undefined_behavior } storage_dead(_7) storage_dead(_6) storage_dead(_5) _0 = () storage_dead(_4) + storage_dead(_10) + storage_dead(_9) + storage_dead(msg) + storage_dead(size) + storage_dead(count) + storage_dead(this) return } @@ -207,6 +232,7 @@ where let _9: *const T; // anonymous local let _10: isize; // anonymous local + storage_live(_0) storage_live(_3) _3 = check_language_ub() if move _3 { @@ -235,6 +261,8 @@ where _0 = move _9 offset move _10 storage_dead(_10) storage_dead(_9) + storage_dead(count) + storage_dead(self) return } @@ -257,6 +285,7 @@ fn main() let _7: *const i32; // anonymous local let _8: *const i32; // anonymous local + storage_live(_0) _0 = () storage_live(s) s = [const 11i32, const 42i32] diff --git a/charon/tests/ui/ptr_no_provenance.out b/charon/tests/ui/ptr_no_provenance.out index 070e596df..1786b8e14 100644 --- a/charon/tests/ui/ptr_no_provenance.out +++ b/charon/tests/ui/ptr_no_provenance.out @@ -228,6 +228,7 @@ where let _1: *const (); // anonymous local let _2: (); // anonymous local + storage_live(_0) storage_live(_1) _1 = without_provenance<()>[{built_in impl Sized for ()}](const 0usize) storage_live(_2) @@ -244,6 +245,7 @@ fn main() let _0: (); // return let ptr: *const (); // local + storage_live(_0) _0 = () storage_live(ptr) ptr = null<()>[impl_Thin_for_T<()>[{built_in impl Pointee for () where Metadata = ()}]]() diff --git a/charon/tests/ui/quantified-clause.out b/charon/tests/ui/quantified-clause.out index d439dc05d..76170a600 100644 --- a/charon/tests/ui/quantified-clause.out +++ b/charon/tests/ui/quantified-clause.out @@ -129,9 +129,11 @@ where let _0: (); // return let _f: F; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for F}::drop_glue<'0>] _f + storage_dead(_f) return } @@ -144,6 +146,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -155,7 +158,9 @@ pub fn f<'a>(_1: &'a ()) -> Option<(&'a u8,)>[{built_in impl Sized for (&'a u8,) let _0: Option<(&'9 u8,)>[{built_in impl Sized for (&'9 u8,)}]; // return let _1: &'13 (); // arg #1 + storage_live(_0) _0 = Option::None { } + storage_dead(_1) return } diff --git a/charon/tests/ui/raw-boxes.out b/charon/tests/ui/raw-boxes.out index d7f194b74..691cd707d 100644 --- a/charon/tests/ui/raw-boxes.out +++ b/charon/tests/ui/raw-boxes.out @@ -40,10 +40,12 @@ pub fn core::ptr::non_null::{NonNull}::as_ptr(self: NonNull) -> *mut T let self: NonNull; // arg #1 let _2: NonNull; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy self _0 = transmute, *mut T>(move _2) storage_dead(_2) + storage_dead(self) return } @@ -58,6 +60,7 @@ where let _4: *mut T; // anonymous local let _5: NonNull; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -71,6 +74,7 @@ where _0 = transmute<*mut U, NonNull>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(self) return } @@ -82,10 +86,12 @@ where let self: NonNull<[T]>; // arg #1 let _2: NonNull<[T]>; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy self _0 = core::ptr::non_null::{NonNull}::cast<[T], T>[TraitClause0](move _2) storage_dead(_2) + storage_dead(self) return } @@ -113,10 +119,12 @@ pub fn metadata(ptr: *const T) -> {built_in impl Pointee for T}::Metadata let ptr: *const T; // arg #1 let _2: *const T; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy ptr _0 = copy _2.metadata storage_dead(_2) + storage_dead(ptr) return } @@ -129,6 +137,7 @@ where let _2: *const [T]; // anonymous local let _3: *mut [T]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy self @@ -136,6 +145,7 @@ where storage_dead(_3) _0 = metadata<[T]>(move _2) storage_dead(_2) + storage_dead(self) return } @@ -148,6 +158,7 @@ where let _2: *mut [T]; // anonymous local let _3: NonNull<[T]>; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy self @@ -155,6 +166,7 @@ where storage_dead(_3) _0 = core::ptr::mut_ptr::{*mut [T]}::len[TraitClause0](move _2) storage_dead(_2) + storage_dead(self) return } @@ -173,6 +185,7 @@ fn core::ptr::write_bytes::precondition_check(addr: *const (), align: usize, zer let _10: Arguments<'3>; // anonymous local let _11: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -196,12 +209,25 @@ fn core::ptr::write_bytes::precondition_check(addr: *const (), align: usize, zer _10 = from_str<'6>(move _11) storage_dead(_11) _9 = panic_nounwind_fmt<'8>(move _10, const false) + storage_dead(_10) + storage_dead(_9) + storage_dead(msg) + storage_dead(zero_size) + storage_dead(align) + storage_dead(addr) + undefined_behavior } storage_dead(_7) storage_dead(_6) storage_dead(_5) _0 = () storage_dead(_4) + storage_dead(_10) + storage_dead(_9) + storage_dead(msg) + storage_dead(zero_size) + storage_dead(align) + storage_dead(addr) return } @@ -303,6 +329,7 @@ where let _4: usize; // anonymous local let _5: bool; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_1) _1 = const TraitClause0::SIZE @@ -323,11 +350,13 @@ where storage_dead(_3) storage_dead(n) storage_dead(_1) + storage_dead(_5) return }, } _0 = copy core::num::{usize}::MAX storage_dead(_1) + storage_dead(_5) return } @@ -344,6 +373,7 @@ where { let _0: Layout; // return + storage_live(_0) _0 = from_size_align_unchecked(const TraitClause0::SIZE, const TraitClause0::ALIGN) return } @@ -361,6 +391,7 @@ where { let _0: bool; // return + storage_live(_0) _0 = const TraitClause0::SIZE == const 0usize return } @@ -392,6 +423,7 @@ fn core::mem::alignment::{Alignment}::new_unchecked::precondition_check(align: u let _6: Arguments<'3>; // anonymous local let _7: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -409,10 +441,19 @@ fn core::mem::alignment::{Alignment}::new_unchecked::precondition_check(align: u _6 = from_str<'6>(move _7) storage_dead(_7) _5 = panic_nounwind_fmt<'8>(move _6, const false) + storage_dead(_6) + storage_dead(_5) + storage_dead(msg) + storage_dead(align) + undefined_behavior } storage_dead(_3) _0 = () storage_dead(_2) + storage_dead(_6) + storage_dead(_5) + storage_dead(msg) + storage_dead(align) return } @@ -425,6 +466,7 @@ pub unsafe fn core::mem::alignment::{Alignment}::new_unchecked(align: usize) -> let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_2) _2 = check_language_ub() if move _2 { @@ -441,6 +483,7 @@ pub unsafe fn core::mem::alignment::{Alignment}::new_unchecked(align: usize) -> _5 = copy align _0 = transmute(move _5) storage_dead(_5) + storage_dead(align) return } @@ -453,6 +496,7 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option let _4: Alignment; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy align @@ -462,6 +506,7 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option storage_dead(_3) _0 = Option::None { } storage_dead(_2) + storage_dead(align) return } storage_dead(_3) @@ -473,6 +518,7 @@ pub fn core::mem::alignment::{Alignment}::new(align: usize) -> Option _0 = Option::Some { 0: move _4 } storage_dead(_4) storage_dead(_2) + storage_dead(align) return } @@ -484,6 +530,7 @@ where let _0: Alignment; // return let _1: Option[{built_in impl Sized for Alignment}]; // anonymous local + storage_live(_0) storage_live(_1) _1 = core::mem::alignment::{Alignment}::new(const TraitClause0::ALIGN) _0 = unwrap[{built_in impl Sized for Alignment}](move _1) @@ -505,6 +552,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = core::intrinsics::align_of[TraitClause0::ImpliedClause0]() return } @@ -524,6 +572,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = core::intrinsics::size_of[TraitClause0::ImpliedClause0]() return } @@ -557,6 +606,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy ALIGN[impl_SizedTypeProperties_for_T[TraitClause0]] return } @@ -582,6 +632,7 @@ where let _13: u8; // anonymous local let _14: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_4) _4 = check_language_ub() @@ -624,6 +675,9 @@ where storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(count) + storage_dead(val) + storage_dead(dst) return } @@ -639,6 +693,7 @@ where let _5: u8; // anonymous local let _6: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_4) _4 = copy self @@ -650,6 +705,9 @@ where storage_dead(_6) storage_dead(_5) storage_dead(_4) + storage_dead(count) + storage_dead(val) + storage_dead(self) return } @@ -688,6 +746,7 @@ where let _16: NonNull<[u8]>; // anonymous local let _17: NonNull<[u8]>; // anonymous local + storage_live(_0) storage_live(ptr) storage_live(_4) storage_live(_5) @@ -713,6 +772,8 @@ where storage_dead(residual) storage_dead(_4) storage_dead(ptr) + storage_dead(layout) + storage_dead(self) return }, } @@ -744,6 +805,8 @@ where _0 = Result::Ok { 0: move _17 } storage_dead(_17) storage_dead(ptr) + storage_dead(layout) + storage_dead(self) return } @@ -757,6 +820,7 @@ where let _2: NonNull; // anonymous local let _3: NonNull<[T]>; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy self @@ -764,6 +828,7 @@ where storage_dead(_3) _0 = core::ptr::non_null::{NonNull}::as_ptr(move _2) storage_dead(_2) + storage_dead(self) return } @@ -799,6 +864,7 @@ fn core::ptr::copy_nonoverlapping::precondition_check(src: *const (), dst: *mut let _27: Arguments<'3>; // anonymous local let _28: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_6) storage_live(zero_size) @@ -886,9 +952,26 @@ fn core::ptr::copy_nonoverlapping::precondition_check(src: *const (), dst: *mut _27 = from_str<'6>(move _28) storage_dead(_28) _26 = panic_nounwind_fmt<'8>(move _27, const false) + storage_dead(_27) + storage_dead(_26) + storage_dead(msg) + storage_dead(count) + storage_dead(align) + storage_dead(size) + storage_dead(dst) + storage_dead(src) + undefined_behavior } _0 = () storage_dead(_6) + storage_dead(_27) + storage_dead(_26) + storage_dead(msg) + storage_dead(count) + storage_dead(align) + storage_dead(size) + storage_dead(dst) + storage_dead(src) return } @@ -899,6 +982,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy SIZE[impl_SizedTypeProperties_for_T[TraitClause0]] return } @@ -926,6 +1010,7 @@ where let _14: *mut T; // anonymous local let _15: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_4) _4 = check_language_ub() @@ -967,6 +1052,9 @@ where storage_dead(_15) storage_dead(_14) storage_dead(_13) + storage_dead(count) + storage_dead(dst) + storage_dead(src) return } @@ -1009,6 +1097,7 @@ where let _31: Layout; // anonymous local let _32: NonNull<[u8]>; // anonymous local + storage_live(_0) storage_live(_5) _5 = const false if move _5 { @@ -1030,6 +1119,11 @@ where storage_dead(_7) storage_live(_11) _11 = from_str<'15>(const "`new_layout.size()` must be greater than or equal to `old_layout.size()`") + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) panic(core::panicking::panic_fmt) } storage_dead(_9) @@ -1063,6 +1157,11 @@ where storage_dead(residual) storage_dead(_13) storage_dead(new_ptr) + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) return }, } @@ -1112,6 +1211,11 @@ where _0 = Result::Ok { 0: move _32 } storage_dead(_32) storage_dead(new_ptr) + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) return } @@ -1154,6 +1258,7 @@ where let _31: Layout; // anonymous local let _32: NonNull<[u8]>; // anonymous local + storage_live(_0) storage_live(_5) _5 = const false if move _5 { @@ -1175,6 +1280,11 @@ where storage_dead(_7) storage_live(_11) _11 = from_str<'15>(const "`new_layout.size()` must be greater than or equal to `old_layout.size()`") + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) panic(core::panicking::panic_fmt) } storage_dead(_9) @@ -1208,6 +1318,11 @@ where storage_dead(residual) storage_dead(_13) storage_dead(new_ptr) + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) return }, } @@ -1257,6 +1372,11 @@ where _0 = Result::Ok { 0: move _32 } storage_dead(_32) storage_dead(new_ptr) + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) return } @@ -1299,6 +1419,7 @@ where let _31: Layout; // anonymous local let _32: NonNull<[u8]>; // anonymous local + storage_live(_0) storage_live(_5) _5 = const false if move _5 { @@ -1320,6 +1441,11 @@ where storage_dead(_7) storage_live(_11) _11 = from_str<'15>(const "`new_layout.size()` must be smaller than or equal to `old_layout.size()`") + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) panic(core::panicking::panic_fmt) } storage_dead(_9) @@ -1353,6 +1479,11 @@ where storage_dead(residual) storage_dead(_13) storage_dead(new_ptr) + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) return }, } @@ -1402,6 +1533,11 @@ where _0 = Result::Ok { 0: move _32 } storage_dead(_32) storage_dead(new_ptr) + storage_dead(_11) + storage_dead(new_layout) + storage_dead(old_layout) + storage_dead(ptr) + storage_dead(self) return } @@ -1414,7 +1550,9 @@ where let _0: &'1 Self; // return let self: &'2 Self; // arg #1 + storage_live(_0) _0 = copy self + storage_dead(self) return } @@ -1428,6 +1566,7 @@ where let _2: *const U; // anonymous local let _3: *const T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy self @@ -1435,6 +1574,7 @@ where _0 = copy _2 storage_dead(_3) storage_dead(_2) + storage_dead(self) return } @@ -1446,6 +1586,7 @@ pub fn addr(self: *const T) -> usize let _2: *const (); // anonymous local let _3: *const T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy self @@ -1453,6 +1594,7 @@ pub fn addr(self: *const T) -> usize storage_dead(_3) _0 = transmute<*const (), usize>(move _2) storage_dead(_2) + storage_dead(self) return } @@ -1464,6 +1606,7 @@ fn runtime(ptr: *const u8) -> bool let _2: usize; // anonymous local let _3: *const u8; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy ptr @@ -1471,6 +1614,7 @@ fn runtime(ptr: *const u8) -> bool storage_dead(_3) _0 = move _2 == const 0usize storage_dead(_2) + storage_dead(ptr) return } @@ -1509,10 +1653,12 @@ where let x: P; // arg #1 let _2: P; // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = MaybeDangling { 0: move _2 } storage_dead(_2) + storage_dead(x) return } @@ -1525,6 +1671,7 @@ where let _2: MaybeDangling[TraitClause0::ImpliedClause0]; // anonymous local let _3: T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = move value @@ -1532,6 +1679,7 @@ where storage_dead(_3) _0 = ManuallyDrop { value: move _2 } storage_dead(_2) + storage_dead(value) return } @@ -1544,10 +1692,12 @@ where let self: &'3 MaybeDangling

[TraitClause0]; // arg #1 let _2: &'4 P; // anonymous local + storage_live(_0) storage_live(_2) _2 = &((*self)).0 with_metadata(copy self.metadata) _0 = &(*_2) with_metadata(copy _2.metadata) storage_dead(_2) + storage_dead(self) return } @@ -1561,6 +1711,7 @@ where let _2: &'4 T; // anonymous local let _3: &'6 MaybeDangling[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &((*self)).value with_metadata(copy self.metadata) @@ -1568,6 +1719,7 @@ where _0 = &(*_2) with_metadata(copy _2.metadata) storage_dead(_3) storage_dead(_2) + storage_dead(self) return } @@ -1581,6 +1733,7 @@ where let _2: &'4 mut P; // anonymous local let _3: &'5 mut P; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &mut ((*self)).0 with_metadata(copy self.metadata) @@ -1588,6 +1741,7 @@ where storage_dead(_3) _0 = &mut (*_2) with_metadata(copy _2.metadata) storage_dead(_2) + storage_dead(self) return } @@ -1602,6 +1756,7 @@ where let _3: &'5 mut T; // anonymous local let _4: &'7 mut MaybeDangling[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -1612,6 +1767,7 @@ where storage_dead(_3) _0 = &mut (*_2) with_metadata(copy _2.metadata) storage_dead(_2) + storage_dead(self) return } @@ -1626,6 +1782,7 @@ where let _2: ManuallyDrop[TraitClause0::ImpliedClause0]; // anonymous local let _3: T; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -1634,6 +1791,7 @@ where storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(t) return } @@ -1647,6 +1805,7 @@ pub fn core::ptr::const_ptr::{*const T}::is_null(self: *const T) -> bool let _4: (*const u8,); // anonymous local let _5: *const u8; // anonymous local + storage_live(_0) storage_live(ptr) storage_live(_3) _3 = copy self @@ -1660,6 +1819,7 @@ pub fn core::ptr::const_ptr::{*const T}::is_null(self: *const T) -> bool _0 = runtime(move _4.0) storage_dead(_4) storage_dead(ptr) + storage_dead(self) return } @@ -1673,10 +1833,12 @@ where let src: *const T; // arg #1 let _2: *const T; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy src _0 = copy (*_2) storage_dead(_2) + storage_dead(src) return } @@ -1690,6 +1852,7 @@ pub fn cast_const(self: *mut T) -> *const T let _3: *const T; // anonymous local let _4: *mut T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -1700,6 +1863,7 @@ pub fn cast_const(self: *mut T) -> *const T _0 = copy _2 storage_dead(_3) storage_dead(_2) + storage_dead(self) return } @@ -1711,6 +1875,7 @@ pub fn core::ptr::mut_ptr::{*mut T}::is_null(self: *mut T) -> bool let _2: *const T; // anonymous local let _3: *mut T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy self @@ -1718,6 +1883,7 @@ pub fn core::ptr::mut_ptr::{*mut T}::is_null(self: *mut T) -> bool storage_dead(_3) _0 = core::ptr::const_ptr::{*const T}::is_null(move _2) storage_dead(_2) + storage_dead(self) return } @@ -1732,6 +1898,7 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(ptr: *mu let _6: Arguments<'3>; // anonymous local let _7: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -1742,6 +1909,10 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(ptr: *mu storage_dead(_3) _0 = () storage_dead(_2) + storage_dead(_6) + storage_dead(_5) + storage_dead(msg) + storage_dead(ptr) return } storage_dead(_3) @@ -1754,6 +1925,11 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(ptr: *mu _6 = from_str<'6>(move _7) storage_dead(_7) _5 = panic_nounwind_fmt<'8>(move _6, const false) + storage_dead(_6) + storage_dead(_5) + storage_dead(msg) + storage_dead(ptr) + undefined_behavior } pub unsafe fn core::ptr::non_null::{NonNull}::new_unchecked(ptr: *mut T) -> NonNull @@ -1766,6 +1942,7 @@ pub unsafe fn core::ptr::non_null::{NonNull}::new_unchecked(ptr: *mut T) - let _5: *mut T; // anonymous local let _6: *mut T; // anonymous local + storage_live(_0) storage_live(_2) _2 = check_language_ub() if move _2 { @@ -1785,6 +1962,7 @@ pub unsafe fn core::ptr::non_null::{NonNull}::new_unchecked(ptr: *mut T) - _6 = copy ptr _0 = transmute<*mut T, NonNull>(move _6) storage_dead(_6) + storage_dead(ptr) return } @@ -1799,7 +1977,9 @@ pub fn core::ptr::unique::{Unique}::as_non_null_ptr(self: Unique) -> No let _0: NonNull; // return let self: Unique; // arg #1 + storage_live(_0) _0 = copy (self).pointer + storage_dead(self) return } @@ -1810,10 +1990,12 @@ pub fn from(unique: Unique) -> NonNull let unique: Unique; // arg #1 let _2: Unique; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy unique _0 = core::ptr::unique::{Unique}::as_non_null_ptr(move _2) storage_dead(_2) + storage_dead(unique) return } @@ -1825,6 +2007,7 @@ pub unsafe fn core::ptr::unique::{Unique}::new_unchecked(ptr: *mut T) -> U let _3: *mut T; // anonymous local let _4: PhantomData; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy ptr @@ -1835,6 +2018,7 @@ pub unsafe fn core::ptr::unique::{Unique}::new_unchecked(ptr: *mut T) -> U _0 = Unique { pointer: move _2, _marker: move _4 } storage_dead(_4) storage_dead(_2) + storage_dead(ptr) return } @@ -1844,10 +2028,12 @@ pub fn core::ptr::unique::{Unique}::as_ptr(self: Unique) -> *mut T let self: Unique; // arg #1 let _2: NonNull; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy (self).pointer _0 = core::ptr::non_null::{NonNull}::as_ptr(move _2) storage_dead(_2) + storage_dead(self) return } @@ -1861,6 +2047,7 @@ where let _3: NonNull; // anonymous local let _4: PhantomData; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = copy (self).pointer @@ -1871,6 +2058,7 @@ where _0 = Unique { pointer: move _2, _marker: move _4 } storage_dead(_4) storage_dead(_2) + storage_dead(self) return } @@ -1910,6 +2098,7 @@ where let _14: Unique; // anonymous local let _15: Layout; // anonymous local + storage_live(_0) _0 = () storage_live(ptr) ptr = copy ((*self)).0 @@ -1938,6 +2127,7 @@ where storage_dead(_7) storage_dead(layout) storage_dead(ptr) + storage_dead(self) return } storage_dead(_8) @@ -1963,6 +2153,7 @@ where storage_dead(_7) storage_dead(layout) storage_dead(ptr) + storage_dead(self) return } @@ -1979,6 +2170,7 @@ where let _3: (); // anonymous local let _4: *const T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -1988,6 +2180,10 @@ where _2 = &mut (*_1) _3 = drop<'6, T, A>[TraitClause0, TraitClause1, TraitClause2](move _2) drop[{built_in impl Destruct for A}::drop_glue<'10>] ((*_1)).1 + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -2010,10 +2206,13 @@ fn box_new_uninit(layout: Layout) -> *mut u8 storage_live(_10) storage_live(_11) + storage_live(_11) storage_live(_12) _12 = Global { } _11 = &_12 + storage_dead(_12) _10 = move _11 + storage_live(_0) storage_live(_9) storage_live(_2) storage_live(_3) @@ -2032,6 +2231,13 @@ fn box_new_uninit(layout: Layout) -> *mut u8 storage_live(_8) _8 = copy layout _7 = handle_alloc_error(move _8) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(layout) + storage_dead(_11) + storage_dead(_10) + undefined_behavior }, } storage_live(ptr) @@ -2042,6 +2248,12 @@ fn box_new_uninit(layout: Layout) -> *mut u8 storage_dead(_6) storage_dead(ptr) storage_dead(_2) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(layout) + storage_dead(_11) + storage_dead(_10) return } @@ -2059,6 +2271,7 @@ where let _6: *mut T; // anonymous local let _7: bool; // anonymous local + storage_live(_0) storage_live(_7) _7 = const false _7 = const true @@ -2080,6 +2293,8 @@ where _0 = transmute<*mut T, Box[TraitClause0::ImpliedClause0, {built_in impl Sized for Global}, {impl#0}]>(move _6) storage_dead(_6) storage_dead(ptr) + storage_dead(_7) + storage_dead(x) return } @@ -2097,6 +2312,7 @@ where let _4: *mut T; // anonymous local let _5: A; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy raw @@ -2107,6 +2323,8 @@ where _0 = Box { 0: move _3, 1: move _5 } storage_dead(_5) storage_dead(_3) + storage_dead(alloc) + storage_dead(raw) return } @@ -2120,6 +2338,7 @@ where let _2: *mut T; // anonymous local let _3: Global; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy raw storage_live(_3) @@ -2127,6 +2346,7 @@ where _0 = from_raw_in[TraitClause0, {built_in impl Sized for Global}, {impl#0}](move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(raw) return } @@ -2146,6 +2366,7 @@ where let _8: Box[TraitClause0, {built_in impl Sized for Global}, {impl#0}]; // anonymous local let _9: *const T; // anonymous local + storage_live(_0) storage_live(_8) storage_live(_9) storage_live(b_2) @@ -2169,6 +2390,9 @@ where storage_dead(_5) storage_dead(_4) storage_dead(b_2) + storage_dead(_9) + storage_dead(_8) + storage_dead(b_1) return } @@ -2196,6 +2420,7 @@ where let _14: Box[TraitClause0, TraitClause1, TraitClause2]; // anonymous local let _15: *const T; // anonymous local + storage_live(_0) storage_live(_14) storage_live(_15) storage_live(b_2) @@ -2237,6 +2462,9 @@ where storage_dead(_5) storage_dead(ptr) storage_dead(b_2) + storage_dead(_15) + storage_dead(_14) + storage_dead(b_1) return } @@ -2260,6 +2488,7 @@ where let _9: &'3 mut T; // anonymous local let _10: &'4 mut T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_5) storage_live(_6) @@ -2288,6 +2517,7 @@ where storage_dead(ptr) _0 = &mut (*_2) with_metadata(copy _2.metadata) storage_dead(_2) + storage_dead(b) return } @@ -2306,6 +2536,7 @@ unsafe fn foo() let _9: *const i32; // anonymous local let _10: *const i32; // anonymous local + storage_live(_0) storage_live(_9) storage_live(_10) _0 = () @@ -2338,6 +2569,8 @@ unsafe fn foo() storage_dead(b_6) storage_dead(p) storage_dead(b_1) + storage_dead(_10) + storage_dead(_9) return } diff --git a/charon/tests/ui/reconstruct_early_return.out b/charon/tests/ui/reconstruct_early_return.out index 36af5d664..db9ce4ea9 100644 --- a/charon/tests/ui/reconstruct_early_return.out +++ b/charon/tests/ui/reconstruct_early_return.out @@ -15,6 +15,7 @@ fn f() -> usize let _9: i32; // anonymous local let _10: i32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_10) storage_live(i) @@ -51,6 +52,8 @@ fn f() -> usize storage_dead(_3) storage_dead(j) storage_dead(i) + storage_dead(_10) + storage_dead(_5) return } else { } @@ -71,6 +74,8 @@ fn f() -> usize _0 = const 0usize storage_dead(j) storage_dead(i) + storage_dead(_10) + storage_dead(_5) return } diff --git a/charon/tests/ui/region-inference-vars.out b/charon/tests/ui/region-inference-vars.out index 7192019ea..b35d1f4fc 100644 --- a/charon/tests/ui/region-inference-vars.out +++ b/charon/tests/ui/region-inference-vars.out @@ -41,10 +41,12 @@ pub fn from<'_0>(v: &'_0 bool) -> Result[{built_in impl Sized for bool let v: &'1 bool; // arg #1 let _2: bool; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy (*v) _0 = Result::Ok { 0: move _2 } storage_dead(_2) + storage_dead(v) return } diff --git a/charon/tests/ui/regressions/invalid-reconstruct-assert.out b/charon/tests/ui/regressions/invalid-reconstruct-assert.out index 956d58be0..54510c2b4 100644 --- a/charon/tests/ui/regressions/invalid-reconstruct-assert.out +++ b/charon/tests/ui/regressions/invalid-reconstruct-assert.out @@ -147,6 +147,7 @@ where let _46: Result[{built_in impl Sized for usize}, {built_in impl Sized for usize}]; // anonymous local bb0: { + storage_live(_0); storage_live(base); storage_live(_15); storage_live(_21); @@ -179,6 +180,22 @@ where } bb3: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); unwind_continue; } @@ -265,6 +282,22 @@ where } bb11: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); undefined_behavior; } @@ -290,6 +323,22 @@ where } bb15: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); undefined_behavior; } @@ -306,10 +355,42 @@ where } bb18: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); unwind_continue; } bb19: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); unwind_terminate; } @@ -376,6 +457,22 @@ where } bb27: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); undefined_behavior; } @@ -386,18 +483,82 @@ where } bb29: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); undefined_behavior; } bb30: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); unwind_continue; } bb31: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); return; } bb32: { + storage_dead(_45); + storage_dead(_44); + storage_dead(_43); + storage_dead(_42); + storage_dead(_41); + storage_dead(_40); + storage_dead(_39); + storage_dead(_38); + storage_dead(_36); + storage_dead(_30); + storage_dead(_21); + storage_dead(_15); + storage_dead(base); + storage_dead(f); + storage_dead(self); + storage_dead(_46); return; } } @@ -423,10 +584,13 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure, tupled_args: (&'_0 u32,)) -> Orderin bb0: { storage_live(_8); storage_live(_9); + storage_live(_9); storage_live(_10); _10 = const 3u32; _9 = &_10; + storage_dead(_10); _8 = move _9; + storage_live(_0); storage_live(x); storage_live(_7); x = move tupled_args.0; @@ -441,6 +605,12 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure, tupled_args: (&'_0 u32,)) -> Orderin } bb1: { + storage_dead(_7); + storage_dead(x); + storage_dead(tupled_args); + storage_dead(_1); + storage_dead(_9); + storage_dead(_8); unwind_continue; } @@ -448,6 +618,12 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure, tupled_args: (&'_0 u32,)) -> Orderin storage_dead(_6); storage_dead(_5); storage_dead(_4); + storage_dead(_7); + storage_dead(x); + storage_dead(tupled_args); + storage_dead(_1); + storage_dead(_9); + storage_dead(_8); return; } } @@ -459,7 +635,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _1: &'1 mut closure; // arg #1 bb0: { + storage_live(_0); _0 = (); + storage_dead(_1); return; } } @@ -473,6 +651,7 @@ fn call_once<'_0>(_1: closure, _2: (&'_0 u32,)) -> Ordering let _3: &'2 mut closure; // anonymous local bb0: { + storage_live(_0); storage_live(_3); _3 = &mut _1; _0 = call_mut<'_0, '7>(move _3, move _2) -> bb2 (unwind: bb1); @@ -487,18 +666,30 @@ fn call_once<'_0>(_1: closure, _2: (&'_0 u32,)) -> Ordering } bb3: { + storage_dead(_3); + storage_dead(_2); + storage_dead(_1); unwind_continue; } bb4: { + storage_dead(_3); + storage_dead(_2); + storage_dead(_1); unwind_terminate; } bb5: { + storage_dead(_3); + storage_dead(_2); + storage_dead(_1); unwind_continue; } bb6: { + storage_dead(_3); + storage_dead(_2); + storage_dead(_1); return; } } @@ -538,6 +729,7 @@ fn main() let _8: closure; // anonymous local bb0: { + storage_live(_0); _0 = (); storage_live(a); a = [const 1u32, const 2u32, const 3u32, const 4u32, const 5u32]; diff --git a/charon/tests/ui/regressions/issue-1010-missing-lifetime.out b/charon/tests/ui/regressions/issue-1010-missing-lifetime.out index b88386ced..200a3e048 100644 --- a/charon/tests/ui/regressions/issue-1010-missing-lifetime.out +++ b/charon/tests/ui/regressions/issue-1010-missing-lifetime.out @@ -73,8 +73,10 @@ where let _0: (); // return let _1: fn(&'2 T); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -86,7 +88,9 @@ unsafe fn {impl Destruct for test_crate::main::closure#1}::drop_glue<'_0>(_1: &' let _0: (); // return let _1: &'1 mut test_crate::main::closure#1; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -98,10 +102,14 @@ fn {impl Fn<(&'_ u16,)> for test_crate::main::closure#1}::call<'_0, '_1>(_1: &'_ let tupled_args: (&'_0 u16,); // arg #2 let _3: &'2 u16; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = move tupled_args.0 _0 = () + storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -113,10 +121,14 @@ fn {impl FnMut<(&'_ u16,)> for test_crate::main::closure#1}::call_mut<'_0, '_1>( let args: (&'_0 u16,); // arg #2 let _3: &'0 test_crate::main::closure#1; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ u16,)> for test_crate::main::closure#1}::call<'_0, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -128,11 +140,15 @@ fn {impl FnOnce<(&'_ u16,)> for test_crate::main::closure#1}::call_once<'_0>(_1: let _2: (&'0 u16,); // arg #2 let _3: &'2 mut test_crate::main::closure#1; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = {impl FnMut<(&'_ u16,)> for test_crate::main::closure#1}::call_mut<'_0, '7>(move _3, move _2) drop[{impl Destruct for test_crate::main::closure#1}::drop_glue<'9>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -144,12 +160,16 @@ fn as_fn<'_0>(arg1: &'_0 u16) let args: (&'_0 u16,); // local let state: test_crate::main::closure#1; // local + storage_live(_0) _0 = () storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::main::closure#1 { } _0 = {impl FnOnce<(&'_ u16,)> for test_crate::main::closure#1}::call_once<'_0>(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -164,6 +184,7 @@ fn main() let _3: fn(&'2 u16); // anonymous local let _4: test_crate::main::closure#1; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = test_crate::main::closure { } @@ -187,7 +208,9 @@ unsafe fn {impl Destruct for test_crate::main::closure}::drop_glue<'_0>(_1: &'_0 let _0: (); // return let _1: &'1 mut test_crate::main::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -199,10 +222,14 @@ fn {impl Fn<(&'_ u8,)> for test_crate::main::closure}::call<'_0, '_1>(_1: &'_1 t let tupled_args: (&'_0 u8,); // arg #2 let _3: &'2 u8; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = move tupled_args.0 _0 = () + storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -214,10 +241,14 @@ fn {impl FnMut<(&'_ u8,)> for test_crate::main::closure}::call_mut<'_0, '_1>(sta let args: (&'_0 u8,); // arg #2 let _3: &'0 test_crate::main::closure; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ u8,)> for test_crate::main::closure}::call<'_0, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -229,11 +260,15 @@ fn {impl FnOnce<(&'_ u8,)> for test_crate::main::closure}::call_once<'_0>(_1: te let _2: (&'0 u8,); // arg #2 let _3: &'2 mut test_crate::main::closure; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = {impl FnMut<(&'_ u8,)> for test_crate::main::closure}::call_mut<'_0, '7>(move _3, move _2) drop[{impl Destruct for test_crate::main::closure}::drop_glue<'9>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/regressions/issue-1067-filename-ice.out b/charon/tests/ui/regressions/issue-1067-filename-ice.out index 0ba56eb53..9a2144344 100644 --- a/charon/tests/ui/regressions/issue-1067-filename-ice.out +++ b/charon/tests/ui/regressions/issue-1067-filename-ice.out @@ -84,6 +84,7 @@ fn main() let _8: [u8; 5usize]; // anonymous local let _9: &'7 [u8; 5usize]; // anonymous local + storage_live(_0) _0 = () storage_live(buf) buf = new[{built_in impl Sized for u8}]() @@ -112,6 +113,8 @@ fn main() _0 = () conditional_drop[impl_Destruct_for_Vec::drop_glue<'15, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}]] buf storage_dead(buf) + storage_dead(_9) + storage_dead(_8) return } diff --git a/charon/tests/ui/regressions/issue-1073-out-of-bounds-body-region.out b/charon/tests/ui/regressions/issue-1073-out-of-bounds-body-region.out index 65e2ab2f5..fd7d04622 100644 --- a/charon/tests/ui/regressions/issue-1073-out-of-bounds-body-region.out +++ b/charon/tests/ui/regressions/issue-1073-out-of-bounds-body-region.out @@ -15,6 +15,7 @@ pub fn foo<'_0, '_1, '_2>(bufs: &'_0 mut &'_1 mut [IoSlice<'_2>]) let _2: (); // anonymous local let _3: &'10 mut &'11 mut [IoSlice<'12>]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -23,6 +24,7 @@ pub fn foo<'_0, '_1, '_2>(bufs: &'_0 mut &'_1 mut [IoSlice<'_2>]) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(bufs) return } diff --git a/charon/tests/ui/regressions/issue-1074-vtable-supertrait.out b/charon/tests/ui/regressions/issue-1074-vtable-supertrait.out index ebb6c89c5..2ccbff0f6 100644 --- a/charon/tests/ui/regressions/issue-1074-vtable-supertrait.out +++ b/charon/tests/ui/regressions/issue-1074-vtable-supertrait.out @@ -49,7 +49,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut MyStruct) let _0: (); // return let _1: &'1 mut MyStruct; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -65,8 +67,10 @@ pub fn foo<'_0>(self: &'_0 MyStruct) let _0: (); // return let self: &'1 MyStruct; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -77,10 +81,13 @@ fn {vtable_method}<'_0>(_1: &'_0 (dyn MyTrait)) let _1: &'_0 (dyn MyTrait + '0); // arg #1 let _2: &'_0 MyStruct; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn MyTrait + '1), &'_0 MyStruct>(move _1) _0 = foo<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -91,10 +98,13 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn MyTrait)) let dyn_self: &'_0 mut (dyn MyTrait + '0); // arg #1 let target_self: &'_0 mut MyStruct; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn MyTrait + '1), &'_0 mut MyStruct>(move dyn_self) drop[drop_glue<'3>] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -107,6 +117,7 @@ fn impl_MyTrait_for_MyStruct::{vtable}() -> test_crate::MyTrait::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn MyTrait + '1)); // anonymous local let _4: fn<'_0_1>(&'_0_1 (dyn MyTrait + '3)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -116,6 +127,10 @@ fn impl_MyTrait_for_MyStruct::{vtable}() -> test_crate::MyTrait::{vtable} storage_live(_4) _4 = cast {vtable_method}<'2>, fn<'_0_1>(&'_0_1 (dyn MyTrait + '3))>(const {vtable_method}<'2>) ret = test_crate::MyTrait::{vtable} { size: move size, align: move align, drop: move _3, method_foo: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for MyStruct}), super_trait_1: const &vtable_of({built_in impl Send for MyStruct}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -146,10 +161,13 @@ fn main() storage_live(_7) storage_live(_8) + storage_live(_8) storage_live(_9) _9 = MyStruct { } _8 = &_9 + storage_dead(_9) _7 = move _8 + storage_live(_0) storage_live(_6) _0 = () storage_live(x) @@ -169,6 +187,9 @@ fn main() storage_dead(_4) _0 = () storage_dead(x) + storage_dead(_6) + storage_dead(_8) + storage_dead(_7) return } diff --git a/charon/tests/ui/regressions/issue-1089-inline-const-precise-drops.out b/charon/tests/ui/regressions/issue-1089-inline-const-precise-drops.out index a80bca1ea..4dd9beb42 100644 --- a/charon/tests/ui/regressions/issue-1089-inline-const-precise-drops.out +++ b/charon/tests/ui/regressions/issue-1089-inline-const-precise-drops.out @@ -32,9 +32,13 @@ where storage_live(_1) storage_live(_2) + storage_live(_2) _2 = const 42usize _1 = move _2 + storage_live(_0) _0 = move _1 + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/regressions/issue-1236-vtable-fn-ptr.out b/charon/tests/ui/regressions/issue-1236-vtable-fn-ptr.out index 44c9de938..19b2228f9 100644 --- a/charon/tests/ui/regressions/issue-1236-vtable-fn-ptr.out +++ b/charon/tests/ui/regressions/issue-1236-vtable-fn-ptr.out @@ -39,7 +39,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut Bar) let _1: &'1 mut Bar; // arg #1 bb0: { + storage_live(_0); _0 = (); + storage_dead(_1); return; } } @@ -57,8 +59,10 @@ fn foo<'_0>(self: &'_0 Bar) let self: &'1 Bar; // arg #1 bb0: { + storage_live(_0); _0 = (); _0 = (); + storage_dead(self); return; } } @@ -71,6 +75,7 @@ fn {vtable_method}<'_0>(_1: &'_0 (dyn Foo)) let _2: &'_0 Bar; // anonymous local bb0: { + storage_live(_0); _0 = (); storage_live(_2); _2 = concretize<&'_0 (dyn Foo + '1), &'_0 Bar>(move _1); @@ -78,10 +83,14 @@ fn {vtable_method}<'_0>(_1: &'_0 (dyn Foo)) } bb1: { + storage_dead(_2); + storage_dead(_1); unwind_continue; } bb2: { + storage_dead(_2); + storage_dead(_1); return; } } @@ -94,6 +103,7 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Foo)) let target_self: &'_0 mut Bar; // local bb0: { + storage_live(ret); ret = (); storage_live(target_self); target_self = concretize<&'_0 mut (dyn Foo + '1), &'_0 mut Bar>(move dyn_self); @@ -101,10 +111,14 @@ unsafe fn {vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn Foo)) } bb1: { + storage_dead(target_self); + storage_dead(dyn_self); unwind_continue; } bb2: { + storage_dead(target_self); + storage_dead(dyn_self); return; } } @@ -123,6 +137,7 @@ fn impl_Foo_for_Bar::{vtable}() -> test_crate::Foo::{vtable} let _8: fn<'_0_1>(&'_0_1 (dyn Foo + '9)); // anonymous local bb0: { + storage_live(ret); storage_live(size); size = size_of; storage_live(align); @@ -140,6 +155,14 @@ fn impl_Foo_for_Bar::{vtable}() -> test_crate::Foo::{vtable} foo = move _8; erased_foo = cast(&'_0_1 (dyn Foo + '10)), *const ()>(move foo); ret = test_crate::Foo::{vtable} { size: move size, align: move align, drop: move erased_drop, method_foo: move erased_foo, super_trait_0: const &vtable_of({built_in impl MetaSized for Bar}) }; + storage_dead(erased_foo); + storage_dead(foo); + storage_dead(erased_drop); + storage_dead(drop); + storage_dead(align); + storage_dead(size); + storage_dead(_8); + storage_dead(_7); return; } } @@ -166,6 +189,7 @@ fn main() let _7: unsafe fn(&'8 (dyn Foo + '9)); // anonymous local bb0: { + storage_live(_0); _0 = (); storage_live(bar); bar = Bar { }; @@ -186,6 +210,7 @@ fn main() } bb1: { + storage_dead(_7); unwind_continue; } @@ -195,6 +220,7 @@ fn main() _0 = (); storage_dead(some_foo); storage_dead(bar); + storage_dead(_7); return; } } diff --git a/charon/tests/ui/regressions/issue-1294-remove-clause-underflow.out b/charon/tests/ui/regressions/issue-1294-remove-clause-underflow.out index 6b123d83c..0d94e498e 100644 --- a/charon/tests/ui/regressions/issue-1294-remove-clause-underflow.out +++ b/charon/tests/ui/regressions/issue-1294-remove-clause-underflow.out @@ -41,6 +41,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/regressions/issue-1296-exclude-needed-builtin-ty.out b/charon/tests/ui/regressions/issue-1296-exclude-needed-builtin-ty.out index 199b9c291..10a414393 100644 --- a/charon/tests/ui/regressions/issue-1296-exclude-needed-builtin-ty.out +++ b/charon/tests/ui/regressions/issue-1296-exclude-needed-builtin-ty.out @@ -12,6 +12,7 @@ fn main() let x: alloc::boxed::Box<[i32; 1usize]>[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}]; // local let y: alloc::boxed::Box<[i32]>[{built_in impl MetaSized for [i32]}, {built_in impl Sized for Global}]; // local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -24,16 +25,21 @@ fn main() storage_live(ret) storage_live(b) b = move _2 + storage_live(ret) storage_live(x) storage_live(y) x = assume_init<[i32; 1usize], Global>[{built_in impl Sized for [i32; 1usize]}, {built_in impl Sized for Global}](move b) y = unsize_cast[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[i32]>[{built_in impl MetaSized for [i32]}, {built_in impl Sized for Global}], 1usize>(move x) ret = into_vec[{built_in impl Sized for i32}, {built_in impl Sized for Global}](move y) + storage_dead(y) + storage_dead(x) + storage_dead(b) _1 = move ret storage_dead(_2) conditional_drop[{impl#1}[{built_in impl Sized for i32}, {built_in impl Sized for Global}]::drop_glue<'2>] _1 storage_dead(_1) _0 = () + storage_dead(ret) return } diff --git a/charon/tests/ui/regressions/issue-1297-box-new-allocator-ty.out b/charon/tests/ui/regressions/issue-1297-box-new-allocator-ty.out index 7178f2500..cef61234c 100644 --- a/charon/tests/ui/regressions/issue-1297-box-new-allocator-ty.out +++ b/charon/tests/ui/regressions/issue-1297-box-new-allocator-ty.out @@ -48,6 +48,7 @@ fn main() let _5: [i32; 1usize]; // anonymous local let _6: alloc::boxed::Box<[i32; 1usize]>[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_5) @@ -55,6 +56,7 @@ fn main() storage_live(_6) _6 = @BoxNew<[i32; 1usize]>[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}](move _5) storage_live(ret) + storage_live(ret) storage_live(x) storage_live(y) storage_dead(_5) @@ -62,10 +64,13 @@ fn main() storage_dead(_6) y = unsize_cast[{built_in impl MetaSized for [i32; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[i32]>[{built_in impl MetaSized for [i32]}, {built_in impl Sized for Global}], 1usize>(move x) ret = into_vec[{built_in impl Sized for i32}, {built_in impl Sized for Global}](move y) + storage_dead(y) + storage_dead(x) _1 = move ret conditional_drop[impl_Destruct_for_Vec::drop_glue<'2, i32, Global>[{built_in impl Sized for i32}, {built_in impl Sized for Global}]] _1 storage_dead(_1) _0 = () + storage_dead(ret) return } diff --git a/charon/tests/ui/regressions/issue-393-vec-with-control-flow.out b/charon/tests/ui/regressions/issue-393-vec-with-control-flow.out index bfc72fb71..d8b54e704 100644 --- a/charon/tests/ui/regressions/issue-393-vec-with-control-flow.out +++ b/charon/tests/ui/regressions/issue-393-vec-with-control-flow.out @@ -89,6 +89,7 @@ pub fn next(b: bool) -> Option[{built_in impl Sized for u8}, {built_in i let _10: [u8; 1usize]; // anonymous local let _11: alloc::boxed::Box<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) storage_live(vec) storage_live(_3) _3 = new_uninit<[u8; 1usize]>[{built_in impl Sized for [u8; 1usize]}]() @@ -103,6 +104,8 @@ pub fn next(b: bool) -> Option[{built_in impl Sized for u8}, {built_in i conditional_drop[impl_Destruct_for_Box::drop_glue<'1, MaybeUninit<[u8; 1usize]>[{built_in impl Sized for [u8; 1usize]}], Global>[{built_in impl MetaSized for MaybeUninit<[u8; 1usize]>[{built_in impl Sized for [u8; 1usize]}]}, {built_in impl Sized for Global}]] _3 storage_dead(_3) storage_dead(vec) + storage_dead(b) + storage_dead(ret) return } _4 = const 42u8 @@ -114,6 +117,7 @@ pub fn next(b: bool) -> Option[{built_in impl Sized for u8}, {built_in i _11 = write<[u8; 1usize], Global>[{built_in impl Sized for [u8; 1usize]}, {built_in impl Sized for Global}](move _3, move _10) storage_dead(_3) storage_live(ret) + storage_live(ret) storage_live(x) storage_live(y) storage_dead(_10) @@ -121,6 +125,8 @@ pub fn next(b: bool) -> Option[{built_in impl Sized for u8}, {built_in i storage_dead(_11) y = unsize_cast[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 1usize>(move x) ret = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y) + storage_dead(y) + storage_dead(x) vec = move ret storage_live(_6) _6 = move vec @@ -129,6 +135,8 @@ pub fn next(b: bool) -> Option[{built_in impl Sized for u8}, {built_in i storage_dead(_6) conditional_drop[impl_Destruct_for_Vec::drop_glue<'4, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}]] vec storage_dead(vec) + storage_dead(b) + storage_dead(ret) return } diff --git a/charon/tests/ui/regressions/issue-792-trait-ref-panic-when-tracing.out b/charon/tests/ui/regressions/issue-792-trait-ref-panic-when-tracing.out index 1257a8884..8d832b0e8 100644 --- a/charon/tests/ui/regressions/issue-792-trait-ref-panic-when-tracing.out +++ b/charon/tests/ui/regressions/issue-792-trait-ref-panic-when-tracing.out @@ -30,12 +30,15 @@ fn internal_method<'_0>(self: &'_0 i32) -> i32 let _2: i32; // anonymous local let _3: i32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_2) _2 = copy (*self) _3 = copy _2 panic.+ const 1i32 _0 = move _3 storage_dead(_2) + storage_dead(_3) + storage_dead(self) return } @@ -53,6 +56,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/regressions/issue-967-assoc-type-coherence.out b/charon/tests/ui/regressions/issue-967-assoc-type-coherence.out index efa7379ee..f90e3fa0f 100644 --- a/charon/tests/ui/regressions/issue-967-assoc-type-coherence.out +++ b/charon/tests/ui/regressions/issue-967-assoc-type-coherence.out @@ -65,6 +65,7 @@ where { let _0: Wrapper[TraitClause1::ImpliedClause1, TraitClause1::ImpliedClause2, TraitClause3]; // return + storage_live(_0) panic(core::panicking::panic) } diff --git a/charon/tests/ui/regressions/reconstruct-fallible.out b/charon/tests/ui/regressions/reconstruct-fallible.out index 9d29bc846..a83774fdc 100644 --- a/charon/tests/ui/regressions/reconstruct-fallible.out +++ b/charon/tests/ui/regressions/reconstruct-fallible.out @@ -5,6 +5,7 @@ fn other() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -16,8 +17,10 @@ fn sink_tuple(_x: (usize, bool)) let _0: (); // return let _x: (usize, bool); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_x) return } @@ -27,8 +30,10 @@ fn sink_int(_x: usize) let _0: (); // return let _x: usize; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_x) return } @@ -38,8 +43,10 @@ fn sink_bool(_x: bool) let _0: (); // return let _x: bool; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_x) return } @@ -52,6 +59,7 @@ fn must_preserve_tuple() let _3: (); // anonymous local let _4: (usize, bool); // anonymous local + storage_live(_0) _0 = () storage_live(z) z = const 0usize checked.+ const 0usize @@ -78,6 +86,7 @@ fn can_erase_check() let _3: (); // anonymous local let _4: usize; // anonymous local + storage_live(_0) _0 = () storage_live(z) z = const 0usize checked.+ const 0usize @@ -104,6 +113,7 @@ fn must_preserve_overflow_flag() let _3: (); // anonymous local let _4: bool; // anonymous local + storage_live(_0) _0 = () storage_live(z) z = const 0usize checked.+ const 0usize @@ -132,6 +142,7 @@ fn mixed_field0_and_cross_block_tuple() let _5: (); // anonymous local let _6: (usize, bool); // anonymous local + storage_live(_0) _0 = () storage_live(z) z = const 0usize checked.+ const 0usize @@ -167,6 +178,7 @@ fn can_erase_check_multi_block() let _6: (); // anonymous local let _7: usize; // anonymous local + storage_live(_0) _0 = () storage_live(z) z = const 0usize checked.+ const 0usize diff --git a/charon/tests/ui/remove-dynamic-checks.out b/charon/tests/ui/remove-dynamic-checks.out index 9335302b0..76498c37b 100644 --- a/charon/tests/ui/remove-dynamic-checks.out +++ b/charon/tests/ui/remove-dynamic-checks.out @@ -7,10 +7,12 @@ pub fn neg_test(x: i32) -> i32 let x: i32; // arg #1 let _2: i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = panic.-(move _2) storage_dead(_2) + storage_dead(x) return } @@ -24,6 +26,7 @@ pub fn add_u32(x: u32, y: u32) -> u32 let _4: u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy x @@ -33,6 +36,9 @@ pub fn add_u32(x: u32, y: u32) -> u32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(y) + storage_dead(x) return } @@ -43,11 +49,14 @@ pub fn incr<'_0>(x: &'_0 mut u32) let x: &'1 mut u32; // arg #1 let _2: u32; // anonymous local + storage_live(_0) storage_live(_2) _0 = () _2 = copy (*x) panic.+ const 1u32 (*x) = move _2 _0 = () + storage_dead(_2) + storage_dead(x) return } @@ -61,6 +70,7 @@ pub fn subs_u32(x: u32, y: u32) -> u32 let _4: u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy x @@ -70,6 +80,9 @@ pub fn subs_u32(x: u32, y: u32) -> u32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(y) + storage_dead(x) return } @@ -82,6 +95,7 @@ pub fn div_u32(x: u32, y: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -89,6 +103,8 @@ pub fn div_u32(x: u32, y: u32) -> u32 _0 = move _3 panic./ move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -99,10 +115,12 @@ pub fn div_u32_const(x: u32) -> u32 let x: u32; // arg #1 let _2: u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = move _2 panic./ const 2u32 storage_dead(_2) + storage_dead(x) return } @@ -115,6 +133,7 @@ pub fn rem_u32(x: u32, y: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -122,6 +141,8 @@ pub fn rem_u32(x: u32, y: u32) -> u32 _0 = move _3 panic.% move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -135,6 +156,7 @@ pub fn mul_u32(x: u32, y: u32) -> u32 let _4: u32; // anonymous local let _5: u32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy x @@ -144,6 +166,9 @@ pub fn mul_u32(x: u32, y: u32) -> u32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(y) + storage_dead(x) return } @@ -157,6 +182,7 @@ pub fn add_i32(x: i32, y: i32) -> i32 let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy x @@ -166,6 +192,9 @@ pub fn add_i32(x: i32, y: i32) -> i32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(y) + storage_dead(x) return } @@ -179,6 +208,7 @@ pub fn subs_i32(x: i32, y: i32) -> i32 let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy x @@ -188,6 +218,9 @@ pub fn subs_i32(x: i32, y: i32) -> i32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(y) + storage_dead(x) return } @@ -200,6 +233,7 @@ pub fn div_i32(x: i32, y: i32) -> i32 let _3: i32; // anonymous local let _4: i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -207,6 +241,8 @@ pub fn div_i32(x: i32, y: i32) -> i32 _0 = move _3 panic./ move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -217,10 +253,12 @@ pub fn div_i32_const(x: i32) -> i32 let x: i32; // arg #1 let _2: i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = move _2 panic./ const 2i32 storage_dead(_2) + storage_dead(x) return } @@ -233,6 +271,7 @@ pub fn rem_i32(x: i32, y: i32) -> i32 let _3: i32; // anonymous local let _4: i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -240,6 +279,8 @@ pub fn rem_i32(x: i32, y: i32) -> i32 _0 = move _3 panic.% move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -253,6 +294,7 @@ pub fn mul_i32(x: i32, y: i32) -> i32 let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy x @@ -262,6 +304,9 @@ pub fn mul_i32(x: i32, y: i32) -> i32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(y) + storage_dead(x) return } @@ -297,6 +342,7 @@ pub fn mix_arith_u32(x: u32, y: u32, z: u32) -> u32 let _26: u32; // anonymous local let _27: u32; // anonymous local + storage_live(_0) storage_live(_9) storage_live(_13) storage_live(_19) @@ -364,6 +410,15 @@ pub fn mix_arith_u32(x: u32, y: u32, z: u32) -> u32 _0 = move _4 panic.% move _21 storage_dead(_21) storage_dead(_4) + storage_dead(_27) + storage_dead(_25) + storage_dead(_20) + storage_dead(_19) + storage_dead(_13) + storage_dead(_9) + storage_dead(z) + storage_dead(y) + storage_dead(x) return } @@ -399,6 +454,7 @@ pub fn mix_arith_i32(x: i32, y: i32, z: i32) -> i32 let _26: i32; // anonymous local let _27: i32; // anonymous local + storage_live(_0) storage_live(_9) storage_live(_13) storage_live(_19) @@ -466,6 +522,15 @@ pub fn mix_arith_i32(x: i32, y: i32, z: i32) -> i32 _0 = move _4 panic.% move _21 storage_dead(_21) storage_dead(_4) + storage_dead(_27) + storage_dead(_25) + storage_dead(_20) + storage_dead(_19) + storage_dead(_13) + storage_dead(_9) + storage_dead(z) + storage_dead(y) + storage_dead(x) return } @@ -478,6 +543,7 @@ fn shl_u32(x: u32, y: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -485,6 +551,8 @@ fn shl_u32(x: u32, y: u32) -> u32 _0 = move _3 panic.<< move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -497,6 +565,7 @@ fn shr_u32(x: u32, y: u32) -> u32 let _3: u32; // anonymous local let _4: u32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -504,6 +573,8 @@ fn shr_u32(x: u32, y: u32) -> u32 _0 = move _3 panic.>> move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -518,6 +589,7 @@ fn shr_add_u32(x: u32, y: u32) -> u32 let _5: u32; // anonymous local let _6: u32; // anonymous local + storage_live(_0) storage_live(_6) storage_live(_3) _3 = copy x @@ -530,6 +602,9 @@ fn shr_add_u32(x: u32, y: u32) -> u32 _0 = move _3 panic.>> move _4 storage_dead(_4) storage_dead(_3) + storage_dead(_6) + storage_dead(y) + storage_dead(x) return } @@ -542,6 +617,7 @@ fn shl_i32(x: i32, y: i32) -> i32 let _3: i32; // anonymous local let _4: i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -549,6 +625,8 @@ fn shl_i32(x: i32, y: i32) -> i32 _0 = move _3 panic.<< move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -561,6 +639,7 @@ fn shr_i32(x: i32, y: i32) -> i32 let _3: i32; // anonymous local let _4: i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -568,6 +647,8 @@ fn shr_i32(x: i32, y: i32) -> i32 _0 = move _3 panic.>> move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -581,6 +662,7 @@ fn shr_i32_manual_cast(x: i32, y: i32) -> i32 let _4: u32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy x storage_live(_4) @@ -591,6 +673,8 @@ fn shr_i32_manual_cast(x: i32, y: i32) -> i32 _0 = move _3 panic.>> move _4 storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -603,6 +687,7 @@ fn index_slice_ignore_value<'_0>(x: &'_0 [u32]) let _3: &'_ [u32]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) // FIXME: Bug: the bound check is removed but the place is not mentioned, so the translated @@ -615,6 +700,9 @@ fn index_slice_ignore_value<'_0>(x: &'_0 [u32]) _ = (*_4) storage_dead(_2) _0 = () + storage_dead(x) + storage_dead(_4) + storage_dead(_3) return } @@ -623,9 +711,11 @@ pub fn test_crate::_() -> isize let _0: isize; // return let _1: isize; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 1isize panic.+ const 1isize _0 = move _1 + storage_dead(_1) return } @@ -636,9 +726,11 @@ pub fn test_crate::_#1() -> isize let _0: isize; // return let _1: isize; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 1isize panic.- const 1isize _0 = move _1 + storage_dead(_1) return } @@ -648,6 +740,7 @@ pub fn test_crate::_#2() -> isize { let _0: isize; // return + storage_live(_0) _0 = const -1isize return } @@ -659,9 +752,11 @@ pub fn test_crate::_#3() -> isize let _0: isize; // return let _1: isize; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 2isize panic.* const 2isize _0 = move _1 + storage_dead(_1) return } @@ -671,6 +766,7 @@ pub fn test_crate::_#4() -> isize { let _0: isize; // return + storage_live(_0) _0 = const 2isize panic.>> const 2i32 return } @@ -681,6 +777,7 @@ pub fn test_crate::_#5() -> isize { let _0: isize; // return + storage_live(_0) _0 = const 2isize panic.<< const 2i32 return } @@ -691,6 +788,7 @@ pub fn test_crate::_#6() -> isize { let _0: isize; // return + storage_live(_0) _0 = const 2isize panic.% const 2isize return } @@ -701,6 +799,7 @@ pub fn test_crate::_#7() -> isize { let _0: isize; // return + storage_live(_0) _0 = const 2isize panic./ const 2isize return } @@ -711,6 +810,7 @@ pub fn test_crate::FOO() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 10u32 return } @@ -722,9 +822,11 @@ pub fn test_crate::_#8() -> u32 let _0: u32; // return let _1: u32; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 1u32 panic.+ copy test_crate::FOO _0 = move _1 + storage_dead(_1) return } @@ -735,9 +837,11 @@ pub fn test_crate::_#9() -> u32 let _0: u32; // return let _1: u32; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 10u32 panic.- copy test_crate::FOO _0 = move _1 + storage_dead(_1) return } @@ -748,9 +852,11 @@ pub fn test_crate::_#10() -> u32 let _0: u32; // return let _1: u32; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 2u32 panic.* copy test_crate::FOO _0 = move _1 + storage_dead(_1) return } @@ -760,6 +866,7 @@ pub fn test_crate::_#11() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 2u32 panic.>> copy test_crate::FOO return } @@ -770,6 +877,7 @@ pub fn test_crate::_#12() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 2u32 panic.<< copy test_crate::FOO return } @@ -780,6 +888,7 @@ pub fn test_crate::_#13() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 2u32 panic.% copy test_crate::FOO return } @@ -790,6 +899,7 @@ pub fn test_crate::_#14() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 2u32 panic./ copy test_crate::FOO return } @@ -800,6 +910,7 @@ fn test_crate::div_signed_with_constant::FOO() -> i32 { let _0: i32; // return + storage_live(_0) _0 = const 42i32 return } @@ -811,6 +922,7 @@ fn div_signed_with_constant() -> i32 { let _0: i32; // return + storage_live(_0) _0 = copy test_crate::div_signed_with_constant::FOO panic./ const 2i32 return } @@ -826,6 +938,7 @@ fn div_unsigned_to_slice<'_0>(result: &'_0 mut [u32], x: u32) let _5: &'_ mut [u32]; // anonymous local let _6: &'_ mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = copy x @@ -839,6 +952,10 @@ fn div_unsigned_to_slice<'_0>(result: &'_0 mut [u32], x: u32) storage_dead(_3) storage_dead(_4) _0 = () + storage_dead(x) + storage_dead(result) + storage_dead(_6) + storage_dead(_5) return } @@ -853,6 +970,7 @@ fn div_signed_to_slice<'_0>(result: &'_0 mut [i32], x: i32) let _5: &'_ mut [i32]; // anonymous local let _6: &'_ mut i32; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = copy x @@ -866,6 +984,10 @@ fn div_signed_to_slice<'_0>(result: &'_0 mut [i32], x: i32) storage_dead(_3) storage_dead(_4) _0 = () + storage_dead(x) + storage_dead(result) + storage_dead(_6) + storage_dead(_5) return } @@ -881,6 +1003,7 @@ fn add_to_slice<'_0>(result: &'_0 mut [u32], x: u32) let _6: &'_ mut [u32]; // anonymous local let _7: &'_ mut u32; // anonymous local + storage_live(_0) storage_live(_4) _0 = () storage_live(_3) @@ -896,6 +1019,11 @@ fn add_to_slice<'_0>(result: &'_0 mut [u32], x: u32) storage_dead(_3) storage_dead(_5) _0 = () + storage_dead(_4) + storage_dead(x) + storage_dead(result) + storage_dead(_7) + storage_dead(_6) return } @@ -914,6 +1042,7 @@ fn add_to_slice2<'_0>(result: &'_0 mut [u8], i: usize, x: u8) let _9: &'_ mut [u8]; // anonymous local let _10: &'_ mut u8; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_8) _0 = () @@ -934,6 +1063,13 @@ fn add_to_slice2<'_0>(result: &'_0 mut [u8], i: usize, x: u8) storage_dead(_4) storage_dead(_6) _0 = () + storage_dead(_8) + storage_dead(_5) + storage_dead(x) + storage_dead(i) + storage_dead(result) + storage_dead(_10) + storage_dead(_9) return } diff --git a/charon/tests/ui/rename_attribute.out b/charon/tests/ui/rename_attribute.out index 50be2022c..8beabeb0f 100644 --- a/charon/tests/ui/rename_attribute.out +++ b/charon/tests/ui/rename_attribute.out @@ -28,7 +28,9 @@ where let _0: bool; // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = const true + storage_dead(self) return } @@ -38,7 +40,9 @@ pub fn get_bool<'_0>(self: &'_0 bool) -> bool let _0: bool; // return let self: &'1 bool; // arg #1 + storage_live(_0) _0 = copy (*self) + storage_dead(self) return } @@ -48,7 +52,9 @@ pub fn impl_BoolTrait_for_bool::ret_true<'_0>(self: &'_0 bool) -> bool let _0: bool; // return let self: &'1 bool; // arg #1 + storage_live(_0) _0 = const true + storage_dead(self) return } @@ -71,6 +77,7 @@ where let _3: &'1 bool; // anonymous local let _4: &'2 bool; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &x @@ -80,6 +87,7 @@ where storage_dead(_3) _0 = const false storage_dead(_2) + storage_dead(x) return } storage_dead(_3) @@ -88,6 +96,7 @@ where _0 = impl_BoolTrait_for_bool::ret_true<'6>(move _4) storage_dead(_4) storage_dead(_2) + storage_dead(x) return } @@ -114,6 +123,7 @@ fn C() -> u32 let _2: u32; // anonymous local let _3: u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_1) @@ -122,6 +132,8 @@ fn C() -> u32 _3 = copy _1 panic.+ const 1u32 _0 = move _3 storage_dead(_1) + storage_dead(_3) + storage_dead(_2) return } diff --git a/charon/tests/ui/result-unwrap.out b/charon/tests/ui/result-unwrap.out index 7c356bb89..2a8d9c3eb 100644 --- a/charon/tests/ui/result-unwrap.out +++ b/charon/tests/ui/result-unwrap.out @@ -40,6 +40,7 @@ where let _4: &'3 (dyn Debug + '4); // anonymous local let _5: &'6 E; // anonymous local + storage_live(t) storage_live(_3) match self { Result::Ok => { @@ -52,9 +53,20 @@ where _5 = &e _4 = unsize_cast<&'6 E, &'7 (dyn Debug + '8), &vtable_of(TraitClause2)>(copy _5) _3 = unwrap_failed<'11, '12>(const "called `Result::unwrap()` on an `Err` value", move _4) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(e) + storage_dead(self) + undefined_behavior }, } t = move (self as variant Result::Ok).0 + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(e) + storage_dead(self) return } @@ -64,10 +76,12 @@ fn test_crate::unwrap(res: Result[{built_in impl Sized for u32}, {buil let res: Result[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // arg #1 let _2: Result[{built_in impl Sized for u32}, {built_in impl Sized for u32}]; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy res _0 = core::result::{Result[TraitClause0, TraitClause1]}::unwrap[{built_in impl Sized for u32}, {built_in impl Sized for u32}, {impl#0}](move _2) storage_dead(_2) + storage_dead(res) return } diff --git a/charon/tests/ui/rust-name-matcher-tests.out b/charon/tests/ui/rust-name-matcher-tests.out index a986a1b7b..5033e4294 100644 --- a/charon/tests/ui/rust-name-matcher-tests.out +++ b/charon/tests/ui/rust-name-matcher-tests.out @@ -39,6 +39,7 @@ fn bar() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -61,6 +62,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -85,6 +87,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -109,6 +112,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -142,12 +146,14 @@ where let value: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move value _0 = Generic { value: move _2 } conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _2 storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] value + storage_dead(value) return } @@ -160,10 +166,12 @@ where let self: &'3 Generic[TraitClause0]; // arg #1 let _2: &'4 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &((*self)).value _0 = &(*_2) storage_dead(_2) + storage_dead(self) return } @@ -176,6 +184,7 @@ fn use_generic() let _3: &'10 i32; // anonymous local let _4: &'12 Generic[{built_in impl Sized for i32}]; // anonymous local + storage_live(_0) _0 = () storage_live(_int_generic) _int_generic = new[{built_in impl Sized for i32}](const 42i32) diff --git a/charon/tests/ui/rvalues.out b/charon/tests/ui/rvalues.out index 0b5924087..da65b94fe 100644 --- a/charon/tests/ui/rvalues.out +++ b/charon/tests/ui/rvalues.out @@ -103,6 +103,7 @@ fn addr_of() let _4: *const u32; // anonymous local let _5: *mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0u32 @@ -133,6 +134,7 @@ fn literal_casts() let _4: u64; // anonymous local let _5: f64; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = cast(const 0u64) @@ -157,6 +159,7 @@ fn test_crate::ptr_casts::foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -189,10 +192,13 @@ fn ptr_casts() storage_live(_18) storage_live(_19) + storage_live(_19) storage_live(_20) _20 = @ArrayRepeat(const 0u32) _19 = &_20 + storage_dead(_20) _18 = move _19 + storage_live(_0) storage_live(_17) _0 = () storage_live(array_ptr) @@ -245,6 +251,9 @@ fn ptr_casts() storage_dead(x_6) storage_dead(x_5) storage_dead(array_ptr) + storage_dead(_17) + storage_dead(_19) + storage_dead(_18) return } @@ -257,7 +266,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -269,10 +280,14 @@ fn call<'_0>(_1: &'_0 closure, tupled_args: (u8,)) let tupled_args: (u8,); // arg #2 let _3: u8; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = move tupled_args.0 _0 = () + storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -284,10 +299,14 @@ fn call_mut<'_0>(state: &'_0 mut closure, args: (u8,)) let args: (u8,); // arg #2 let _3: &'0 closure; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -299,11 +318,15 @@ fn call_once(_1: closure, _2: (u8,)) let _2: (u8,); // arg #2 let _3: &'1 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'2>(move _3, move _2) drop[drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -315,12 +338,16 @@ fn as_fn(arg1: u8) let args: (u8,); // local let state: closure; // local + storage_live(_0) _0 = () storage_live(args) storage_live(state) args = (move arg1,) state = closure { } _0 = call_once(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -329,6 +356,7 @@ unsafe fn bar() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -338,6 +366,7 @@ fn test_crate::fn_casts::foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -355,6 +384,7 @@ fn fn_casts() let _6: unsafe fn(u8); // anonymous local let _7: closure; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = cast(const test_crate::fn_casts::foo) @@ -424,6 +454,7 @@ fn STEAL() -> [(); 1usize] let _0: [(); 1usize]; // return let _1: (); // anonymous local + storage_live(_0) storage_live(_1) _1 = () _0 = @ArrayRepeat<(), 1usize>(move _1) @@ -441,11 +472,13 @@ fn transmute(x: [u32; 2usize]) -> u64 let x: [u32; 2usize]; // arg #1 let _2: [u32; 2usize]; // anonymous local + storage_live(_0) storage_live(_2) // When optimized, this becomes a built-in cast. Otherwise this is just a call to `transmute`. _2 = copy x _0 = transmute<[u32; 2usize], u64>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -455,6 +488,7 @@ fn STEAL2() -> [(); 13usize] let _0: [(); 13usize]; // return let _1: (); // anonymous local + storage_live(_0) storage_live(_1) _1 = () _0 = @ArrayRepeat<(), 13usize>(move _1) @@ -498,6 +532,7 @@ where let _16: usize; // anonymous local let _17: usize; // anonymous local + storage_live(_0) storage_live(_9) storage_live(_12) storage_live(_14) @@ -507,6 +542,7 @@ where align = align_of[TraitClause0]() storage_live(_16) storage_live(_17) + storage_live(_17) // This is `const (false)` in the MIR we get, but `true` in const evaluation. _17 = offset_of(Struct[TraitClause0].b) _16 = move _17 @@ -545,6 +581,12 @@ where storage_dead(ub) storage_dead(align) storage_dead(size) + storage_dead(_15) + storage_dead(_14) + storage_dead(_12) + storage_dead(_9) + storage_dead(_17) + storage_dead(_16) return } diff --git a/charon/tests/ui/send_bound.out b/charon/tests/ui/send_bound.out index 8d90f58bb..bdbe37edd 100644 --- a/charon/tests/ui/send_bound.out +++ b/charon/tests/ui/send_bound.out @@ -33,9 +33,11 @@ where let _0: (); // return let _msg: M; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for M}::drop_glue<'0>] _msg + storage_dead(_msg) return } @@ -46,6 +48,7 @@ fn main() let _1: (); // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/simple-cmp.out b/charon/tests/ui/simple-cmp.out index 106c800a1..8d900a5ff 100644 --- a/charon/tests/ui/simple-cmp.out +++ b/charon/tests/ui/simple-cmp.out @@ -23,6 +23,7 @@ fn main() let _5: &'2 i32; // anonymous local let _6: &'3 i32; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 11i32 diff --git a/charon/tests/ui/simple/addition.out b/charon/tests/ui/simple/addition.out index 1dfd631e6..9ff4ce8df 100644 --- a/charon/tests/ui/simple/addition.out +++ b/charon/tests/ui/simple/addition.out @@ -7,6 +7,7 @@ fn main() let _1: i32; // anonymous local let _2: i32; // anonymous local + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -14,6 +15,7 @@ fn main() _1 = move _2 storage_dead(_1) _0 = () + storage_dead(_2) return } diff --git a/charon/tests/ui/simple/additions.out b/charon/tests/ui/simple/additions.out index 26db6979e..bdbc96ad3 100644 --- a/charon/tests/ui/simple/additions.out +++ b/charon/tests/ui/simple/additions.out @@ -41,6 +41,7 @@ where let _3: Self; // anonymous local let _4: &'4 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -51,6 +52,8 @@ where (*self) = move _3 _0 = () storage_dead(_3) + storage_dead(source) + storage_dead(self) return } @@ -60,7 +63,9 @@ pub fn clone<'_0>(self: &'_0 u8) -> u8 let _0: u8; // return let self: &'1 u8; // arg #1 + storage_live(_0) _0 = copy (*self) + storage_dead(self) return } @@ -75,6 +80,7 @@ where let _3: u8; // anonymous local let _4: &'4 u8; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -85,6 +91,8 @@ where (*self) = move _3 _0 = () storage_dead(_3) + storage_dead(source) + storage_dead(self) return } @@ -126,6 +134,7 @@ pub fn core::num::{u8}::saturating_add(self: u8, rhs: u8) -> u8 let _3: u8; // anonymous local let _4: u8; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy self storage_live(_4) @@ -133,6 +142,8 @@ pub fn core::num::{u8}::saturating_add(self: u8, rhs: u8) -> u8 _0 = core::intrinsics::saturating_add[{built_in impl Sized for u8}, impl_Copy_for_u8](move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(rhs) + storage_dead(self) return } @@ -145,6 +156,7 @@ pub fn wrapping_add(self: u8, rhs: u8) -> u8 let _3: u8; // anonymous local let _4: u8; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy self storage_live(_4) @@ -152,6 +164,8 @@ pub fn wrapping_add(self: u8, rhs: u8) -> u8 _0 = move _3 wrap.+ move _4 storage_dead(_4) storage_dead(_3) + storage_dead(rhs) + storage_dead(self) return } @@ -169,6 +183,7 @@ pub fn overflowing_add(self: u8, rhs: u8) -> (u8, bool) let _8: u8; // anonymous local let _9: bool; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_6) _6 = copy self @@ -191,6 +206,8 @@ pub fn overflowing_add(self: u8, rhs: u8) -> (u8, bool) storage_dead(_8) storage_dead(b) storage_dead(a) + storage_dead(rhs) + storage_dead(self) return } @@ -202,6 +219,7 @@ fn main() let _2: (u8, bool); // anonymous local let _3: u8; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = wrapping_add(const 255u8, const 1u8) diff --git a/charon/tests/ui/simple/array_index.out b/charon/tests/ui/simple/array_index.out index 3edca38ec..8affabf4f 100644 --- a/charon/tests/ui/simple/array_index.out +++ b/charon/tests/ui/simple/array_index.out @@ -9,6 +9,7 @@ pub fn first(s: [u32; 0usize]) -> u32 let _3: &'_ [u32; 0usize]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -17,6 +18,9 @@ pub fn first(s: [u32; 0usize]) -> u32 _4 = @ArrayIndexShared<'_, u32, 0usize>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(s) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/basic-mono.out b/charon/tests/ui/simple/basic-mono.out index ddb728eb1..bb1233d8f 100644 --- a/charon/tests/ui/simple/basic-mono.out +++ b/charon/tests/ui/simple/basic-mono.out @@ -5,6 +5,7 @@ fn foo::<10usize>() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -15,6 +16,7 @@ fn bar::() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -27,6 +29,7 @@ fn main() let _1: (); // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = foo::<10usize>() diff --git a/charon/tests/ui/simple/box-deref-elaborated.out b/charon/tests/ui/simple/box-deref-elaborated.out index 385f11415..4396c03fa 100644 --- a/charon/tests/ui/simple/box-deref-elaborated.out +++ b/charon/tests/ui/simple/box-deref-elaborated.out @@ -46,11 +46,15 @@ fn into_inner(b: alloc::boxed::Box[{built_in impl MetaSized for String}, let _2: &'1 mut alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = move (*b) _2 = &mut b _3 = impl_Drop_for_Box::drop<'4, String, Global>[{built_in impl MetaSized for String}, {built_in impl Sized for Global}](move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(b) return } @@ -62,6 +66,7 @@ fn write(b: alloc::boxed::Box[{built_in impl MetaSized for String}, {bui let s: String; // arg #2 let _3: String; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = move s @@ -70,6 +75,8 @@ fn write(b: alloc::boxed::Box[{built_in impl MetaSized for String}, {bui storage_dead(_3) _0 = () drop[impl_Destruct_for_Box::drop_glue<'1, String, Global>[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]] b + storage_dead(s) + storage_dead(b) return } @@ -80,12 +87,14 @@ fn borrow(b: alloc::boxed::Box[{built_in impl MetaSized for String}, {bu let b: alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // arg #1 let _2: &'1 mut String; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &mut (*b) storage_dead(_2) _0 = () drop[impl_Destruct_for_Box::drop_glue<'2, String, Global>[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]] b + storage_dead(b) return } @@ -98,6 +107,7 @@ fn reborrow<'_0>(b: &'_0 mut alloc::boxed::Box[{built_in impl MetaSized let _3: &'5 mut alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // anonymous local let _4: alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_2) storage_live(_3) @@ -107,6 +117,8 @@ fn reborrow<'_0>(b: &'_0 mut alloc::boxed::Box[{built_in impl MetaSized _0 = &mut (*_2) storage_dead(_3) storage_dead(_2) + storage_dead(_4) + storage_dead(b) return } @@ -124,11 +136,15 @@ fn field(b: alloc::boxed::Box[{built_in impl MetaSized for Struct}, {bui let _2: &'1 mut alloc::boxed::Box[{built_in impl MetaSized for Struct}, {built_in impl Sized for Global}]; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = move ((*b)).b _2 = &mut b _3 = impl_Drop_for_Box::drop<'4, Struct, Global>[{built_in impl MetaSized for Struct}, {built_in impl Sized for Global}](move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(b) return } diff --git a/charon/tests/ui/simple/box-deref-optimized.out b/charon/tests/ui/simple/box-deref-optimized.out index 385f11415..4396c03fa 100644 --- a/charon/tests/ui/simple/box-deref-optimized.out +++ b/charon/tests/ui/simple/box-deref-optimized.out @@ -46,11 +46,15 @@ fn into_inner(b: alloc::boxed::Box[{built_in impl MetaSized for String}, let _2: &'1 mut alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = move (*b) _2 = &mut b _3 = impl_Drop_for_Box::drop<'4, String, Global>[{built_in impl MetaSized for String}, {built_in impl Sized for Global}](move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(b) return } @@ -62,6 +66,7 @@ fn write(b: alloc::boxed::Box[{built_in impl MetaSized for String}, {bui let s: String; // arg #2 let _3: String; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = move s @@ -70,6 +75,8 @@ fn write(b: alloc::boxed::Box[{built_in impl MetaSized for String}, {bui storage_dead(_3) _0 = () drop[impl_Destruct_for_Box::drop_glue<'1, String, Global>[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]] b + storage_dead(s) + storage_dead(b) return } @@ -80,12 +87,14 @@ fn borrow(b: alloc::boxed::Box[{built_in impl MetaSized for String}, {bu let b: alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // arg #1 let _2: &'1 mut String; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &mut (*b) storage_dead(_2) _0 = () drop[impl_Destruct_for_Box::drop_glue<'2, String, Global>[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]] b + storage_dead(b) return } @@ -98,6 +107,7 @@ fn reborrow<'_0>(b: &'_0 mut alloc::boxed::Box[{built_in impl MetaSized let _3: &'5 mut alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // anonymous local let _4: alloc::boxed::Box[{built_in impl MetaSized for String}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_2) storage_live(_3) @@ -107,6 +117,8 @@ fn reborrow<'_0>(b: &'_0 mut alloc::boxed::Box[{built_in impl MetaSized _0 = &mut (*_2) storage_dead(_3) storage_dead(_2) + storage_dead(_4) + storage_dead(b) return } @@ -124,11 +136,15 @@ fn field(b: alloc::boxed::Box[{built_in impl MetaSized for Struct}, {bui let _2: &'1 mut alloc::boxed::Box[{built_in impl MetaSized for Struct}, {built_in impl Sized for Global}]; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = move ((*b)).b _2 = &mut b _3 = impl_Drop_for_Box::drop<'4, Struct, Global>[{built_in impl MetaSized for Struct}, {built_in impl Sized for Global}](move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(b) return } diff --git a/charon/tests/ui/simple/box-dyn-fnonce-raw.out b/charon/tests/ui/simple/box-dyn-fnonce-raw.out index 9cbe317d2..f3ea8fff2 100644 --- a/charon/tests/ui/simple/box-dyn-fnonce-raw.out +++ b/charon/tests/ui/simple/box-dyn-fnonce-raw.out @@ -282,6 +282,7 @@ where let _14: Unique; // anonymous local let _15: Layout; // anonymous local + storage_live(_0) _0 = () storage_live(ptr) ptr = copy ((*self)).0 @@ -310,6 +311,7 @@ where storage_dead(_7) storage_dead(layout) storage_dead(ptr) + storage_dead(self) return } storage_dead(_8) @@ -335,6 +337,7 @@ where storage_dead(_7) storage_dead(layout) storage_dead(ptr) + storage_dead(self) return } @@ -351,6 +354,7 @@ where let _3: (); // anonymous local let _4: *const T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -360,6 +364,10 @@ where _2 = &mut (*_1) _3 = impl_Drop_for_Box::drop<'6, T, A>[TraitClause0, TraitClause1, TraitClause2](move _2) drop[{built_in impl Destruct for A}::drop_glue<'10>] ((*_1)).1 + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -382,10 +390,13 @@ fn box_new_uninit(layout: Layout) -> *mut u8 storage_live(_10) storage_live(_11) + storage_live(_11) storage_live(_12) _12 = Global { } _11 = &_12 + storage_dead(_12) _10 = move _11 + storage_live(_0) storage_live(_9) storage_live(_2) storage_live(_3) @@ -404,6 +415,13 @@ fn box_new_uninit(layout: Layout) -> *mut u8 storage_live(_8) _8 = copy layout _7 = handle_alloc_error(move _8) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(layout) + storage_dead(_11) + storage_dead(_10) + undefined_behavior }, } storage_live(ptr) @@ -414,6 +432,12 @@ fn box_new_uninit(layout: Layout) -> *mut u8 storage_dead(_6) storage_dead(ptr) storage_dead(_2) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(layout) + storage_dead(_11) + storage_dead(_10) return } @@ -432,6 +456,7 @@ where let _6: *mut T; // anonymous local let _7: bool; // anonymous local + storage_live(_0) storage_live(_7) _7 = const false _7 = const true @@ -453,6 +478,8 @@ where _0 = transmute<*mut T, Box[TraitClause0::ImpliedClause0, {built_in impl Sized for Global}, impl_Allocator_for_Global]>(move _6) storage_dead(_6) storage_dead(ptr) + storage_dead(_7) + storage_dead(x) return } @@ -476,6 +503,7 @@ where let _7: *const F; // anonymous local let _8: *const F; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_6) storage_live(_7) @@ -492,6 +520,12 @@ where _6 = impl_Drop_for_Box::drop<'7, F, A>[TraitClause1, TraitClause2, TraitClause5](move _5) drop[{built_in impl Destruct for A}::drop_glue<'10>] (_3).1 storage_dead(_3) + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) + storage_dead(args) + storage_dead(self) return } @@ -510,9 +544,13 @@ where let _2: Args; // arg #2 let _3: Box[TraitClause1, TraitClause2, TraitClause5]; // anonymous local + storage_live(_0) storage_live(_3) _3 = concretize<(dyn FnOnce + '1), Box[TraitClause1, TraitClause2, TraitClause5]>(move _1) _0 = call_once[TraitClause0, TraitClause1, TraitClause2, TraitClause3, TraitClause4, TraitClause5](move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -530,10 +568,13 @@ where let dyn_self: &'_0 mut (dyn FnOnce + '0); // arg #1 let target_self: &'_0 mut Box[TraitClause1, TraitClause2, TraitClause5]; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn FnOnce + '1), &'_0 mut Box[TraitClause1, TraitClause2, TraitClause5]>(move dyn_self) drop[drop_glue<'3, F, A>[TraitClause1, TraitClause2, TraitClause5]] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -553,6 +594,7 @@ where let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn FnOnce + '1)); // anonymous local let _4: extern "rust-call" fn((dyn FnOnce + '2), Args) -> TraitClause4::Output; // anonymous local + storage_live(ret) storage_live(size) size = size_of[TraitClause1, TraitClause2, TraitClause5]> storage_live(align) @@ -562,6 +604,10 @@ where storage_live(_4) _4 = cast<{vtable_method}[TraitClause0, TraitClause1, TraitClause2, TraitClause3, TraitClause4, TraitClause5], extern "rust-call" fn((dyn FnOnce + '2), Args) -> TraitClause4::Output>(const {vtable_method}[TraitClause0, TraitClause1, TraitClause2, TraitClause3, TraitClause4, TraitClause5]) ret = core::ops::function::FnOnce::{vtable} { size: move size, align: move align, drop: move _3, method_call_once: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for Box[TraitClause1, TraitClause2, TraitClause5]}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -604,6 +650,7 @@ pub fn box_box(f: Box<(dyn FnOnce<(), Output = ()> + 'static), Global>[{built_in let _3: Box + '18), Global>[{built_in impl MetaSized for (dyn FnOnce<(), Output = ()> + '19)}, {built_in impl Sized for Global}, impl_Allocator_for_Global], Global>[{built_in impl MetaSized for Box<(dyn FnOnce<(), Output = ()> + '20), Global>[{built_in impl MetaSized for (dyn FnOnce<(), Output = ()> + '21)}, {built_in impl Sized for Global}, impl_Allocator_for_Global]}, {built_in impl Sized for Global}, impl_Allocator_for_Global]; // anonymous local let _4: Box<(dyn FnOnce<(), Output = ()> + '22), Global>[{built_in impl MetaSized for (dyn FnOnce<(), Output = ()> + '23)}, {built_in impl Sized for Global}, impl_Allocator_for_Global]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -617,6 +664,7 @@ pub fn box_box(f: Box<(dyn FnOnce<(), Output = ()> + 'static), Global>[{built_in conditional_drop[drop_glue<'123, (dyn FnOnce<(), Output = ()> + '120), Global>[{built_in impl MetaSized for (dyn FnOnce<(), Output = ()> + '120)}, {built_in impl Sized for Global}, impl_Allocator_for_Global]] _2 storage_dead(_2) conditional_drop[drop_glue<'133, (dyn FnOnce<(), Output = ()> + '130), Global>[{built_in impl MetaSized for (dyn FnOnce<(), Output = ()> + '130)}, {built_in impl Sized for Global}, impl_Allocator_for_Global]] f + storage_dead(f) return } diff --git a/charon/tests/ui/simple/box-new.out b/charon/tests/ui/simple/box-new.out index fdf5c858c..30f18bb2d 100644 --- a/charon/tests/ui/simple/box-new.out +++ b/charon/tests/ui/simple/box-new.out @@ -92,6 +92,7 @@ fn main() let _0: (); // return let _1: Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, impl_Allocator_for_Global]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = new[{built_in impl Sized for i32}](const 42i32) diff --git a/charon/tests/ui/simple/builtin-drop-mono.out b/charon/tests/ui/simple/builtin-drop-mono.out index ca875bb58..96d9ae72f 100644 --- a/charon/tests/ui/simple/builtin-drop-mono.out +++ b/charon/tests/ui/simple/builtin-drop-mono.out @@ -43,6 +43,7 @@ unsafe fn impl_Destruct_for_slice::drop_glue::<'_0>(_1: &'_0 mut [String let _6: &'_ mut [String]; // anonymous local let _7: &'_ mut String; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -65,6 +66,13 @@ unsafe fn impl_Destruct_for_slice::drop_glue::<'_0>(_1: &'_0 mut [String continue 0 } } + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) + storage_dead(_7) + storage_dead(_6) return } @@ -74,8 +82,10 @@ unsafe fn core::ptr::drop_glue::<[String]><'_0>(_1: &'_0 mut [String]) let ret: (); // return let _1: &'_0 mut [String]; // arg #1 + storage_live(ret) ret = () drop[impl_Destruct_for_slice::drop_glue::<'0>] (*_1) + storage_dead(_1) return } @@ -110,10 +120,13 @@ unsafe fn impl_Destruct_for_array::drop_glue::<'_0>(_1: &'_0 mut let _1: &'1 mut [String; 4usize]; // arg #1 let _2: &'3 mut [String]; // anonymous local + storage_live(_0) storage_live(_2) _0 = () _2 = @ArrayToSliceMut<'_, String, 4usize>(move _1) _0 = core::ptr::drop_glue::<[String]><'6>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -129,9 +142,11 @@ unsafe fn impl_Destruct_for_tuple_String_String::drop_glue::<'_0 let _0: (); // return let _1: &'1 mut (String, String); // arg #1 + storage_live(_0) _0 = () drop[impl_Destruct_for_String::drop_glue<'2>] (*_1).0 drop[impl_Destruct_for_String::drop_glue<'3>] (*_1).1 + storage_dead(_1) return } @@ -147,9 +162,11 @@ fn drop_array(_1: [String; 4usize]) let _0: (); // return let _1: [String; 4usize]; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_array::drop_glue::<'0>] _1 + storage_dead(_1) return } @@ -159,9 +176,11 @@ fn drop_slice(_1: alloc::boxed::Box<[String]>[{built_in impl MetaSized for [Stri let _0: (); // return let _1: alloc::boxed::Box<[String]>[{built_in impl MetaSized for [String]}, {built_in impl Sized for Global}, impl_Destruct_for_slice, impl_Destruct_for_Global]; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_Box_slice_Global::drop_glue::<[String], Global><'0>] _1 + storage_dead(_1) return } @@ -171,9 +190,11 @@ fn drop_tuple(_1: (String, String)) let _0: (); // return let _1: (String, String); // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_tuple_String_String::drop_glue::<'0>] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/builtin-drop.out b/charon/tests/ui/simple/builtin-drop.out index e4098dd55..1864d4bdc 100644 --- a/charon/tests/ui/simple/builtin-drop.out +++ b/charon/tests/ui/simple/builtin-drop.out @@ -29,8 +29,10 @@ where let ret: (); // return let _1: &'_0 mut T; // arg #1 + storage_live(ret) ret = () drop[TraitClause0::drop_glue<'0>] (*_1) + storage_dead(_1) return } @@ -86,6 +88,7 @@ where let _6: &'_ mut [T]; // anonymous local let _7: &'_ mut T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -108,6 +111,13 @@ where continue 0 } } + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) + storage_dead(_7) + storage_dead(_6) return } @@ -131,10 +141,13 @@ where let _1: &'1 mut [T; N]; // arg #1 let _2: &'3 mut [T]; // anonymous local + storage_live(_0) storage_live(_2) _0 = () _2 = @ArrayToSliceMut<'_, T, N>(move _1) _0 = core::ptr::drop_glue<'6, [T]>[impl_Destruct_for_slice[TraitClause0, TraitClause1], impl_Destruct_for_slice[TraitClause0, TraitClause1]](move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -158,9 +171,11 @@ where let _0: (); // return let _1: &'1 mut (A, B); // arg #1 + storage_live(_0) _0 = () drop[TraitClause1::drop_glue<'2>] (*_1).0 drop[TraitClause2::drop_glue<'3>] (*_1).1 + storage_dead(_1) return } @@ -181,9 +196,11 @@ fn drop_array(_1: [String; 4usize]) let _0: (); // return let _1: [String; 4usize]; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_array::drop_glue<'0, String, 4usize>[{built_in impl Sized for String}, impl_Destruct_for_String]] _1 + storage_dead(_1) return } @@ -193,9 +210,11 @@ fn drop_slice(_1: alloc::boxed::Box<[String]>[{built_in impl MetaSized for [Stri let _0: (); // return let _1: alloc::boxed::Box<[String]>[{built_in impl MetaSized for [String]}, {built_in impl Sized for Global}, impl_Destruct_for_slice[{built_in impl Sized for String}, impl_Destruct_for_String], impl_Destruct_for_Global]; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_Box::drop_glue<'0, [String], Global>[{built_in impl MetaSized for [String]}, {built_in impl Sized for Global}, impl_Destruct_for_slice[{built_in impl Sized for String}, impl_Destruct_for_String], impl_Destruct_for_Global]] _1 + storage_dead(_1) return } @@ -210,9 +229,11 @@ where let _0: (); // return let _1: (A, B); // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_tuple::drop_glue<'0, A, B>[TraitClause0, TraitClause2, TraitClause3]] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/call-foreign-defaulted-method.out b/charon/tests/ui/simple/call-foreign-defaulted-method.out index 37b7cb784..bcf43ee83 100644 --- a/charon/tests/ui/simple/call-foreign-defaulted-method.out +++ b/charon/tests/ui/simple/call-foreign-defaulted-method.out @@ -10,8 +10,10 @@ pub fn impl_Trait_for_unit::defaulted<'_0>(self: &'_0 ()) let _0: (); // return let self: &'1 (); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -28,10 +30,13 @@ fn main() storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) _6 = () _5 = &_6 + storage_dead(_6) _4 = move _5 + storage_live(_0) storage_live(_3) _0 = () storage_live(_1) @@ -42,6 +47,9 @@ fn main() storage_dead(_2) storage_dead(_1) _0 = () + storage_dead(_3) + storage_dead(_5) + storage_dead(_4) return } @@ -60,8 +68,10 @@ where let _0: (); // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out b/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out index 994642a13..5a3709f59 100644 --- a/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out +++ b/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out @@ -51,8 +51,10 @@ where let _0: (); // return let _1: &'1 mut HashMap[TraitClause0]; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for S}::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -76,10 +78,13 @@ where let _x: HashMap[TraitClause0]; // arg #1 let _k: Q; // arg #2 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for Q}::drop_glue<'0>] _k conditional_drop[drop_glue<'1, S>[TraitClause0]] _x + storage_dead(_k) + storage_dead(_x) return } @@ -94,10 +99,13 @@ where let _x: HashMap[TraitClause0]; // arg #1 let _k: Q; // arg #2 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for Q}::drop_glue<'0>] _k conditional_drop[drop_glue<'1, S>[TraitClause0]] _x + storage_dead(_k) + storage_dead(_x) return } @@ -110,6 +118,7 @@ pub fn test1(map: HashMap<()>[{built_in impl Sized for ()}]) let _3: HashMap<()>[{built_in impl Sized for ()}]; // anonymous local let _4: (); // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -121,6 +130,7 @@ pub fn test1(map: HashMap<()>[{built_in impl Sized for ()}]) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(map) return } @@ -133,6 +143,7 @@ pub fn test2(map: HashMap<()>[{built_in impl Sized for ()}]) let _3: HashMap<()>[{built_in impl Sized for ()}]; // anonymous local let _4: (); // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -144,6 +155,7 @@ pub fn test2(map: HashMap<()>[{built_in impl Sized for ()}]) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(map) return } diff --git a/charon/tests/ui/simple/call-method-via-supertrait-bound.out b/charon/tests/ui/simple/call-method-via-supertrait-bound.out index a15332b26..d6ca6a04c 100644 --- a/charon/tests/ui/simple/call-method-via-supertrait-bound.out +++ b/charon/tests/ui/simple/call-method-via-supertrait-bound.out @@ -52,8 +52,10 @@ where let _0: (); // return let self: &'1 T; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -79,6 +81,7 @@ where let _2: (); // anonymous local let _3: &'1 T; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -88,6 +91,7 @@ where storage_dead(_2) _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'5>] x + storage_dead(x) return } diff --git a/charon/tests/ui/simple/catch-unwind.out b/charon/tests/ui/simple/catch-unwind.out index 3a90d758f..d0af9d0ce 100644 --- a/charon/tests/ui/simple/catch-unwind.out +++ b/charon/tests/ui/simple/catch-unwind.out @@ -100,8 +100,11 @@ fn call_once(_1: closure, tupled_args: ()) let _1: closure; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(tupled_args) + storage_dead(_1) return } @@ -123,6 +126,7 @@ fn main() let _1: Result<(), alloc::boxed::Box<(dyn Any + Send + '18)>[{built_in impl MetaSized for (dyn Any + Send + '19)}, {built_in impl Sized for Global}]>[{built_in impl Sized for ()}, {built_in impl Sized for alloc::boxed::Box<(dyn Any + Send + '22)>[{built_in impl MetaSized for (dyn Any + Send + '23)}, {built_in impl Sized for Global}]}]; // anonymous local let _2: closure; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/simple/closure-capture-ref-by-move.out b/charon/tests/ui/simple/closure-capture-ref-by-move.out index b7cccfbd8..9b44d00ad 100644 --- a/charon/tests/ui/simple/closure-capture-ref-by-move.out +++ b/charon/tests/ui/simple/closure-capture-ref-by-move.out @@ -66,11 +66,15 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure<'_0>, tupled_args: ()) let tupled_args: (); // arg #2 let _3: i32; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = copy (*((*_1)).0) panic.+ const 1i32 (*((*_1)).0) = move _3 _0 = () + storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -85,6 +89,7 @@ fn foo() let _5: &'6 mut closure<'7>; // anonymous local let _6: (); // anonymous local + storage_live(_0) _0 = () storage_live(x) x = const 0i32 @@ -114,7 +119,9 @@ unsafe fn drop_glue<'_0, '_1>(_1: &'_1 mut closure<'_0>) let _0: (); // return let _1: &'1 mut closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -126,11 +133,15 @@ fn call_once<'_0>(_1: closure<'_0>, _2: ()) let _2: (); // arg #2 let _3: &'1 mut closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'_0, '4>(move _3, move _2) drop[drop_glue<'_0, '10>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/closure-fn.out b/charon/tests/ui/simple/closure-fn.out index 3c744f940..3794f65cd 100644 --- a/charon/tests/ui/simple/closure-fn.out +++ b/charon/tests/ui/simple/closure-fn.out @@ -77,6 +77,7 @@ where let _2: &'2 T0; // anonymous local let _3: (u8, u8); // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*f) storage_live(_3) @@ -84,6 +85,7 @@ where _0 = TraitClause1::call<'3>(move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(f) return } @@ -99,6 +101,7 @@ where let _2: &'2 mut T0; // anonymous local let _3: (u8, u8); // anonymous local + storage_live(_0) storage_live(_2) _2 = &mut (*f) storage_live(_3) @@ -106,6 +109,7 @@ where _0 = TraitClause1::call_mut<'3>(move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(f) return } @@ -121,6 +125,7 @@ where let _2: T0; // anonymous local let _3: (u8, u8); // anonymous local + storage_live(_0) storage_live(_2) _2 = move f storage_live(_3) @@ -129,6 +134,7 @@ where storage_dead(_3) storage_dead(_2) conditional_drop[{built_in impl Destruct for T0}::drop_glue<'1>] f + storage_dead(f) return } @@ -156,6 +162,7 @@ fn call<'_0, '_1, '_2>(_1: &'_2 closure<'_0, '_1>, tupled_args: (u8, u8)) -> u8 let _12: u8; // anonymous local let _13: u8; // anonymous local + storage_live(_0) storage_live(x) storage_live(y) storage_live(_9) @@ -185,6 +192,13 @@ fn call<'_0, '_1, '_2>(_1: &'_2 closure<'_0, '_1>, tupled_args: (u8, u8)) -> u8 _0 = move _13 storage_dead(_12) storage_dead(_5) + storage_dead(_13) + storage_dead(_11) + storage_dead(_9) + storage_dead(y) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -196,9 +210,13 @@ fn call_mut<'_0, '_1, '_2>(state: &'_2 mut closure<'_0, '_1>, args: (u8, u8)) -> let args: (u8, u8); // arg #2 let _3: &'0 closure<'_0, '_1>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'_0, '_1, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -208,7 +226,9 @@ unsafe fn drop_glue<'_0, '_1, '_2>(_1: &'_2 mut closure<'_0, '_1>) let _0: (); // return let _1: &'1 mut closure<'_0, '_1>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -220,10 +240,14 @@ fn call_once<'_0, '_1>(_1: closure<'_0, '_1>, _2: (u8, u8)) -> u8 let _2: (u8, u8); // arg #2 let _3: &'1 mut closure<'_0, '_1>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'_0, '_1, '6>(move _3, move _2) drop[drop_glue<'_0, '_1, '16>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -279,6 +303,7 @@ fn main() let _15: u8; // anonymous local let _16: closure<'28, '29>; // anonymous local + storage_live(_0) _0 = () storage_live(v) v = const 5u8 diff --git a/charon/tests/ui/simple/closure-fnmut.out b/charon/tests/ui/simple/closure-fnmut.out index 2698f8dd2..73cb1e651 100644 --- a/charon/tests/ui/simple/closure-fnmut.out +++ b/charon/tests/ui/simple/closure-fnmut.out @@ -65,6 +65,7 @@ where let _2: &'1 mut T0; // anonymous local let _3: (u8,); // anonymous local + storage_live(_0) storage_live(_2) _2 = &mut f storage_live(_3) @@ -73,6 +74,7 @@ where storage_dead(_3) storage_dead(_2) conditional_drop[{built_in impl Destruct for T0}::drop_glue<'4>] f + storage_dead(f) return } @@ -93,6 +95,7 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure<'_0>, tupled_args: (u8,)) -> u8 let _6: u8; // anonymous local let _7: u8; // anonymous local + storage_live(_0) storage_live(x) storage_live(_4) storage_live(_7) @@ -107,6 +110,11 @@ fn call_mut<'_0, '_1>(_1: &'_1 mut closure<'_0>, tupled_args: (u8,)) -> u8 _0 = move _7 storage_dead(_6) storage_dead(_5) + storage_dead(_7) + storage_dead(_4) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -116,7 +124,9 @@ unsafe fn drop_glue<'_0, '_1>(_1: &'_1 mut closure<'_0>) let _0: (); // return let _1: &'1 mut closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -128,10 +138,14 @@ fn call_once<'_0>(_1: closure<'_0>, _2: (u8,)) -> u8 let _2: (u8,); // arg #2 let _3: &'1 mut closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'_0, '4>(move _3, move _2) drop[drop_glue<'_0, '10>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -165,6 +179,7 @@ fn main() let _3: closure<'1>; // anonymous local let _4: &'3 mut u8; // anonymous local + storage_live(_0) _0 = () storage_live(z) z = const 3u8 diff --git a/charon/tests/ui/simple/closure-fnonce.out b/charon/tests/ui/simple/closure-fnonce.out index fdefb933a..40a19d4a7 100644 --- a/charon/tests/ui/simple/closure-fnonce.out +++ b/charon/tests/ui/simple/closure-fnonce.out @@ -61,6 +61,7 @@ where let _2: T0; // anonymous local let _3: (u8,); // anonymous local + storage_live(_0) storage_live(_2) _2 = move f storage_live(_3) @@ -69,6 +70,7 @@ where storage_dead(_3) storage_dead(_2) conditional_drop[{built_in impl Destruct for T0}::drop_glue<'1>] f + storage_dead(f) return } @@ -81,7 +83,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut NotCopy) let _0: (); // return let _1: &'1 mut NotCopy; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -108,6 +112,7 @@ fn call_once(_1: closure, tupled_args: (u8,)) -> u8 let _6: u8; // anonymous local let _7: u8; // anonymous local + storage_live(_0) storage_live(x) storage_live(_7) x = move tupled_args.0 @@ -122,6 +127,10 @@ fn call_once(_1: closure, tupled_args: (u8,)) -> u8 _7 = copy _6 panic.+ const 1u8 _0 = move _7 storage_dead(_6) + storage_dead(_7) + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -144,6 +153,7 @@ fn main() let _2: u8; // anonymous local let _3: closure; // anonymous local + storage_live(_0) _0 = () storage_live(z) z = NotCopy { } diff --git a/charon/tests/ui/simple/closure-inside-impl.out b/charon/tests/ui/simple/closure-inside-impl.out index 9f02b4824..fddb915bc 100644 --- a/charon/tests/ui/simple/closure-inside-impl.out +++ b/charon/tests/ui/simple/closure-inside-impl.out @@ -89,6 +89,7 @@ where let _0: (); // return let _closure: closure[TraitClause0, TraitClause1]; // local + storage_live(_0) _0 = () storage_live(_closure) _closure = closure { } @@ -106,7 +107,9 @@ where let _0: (); // return let _1: &'1 mut closure[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -121,10 +124,14 @@ where let tupled_args: ((),); // arg #2 let _x: (); // local + storage_live(_0) storage_live(_x) _0 = () _x = move tupled_args.0 _0 = () + storage_dead(_x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -139,10 +146,14 @@ where let args: ((),); // arg #2 let _3: &'0 closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = call<'2, F, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -157,11 +168,15 @@ where let _2: ((),); // arg #2 let _3: &'1 mut closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'2, F, T>[TraitClause0, TraitClause1](move _3, move _2) drop[drop_glue<'4, F, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/closure-inside-inline-const.out b/charon/tests/ui/simple/closure-inside-inline-const.out index 3afa7be98..3ea3377b7 100644 --- a/charon/tests/ui/simple/closure-inside-inline-const.out +++ b/charon/tests/ui/simple/closure-inside-inline-const.out @@ -90,12 +90,16 @@ where storage_live(_1) storage_live(_2) + storage_live(_2) storage_live(_f) _f = closure { } _2 = size_of[TraitClause0]() storage_dead(_f) _1 = move _2 + storage_live(_0) _0 = move _1 + storage_dead(_2) + storage_dead(_1) return } @@ -107,7 +111,9 @@ where let _0: (); // return let _1: &'1 mut closure[TraitClause0]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -120,7 +126,10 @@ where let _1: &'1 closure[TraitClause0]; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = const 42i32 + storage_dead(tupled_args) + storage_dead(_1) return } @@ -134,9 +143,13 @@ where let args: (); // arg #2 let _3: &'0 closure[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'2, T>[TraitClause0](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -150,10 +163,14 @@ where let _2: (); // arg #2 let _3: &'1 mut closure[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'2, T>[TraitClause0](move _3, move _2) drop[drop_glue<'4, T>[TraitClause0]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out index 9276ede12..979af9b69 100644 --- a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out +++ b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out @@ -71,8 +71,10 @@ unsafe fn impl_Destruct_for_tuple::drop_glue<'_0, A>(_1: &'_0 mut (A,)) let _0: (); // return let _1: &'1 mut (A,); // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for A}::drop_glue<'2>] (*_1).0 + storage_dead(_1) return } @@ -108,11 +110,15 @@ where let tupled_args: (TraitClause0::Item,); // arg #2 let _3: TraitClause0::Item; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = move tupled_args.0 _0 = () conditional_drop[{built_in impl Destruct for TraitClause0::Item}::drop_glue<'2>] _3 + storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -133,10 +139,13 @@ where storage_live(_6) storage_live(_7) + storage_live(_7) storage_live(_8) _8 = closure { } _7 = &_8 + storage_dead(_8) _6 = move _7 + storage_live(_0) storage_live(_5) _0 = () storage_live(_2) @@ -152,6 +161,10 @@ where storage_dead(_3) storage_dead(_2) conditional_drop[{built_in impl Destruct for TraitClause0::Item}::drop_glue<'8>] i + storage_dead(_5) + storage_dead(i) + storage_dead(_7) + storage_dead(_6) return } @@ -163,7 +176,9 @@ where let _0: (); // return let _1: &'1 mut closure[TraitClause0]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -177,10 +192,14 @@ where let args: (TraitClause0::Item,); // arg #2 let _3: &'0 closure[TraitClause0]; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = call<'2, Self>[TraitClause0](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -194,11 +213,15 @@ where let _2: (TraitClause0::Item,); // arg #2 let _3: &'1 mut closure[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'2, Self>[TraitClause0](move _3, move _2) drop[impl_Destruct_for_closure::drop_glue<'4, Self>[TraitClause0]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/closure-with-drops.out b/charon/tests/ui/simple/closure-with-drops.out index bfbbd70cb..32f12402c 100644 --- a/charon/tests/ui/simple/closure-with-drops.out +++ b/charon/tests/ui/simple/closure-with-drops.out @@ -98,8 +98,10 @@ where let _0: (); // return let _1: &'1 mut test_crate::foo::closure[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () drop[TraitClause1::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -113,12 +115,14 @@ where let x: T; // arg #1 let _2: test_crate::foo::closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = test_crate::foo::closure { 0: move x } drop[{impl Destruct for test_crate::foo::closure[TraitClause0, TraitClause1]}::drop_glue<'0, T>[TraitClause0, TraitClause1]] _2 storage_dead(_2) _0 = () + storage_dead(x) return } @@ -133,11 +137,14 @@ where let tupled_args: (); // arg #2 let _3: T; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = move (_1).0 _0 = drop[TraitClause0, TraitClause1, TraitClause1](move _3) storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -177,6 +184,7 @@ fn bar() let _0: (); // return let x: test_crate::bar::closure; // local + storage_live(_0) _0 = () storage_live(x) x = test_crate::bar::closure { } @@ -191,7 +199,9 @@ unsafe fn {impl Destruct for test_crate::bar::closure}::drop_glue<'_0>(_1: &'_0 let _0: (); // return let _1: &'1 mut test_crate::bar::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -202,8 +212,11 @@ fn call<'_0>(_1: &'_0 test_crate::bar::closure, tupled_args: ()) let _1: &'1 test_crate::bar::closure; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(tupled_args) + storage_dead(_1) return } @@ -215,10 +228,14 @@ fn call_mut<'_0>(state: &'_0 mut test_crate::bar::closure, args: ()) let args: (); // arg #2 let _3: &'0 test_crate::bar::closure; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -230,11 +247,15 @@ fn {impl FnOnce<()> for test_crate::bar::closure}::call_once(_1: test_crate::bar let _2: (); // arg #2 let _3: &'1 mut test_crate::bar::closure; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'2>(move _3, move _2) drop[{impl Destruct for test_crate::bar::closure}::drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/closure-with-non-upvar-lifetime.out b/charon/tests/ui/simple/closure-with-non-upvar-lifetime.out index a24b28858..aaf615bd0 100644 --- a/charon/tests/ui/simple/closure-with-non-upvar-lifetime.out +++ b/charon/tests/ui/simple/closure-with-non-upvar-lifetime.out @@ -82,6 +82,7 @@ fn call<'_0, '_1, '_2>(_1: &'_2 closure<'_0, '_1>, tupled_args: (usize,)) -> u8 let _6: &'_ [u8]; // anonymous local let _7: &'_ u8; // anonymous local + storage_live(_0) storage_live(i) i = move tupled_args.0 storage_live(_4) @@ -95,6 +96,11 @@ fn call<'_0, '_1, '_2>(_1: &'_2 closure<'_0, '_1>, tupled_args: (usize,)) -> u8 _0 = copy (*_7) storage_dead(_5) storage_dead(_4) + storage_dead(i) + storage_dead(tupled_args) + storage_dead(_1) + storage_dead(_7) + storage_dead(_6) return } @@ -110,6 +116,7 @@ fn call_fn<'_0>(a: &'_0 [u8], i: usize) -> u8 let _6: (usize,); // anonymous local let _7: usize; // anonymous local + storage_live(_0) storage_live(read) storage_live(_4) _4 = &a @@ -126,6 +133,8 @@ fn call_fn<'_0>(a: &'_0 [u8], i: usize) -> u8 storage_dead(_6) storage_dead(_5) storage_dead(read) + storage_dead(i) + storage_dead(a) return } @@ -135,7 +144,9 @@ unsafe fn drop_glue<'_0, '_1, '_2>(_1: &'_2 mut closure<'_0, '_1>) let _0: (); // return let _1: &'1 mut closure<'_0, '_1>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -147,9 +158,13 @@ fn call_mut<'_0, '_1, '_2>(state: &'_2 mut closure<'_0, '_1>, args: (usize,)) -> let args: (usize,); // arg #2 let _3: &'0 closure<'_0, '_1>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'_0, '_1, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -161,10 +176,14 @@ fn call_once<'_0, '_1>(_1: closure<'_0, '_1>, _2: (usize,)) -> u8 let _2: (usize,); // arg #2 let _3: &'1 mut closure<'_0, '_1>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'_0, '_1, '6>(move _3, move _2) drop[drop_glue<'_0, '_1, '16>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/closure-with-remove-adt-clauses.out b/charon/tests/ui/simple/closure-with-remove-adt-clauses.out index d440cd74d..f0190cc10 100644 --- a/charon/tests/ui/simple/closure-with-remove-adt-clauses.out +++ b/charon/tests/ui/simple/closure-with-remove-adt-clauses.out @@ -97,6 +97,7 @@ where let _c: test_crate::f::closure<'3, T>; // local let _3: &'4 T; // anonymous local + storage_live(_0) _0 = () storage_live(_c) storage_live(_3) @@ -105,6 +106,7 @@ where storage_dead(_3) _0 = () storage_dead(_c) + storage_dead(x) return } @@ -117,7 +119,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::f::closure<'_0, T>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -131,7 +135,10 @@ where let _1: &'1 test_crate::f::closure<'_0, T>; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = copy (*((*_1)).0) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -146,9 +153,13 @@ where let args: (); // arg #2 let _3: &'0 test_crate::f::closure<'_0, T>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(), T> for test_crate::f::closure<'_0, T>}::call<'_0, '2, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -163,10 +174,14 @@ where let _2: (); // arg #2 let _3: &'1 mut test_crate::f::closure<'_0, T>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(), T> for test_crate::f::closure<'_0, T>}::call_mut<'_0, '4, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::f::closure<'_0, T>}::drop_glue<'_0, '10, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -237,6 +252,7 @@ where let _c: test_crate::g::closure<'1, T>; // local let _3: &'3 T; // anonymous local + storage_live(_0) _0 = () storage_live(_c) storage_live(_3) @@ -245,6 +261,7 @@ where storage_dead(_3) _0 = () storage_dead(_c) + storage_dead(x) return } @@ -257,7 +274,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::g::closure<'_0, T>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -271,7 +290,10 @@ where let _1: &'1 test_crate::g::closure<'_0, T>; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = copy (*((*_1)).0) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -286,9 +308,13 @@ where let args: (); // arg #2 let _3: &'0 test_crate::g::closure<'_0, T>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(), T> for test_crate::g::closure<'_0, T>}::call<'_0, '2, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -303,10 +329,14 @@ where let _2: (); // arg #2 let _3: &'1 mut test_crate::g::closure<'_0, T>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(), T> for test_crate::g::closure<'_0, T>}::call_mut<'_0, '4, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::g::closure<'_0, T>}::drop_glue<'_0, '10, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/comma-delimited-start-from.out b/charon/tests/ui/simple/comma-delimited-start-from.out index 899c64597..dacc2e2ac 100644 --- a/charon/tests/ui/simple/comma-delimited-start-from.out +++ b/charon/tests/ui/simple/comma-delimited-start-from.out @@ -5,6 +5,7 @@ fn a() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -15,6 +16,7 @@ fn b() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/conditional-drop.out b/charon/tests/ui/simple/conditional-drop.out index 4b0600afe..2c133a8ee 100644 --- a/charon/tests/ui/simple/conditional-drop.out +++ b/charon/tests/ui/simple/conditional-drop.out @@ -49,9 +49,11 @@ fn use_box(_1: alloc::boxed::Box[{built_in impl MetaSized for u32}, {built_ let _0: (); // return let _1: alloc::boxed::Box[{built_in impl MetaSized for u32}, {built_in impl Sized for Global}, {built_in impl Destruct for u32}, impl_Destruct_for_Global]; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_Box::drop_glue<'0, u32, Global>[{built_in impl MetaSized for u32}, {built_in impl Sized for Global}, {built_in impl Destruct for u32}, impl_Destruct_for_Global]] _1 + storage_dead(_1) return } @@ -65,6 +67,7 @@ fn main() let _4: alloc::boxed::Box[{built_in impl MetaSized for u32}, {built_in impl Sized for Global}, {built_in impl Destruct for u32}, impl_Destruct_for_Global]; // anonymous local let _5: bool; // anonymous local + storage_live(_0) storage_live(_5) _0 = () _5 = const false @@ -93,6 +96,7 @@ fn main() } _5 = const false storage_dead(b) + storage_dead(_5) return } diff --git a/charon/tests/ui/simple/const-subslice.out b/charon/tests/ui/simple/const-subslice.out index b92e0578b..1ca14e30b 100644 --- a/charon/tests/ui/simple/const-subslice.out +++ b/charon/tests/ui/simple/const-subslice.out @@ -13,6 +13,7 @@ fn main() let _7: &'_ [u8; 3usize]; // anonymous local let _8: &'2 [u8]; // anonymous local + storage_live(_0) _0 = () storage_live(y) storage_live(_6) @@ -36,6 +37,9 @@ fn main() _0 = () storage_dead(z) storage_dead(y) + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) return } diff --git a/charon/tests/ui/simple/const_pat_value.out b/charon/tests/ui/simple/const_pat_value.out index 3225547e0..0dc3505ac 100644 --- a/charon/tests/ui/simple/const_pat_value.out +++ b/charon/tests/ui/simple/const_pat_value.out @@ -8,6 +8,7 @@ fn ONE() -> i32 is 1i32..=2147483647i32 { let _0: i32 is 1i32..=2147483647i32; // return + storage_live(_0) _0 = const 1i32 return } diff --git a/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.2.out b/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.2.out index d96a6d99e..db2b7158c 100644 --- a/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.2.out +++ b/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.2.out @@ -22,6 +22,7 @@ where { let _0: TraitClause1::Assoc; // return + storage_live(_0) panic(core::panicking::panic) } @@ -36,6 +37,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out b/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out index 8cf8a5f2b..a88e62c99 100644 --- a/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out +++ b/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out @@ -21,6 +21,7 @@ where { let _0: TraitClause1::Assoc; // return + storage_live(_0) panic(core::panicking::panic) } @@ -31,6 +32,7 @@ where { let _0: TraitClause0::Assoc; // return + storage_live(_0) panic(core::panicking::panic) } @@ -45,6 +47,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/defaulted-rpitit.2.out b/charon/tests/ui/simple/defaulted-rpitit.2.out index b02c5aead..79e8369e9 100644 --- a/charon/tests/ui/simple/defaulted-rpitit.2.out +++ b/charon/tests/ui/simple/defaulted-rpitit.2.out @@ -31,6 +31,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -46,6 +47,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/defaulted-rpitit.3.out b/charon/tests/ui/simple/defaulted-rpitit.3.out index 88c179c4b..ffeb67c4a 100644 --- a/charon/tests/ui/simple/defaulted-rpitit.3.out +++ b/charon/tests/ui/simple/defaulted-rpitit.3.out @@ -66,7 +66,9 @@ where let _0: Empty[TraitClause0::ImpliedClause1]; // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = empty[TraitClause0::ImpliedClause1]() + storage_dead(self) return } @@ -78,7 +80,9 @@ where let _0: Empty[impl_MyTrait_for_unit[TraitClause0]::ImpliedClause1]; // return let self: &'1 (); // arg #1 + storage_live(_0) _0 = empty[impl_MyTrait_for_unit[TraitClause0]::ImpliedClause1]() + storage_dead(self) return } diff --git a/charon/tests/ui/simple/defaulted-rpitit.out b/charon/tests/ui/simple/defaulted-rpitit.out index 793d2b866..87809a149 100644 --- a/charon/tests/ui/simple/defaulted-rpitit.out +++ b/charon/tests/ui/simple/defaulted-rpitit.out @@ -29,6 +29,7 @@ where { let _0: [u8; N]; // return + storage_live(_0) _0 = @ArrayRepeat(const 0u8) return } @@ -41,6 +42,7 @@ pub fn impl_Foo_for_S::bar() -> [u8; N] { let _0: [u8; N]; // return + storage_live(_0) _0 = @ArrayRepeat(const 0u8) return } diff --git a/charon/tests/ui/simple/double-promotion.out b/charon/tests/ui/simple/double-promotion.out index 07a199958..3a011f1f6 100644 --- a/charon/tests/ui/simple/double-promotion.out +++ b/charon/tests/ui/simple/double-promotion.out @@ -36,6 +36,7 @@ fn main() storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) storage_live(_6) storage_live(_7) @@ -45,7 +46,12 @@ fn main() _6 = &(*_7) _5 = Ref { 0: move _6 } _4 = &_5 + storage_dead(_8) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -53,6 +59,9 @@ fn main() _1 = &(*_2) storage_dead(_1) _0 = () + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/drop-cow.out b/charon/tests/ui/simple/drop-cow.out index 62d4277ab..fe24952c9 100644 --- a/charon/tests/ui/simple/drop-cow.out +++ b/charon/tests/ui/simple/drop-cow.out @@ -71,15 +71,18 @@ where let _0: (); // return let _1: &'1 mut Cow<'a, B>[TraitClause0, TraitClause1, TraitClause2]; // arg #1 + storage_live(_0) _0 = () match (*_1) { Cow::Borrowed => { }, _ => { drop[TraitClause1::ImpliedClause4::drop_glue<'2>] ((*_1) as variant Cow::Owned).0 + storage_dead(_1) return }, } + storage_dead(_1) return } @@ -107,9 +110,11 @@ where let _0: (); // return let _1: Cow<'1, B>[TraitClause0, TraitClause1, TraitClause2]; // arg #1 + storage_live(_0) _0 = () _0 = () drop[drop_glue<'4, '5, B>[TraitClause0, TraitClause1, TraitClause2]] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/drop-glue-with-const-generic-silenced.out b/charon/tests/ui/simple/drop-glue-with-const-generic-silenced.out index abee2beeb..0fa9ca151 100644 --- a/charon/tests/ui/simple/drop-glue-with-const-generic-silenced.out +++ b/charon/tests/ui/simple/drop-glue-with-const-generic-silenced.out @@ -59,9 +59,11 @@ fn foo(_1: PortableHash<42usize>) let _0: (); // return let _1: PortableHash<42usize>; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_PortableHash::drop_glue<'0, 42usize>] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/drop-glue-with-const-generic.out b/charon/tests/ui/simple/drop-glue-with-const-generic.out index de52ba9ea..87d86d33b 100644 --- a/charon/tests/ui/simple/drop-glue-with-const-generic.out +++ b/charon/tests/ui/simple/drop-glue-with-const-generic.out @@ -58,8 +58,10 @@ unsafe fn impl_Destruct_for_PortableHash::drop_glue<'_0, const K : usize>(_1: &' let _0: (); // return let _1: &'1 mut PortableHash; // arg #1 + storage_live(_0) _0 = () drop[impl_Destruct_for_Box::drop_glue<'2, u32, Global>[{built_in impl MetaSized for u32}, {built_in impl Sized for Global}, {built_in impl Destruct for u32}, impl_Destruct_for_Global]] ((*_1)).make_non_trivial + storage_dead(_1) return } @@ -75,9 +77,11 @@ fn foo(_1: PortableHash<42usize>) let _0: (); // return let _1: PortableHash<42usize>; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_PortableHash::drop_glue<'0, 42usize>] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/drop-string-desugar.out b/charon/tests/ui/simple/drop-string-desugar.out index 0e5d432c9..17af8562e 100644 --- a/charon/tests/ui/simple/drop-string-desugar.out +++ b/charon/tests/ui/simple/drop-string-desugar.out @@ -66,11 +66,15 @@ unsafe fn impl_Destruct_for_String::drop_glue<'_0>(_1: &'_0 mut String) let drop_arg: &'_ mut Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}, {built_in impl Destruct for u8}, impl_Destruct_for_Global]; // local let drop_ret: (); // local + storage_live(_0) _0 = () storage_live(drop_arg) drop_arg = &mut ((*_1)).vec storage_live(drop_ret) drop_ret = impl_Destruct_for_Vec::drop_glue<'2, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}, {built_in impl Destruct for u8}, impl_Destruct_for_Global](move drop_arg) + storage_dead(_1) + storage_dead(drop_ret) + storage_dead(drop_arg) return } @@ -87,12 +91,16 @@ fn use_string(_1: String) let drop_arg: &'_ mut String; // local let drop_ret: (); // local + storage_live(_0) _0 = () _0 = () storage_live(drop_arg) drop_arg = &mut _1 storage_live(drop_ret) drop_ret = impl_Destruct_for_String::drop_glue<'0>(move drop_arg) + storage_dead(_1) + storage_dead(drop_ret) + storage_dead(drop_arg) return } @@ -104,6 +112,7 @@ fn main() let drop_arg: &'_ mut String; // local let drop_ret: (); // local + storage_live(_0) _0 = () storage_live(_s) _s = new() @@ -113,6 +122,8 @@ fn main() storage_live(drop_ret) drop_ret = impl_Destruct_for_String::drop_glue<'0>(move drop_arg) storage_dead(_s) + storage_dead(drop_ret) + storage_dead(drop_arg) return } diff --git a/charon/tests/ui/simple/drop-string.out b/charon/tests/ui/simple/drop-string.out index 8b3e3a5d1..91ee79852 100644 --- a/charon/tests/ui/simple/drop-string.out +++ b/charon/tests/ui/simple/drop-string.out @@ -64,8 +64,10 @@ unsafe fn impl_Destruct_for_String::drop_glue<'_0>(_1: &'_0 mut String) let _0: (); // return let _1: &'1 mut String; // arg #1 + storage_live(_0) _0 = () drop[impl_Destruct_for_Vec::drop_glue<'2, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}, {built_in impl Destruct for u8}, impl_Destruct_for_Global]] ((*_1)).vec + storage_dead(_1) return } @@ -80,9 +82,11 @@ fn use_string(_1: String) let _0: (); // return let _1: String; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_String::drop_glue<'0>] _1 + storage_dead(_1) return } @@ -93,6 +97,7 @@ fn main() let s: String; // local let _2: String; // anonymous local + storage_live(_0) _0 = () storage_live(s) s = new() diff --git a/charon/tests/ui/simple/dyn-broken-assoc-type-constraint.out b/charon/tests/ui/simple/dyn-broken-assoc-type-constraint.out index 46c4eb1a2..e2d25e770 100644 --- a/charon/tests/ui/simple/dyn-broken-assoc-type-constraint.out +++ b/charon/tests/ui/simple/dyn-broken-assoc-type-constraint.out @@ -62,8 +62,10 @@ where let _0: (); // return let self: &'1 T; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -77,10 +79,13 @@ where let _1: &'_0 (dyn Broken + '0); // arg #1 let _2: &'_0 T; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Broken + '1), &'_0 T>(move _1) _0 = broken<'_0, T>[TraitClause0, TraitClause1](move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -93,10 +98,13 @@ where let dyn_self: &'_0 mut (dyn Broken + '0); // arg #1 let target_self: &'_0 mut T; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Broken + '1), &'_0 mut T>(move dyn_self) drop[{built_in impl Destruct for T}::drop_glue<'3>] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -111,6 +119,7 @@ where let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Broken + '1)); // anonymous local let _4: fn<'_0_1>(&'_0_1 (dyn Broken + '3)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -120,6 +129,10 @@ where storage_live(_4) _4 = cast {vtable_method}<'2, T>[TraitClause0, impl_Foo_for_unit], fn<'_0_1>(&'_0_1 (dyn Broken + '3))>(const {vtable_method}<'2, T>[TraitClause0, impl_Foo_for_unit]) ret = test_crate::Broken::{vtable} { size: move size, align: move align, drop: move _3, method_broken: move _4, super_trait_0: const &vtable_of(TraitClause0::ImpliedClause0) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -155,10 +168,13 @@ fn main() storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = () _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_m) @@ -172,6 +188,9 @@ fn main() storage_dead(_3) _0 = () storage_dead(_m) + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } diff --git a/charon/tests/ui/simple/dyn-cast-to-supertrait.out b/charon/tests/ui/simple/dyn-cast-to-supertrait.out index 767700c52..48bad0d32 100644 --- a/charon/tests/ui/simple/dyn-cast-to-supertrait.out +++ b/charon/tests/ui/simple/dyn-cast-to-supertrait.out @@ -75,7 +75,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut HouseCat) let _0: (); // return let _1: &'1 mut HouseCat; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -91,8 +93,10 @@ fn hunt<'_0>(self: &'_0 HouseCat) let _0: (); // return let self: &'1 HouseCat; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -103,10 +107,13 @@ fn impl_Feline_for_HouseCat::hunt::{vtable_method}<'_0>(_1: &'_0 (dyn Feline)) let _1: &'_0 (dyn Feline + '0); // arg #1 let _2: &'_0 HouseCat; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Feline + '1), &'_0 HouseCat>(move _1) _0 = hunt<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -117,10 +124,13 @@ unsafe fn impl_Feline_for_HouseCat::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut ( let dyn_self: &'_0 mut (dyn Feline + '0); // arg #1 let target_self: &'_0 mut HouseCat; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Feline + '1), &'_0 mut HouseCat>(move dyn_self) drop[drop_glue<'3>] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -133,6 +143,7 @@ fn impl_Feline_for_HouseCat::{vtable}() -> test_crate::Feline::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Feline + '1)); // anonymous local let _4: fn<'_0_1>(&'_0_1 (dyn Feline + '3)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -142,6 +153,10 @@ fn impl_Feline_for_HouseCat::{vtable}() -> test_crate::Feline::{vtable} storage_live(_4) _4 = cast impl_Feline_for_HouseCat::hunt::{vtable_method}<'2>, fn<'_0_1>(&'_0_1 (dyn Feline + '3))>(const impl_Feline_for_HouseCat::hunt::{vtable_method}<'2>) ret = test_crate::Feline::{vtable} { size: move size, align: move align, drop: move _3, method_hunt: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for HouseCat}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -161,8 +176,10 @@ fn pet<'_0>(self: &'_0 HouseCat) let _0: (); // return let self: &'1 HouseCat; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -173,10 +190,13 @@ fn impl_Pettable_for_HouseCat::pet::{vtable_method}<'_0>(_1: &'_0 (dyn Pettable) let _1: &'_0 (dyn Pettable + '0); // arg #1 let _2: &'_0 HouseCat; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Pettable + '1), &'_0 HouseCat>(move _1) _0 = pet<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -187,10 +207,13 @@ unsafe fn impl_Pettable_for_HouseCat::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut let dyn_self: &'_0 mut (dyn Pettable + '0); // arg #1 let target_self: &'_0 mut HouseCat; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Pettable + '1), &'_0 mut HouseCat>(move dyn_self) drop[drop_glue<'3>] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -203,6 +226,7 @@ fn impl_Pettable_for_HouseCat::{vtable}() -> test_crate::Pettable::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Pettable + '1)); // anonymous local let _4: fn<'_0_1>(&'_0_1 (dyn Pettable + '3)); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -212,6 +236,10 @@ fn impl_Pettable_for_HouseCat::{vtable}() -> test_crate::Pettable::{vtable} storage_live(_4) _4 = cast impl_Pettable_for_HouseCat::pet::{vtable_method}<'2>, fn<'_0_1>(&'_0_1 (dyn Pettable + '3))>(const impl_Pettable_for_HouseCat::pet::{vtable_method}<'2>) ret = test_crate::Pettable::{vtable} { size: move size, align: move align, drop: move _3, method_pet: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for HouseCat}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -231,8 +259,10 @@ fn meow<'_0>(self: &'_0 HouseCat) let _0: (); // return let self: &'1 HouseCat; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -243,10 +273,13 @@ fn impl_Cat_for_HouseCat::meow::{vtable_method}<'_0>(_1: &'_0 (dyn Cat)) let _1: &'_0 (dyn Cat + '0); // arg #1 let _2: &'_0 HouseCat; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = concretize<&'_0 (dyn Cat + '1), &'_0 HouseCat>(move _1) _0 = meow<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -257,10 +290,13 @@ unsafe fn impl_Cat_for_HouseCat::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dyn let dyn_self: &'_0 mut (dyn Cat + '0); // arg #1 let target_self: &'_0 mut HouseCat; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Cat + '1), &'_0 mut HouseCat>(move dyn_self) drop[drop_glue<'3>] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -275,6 +311,7 @@ fn impl_Cat_for_HouseCat::{vtable}() -> test_crate::Cat::{vtable} let _5: &'static test_crate::Feline::{vtable}; // anonymous local let _6: &'static test_crate::Pettable::{vtable}; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -288,6 +325,12 @@ fn impl_Cat_for_HouseCat::{vtable}() -> test_crate::Cat::{vtable} storage_live(_6) _6 = &impl_Pettable_for_HouseCat::{vtable} ret = test_crate::Cat::{vtable} { size: move size, align: move align, drop: move _3, method_meow: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for HouseCat}), super_trait_1: move _5, super_trait_2: move _6 } + storage_dead(align) + storage_dead(size) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) return } @@ -316,6 +359,7 @@ fn main() let dyn_pettable: &'18 (dyn Pettable + '19); // local let _8: &'20 (dyn Cat + '21); // anonymous local + storage_live(_0) _0 = () storage_live(cat) cat = HouseCat { } diff --git a/charon/tests/ui/simple/dyn-fn.out b/charon/tests/ui/simple/dyn-fn.out index fbf794daa..b08051cfe 100644 --- a/charon/tests/ui/simple/dyn-fn.out +++ b/charon/tests/ui/simple/dyn-fn.out @@ -90,6 +90,7 @@ fn takes_fn<'_0>(f: &'_0 (dyn for<'a> Fn<(&'a mut u32,), ImpliedClause1::Implied let _6: &'16 mut u32; // anonymous local let _7: &'17 mut u32; // anonymous local + storage_live(_0) _0 = () storage_live(counter) counter = const 0u32 @@ -112,6 +113,7 @@ fn takes_fn<'_0>(f: &'_0 (dyn for<'a> Fn<(&'a mut u32,), ImpliedClause1::Implied _0 = () storage_dead(_3) storage_dead(counter) + storage_dead(f) return } storage_dead(_7) @@ -121,6 +123,7 @@ fn takes_fn<'_0>(f: &'_0 (dyn for<'a> Fn<(&'a mut u32,), ImpliedClause1::Implied _0 = () storage_dead(_3) storage_dead(counter) + storage_dead(f) return } @@ -136,12 +139,17 @@ fn call<'_0, '_1>(_1: &'_1 closure, tupled_args: (&'_0 mut u32,)) -> bool let counter: &'2 mut u32; // local let _4: u32; // anonymous local + storage_live(_0) storage_live(counter) storage_live(_4) counter = move tupled_args.0 _4 = copy (*counter) panic.+ const 1u32 (*counter) = move _4 _0 = const true + storage_dead(_4) + storage_dead(counter) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -153,9 +161,13 @@ fn call_mut<'_0, '_1>(state: &'_1 mut closure, args: (&'_0 mut u32,)) -> bool let args: (&'_0 mut u32,); // arg #2 let _3: &'0 closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'_0, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -165,7 +177,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -177,10 +191,14 @@ fn call_once<'_0>(_1: closure, _2: (&'_0 mut u32,)) -> bool let _2: (&'0 mut u32,); // arg #2 let _3: &'2 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'_0, '7>(move _3, move _2) drop[drop_glue<'9>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -229,10 +247,13 @@ fn gives_fn() storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = closure { } _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_1) @@ -246,6 +267,9 @@ fn gives_fn() _0 = takes_fn<'24>(move _1) storage_dead(_1) storage_dead(_3) + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } diff --git a/charon/tests/ui/simple/dyn-method-with-early-bound-lifetimes.out b/charon/tests/ui/simple/dyn-method-with-early-bound-lifetimes.out index f8d5df5b2..5659c4c84 100644 --- a/charon/tests/ui/simple/dyn-method-with-early-bound-lifetimes.out +++ b/charon/tests/ui/simple/dyn-method-with-early-bound-lifetimes.out @@ -28,8 +28,10 @@ fn foo<'_0>(x: &'_0 (dyn Trait + '_0)) let _0: (); // return let x: &'3 (dyn Trait + '4); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(x) return } diff --git a/charon/tests/ui/simple/explicit_destruct_bound.out b/charon/tests/ui/simple/explicit_destruct_bound.out index 186a41d43..7204fff45 100644 --- a/charon/tests/ui/simple/explicit_destruct_bound.out +++ b/charon/tests/ui/simple/explicit_destruct_bound.out @@ -16,9 +16,11 @@ where let _0: (); // return let _1: T; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[TraitClause0::drop_glue<'0>] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/extern-same-name-across-modules.out b/charon/tests/ui/simple/extern-same-name-across-modules.out index c002012ac..7ecade329 100644 --- a/charon/tests/ui/simple/extern-same-name-across-modules.out +++ b/charon/tests/ui/simple/extern-same-name-across-modules.out @@ -8,6 +8,7 @@ unsafe fn call_root() -> i32 { let _0: i32; // return + storage_live(_0) _0 = test_crate::same_name(const 0i32) return } @@ -19,6 +20,7 @@ pub unsafe fn test_crate::first::call() -> i32 { let _0: i32; // return + storage_live(_0) _0 = test_crate::first::same_name(const 1i32) return } @@ -30,6 +32,7 @@ pub unsafe fn test_crate::second::nested::call() -> i32 { let _0: i32; // return + storage_live(_0) _0 = test_crate::second::nested::same_name(const 2i32) return } @@ -39,7 +42,9 @@ pub fn test_crate::local_impl::same_name(x: i32) -> i32 let _0: i32; // return let x: i32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -47,6 +52,7 @@ pub fn test_crate::local_impl::call() -> i32 { let _0: i32; // return + storage_live(_0) _0 = test_crate::local_impl::same_name(const 3i32) return } diff --git a/charon/tests/ui/simple/fewer-clauses-in-method-impl.2.out b/charon/tests/ui/simple/fewer-clauses-in-method-impl.2.out index 9c90d29e6..1f60eba8c 100644 --- a/charon/tests/ui/simple/fewer-clauses-in-method-impl.2.out +++ b/charon/tests/ui/simple/fewer-clauses-in-method-impl.2.out @@ -25,6 +25,7 @@ fn method() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -42,6 +43,7 @@ pub fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = method() return diff --git a/charon/tests/ui/simple/fewer-clauses-in-method-impl.out b/charon/tests/ui/simple/fewer-clauses-in-method-impl.out index c12a066d7..824780a2e 100644 --- a/charon/tests/ui/simple/fewer-clauses-in-method-impl.out +++ b/charon/tests/ui/simple/fewer-clauses-in-method-impl.out @@ -46,6 +46,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -63,6 +64,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = method<()>[{built_in impl Sized for ()}, {built_in impl Clone for ()}]() return diff --git a/charon/tests/ui/simple/fn-ptr.out b/charon/tests/ui/simple/fn-ptr.out index ef4b0ecc9..37e1c8823 100644 --- a/charon/tests/ui/simple/fn-ptr.out +++ b/charon/tests/ui/simple/fn-ptr.out @@ -5,6 +5,7 @@ fn foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -18,6 +19,7 @@ fn main() let _2: (); // anonymous local let _3: fn(); // anonymous local + storage_live(_0) _0 = () storage_live(f) f = cast(const foo) diff --git a/charon/tests/ui/simple/fn_ptr_trait.out b/charon/tests/ui/simple/fn_ptr_trait.out index 34d509ec2..943b448cb 100644 --- a/charon/tests/ui/simple/fn_ptr_trait.out +++ b/charon/tests/ui/simple/fn_ptr_trait.out @@ -49,6 +49,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -60,6 +61,7 @@ fn main() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = requires_fn_ptr[{built_in impl Sized for fn()}, {built_in impl FnPtr for fn()}]() diff --git a/charon/tests/ui/simple/foreign-inline-const.out b/charon/tests/ui/simple/foreign-inline-const.out index 960d4c7d4..ccf2d2864 100644 --- a/charon/tests/ui/simple/foreign-inline-const.out +++ b/charon/tests/ui/simple/foreign-inline-const.out @@ -37,12 +37,16 @@ where storage_live(_1) storage_live(_2) + storage_live(_2) storage_live(_f) _f = closure { } _2 = size_of[TraitClause0]() storage_dead(_f) _1 = move _2 + storage_live(_0) _0 = move _1 + storage_dead(_2) + storage_dead(_1) return } @@ -54,6 +58,7 @@ where let _0: (); // return let _1: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = foo[TraitClause0]() diff --git a/charon/tests/ui/simple/gat-complex-lifetimes.out b/charon/tests/ui/simple/gat-complex-lifetimes.out index d891a1f2f..7d68fd96e 100644 --- a/charon/tests/ui/simple/gat-complex-lifetimes.out +++ b/charon/tests/ui/simple/gat-complex-lifetimes.out @@ -51,6 +51,7 @@ where let _2: &'13 &'14 &'15 (); // anonymous local let _3: TraitClause1::Type<'17>; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = move x @@ -59,6 +60,7 @@ where storage_dead(_3) storage_dead(_2) conditional_drop[{built_in impl Destruct for TraitClause1::Type<'42>}::drop_glue<'43>] x + storage_dead(x) return } diff --git a/charon/tests/ui/simple/gat-default.out b/charon/tests/ui/simple/gat-default.out index 22f7f15df..8fa75f358 100644 --- a/charon/tests/ui/simple/gat-default.out +++ b/charon/tests/ui/simple/gat-default.out @@ -49,6 +49,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/gat-implied-clause.out b/charon/tests/ui/simple/gat-implied-clause.out index bb7826cd5..101584e10 100644 --- a/charon/tests/ui/simple/gat-implied-clause.out +++ b/charon/tests/ui/simple/gat-implied-clause.out @@ -56,6 +56,7 @@ where let _2: TraitClause1::LifetimeGat<'2>; // anonymous local let _3: &'5 TraitClause1::LifetimeGat<'6>; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -66,6 +67,7 @@ where storage_dead(_2) _0 = () conditional_drop[{built_in impl Destruct for TraitClause1::LifetimeGat<'17>}::drop_glue<'18>] x + storage_dead(x) return } @@ -80,6 +82,7 @@ where let _2: TraitClause1::NonLifetimeGat[{built_in impl Sized for u8}]; // anonymous local let _3: &'1 TraitClause1::NonLifetimeGat[{built_in impl Sized for u8}]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -90,6 +93,7 @@ where storage_dead(_2) _0 = () conditional_drop[{built_in impl Destruct for TraitClause1::NonLifetimeGat[{built_in impl Sized for u8}]}::drop_glue<'5>] x + storage_dead(x) return } diff --git a/charon/tests/ui/simple/generic-cast-to-dyn.out b/charon/tests/ui/simple/generic-cast-to-dyn.out index ab66afca1..4a94eec1f 100644 --- a/charon/tests/ui/simple/generic-cast-to-dyn.out +++ b/charon/tests/ui/simple/generic-cast-to-dyn.out @@ -41,6 +41,7 @@ where let _3: &'9 (dyn Any + '10); // anonymous local let _4: &'11 T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -51,6 +52,7 @@ where _0 = unsize_cast<&'7 (dyn Any + '8), &'15 (dyn Any + '16), at []>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/simple/generic-discriminant.out b/charon/tests/ui/simple/generic-discriminant.out index 0980640b3..adcb323d5 100644 --- a/charon/tests/ui/simple/generic-discriminant.out +++ b/charon/tests/ui/simple/generic-discriminant.out @@ -110,6 +110,7 @@ where let _2: {built_in impl DiscriminantKind for T}::Discriminant; // anonymous local let _3: &'2 T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &(*v) @@ -117,6 +118,7 @@ where storage_dead(_3) _0 = Discriminant { 0: move _2 } storage_dead(_2) + storage_dead(v) return } @@ -129,10 +131,12 @@ where let x: &'1 T; // arg #1 let _2: &'2 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = discriminant<'4, T>[TraitClause0](move _2) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/simple/generic-impl-with-defaulted-method.out b/charon/tests/ui/simple/generic-impl-with-defaulted-method.out index 5b8fa02b4..9a6d01e37 100644 --- a/charon/tests/ui/simple/generic-impl-with-defaulted-method.out +++ b/charon/tests/ui/simple/generic-impl-with-defaulted-method.out @@ -37,8 +37,10 @@ where let _0: (); // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -50,8 +52,10 @@ where let _0: (); // return let self: &'1 Option[TraitClause0]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/simple/generic-impl-with-method.out b/charon/tests/ui/simple/generic-impl-with-method.out index cca90e8a8..4c04bb2b1 100644 --- a/charon/tests/ui/simple/generic-impl-with-method.out +++ b/charon/tests/ui/simple/generic-impl-with-method.out @@ -28,8 +28,10 @@ where let _0: (); // return let self: &'1 T; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/simple/generic-offset-of.out b/charon/tests/ui/simple/generic-offset-of.out index 82a3518cf..36136dd4f 100644 --- a/charon/tests/ui/simple/generic-offset-of.out +++ b/charon/tests/ui/simple/generic-offset-of.out @@ -44,6 +44,7 @@ where storage_live(_2) storage_live(_3) + storage_live(_3) storage_live(_6) storage_live(_4) _4 = offset_of(A[TraitClause0].x) @@ -53,12 +54,16 @@ where _3 = move _6 storage_dead(_5) storage_dead(_4) + storage_dead(_6) _2 = move _3 + storage_live(_0) _0 = () storage_live(_1) _1 = move _2 storage_dead(_1) _0 = () + storage_dead(_3) + storage_dead(_2) return } diff --git a/charon/tests/ui/simple/hello-world.out b/charon/tests/ui/simple/hello-world.out index 6d8c5a279..03dc26678 100644 --- a/charon/tests/ui/simple/hello-world.out +++ b/charon/tests/ui/simple/hello-world.out @@ -20,6 +20,7 @@ fn main() let _2: &'1 str; // anonymous local let _3: &'2 str; // anonymous local + storage_live(_0) _0 = () storage_live(a) storage_live(_2) diff --git a/charon/tests/ui/simple/hide-drops.out b/charon/tests/ui/simple/hide-drops.out index 3020bd29b..c5159b41b 100644 --- a/charon/tests/ui/simple/hide-drops.out +++ b/charon/tests/ui/simple/hide-drops.out @@ -19,9 +19,11 @@ fn use_string(_1: String) let _0: (); // return let _1: String; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[drop_glue<'0>] _1 + storage_dead(_1) return } @@ -31,6 +33,7 @@ fn main() let _0: (); // return let _s: String; // local + storage_live(_0) _0 = () storage_live(_s) _s = new() diff --git a/charon/tests/ui/simple/impl-trait-in-arg.out b/charon/tests/ui/simple/impl-trait-in-arg.out index 8d7bbb70a..09eacf11b 100644 --- a/charon/tests/ui/simple/impl-trait-in-arg.out +++ b/charon/tests/ui/simple/impl-trait-in-arg.out @@ -36,9 +36,11 @@ where let _0: (); // return let _1: T0; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for T0}::drop_glue<'0>] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/inline-asm.out b/charon/tests/ui/simple/inline-asm.out index c2635cac4..5542a2c47 100644 --- a/charon/tests/ui/simple/inline-asm.out +++ b/charon/tests/ui/simple/inline-asm.out @@ -5,6 +5,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () asm!("nop") _0 = () @@ -17,14 +18,17 @@ fn multiple_targets(x: u32) -> u32 let _0: u32; // return let x: u32; // arg #1 + storage_live(_0) asm!("jmp {0}") { target 0 => { _0 = copy x + storage_dead(x) return } target 1 => { x = const 1u32 _0 = copy x + storage_dead(x) return } } diff --git a/charon/tests/ui/simple/intrinsic-same-name-across-modules.out b/charon/tests/ui/simple/intrinsic-same-name-across-modules.out index 0f8bbd033..8d15b8079 100644 --- a/charon/tests/ui/simple/intrinsic-same-name-across-modules.out +++ b/charon/tests/ui/simple/intrinsic-same-name-across-modules.out @@ -64,6 +64,7 @@ pub fn test_crate::first::nested::call() -> u8 { let _0: u8; // return + storage_live(_0) _0 = test_crate::first::nested::wrapping_add[{built_in impl Sized for u8}, impl_Copy_for_u8](const 1u8, const 2u8) return } @@ -72,6 +73,7 @@ fn test_crate::call() -> u8 { let _0: u8; // return + storage_live(_0) _0 = core::intrinsics::wrapping_add[{built_in impl Sized for u8}, impl_Copy_for_u8](const 3u8, const 4u8) return } diff --git a/charon/tests/ui/simple/issue-1040-closure-upvar-lifetime.out b/charon/tests/ui/simple/issue-1040-closure-upvar-lifetime.out index 0968099a2..4a476e372 100644 --- a/charon/tests/ui/simple/issue-1040-closure-upvar-lifetime.out +++ b/charon/tests/ui/simple/issue-1040-closure-upvar-lifetime.out @@ -78,6 +78,7 @@ pub fn foo<'_0>(s: &'_0 u8) let _2: closure<'3>; // anonymous local let _3: &'4 u8; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -86,6 +87,7 @@ pub fn foo<'_0>(s: &'_0 u8) storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(s) return } @@ -95,7 +97,9 @@ unsafe fn drop_glue<'_0, '_1>(_1: &'_1 mut closure<'_0>) let _0: (); // return let _1: &'1 mut closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -106,7 +110,10 @@ fn call<'_0, '_1, '_2>(_1: &'_2 closure<'_0>, tupled_args: ()) -> &'_1 u8 let _1: &'2 closure<'_0>; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = &(*((*_1)).0) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -118,9 +125,13 @@ fn call_mut<'_0, '_1, '_2>(state: &'_2 mut closure<'_0>, args: ()) -> &'_1 u8 let args: (); // arg #2 let _3: &'0 closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'_0, '_1, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -132,10 +143,14 @@ fn call_once<'_0, '_1>(_1: closure<'_0>, _2: ()) -> &'_1 u8 let _2: (); // arg #2 let _3: &'2 mut closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'_0, '_1, '6>(move _3, move _2) drop[drop_glue<'_0, '12>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/issue-988-closure-outlives.out b/charon/tests/ui/simple/issue-988-closure-outlives.out index 5475ac63d..16299783e 100644 --- a/charon/tests/ui/simple/issue-988-closure-outlives.out +++ b/charon/tests/ui/simple/issue-988-closure-outlives.out @@ -81,6 +81,7 @@ fn call<'_0, '_1>(_1: &'_1 closure<'_0>, tupled_args: (usize,)) -> u8 let _5: &'_ [u8]; // anonymous local let _6: &'_ u8; // anonymous local + storage_live(_0) storage_live(i) i = move tupled_args.0 storage_live(_4) @@ -91,6 +92,11 @@ fn call<'_0, '_1>(_1: &'_1 closure<'_0>, tupled_args: (usize,)) -> u8 _6 = @SliceIndexShared<'_, u8>(move _5, copy _4) _0 = copy (*_6) storage_dead(_4) + storage_dead(i) + storage_dead(tupled_args) + storage_dead(_1) + storage_dead(_6) + storage_dead(_5) return } @@ -106,6 +112,7 @@ pub fn call_fn_shared<'_0>(a: &'_0 [u8], i: usize) -> u8 let _6: (usize,); // anonymous local let _7: usize; // anonymous local + storage_live(_0) storage_live(read) storage_live(_4) _4 = &(*a) with_metadata(copy a.metadata) @@ -122,6 +129,8 @@ pub fn call_fn_shared<'_0>(a: &'_0 [u8], i: usize) -> u8 storage_dead(_6) storage_dead(_5) storage_dead(read) + storage_dead(i) + storage_dead(a) return } @@ -131,7 +140,9 @@ unsafe fn drop_glue<'_0, '_1>(_1: &'_1 mut closure<'_0>) let _0: (); // return let _1: &'1 mut closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -143,9 +154,13 @@ fn call_mut<'_0, '_1>(state: &'_1 mut closure<'_0>, args: (usize,)) -> u8 let args: (usize,); // arg #2 let _3: &'0 closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'_0, '2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -157,10 +172,14 @@ fn call_once<'_0>(_1: closure<'_0>, _2: (usize,)) -> u8 let _2: (usize,); // arg #2 let _3: &'1 mut closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'_0, '4>(move _3, move _2) drop[drop_glue<'_0, '10>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/lending-iterator-gat.out b/charon/tests/ui/simple/lending-iterator-gat.out index a9322db8e..572e5dce8 100644 --- a/charon/tests/ui/simple/lending-iterator-gat.out +++ b/charon/tests/ui/simple/lending-iterator-gat.out @@ -82,8 +82,10 @@ unsafe fn impl_Destruct_for_tuple::drop_glue<'_0, A>(_1: &'_0 mut (A,)) let _0: (); // return let _1: &'1 mut (A,); // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for A}::drop_glue<'2>] (*_1).0 + storage_dead(_1) return } @@ -117,11 +119,13 @@ where let _4: Option<&'22 T>[{built_in impl Sized for &'22 T}]; // anonymous local let _5: &'25 T; // anonymous local + storage_live(_0) match (*self) { Option::Some => { }, _ => { _0 = Option::None { } + storage_dead(self) return }, } @@ -139,6 +143,7 @@ where storage_dead(_5) storage_dead(item_3) storage_dead(item_2) + storage_dead(self) return } @@ -176,6 +181,7 @@ where let _8: (TraitClause2::Item<'12>,); // anonymous local let _9: TraitClause2::Item<'13>; // anonymous local + storage_live(_0) storage_live(_3) _0 = () loop { @@ -215,6 +221,9 @@ where storage_dead(_4) conditional_drop[{built_in impl Destruct for T1}::drop_glue<'34>] f conditional_drop[{built_in impl Destruct for I}::drop_glue<'43>] iter + storage_dead(_3) + storage_dead(f) + storage_dead(iter) return } @@ -233,6 +242,7 @@ fn call_mut<'_0, '_1, '_2>(_1: &'_2 mut closure<'_0>, tupled_args: (&'_1 i32,)) let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(item) storage_live(_5) _0 = () @@ -243,6 +253,10 @@ fn call_mut<'_0, '_1, '_2>(_1: &'_2 mut closure<'_0>, tupled_args: (&'_1 i32,)) (*((*_1)).0) = move _5 _0 = () storage_dead(_4) + storage_dead(_5) + storage_dead(item) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -252,7 +266,9 @@ unsafe fn impl_Destruct_for_closure::drop_glue<'_0, '_1>(_1: &'_1 mut closure<'_ let _0: (); // return let _1: &'1 mut closure<'_0>; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -264,11 +280,15 @@ fn call_once<'_0, '_1>(_1: closure<'_0>, _2: (&'_1 i32,)) let _2: (&'0 i32,); // arg #2 let _3: &'2 mut closure<'_0>; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'_0, '_1, '9>(move _3, move _2) drop[impl_Destruct_for_closure::drop_glue<'_0, '15>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -331,10 +351,13 @@ pub fn main() storage_live(_26) storage_live(_28) + storage_live(_28) storage_live(_29) _29 = const 42i32 _28 = &_29 + storage_dead(_29) _26 = move _28 + storage_live(_0) storage_live(_24) storage_live(_25) _0 = () @@ -359,9 +382,11 @@ pub fn main() _5 = for_each[{built_in impl Sized for &'55 i32}], closure<'57>>[{built_in impl Sized for Option<&'55 i32>[{built_in impl Sized for &'55 i32}]}, {built_in impl Sized for closure<'57>}, impl_LendingIterator_for_Option<'55, i32>[{built_in impl Sized for i32}], impl_FnMut_tuple_for_closure<'57, '93>](move _6, move _7) storage_live(_27) storage_live(_30) + storage_live(_30) storage_live(_31) _31 = const 42i32 _30 = &_31 + storage_dead(_31) _27 = move _30 storage_dead(_7) storage_dead(_6) @@ -403,6 +428,19 @@ pub fn main() _21 = &(*_22) storage_live(_23) _23 = Option::None { } + storage_dead(_25) + storage_dead(_24) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(kind) + storage_dead(_30) + storage_dead(_28) + storage_dead(_27) + storage_dead(_26) panic(core::panicking::assert_failed) } storage_dead(_16) @@ -415,6 +453,19 @@ pub fn main() storage_dead(sum) storage_dead(iter) storage_dead(x) + storage_dead(_25) + storage_dead(_24) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) + storage_dead(kind) + storage_dead(_30) + storage_dead(_28) + storage_dead(_27) + storage_dead(_26) return } diff --git a/charon/tests/ui/simple/lifetime-unification-from-trait-impl.out b/charon/tests/ui/simple/lifetime-unification-from-trait-impl.out index debb2ddf9..5dd4b429d 100644 --- a/charon/tests/ui/simple/lifetime-unification-from-trait-impl.out +++ b/charon/tests/ui/simple/lifetime-unification-from-trait-impl.out @@ -45,6 +45,7 @@ fn method<'a>(self: &'a u32) -> &'a [u8; 4usize] let _3: *const [u8; 4usize]; // anonymous local let _4: *const u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -55,6 +56,7 @@ fn method<'a>(self: &'a u32) -> &'a [u8; 4usize] _0 = &(*_2) storage_dead(_3) storage_dead(_2) + storage_dead(self) return } @@ -77,11 +79,13 @@ where let x: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = TraitClause2::method(move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] x + storage_dead(x) return } @@ -93,6 +97,7 @@ pub fn to_bytes_by_ref<'b>(s: &'b u32) -> &'b [u8; 4usize] let _2: &'4 [u8; 4usize]; // anonymous local let _3: &'5 u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) // Here `convert` is given generics `<&'_ u32, &'_ [u8; 4]>`, which loses the information @@ -102,6 +107,7 @@ pub fn to_bytes_by_ref<'b>(s: &'b u32) -> &'b [u8; 4usize] _0 = &(*_2) storage_dead(_3) storage_dead(_2) + storage_dead(s) return } diff --git a/charon/tests/ui/simple/manual-drop-impl.out b/charon/tests/ui/simple/manual-drop-impl.out index 89e3fffc2..b59900974 100644 --- a/charon/tests/ui/simple/manual-drop-impl.out +++ b/charon/tests/ui/simple/manual-drop-impl.out @@ -68,8 +68,10 @@ where let _0: (); // return let self: &'1 mut Foo[TraitClause0]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -83,12 +85,16 @@ where let _2: &'2 mut Foo[TraitClause0]; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = () _2 = &mut (*_1) _3 = impl_Drop_for_Foo::drop<'4, T>[TraitClause0](move _2) drop[impl_Destruct_for_Vec::drop_glue<'6, T, Global>[TraitClause0, {built_in impl Sized for Global}]] ((*_1)).vec + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -117,9 +123,11 @@ fn drop_foo(_1: Foo[{built_in impl Sized for u32}]) let _0: (); // return let _1: Foo[{built_in impl Sized for u32}]; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[impl_Destruct_for_Foo::drop_glue<'0, u32>[{built_in impl Sized for u32}]] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/match-on-char.out b/charon/tests/ui/simple/match-on-char.out index dde671d07..5d20098e7 100644 --- a/charon/tests/ui/simple/match-on-char.out +++ b/charon/tests/ui/simple/match-on-char.out @@ -6,6 +6,7 @@ fn main() let _0: (); // return let _1: char; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const 'x' diff --git a/charon/tests/ui/simple/match-on-float.out b/charon/tests/ui/simple/match-on-float.out index aaa4ac1f6..17a893ee6 100644 --- a/charon/tests/ui/simple/match-on-float.out +++ b/charon/tests/ui/simple/match-on-float.out @@ -8,6 +8,7 @@ fn main() let _2: bool; // anonymous local let _3: bool; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = () @@ -21,14 +22,20 @@ fn main() } else { _0 = () storage_dead(_1) + storage_dead(_3) + storage_dead(_2) return } _0 = () storage_dead(_1) + storage_dead(_3) + storage_dead(_2) return } _0 = () storage_dead(_1) + storage_dead(_3) + storage_dead(_2) return } diff --git a/charon/tests/ui/simple/metadata-without-marker-trait.out b/charon/tests/ui/simple/metadata-without-marker-trait.out index 699cb2bcd..33049a6d2 100644 --- a/charon/tests/ui/simple/metadata-without-marker-trait.out +++ b/charon/tests/ui/simple/metadata-without-marker-trait.out @@ -14,10 +14,12 @@ pub fn wrap_shared_in_option<'a, T>(x: &'a T) -> Option<&'a T> let x: &'3 T; // arg #1 let _2: &'4 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = Option::Some { 0: move _2 } storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/simple/min.out b/charon/tests/ui/simple/min.out index b7bb1d2cb..14b82175a 100644 --- a/charon/tests/ui/simple/min.out +++ b/charon/tests/ui/simple/min.out @@ -34,6 +34,7 @@ fn main() let _0: (); // return let _1: u64; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = impl_Ord_for_u64::min[{built_in impl Sized for u64}, {built_in impl Destruct for u64}](const 1u64, const 2u64) diff --git a/charon/tests/ui/simple/mono-enum-with-single-variant.out b/charon/tests/ui/simple/mono-enum-with-single-variant.out index b45b14cd5..acf2f6e83 100644 --- a/charon/tests/ui/simple/mono-enum-with-single-variant.out +++ b/charon/tests/ui/simple/mono-enum-with-single-variant.out @@ -16,8 +16,10 @@ fn use_result(_1: MyResult::) let _0: (); // return let _1: MyResult::; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/monomorphized-intrinsic.out b/charon/tests/ui/simple/monomorphized-intrinsic.out index 57a82afc1..d124ce1f5 100644 --- a/charon/tests/ui/simple/monomorphized-intrinsic.out +++ b/charon/tests/ui/simple/monomorphized-intrinsic.out @@ -33,12 +33,15 @@ fn main() storage_live(_9) storage_live(_11) + storage_live(_11) storage_live(_12) // We detect these in a pass; this test makes sure we don't mess up the generics in `--mono` // mode. _12 = E1::A { } _11 = &_12 + storage_dead(_12) _9 = move _11 + storage_live(_0) storage_live(_7) storage_live(_8) _0 = () @@ -51,9 +54,11 @@ fn main() _1 = @discriminant((*_2)) storage_live(_10) storage_live(_13) + storage_live(_13) storage_live(_14) _14 = E2::A { } _13 = &_14 + storage_dead(_14) _10 = move _13 storage_dead(_2) storage_dead(_3) @@ -69,6 +74,12 @@ fn main() storage_dead(_6) storage_dead(_4) _0 = () + storage_dead(_8) + storage_dead(_7) + storage_dead(_13) + storage_dead(_11) + storage_dead(_10) + storage_dead(_9) return } diff --git a/charon/tests/ui/simple/multiple-promoteds.out b/charon/tests/ui/simple/multiple-promoteds.out index 26a4e7141..498ed0e99 100644 --- a/charon/tests/ui/simple/multiple-promoteds.out +++ b/charon/tests/ui/simple/multiple-promoteds.out @@ -25,6 +25,7 @@ fn six() -> u32 let _15: u32; // anonymous local let _16: u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_4) storage_live(_7) @@ -33,11 +34,14 @@ fn six() -> u32 _2 = const 0u32 panic.+ const 1u32 storage_live(_9) storage_live(_11) + storage_live(_11) storage_live(_12) storage_live(_13) _13 = const 0u32 wrap.+ const 1u32 _12 = move _13 _11 = &_12 + storage_dead(_13) + storage_dead(_12) _9 = move _11 _8 = move _9 x = &(*_8) @@ -45,11 +49,14 @@ fn six() -> u32 _4 = const 2u32 panic.+ const 3u32 storage_live(_10) storage_live(_14) + storage_live(_14) storage_live(_15) storage_live(_16) _16 = const 2u32 wrap.+ const 3u32 _15 = move _16 _14 = &_15 + storage_dead(_16) + storage_dead(_15) _10 = move _14 _7 = move _10 y = &(*_7) @@ -62,6 +69,14 @@ fn six() -> u32 storage_dead(_5) storage_dead(y) storage_dead(x) + storage_dead(_8) + storage_dead(_7) + storage_dead(_4) + storage_dead(_2) + storage_dead(_14) + storage_dead(_11) + storage_dead(_10) + storage_dead(_9) return } diff --git a/charon/tests/ui/simple/nested-closure-lifetime.out b/charon/tests/ui/simple/nested-closure-lifetime.out index 502aa7cc9..b225d0655 100644 --- a/charon/tests/ui/simple/nested-closure-lifetime.out +++ b/charon/tests/ui/simple/nested-closure-lifetime.out @@ -100,7 +100,10 @@ where let _1: &'3 test_crate::foo::closure<'_0, T>[TraitClause0, TraitClause1]; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = test_crate::foo::closure::closure { 0: copy ((*_1)).0 } + storage_dead(tupled_args) + storage_dead(_1) return } @@ -116,6 +119,7 @@ where let _3: &'8 test_crate::foo::closure<'9, T>[TraitClause0, TraitClause1]; // anonymous local let _4: (); // anonymous local + storage_live(_0) storage_live(f) f = test_crate::foo::closure { 0: copy x } storage_live(_3) @@ -126,6 +130,7 @@ where storage_dead(_4) storage_dead(_3) storage_dead(f) + storage_dead(x) return } @@ -138,7 +143,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::foo::closure<'_0, T>[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -153,9 +160,13 @@ where let args: (); // arg #2 let _3: &'1 test_crate::foo::closure<'_0, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<()> for test_crate::foo::closure<'_0, T>[TraitClause0, TraitClause1]}::call<'_0, '_1, '_2, '3, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -170,10 +181,14 @@ where let _2: (); // arg #2 let _3: &'3 mut test_crate::foo::closure<'_0, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<()> for test_crate::foo::closure<'_0, T>[TraitClause0, TraitClause1]}::call_mut<'_0, '_1, '_2, '8, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::foo::closure<'_0, T>[TraitClause0, TraitClause1]}::drop_glue<'_0, '14, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -239,7 +254,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::foo::closure::closure<'_0, T>[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -253,7 +270,10 @@ where let _1: &'2 test_crate::foo::closure::closure<'_0, T>[TraitClause0, TraitClause1]; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = copy ((*_1)).0 + storage_dead(tupled_args) + storage_dead(_1) return } @@ -268,9 +288,13 @@ where let args: (); // arg #2 let _3: &'0 test_crate::foo::closure::closure<'_0, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<()> for test_crate::foo::closure::closure<'_0, T>[TraitClause0, TraitClause1]}::call<'_0, '_1, '2, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -285,10 +309,14 @@ where let _2: (); // arg #2 let _3: &'2 mut test_crate::foo::closure::closure<'_0, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<()> for test_crate::foo::closure::closure<'_0, T>[TraitClause0, TraitClause1]}::call_mut<'_0, '_1, '6, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::foo::closure::closure<'_0, T>[TraitClause0, TraitClause1]}::drop_glue<'_0, '12, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/nested-closure-trait-ref.out b/charon/tests/ui/simple/nested-closure-trait-ref.out index 090d096ac..03dc97854 100644 --- a/charon/tests/ui/simple/nested-closure-trait-ref.out +++ b/charon/tests/ui/simple/nested-closure-trait-ref.out @@ -99,8 +99,10 @@ where let _0: (); // return let _1: &'1 mut test_crate::foo::closure[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -114,8 +116,11 @@ where let _1: test_crate::foo::closure[TraitClause0, TraitClause1]; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = test_crate::foo::closure::closure { 0: move (_1).0 } conditional_drop[{impl Destruct for test_crate::foo::closure[TraitClause0, TraitClause1]}::drop_glue<'0, T>[TraitClause0, TraitClause1]] _1 + storage_dead(tupled_args) + storage_dead(_1) return } @@ -131,6 +136,7 @@ where let _3: test_crate::foo::closure[TraitClause0, TraitClause1]; // anonymous local let _4: (); // anonymous local + storage_live(_0) storage_live(f) f = test_crate::foo::closure { 0: move x } storage_live(_3) @@ -143,6 +149,7 @@ where conditional_drop[{impl Destruct for test_crate::foo::closure[TraitClause0, TraitClause1]}::drop_glue<'1, T>[TraitClause0, TraitClause1]] f storage_dead(f) conditional_drop[{built_in impl Destruct for T}::drop_glue<'3>] x + storage_dead(x) return } @@ -180,8 +187,10 @@ where let _0: (); // return let _1: &'1 mut test_crate::foo::closure::closure[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -196,10 +205,13 @@ where let tupled_args: (); // arg #2 let _3: &'3 T; // anonymous local + storage_live(_0) storage_live(_3) _3 = &((*_1)).0 _0 = TraitClause1::clone<'4>(move _3) storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -214,9 +226,13 @@ where let args: (); // arg #2 let _3: &'0 test_crate::foo::closure::closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'2, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -231,10 +247,14 @@ where let _2: (); // arg #2 let _3: &'1 mut test_crate::foo::closure::closure[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'2, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::foo::closure::closure[TraitClause0, TraitClause1]}::drop_glue<'4, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/nested-closure.out b/charon/tests/ui/simple/nested-closure.out index 42fa6b6ef..9c9c0f081 100644 --- a/charon/tests/ui/simple/nested-closure.out +++ b/charon/tests/ui/simple/nested-closure.out @@ -103,12 +103,16 @@ where let _z: &'2 u32; // local let _4: &'3 T; // anonymous local + storage_live(_0) storage_live(_z) _z = move tupled_args.0 storage_live(_4) _4 = &(*((*_1)).0) _0 = TraitClause1::clone<'5>(move _4) storage_dead(_4) + storage_dead(_z) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -132,12 +136,16 @@ where let _y: &'6 u32; // local let _4: &'7 T; // anonymous local + storage_live(_0) storage_live(_y) _y = move tupled_args.0 storage_live(_4) _4 = &(*((*_1)).0) _0 = test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure::closure { 0: move _4 } storage_dead(_4) + storage_dead(_y) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -160,10 +168,13 @@ where let tupled_args: (); // arg #2 let _3: &'6 T; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*((*_1)).0) _0 = test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure { 0: move _3 } storage_dead(_3) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -198,6 +209,7 @@ where let _22: &'89 u32; // anonymous local let _23: u32; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(clo) @@ -216,9 +228,11 @@ where _7 = impl_Fn_unit_for_closure::call<'53, '54, '55, '56, '57, '58, '59, T>[TraitClause0, TraitClause1](move _8, move _9) storage_live(_18) storage_live(_20) + storage_live(_20) storage_live(_21) _21 = const 0u32 _20 = &_21 + storage_dead(_21) _18 = move _20 _6 = &_7 storage_dead(_9) @@ -233,9 +247,11 @@ where _5 = {impl Fn<(&'_ u32,)> for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::call<'69, '70, '71, '72, '73, '74, T>[TraitClause0, TraitClause1](move _6, move _10) storage_live(_19) storage_live(_22) + storage_live(_22) storage_live(_23) _23 = const 1u32 _22 = &_23 + storage_dead(_23) _19 = move _22 _4 = &_5 storage_dead(_11) @@ -257,6 +273,13 @@ where storage_dead(_12) storage_dead(_7) storage_dead(_5) + storage_dead(_17) + storage_dead(_16) + storage_dead(x) + storage_dead(_22) + storage_dead(_20) + storage_dead(_19) + storage_dead(_18) return } @@ -269,7 +292,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -284,9 +309,13 @@ where let args: (); // arg #2 let _3: &'1 test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = impl_Fn_unit_for_closure::call<'a, '_1, '_2, '_3, '_4, '_5, '3, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -301,10 +330,14 @@ where let _2: (); // arg #2 let _3: &'5 mut test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = impl_FnMut_unit_for_closure::call_mut<'a, '_1, '_2, '_3, '_4, '_5, '14, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::drop_glue<'a, '_1, '24, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -370,7 +403,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -385,9 +420,13 @@ where let args: (&'_2 u32,); // arg #2 let _3: &'1 test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ u32,)> for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::call<'a, '_1, '_2, '_3, '_4, '3, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -402,10 +441,14 @@ where let _2: (&'4 u32,); // arg #2 let _3: &'6 mut test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(&'_ u32,)> for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::call_mut<'a, '_1, '_2, '_3, '_4, '17, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::drop_glue<'a, '_1, '27, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -471,7 +514,9 @@ where let _0: (); // return let _1: &'1 mut test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -486,9 +531,13 @@ where let args: (&'_2 u32,); // arg #2 let _3: &'0 test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(&'_ u32,)> for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::call<'a, '_1, '_2, '2, T>[TraitClause0, TraitClause1](move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -503,10 +552,14 @@ where let _2: (&'0 u32,); // arg #2 let _3: &'2 mut test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(&'_ u32,)> for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::call_mut<'a, '_1, '_2, '11, T>[TraitClause0, TraitClause1](move _3, move _2) drop[{impl Destruct for test_crate::{Foo<'a, T>[TraitClause0]}::test_nested_closures::closure::closure::closure<'a, '_1, T>[TraitClause0, TraitClause1]}::drop_glue<'a, '_1, '21, T>[TraitClause0, TraitClause1]] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/nested-inline-const.out b/charon/tests/ui/simple/nested-inline-const.out index 692ac7be9..34c8a6506 100644 --- a/charon/tests/ui/simple/nested-inline-const.out +++ b/charon/tests/ui/simple/nested-inline-const.out @@ -7,6 +7,7 @@ fn main() let _1: i32; // anonymous local let _2: i32; // anonymous local + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -14,6 +15,7 @@ fn main() _1 = move _2 storage_dead(_1) _0 = () + storage_dead(_2) return } diff --git a/charon/tests/ui/simple/non-lifetime-gats.out b/charon/tests/ui/simple/non-lifetime-gats.out index 6f25145a9..1a355e11e 100644 --- a/charon/tests/ui/simple/non-lifetime-gats.out +++ b/charon/tests/ui/simple/non-lifetime-gats.out @@ -86,11 +86,13 @@ where let value: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move value _0 = @BoxNew[TraitClause0](move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] value + storage_dead(value) return } @@ -117,11 +119,13 @@ where let x: T; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = TraitClause2::new[TraitClause1](move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'1>] x + storage_dead(x) return } @@ -131,6 +135,7 @@ pub fn main() let _0: (); // return let _1: alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = make_pointer[{built_in impl Sized for BoxFamily}, {built_in impl Sized for i32}, impl_PointerFamily_for_BoxFamily](const 42i32) diff --git a/charon/tests/ui/simple/offset-of.out b/charon/tests/ui/simple/offset-of.out index 144c0a7aa..d56064f86 100644 --- a/charon/tests/ui/simple/offset-of.out +++ b/charon/tests/ui/simple/offset-of.out @@ -16,6 +16,7 @@ fn main() let _0: (); // return let _1: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const 0usize diff --git a/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out b/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out index e7f14b622..400c354c8 100644 --- a/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out +++ b/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out @@ -34,6 +34,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/opaque-vtable.out b/charon/tests/ui/simple/opaque-vtable.out index fad8e6cf5..aabd5c7bc 100644 --- a/charon/tests/ui/simple/opaque-vtable.out +++ b/charon/tests/ui/simple/opaque-vtable.out @@ -38,8 +38,10 @@ fn use_debug<'_0>(_d: &'_0 (dyn Trait + '_0)) let _0: (); // return let _d: &'3 (dyn Trait + '4); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_d) return } @@ -58,10 +60,13 @@ fn main() storage_live(_6) storage_live(_7) + storage_live(_7) storage_live(_8) _8 = () _7 = &_8 + storage_dead(_8) _6 = move _7 + storage_live(_0) storage_live(_5) _0 = () storage_live(_1) @@ -78,6 +83,9 @@ fn main() storage_dead(_4) storage_dead(_1) _0 = () + storage_dead(_5) + storage_dead(_7) + storage_dead(_6) return } diff --git a/charon/tests/ui/simple/partial-drop.out b/charon/tests/ui/simple/partial-drop.out index 0e7bce7f6..ca568bbc4 100644 --- a/charon/tests/ui/simple/partial-drop.out +++ b/charon/tests/ui/simple/partial-drop.out @@ -62,6 +62,7 @@ fn foo(f: Foo) let _2: (); // anonymous local let _3: alloc::boxed::Box[{built_in impl Destruct for u32}, impl_Destruct_for_Global]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -73,6 +74,7 @@ fn foo(f: Foo) // Only `y` and `z` should be dropped here drop[impl_Destruct_for_Box::drop_glue<'1, u32, Global>[{built_in impl Destruct for u32}, impl_Destruct_for_Global]] (f).y drop[impl_Destruct_for_Box::drop_glue<'3, u32, Global>[{built_in impl Destruct for u32}, impl_Destruct_for_Global]] (f).z + storage_dead(f) return } diff --git a/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out b/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out index a60f63f14..06a222de5 100644 --- a/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out +++ b/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out @@ -70,7 +70,9 @@ pub fn flabada<'a>(x: &'a ()) -> &'a () let _0: &'1 (); // return let x: &'2 (); // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -83,9 +85,11 @@ where let _0: (); // return let _1: F; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for F}::drop_glue<'0>] _1 + storage_dead(_1) return } @@ -95,6 +99,7 @@ pub fn flibidi() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = call<'0, for<'a> flabada<'a>>[{built_in impl Sized for for<'a> flabada<'a>}, {built_in impl Fn<(&'0 (),), &'0 ()> for for<'a> flabada<'a>}](const flabada<'63>) diff --git a/charon/tests/ui/simple/place_mention.out b/charon/tests/ui/simple/place_mention.out index 7c9f32939..991508d29 100644 --- a/charon/tests/ui/simple/place_mention.out +++ b/charon/tests/ui/simple/place_mention.out @@ -12,10 +12,13 @@ fn main() storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) _5 = (const 11i32, const 22i32) _4 = &_5 + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) _0 = () storage_live(x) @@ -24,6 +27,9 @@ fn main() _ = (*x).0 _0 = () storage_dead(x) + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/promoted-closure-no-warns.out b/charon/tests/ui/simple/promoted-closure-no-warns.out index 7fede8ab9..8628491d4 100644 --- a/charon/tests/ui/simple/promoted-closure-no-warns.out +++ b/charon/tests/ui/simple/promoted-closure-no-warns.out @@ -81,10 +81,13 @@ pub fn foo() -> &'static closure storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) _6 = closure { } _5 = &_6 + storage_dead(_6) _4 = move _5 + storage_live(_0) storage_live(_3) storage_live(_1) storage_live(_2) @@ -94,6 +97,9 @@ pub fn foo() -> &'static closure _0 = &(*_1) storage_dead(_2) storage_dead(_1) + storage_dead(_3) + storage_dead(_5) + storage_dead(_4) return } @@ -103,7 +109,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -115,9 +123,13 @@ fn call<'_0>(_1: &'_0 closure, tupled_args: (u32,)) -> u32 let tupled_args: (u32,); // arg #2 let x: u32; // local + storage_live(_0) storage_live(x) x = move tupled_args.0 _0 = copy x + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -129,9 +141,13 @@ fn call_mut<'_0>(state: &'_0 mut closure, args: (u32,)) -> u32 let args: (u32,); // arg #2 let _3: &'0 closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -143,10 +159,14 @@ fn call_once(_1: closure, _2: (u32,)) -> u32 let _2: (u32,); // arg #2 let _3: &'1 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'2>(move _3, move _2) drop[drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/promoted-closure.out b/charon/tests/ui/simple/promoted-closure.out index 7fede8ab9..8628491d4 100644 --- a/charon/tests/ui/simple/promoted-closure.out +++ b/charon/tests/ui/simple/promoted-closure.out @@ -81,10 +81,13 @@ pub fn foo() -> &'static closure storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) _6 = closure { } _5 = &_6 + storage_dead(_6) _4 = move _5 + storage_live(_0) storage_live(_3) storage_live(_1) storage_live(_2) @@ -94,6 +97,9 @@ pub fn foo() -> &'static closure _0 = &(*_1) storage_dead(_2) storage_dead(_1) + storage_dead(_3) + storage_dead(_5) + storage_dead(_4) return } @@ -103,7 +109,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -115,9 +123,13 @@ fn call<'_0>(_1: &'_0 closure, tupled_args: (u32,)) -> u32 let tupled_args: (u32,); // arg #2 let x: u32; // local + storage_live(_0) storage_live(x) x = move tupled_args.0 _0 = copy x + storage_dead(x) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -129,9 +141,13 @@ fn call_mut<'_0>(state: &'_0 mut closure, args: (u32,)) -> u32 let args: (u32,); // arg #2 let _3: &'0 closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -143,10 +159,14 @@ fn call_once(_1: closure, _2: (u32,)) -> u32 let _2: (u32,); // arg #2 let _3: &'1 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'2>(move _3, move _2) drop[drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/promoted-in-generic-fn.out b/charon/tests/ui/simple/promoted-in-generic-fn.out index f7e433d23..c79ae287e 100644 --- a/charon/tests/ui/simple/promoted-in-generic-fn.out +++ b/charon/tests/ui/simple/promoted-in-generic-fn.out @@ -33,11 +33,14 @@ where storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) // This can't be evaluated generically. _5 = size_of[TraitClause0]() _4 = &_5 + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -45,6 +48,9 @@ where _1 = &(*_2) storage_dead(_1) _0 = () + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/promoted-inside-impl.out b/charon/tests/ui/simple/promoted-inside-impl.out index 9e857f214..495fc1fc7 100644 --- a/charon/tests/ui/simple/promoted-inside-impl.out +++ b/charon/tests/ui/simple/promoted-inside-impl.out @@ -35,10 +35,13 @@ where storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) _5 = const 0i32 _4 = &_5 + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) _0 = () storage_live(_promoted) @@ -46,6 +49,9 @@ where _promoted = &(*_2) _0 = () storage_dead(_promoted) + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/promoted-literal-addition-overflow.out b/charon/tests/ui/simple/promoted-literal-addition-overflow.out index fdc046a17..f964e789c 100644 --- a/charon/tests/ui/simple/promoted-literal-addition-overflow.out +++ b/charon/tests/ui/simple/promoted-literal-addition-overflow.out @@ -19,22 +19,30 @@ fn overflow() -> &'static u32 let _6: u32; // anonymous local let _7: u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_1) _2 = copy MAX panic.+ const 1u32 storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) storage_live(_7) _7 = copy MAX wrap.+ const 1u32 _6 = move _7 _5 = &_6 + storage_dead(_7) + storage_dead(_6) _4 = move _5 _3 = move _4 _1 = &(*_3) _0 = &(*_1) storage_dead(_1) + storage_dead(_3) + storage_dead(_2) + storage_dead(_5) + storage_dead(_4) return } diff --git a/charon/tests/ui/simple/promoted-literal-addition.out b/charon/tests/ui/simple/promoted-literal-addition.out index 49f8f5909..a331d683c 100644 --- a/charon/tests/ui/simple/promoted-literal-addition.out +++ b/charon/tests/ui/simple/promoted-literal-addition.out @@ -12,22 +12,30 @@ fn two() -> &'static u32 let _6: u32; // anonymous local let _7: u32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_1) _2 = const 1u32 panic.+ const 1u32 storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) storage_live(_7) _7 = const 1u32 wrap.+ const 1u32 _6 = move _7 _5 = &_6 + storage_dead(_7) + storage_dead(_6) _4 = move _5 _3 = move _4 _1 = &(*_3) _0 = &(*_1) storage_dead(_1) + storage_dead(_3) + storage_dead(_2) + storage_dead(_5) + storage_dead(_4) return } diff --git a/charon/tests/ui/simple/promoted-u32-slice.out b/charon/tests/ui/simple/promoted-u32-slice.out index 18cad3514..3b2ad93b5 100644 --- a/charon/tests/ui/simple/promoted-u32-slice.out +++ b/charon/tests/ui/simple/promoted-u32-slice.out @@ -13,10 +13,13 @@ pub fn foo() -> &'static [u32] storage_live(_4) storage_live(_5) + storage_live(_5) storage_live(_6) _6 = [const 0u32, const 1u32, const 2u32, const 3u32] _5 = &_6 + storage_dead(_6) _4 = move _5 + storage_live(_0) storage_live(_3) storage_live(_1) storage_live(_2) @@ -26,6 +29,9 @@ pub fn foo() -> &'static [u32] _0 = @ArrayToSliceShared<'_, u32, 4usize>(move _1) storage_dead(_1) storage_dead(_2) + storage_dead(_3) + storage_dead(_5) + storage_dead(_4) return } diff --git a/charon/tests/ui/simple/promoted_in_closure.out b/charon/tests/ui/simple/promoted_in_closure.out index 5f236a506..8356b3523 100644 --- a/charon/tests/ui/simple/promoted_in_closure.out +++ b/charon/tests/ui/simple/promoted_in_closure.out @@ -74,6 +74,7 @@ fn main() let _0: (); // return let f: closure; // local + storage_live(_0) _0 = () storage_live(f) f = closure { } @@ -88,7 +89,9 @@ unsafe fn drop_glue<'_0>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -106,10 +109,13 @@ fn call<'_0>(_1: &'_0 closure, tupled_args: ()) storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = const 42i32 _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_3) @@ -117,6 +123,11 @@ fn call<'_0>(_1: &'_0 closure, tupled_args: ()) _3 = &(*_4) storage_dead(_3) _0 = () + storage_dead(_4) + storage_dead(tupled_args) + storage_dead(_1) + storage_dead(_6) + storage_dead(_5) return } @@ -128,10 +139,14 @@ fn call_mut<'_0>(state: &'_0 mut closure, args: ()) let args: (); // arg #2 let _3: &'0 closure; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = &(*state) _0 = call<'2>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -143,11 +158,15 @@ fn call_once(_1: closure, _2: ()) let _2: (); // arg #2 let _3: &'1 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _0 = () _3 = &mut _1 _0 = call_mut<'2>(move _3, move _2) drop[drop_glue<'4>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/promoted_in_default_method.out b/charon/tests/ui/simple/promoted_in_default_method.out index d73275234..c7c8c7abd 100644 --- a/charon/tests/ui/simple/promoted_in_default_method.out +++ b/charon/tests/ui/simple/promoted_in_default_method.out @@ -26,10 +26,13 @@ where storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) _5 = const 42i32 _4 = &_5 + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -37,6 +40,9 @@ where _1 = &(*_2) storage_dead(_1) _0 = () + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/ptr-from-raw-parts.out b/charon/tests/ui/simple/ptr-from-raw-parts.out index bc44c3bea..66e5eaa23 100644 --- a/charon/tests/ui/simple/ptr-from-raw-parts.out +++ b/charon/tests/ui/simple/ptr-from-raw-parts.out @@ -180,6 +180,7 @@ where let _3: *const T1; // anonymous local let _4: {built_in impl Pointee for T}::Metadata; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy data_pointer storage_live(_4) @@ -187,6 +188,8 @@ where _0 = @PtrFromPartsShared<'_, T>(move _3, move _4) storage_dead(_4) storage_dead(_3) + storage_dead(metadata) + storage_dead(data_pointer) return } @@ -198,6 +201,7 @@ fn main() let _2: *const [u32]; // anonymous local let _3: *const [u32; 2usize]; // anonymous local + storage_live(_0) _0 = () storage_live(a) a = @ArrayRepeat(const 1u32) diff --git a/charon/tests/ui/simple/ptr_metadata.out b/charon/tests/ui/simple/ptr_metadata.out index 680f86e97..70a791db7 100644 --- a/charon/tests/ui/simple/ptr_metadata.out +++ b/charon/tests/ui/simple/ptr_metadata.out @@ -217,6 +217,7 @@ fn main() let _0: (); // return let _1: *const u8; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = null[impl_Thin_for_T[{built_in impl Pointee for u8 where Metadata = ()}]]() diff --git a/charon/tests/ui/simple/ptr_to_promoted.out b/charon/tests/ui/simple/ptr_to_promoted.out index ac7a2222e..2f9cc77b2 100644 --- a/charon/tests/ui/simple/ptr_to_promoted.out +++ b/charon/tests/ui/simple/ptr_to_promoted.out @@ -15,10 +15,13 @@ fn main() storage_live(_6) storage_live(_7) + storage_live(_7) storage_live(_8) _8 = const 0u8 _7 = &_8 + storage_dead(_8) _6 = move _7 + storage_live(_0) storage_live(_5) _0 = () storage_live(x) @@ -35,6 +38,9 @@ fn main() storage_dead(_3) _0 = () storage_dead(x) + storage_dead(_5) + storage_dead(_7) + storage_dead(_6) return } diff --git a/charon/tests/ui/simple/range-iter.out b/charon/tests/ui/simple/range-iter.out index d0d683622..ef7f8d82c 100644 --- a/charon/tests/ui/simple/range-iter.out +++ b/charon/tests/ui/simple/range-iter.out @@ -155,6 +155,7 @@ fn iter(n: usize) let _8: &'2 mut Range; // anonymous local let i: usize; // local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -193,6 +194,7 @@ fn iter(n: usize) storage_dead(_6) storage_dead(iter) storage_dead(_2) + storage_dead(n) return } diff --git a/charon/tests/ui/simple/ref-in-const.out b/charon/tests/ui/simple/ref-in-const.out index 3702de561..f73cacff9 100644 --- a/charon/tests/ui/simple/ref-in-const.out +++ b/charon/tests/ui/simple/ref-in-const.out @@ -13,18 +13,25 @@ fn SOME_INT() -> &'static &'static i32 storage_live(_3) storage_live(_4) + storage_live(_4) storage_live(_5) storage_live(_6) _6 = const 0i32 _5 = &_6 _4 = &_5 + storage_dead(_6) + storage_dead(_5) _3 = move _4 + storage_live(_0) storage_live(_2) storage_live(_1) _2 = move _3 _1 = &(*_2) _0 = &(*_1) storage_dead(_1) + storage_dead(_2) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/remove-adt-clauses-closure-keep-assoc.out b/charon/tests/ui/simple/remove-adt-clauses-closure-keep-assoc.out index 9de404042..5cc4b1118 100644 --- a/charon/tests/ui/simple/remove-adt-clauses-closure-keep-assoc.out +++ b/charon/tests/ui/simple/remove-adt-clauses-closure-keep-assoc.out @@ -66,8 +66,10 @@ where let _0: closure[TraitClause0, TraitClause1]; // return let x: T; // arg #1 + storage_live(_0) _0 = closure { } conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -81,8 +83,11 @@ where let _1: closure[TraitClause0, TraitClause1]; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(tupled_args) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/remove-adt-clauses-keep-assoc.out b/charon/tests/ui/simple/remove-adt-clauses-keep-assoc.out index d9d3ccc95..c62e6602f 100644 --- a/charon/tests/ui/simple/remove-adt-clauses-keep-assoc.out +++ b/charon/tests/ui/simple/remove-adt-clauses-keep-assoc.out @@ -47,8 +47,10 @@ where let _0: (); // return let _1: &'1 mut Direct[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -97,8 +99,10 @@ where let _0: (); // return let _1: &'1 mut Transitive[TraitClause0, TraitClause1]; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -141,8 +145,10 @@ where let _0: (); // return let _1: &'1 mut Marker; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1)).0 + storage_dead(_1) return } @@ -171,11 +177,15 @@ where let _y: Transitive[TraitClause1, TraitClause4]; // arg #2 let _z: Marker; // arg #3 + storage_live(_0) _0 = () _0 = () conditional_drop[impl_Destruct_for_Marker::drop_glue<'0, V>[TraitClause2, TraitClause5]] _z conditional_drop[impl_Destruct_for_Transitive::drop_glue<'1, U>[TraitClause1, TraitClause4]] _y conditional_drop[impl_Destruct_for_Direct::drop_glue<'3, T>[TraitClause0, TraitClause3]] _x + storage_dead(_z) + storage_dead(_y) + storage_dead(_x) return } diff --git a/charon/tests/ui/simple/remove-adt-clauses-supertrait.out b/charon/tests/ui/simple/remove-adt-clauses-supertrait.out index 02544ae24..4b05c36f6 100644 --- a/charon/tests/ui/simple/remove-adt-clauses-supertrait.out +++ b/charon/tests/ui/simple/remove-adt-clauses-supertrait.out @@ -75,8 +75,10 @@ where let _0: closure; // return let x: T; // arg #1 + storage_live(_0) _0 = closure { } conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] x + storage_dead(x) return } @@ -90,8 +92,11 @@ where let _1: closure; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(tupled_args) + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/remove-adt-clauses.out b/charon/tests/ui/simple/remove-adt-clauses.out index 74ea7aa1f..a94475234 100644 --- a/charon/tests/ui/simple/remove-adt-clauses.out +++ b/charon/tests/ui/simple/remove-adt-clauses.out @@ -38,8 +38,10 @@ fn foo(_x: Foo) let _0: (); // return let _x: Foo; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_x) return } diff --git a/charon/tests/ui/simple/rpitit-with-const-generic.out b/charon/tests/ui/simple/rpitit-with-const-generic.out index ed808a2e5..cc8445510 100644 --- a/charon/tests/ui/simple/rpitit-with-const-generic.out +++ b/charon/tests/ui/simple/rpitit-with-const-generic.out @@ -31,6 +31,7 @@ pub fn bar() -> [u8; N] { let _0: [u8; N]; // return + storage_live(_0) _0 = @ArrayRepeat(const 0u8) return } diff --git a/charon/tests/ui/simple/single-variant-enum-drop-glue.out b/charon/tests/ui/simple/single-variant-enum-drop-glue.out index c4910ba06..393a8dfcc 100644 --- a/charon/tests/ui/simple/single-variant-enum-drop-glue.out +++ b/charon/tests/ui/simple/single-variant-enum-drop-glue.out @@ -42,12 +42,14 @@ unsafe fn impl_Destruct_for_Thing::drop_glue<'_0>(_1: &'_0 mut Thing) let _0: (); // return let _1: &'1 mut Thing; // arg #1 + storage_live(_0) _0 = () match (*_1) { _ => { }, } drop[impl_Destruct_for_Box::drop_glue<'2, (), Global>[{built_in impl MetaSized for ()}, {built_in impl Sized for Global}]] ((*_1) as variant Thing::A).0 + storage_dead(_1) return } @@ -63,9 +65,11 @@ fn foo(_1: Thing) let _0: (); // return let _1: Thing; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[impl_Destruct_for_Thing::drop_glue<'0>] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/slice_increment.out b/charon/tests/ui/simple/slice_increment.out index 52e451ad2..b86e3baba 100644 --- a/charon/tests/ui/simple/slice_increment.out +++ b/charon/tests/ui/simple/slice_increment.out @@ -12,6 +12,7 @@ pub fn incr<'_0>(s: &'_0 mut [u32]) let _6: &'_ mut [u32]; // anonymous local let _7: &'_ mut u32; // anonymous local + storage_live(_0) storage_live(_3) _0 = () storage_live(_2) @@ -28,6 +29,12 @@ pub fn incr<'_0>(s: &'_0 mut [u32]) (*_7) = move _3 storage_dead(_2) _0 = () + storage_dead(_3) + storage_dead(s) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) return } diff --git a/charon/tests/ui/simple/slice_index.out b/charon/tests/ui/simple/slice_index.out index 5f33ca0d0..c0f434915 100644 --- a/charon/tests/ui/simple/slice_index.out +++ b/charon/tests/ui/simple/slice_index.out @@ -9,6 +9,7 @@ pub fn first<'_0>(s: &'_0 [u32]) -> u32 let _3: &'_ [u32]; // anonymous local let _4: &'_ u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = const 0usize storage_live(_3) @@ -17,6 +18,9 @@ pub fn first<'_0>(s: &'_0 [u32]) -> u32 _4 = @SliceIndexShared<'_, u32>(move _3, copy _2) _0 = copy (*_4) storage_dead(_2) + storage_dead(s) + storage_dead(_4) + storage_dead(_3) return } diff --git a/charon/tests/ui/simple/slice_index_range.out b/charon/tests/ui/simple/slice_index_range.out index 248bab699..234109213 100644 --- a/charon/tests/ui/simple/slice_index_range.out +++ b/charon/tests/ui/simple/slice_index_range.out @@ -23,6 +23,7 @@ fn core::slice::index::slice_index_fail::do_panic::runtime(start: usize, len: us let _18: [u8; 57usize]; // anonymous local let _19: &'36 [u8; 57usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -67,6 +68,15 @@ fn core::slice::index::slice_index_fail::do_panic::runtime(start: usize, len: us storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(len) + storage_dead(start) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -93,6 +103,7 @@ fn core::slice::index::slice_index_fail::do_panic#1::runtime(end: usize, len: us let _18: [u8; 55usize]; // anonymous local let _19: &'36 [u8; 55usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -137,6 +148,15 @@ fn core::slice::index::slice_index_fail::do_panic#1::runtime(end: usize, len: us storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -163,6 +183,7 @@ fn core::slice::index::slice_index_fail::do_panic#2::runtime(start: usize, end: let _18: [u8; 40usize]; // anonymous local let _19: &'36 [u8; 40usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -207,6 +228,15 @@ fn core::slice::index::slice_index_fail::do_panic#2::runtime(start: usize, end: storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(end) + storage_dead(start) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -233,6 +263,7 @@ fn core::slice::index::slice_index_fail::do_panic#3::runtime(end: usize, len: us let _18: [u8; 55usize]; // anonymous local let _19: &'36 [u8; 55usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -277,6 +308,15 @@ fn core::slice::index::slice_index_fail::do_panic#3::runtime(end: usize, len: us storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -299,6 +339,7 @@ fn core::slice::index::slice_index_fail::do_panic(start: usize, len: usize) -> ! let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy start @@ -308,6 +349,10 @@ fn core::slice::index::slice_index_fail::do_panic(start: usize, len: usize) -> ! storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(len) + storage_dead(start) + undefined_behavior } fn core::slice::index::slice_index_fail::do_panic#1(end: usize, len: usize) -> ! @@ -319,6 +364,7 @@ fn core::slice::index::slice_index_fail::do_panic#1(end: usize, len: usize) -> ! let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy end @@ -328,6 +374,10 @@ fn core::slice::index::slice_index_fail::do_panic#1(end: usize, len: usize) -> ! storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic#1::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + undefined_behavior } fn core::slice::index::slice_index_fail::do_panic#2(start: usize, end: usize) -> ! @@ -339,6 +389,7 @@ fn core::slice::index::slice_index_fail::do_panic#2(start: usize, end: usize) -> let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy start @@ -348,6 +399,10 @@ fn core::slice::index::slice_index_fail::do_panic#2(start: usize, end: usize) -> storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic#2::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(end) + storage_dead(start) + undefined_behavior } fn core::slice::index::slice_index_fail::do_panic#3(end: usize, len: usize) -> ! @@ -359,6 +414,7 @@ fn core::slice::index::slice_index_fail::do_panic#3(end: usize, len: usize) -> ! let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy end @@ -368,6 +424,10 @@ fn core::slice::index::slice_index_fail::do_panic#3(end: usize, len: usize) -> ! storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic#3::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + undefined_behavior } // Full name: core::slice::index::private_slice_index::Sealed @@ -409,6 +469,7 @@ where let _4: I; // anonymous local let _5: &'5 [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = move index @@ -419,6 +480,8 @@ where storage_dead(_5) storage_dead(_4) storage_dead(_3) + storage_dead(index) + storage_dead(self) return } @@ -450,6 +513,7 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! let _22: usize; // anonymous local let _23: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) _5 = copy start @@ -488,6 +552,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_23) _23 = copy len _0 = core::slice::index::slice_index_fail::do_panic#3(move _22, move _23) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } storage_dead(_18) storage_dead(_17) @@ -497,6 +576,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_21) _21 = copy end _19 = core::slice::index::slice_index_fail::do_panic#2(move _20, move _21) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } storage_dead(_12) storage_dead(_11) @@ -506,6 +600,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_15) _15 = copy len _13 = core::slice::index::slice_index_fail::do_panic#1(move _14, move _15) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } storage_dead(_6) storage_dead(_5) @@ -515,6 +624,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_9) _9 = copy len _7 = core::slice::index::slice_index_fail::do_panic(move _8, move _9) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } // Full name: core::slice::index::get_offset_len_noubcheck @@ -535,6 +659,7 @@ where let _10: *const T; // anonymous local let _11: usize; // anonymous local + storage_live(_0) storage_live(ptr_4) storage_live(_5) storage_live(_6) @@ -560,6 +685,9 @@ where storage_dead(_10) storage_dead(ptr_7) storage_dead(ptr_4) + storage_dead(len) + storage_dead(offset) + storage_dead(ptr_1) return } @@ -581,6 +709,7 @@ where let _10: *mut T; // anonymous local let _11: usize; // anonymous local + storage_live(_0) storage_live(ptr_4) storage_live(_5) storage_live(_6) @@ -606,6 +735,9 @@ where storage_dead(_10) storage_dead(ptr_7) storage_dead(ptr_4) + storage_dead(len) + storage_dead(offset) + storage_dead(ptr_1) return } @@ -624,10 +756,12 @@ where let self: &'1 [T]; // arg #1 let _2: *const [T]; // anonymous local + storage_live(_0) storage_live(_2) _2 = &raw const (*self) with_metadata(copy self.metadata) _0 = metadata<[T]>(move _2) storage_dead(_2) + storage_dead(self) return } @@ -654,6 +788,7 @@ where let _15: usize; // anonymous local let _16: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy (self).1 @@ -700,6 +835,8 @@ where storage_dead(new_len) storage_dead(_3) storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } else { storage_dead(_9) @@ -713,6 +850,8 @@ where storage_dead(_3) _0 = Option::None { } storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } @@ -739,6 +878,7 @@ where let _15: usize; // anonymous local let _16: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy (self).1 @@ -785,6 +925,8 @@ where storage_dead(new_len) storage_dead(_3) storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } else { storage_dead(_9) @@ -798,6 +940,8 @@ where storage_dead(_3) _0 = Option::None { } storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } @@ -819,6 +963,7 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked::precondition_check(star let _12: Arguments<'3>; // anonymous local let _13: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -841,6 +986,12 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked::precondition_check(star _0 = () storage_dead(_7) storage_dead(_4) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) return } else { storage_dead(_9) @@ -859,6 +1010,13 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked::precondition_check(star _12 = from_str<'6>(move _13) storage_dead(_13) _11 = panic_nounwind_fmt<'8>(move _12, const false) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for Range[{built_in impl Sized for usize}]}::get_unchecked @@ -883,6 +1041,7 @@ where let _14: usize; // anonymous local let _15: bool; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_15) _15 = ub_checks @@ -925,6 +1084,9 @@ where storage_dead(_13) storage_dead(_12) storage_dead(new_len) + storage_dead(_15) + storage_dead(slice) + storage_dead(self) return } @@ -946,6 +1108,7 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked_mut::precondition_check( let _12: Arguments<'3>; // anonymous local let _13: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -968,6 +1131,12 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked_mut::precondition_check( _0 = () storage_dead(_7) storage_dead(_4) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) return } else { storage_dead(_9) @@ -986,6 +1155,13 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked_mut::precondition_check( _12 = from_str<'6>(move _13) storage_dead(_13) _11 = panic_nounwind_fmt<'8>(move _12, const false) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for Range[{built_in impl Sized for usize}]}::get_unchecked_mut @@ -1010,6 +1186,7 @@ where let _14: usize; // anonymous local let _15: bool; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_15) _15 = ub_checks @@ -1052,6 +1229,9 @@ where storage_dead(_13) storage_dead(_12) storage_dead(new_len) + storage_dead(_15) + storage_dead(slice) + storage_dead(self) return } @@ -1090,6 +1270,7 @@ where let _27: usize; // anonymous local let _28: &'6 [T]; // anonymous local + storage_live(_0) storage_live(_12) storage_live(start) start = copy (self).0 @@ -1162,6 +1343,13 @@ where storage_dead(exhausted) storage_dead(end) storage_dead(start) + storage_dead(_27) + storage_dead(_26) + storage_dead(_25) + storage_dead(_24) + storage_dead(_12) + storage_dead(slice) + storage_dead(self) return }, _ => { @@ -1184,6 +1372,14 @@ where _27 = core::slice::{[T]}::len<'10, T>[TraitClause0](move _28) storage_dead(_28) _24 = slice_index_fail(move _25, move _26, move _27) + storage_dead(_27) + storage_dead(_26) + storage_dead(_25) + storage_dead(_24) + storage_dead(_12) + storage_dead(slice) + storage_dead(self) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for RangeInclusive[{built_in impl Sized for usize}]}::index @@ -1221,6 +1417,7 @@ where let _27: usize; // anonymous local let _28: &'5 [T]; // anonymous local + storage_live(_0) storage_live(_12) storage_live(start) start = copy (self).0 @@ -1293,6 +1490,13 @@ where storage_dead(exhausted) storage_dead(end) storage_dead(start) + storage_dead(_27) + storage_dead(_26) + storage_dead(_25) + storage_dead(_24) + storage_dead(_12) + storage_dead(slice) + storage_dead(self) return }, _ => { @@ -1315,6 +1519,14 @@ where _27 = core::slice::{[T]}::len<'9, T>[TraitClause0](move _28) storage_dead(_28) _24 = slice_index_fail(move _25, move _26, move _27) + storage_dead(_27) + storage_dead(_26) + storage_dead(_25) + storage_dead(_24) + storage_dead(_12) + storage_dead(slice) + storage_dead(self) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for RangeInclusive[{built_in impl Sized for usize}]}::get_unchecked_mut @@ -1329,6 +1541,7 @@ where let _4: RangeInclusive[{built_in impl Sized for usize}]; // anonymous local let _5: *mut [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = move self @@ -1339,6 +1552,8 @@ where _0 = impl_SliceIndex_slice_for_Range_usize::get_unchecked_mut[TraitClause0](move _3, move _5) storage_dead(_5) storage_dead(_3) + storage_dead(slice) + storage_dead(self) return } @@ -1354,6 +1569,7 @@ where let _4: RangeInclusive[{built_in impl Sized for usize}]; // anonymous local let _5: *const [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = move self @@ -1364,6 +1580,8 @@ where _0 = impl_SliceIndex_slice_for_Range_usize::get_unchecked[TraitClause0](move _3, move _5) storage_dead(_5) storage_dead(_3) + storage_dead(slice) + storage_dead(self) return } @@ -1385,6 +1603,7 @@ where let _10: RangeInclusive[{built_in impl Sized for usize}]; // anonymous local let _11: &'16 mut [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) storage_live(_5) @@ -1415,6 +1634,8 @@ where storage_dead(_11) storage_dead(_9) storage_dead(_3) + storage_dead(slice) + storage_dead(self) return } storage_dead(_7) @@ -1422,6 +1643,8 @@ where storage_dead(_4) _0 = Option::None { } storage_dead(_3) + storage_dead(slice) + storage_dead(self) return } @@ -1443,6 +1666,7 @@ where let _10: RangeInclusive[{built_in impl Sized for usize}]; // anonymous local let _11: &'15 [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) storage_live(_5) @@ -1473,6 +1697,8 @@ where storage_dead(_11) storage_dead(_9) storage_dead(_3) + storage_dead(slice) + storage_dead(self) return } storage_dead(_7) @@ -1480,6 +1706,8 @@ where storage_dead(_4) _0 = Option::None { } storage_dead(_3) + storage_dead(slice) + storage_dead(self) return } @@ -1512,6 +1740,7 @@ pub fn slice_index_range<'_0>(slice: &'_0 [u8]) -> &'_0 [u8] let _4: &'5 [u8]; // anonymous local let _5: RangeInclusive[{built_in impl Sized for usize}]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -1525,6 +1754,7 @@ pub fn slice_index_range<'_0>(slice: &'_0 [u8]) -> &'_0 [u8] _0 = &(*_2) with_metadata(copy _2.metadata) storage_dead(_3) storage_dead(_2) + storage_dead(slice) return } diff --git a/charon/tests/ui/simple/struct-with-drops.out b/charon/tests/ui/simple/struct-with-drops.out index 41759969a..b0c8fddd0 100644 --- a/charon/tests/ui/simple/struct-with-drops.out +++ b/charon/tests/ui/simple/struct-with-drops.out @@ -76,8 +76,10 @@ pub fn impl_Drop_for_B::drop<'_0>(self: &'_0 mut B) let _0: (); // return let self: &'1 mut B; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -89,6 +91,7 @@ unsafe fn impl_Destruct_for_B::drop_glue<'_0>(_1: &'_0 mut B) let _2: &'2 mut B; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = () @@ -96,6 +99,9 @@ unsafe fn impl_Destruct_for_B::drop_glue<'_0>(_1: &'_0 mut B) _3 = impl_Drop_for_B::drop<'4>(move _2) drop[impl_Destruct_for_Box::drop_glue<'6, u32, Global>[{built_in impl MetaSized for u32}, {built_in impl Sized for Global}, {built_in impl Destruct for u32}, impl_Destruct_for_Global]] ((*_1)).x drop[impl_Destruct_for_Box::drop_glue<'8, u32, Global>[{built_in impl MetaSized for u32}, {built_in impl Sized for Global}, {built_in impl Destruct for u32}, impl_Destruct_for_Global]] ((*_1)).y + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -105,9 +111,11 @@ unsafe fn impl_Destruct_for_A::drop_glue<'_0>(_1: &'_0 mut A) let _0: (); // return let _1: &'1 mut A; // arg #1 + storage_live(_0) _0 = () drop[impl_Destruct_for_Box::drop_glue<'2, u32, Global>[{built_in impl MetaSized for u32}, {built_in impl Sized for Global}, {built_in impl Destruct for u32}, impl_Destruct_for_Global]] ((*_1)).x drop[impl_Destruct_for_B::drop_glue<'3>] ((*_1)).b + storage_dead(_1) return } @@ -129,9 +137,11 @@ fn takes_a(_1: A) let _0: (); // return let _1: A; // arg #1 + storage_live(_0) _0 = () _0 = () drop[impl_Destruct_for_A::drop_glue<'0>] _1 + storage_dead(_1) return } diff --git a/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out b/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out index a8b409291..6301bbcbd 100644 --- a/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out +++ b/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out @@ -64,6 +64,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/thread-local.out b/charon/tests/ui/simple/thread-local.out index 69ad7bc33..9bb00b13b 100644 --- a/charon/tests/ui/simple/thread-local.out +++ b/charon/tests/ui/simple/thread-local.out @@ -197,6 +197,7 @@ fn __rust_std_internal_init_fn() -> u32 { let _0: u32; // return + storage_live(_0) _0 = const 0u32 return } @@ -209,7 +210,9 @@ unsafe fn {impl Destruct for test_crate::FOO::{const}::closure}::drop_glue<'_0>( let _0: (); // return let _1: &'1 mut test_crate::FOO::{const}::closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -217,6 +220,7 @@ fn test_crate::FOO::{const}::closure::__RUST_STD_INTERNAL_VAL() -> Storage[{built_in impl Sized for u32}, {built_in impl Sized for ()}]; // return + storage_live(_0) _0 = std::sys::thread_local::native::lazy::{Storage[TraitClause0, TraitClause1]}::new[{built_in impl Sized for u32}, {built_in impl Sized for ()}, impl_DestroyedState_for_unit]() return } @@ -234,6 +238,7 @@ fn {impl Fn<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_i let _5: &'7 Storage[{built_in impl Sized for u32}, {built_in impl Sized for ()}]; // anonymous local let _6: Option<&'8 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'8 mut Option[{built_in impl Sized for u32}]}]; // anonymous local + storage_live(_0) storage_live(__rust_std_internal_init) __rust_std_internal_init = move tupled_args.0 storage_live(_4) @@ -246,6 +251,9 @@ fn {impl Fn<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_i storage_dead(_6) storage_dead(_5) storage_dead(_4) + storage_dead(__rust_std_internal_init) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -257,9 +265,13 @@ fn {impl FnMut<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{buil let args: (Option<&'_0 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_0 mut Option[{built_in impl Sized for u32}]}],); // arg #2 let _3: &'1 test_crate::FOO::{const}::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_ mut Option[{built_in impl Sized for u32}]}],)> for test_crate::FOO::{const}::closure}::call<'_0, '3>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -271,10 +283,14 @@ fn {impl FnOnce<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{bui let _2: (Option<&'0 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'0 mut Option[{built_in impl Sized for u32}]}],); // arg #2 let _3: &'4 mut test_crate::FOO::{const}::closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_ mut Option[{built_in impl Sized for u32}]}],)> for test_crate::FOO::{const}::closure}::call_mut<'_0, '18>(move _3, move _2) drop[{impl Destruct for test_crate::FOO::{const}::closure}::drop_glue<'20>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -322,11 +338,15 @@ fn test_crate::FOO::{const}::closure::as_fn<'_0>(arg1: Option<&'_0 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_0 mut Option[{built_in impl Sized for u32}]}],); // local let state: test_crate::FOO::{const}::closure; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::FOO::{const}::closure { } _0 = {impl FnOnce<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_ mut Option[{built_in impl Sized for u32}]}],)> for test_crate::FOO::{const}::closure}::call_once<'_0>(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -338,7 +358,9 @@ unsafe fn {impl Destruct for test_crate::FOO::{const}::closure#1}::drop_glue<'_0 let _0: (); // return let _1: &'1 mut test_crate::FOO::{const}::closure#1; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -346,6 +368,7 @@ fn test_crate::FOO::{const}::closure#1::__RUST_STD_INTERNAL_VAL() -> Storage[{built_in impl Sized for u32}, {built_in impl Sized for !}]; // return + storage_live(_0) _0 = std::sys::thread_local::native::lazy::{Storage[TraitClause0, TraitClause1]}::new[{built_in impl Sized for u32}, {built_in impl Sized for !}, {impl DestroyedState for !}]() return } @@ -363,6 +386,7 @@ fn {impl Fn<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_i let _5: &'7 Storage[{built_in impl Sized for u32}, {built_in impl Sized for !}]; // anonymous local let _6: Option<&'8 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'8 mut Option[{built_in impl Sized for u32}]}]; // anonymous local + storage_live(_0) storage_live(__rust_std_internal_init) __rust_std_internal_init = move tupled_args.0 storage_live(_4) @@ -375,6 +399,9 @@ fn {impl Fn<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_i storage_dead(_6) storage_dead(_5) storage_dead(_4) + storage_dead(__rust_std_internal_init) + storage_dead(tupled_args) + storage_dead(_1) return } @@ -386,9 +413,13 @@ fn {impl FnMut<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{buil let args: (Option<&'_0 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_0 mut Option[{built_in impl Sized for u32}]}],); // arg #2 let _3: &'1 test_crate::FOO::{const}::closure#1; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = {impl Fn<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_ mut Option[{built_in impl Sized for u32}]}],)> for test_crate::FOO::{const}::closure#1}::call<'_0, '3>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -400,10 +431,14 @@ fn {impl FnOnce<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{bui let _2: (Option<&'0 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'0 mut Option[{built_in impl Sized for u32}]}],); // arg #2 let _3: &'4 mut test_crate::FOO::{const}::closure#1; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = {impl FnMut<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_ mut Option[{built_in impl Sized for u32}]}],)> for test_crate::FOO::{const}::closure#1}::call_mut<'_0, '18>(move _3, move _2) drop[{impl Destruct for test_crate::FOO::{const}::closure#1}::drop_glue<'20>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -451,11 +486,15 @@ fn test_crate::FOO::{const}::closure#1::as_fn<'_0>(arg1: Option<&'_0 mut Option< let args: (Option<&'_0 mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_0 mut Option[{built_in impl Sized for u32}]}],); // local let state: test_crate::FOO::{const}::closure#1; // local + storage_live(_0) storage_live(args) storage_live(state) args = (move arg1,) state = test_crate::FOO::{const}::closure#1 { } _0 = {impl FnOnce<(Option<&'_ mut Option[{built_in impl Sized for u32}]>[{built_in impl Sized for &'_ mut Option[{built_in impl Sized for u32}]}],)> for test_crate::FOO::{const}::closure#1}::call_once<'_0>(move state, move args) + storage_dead(state) + storage_dead(args) + storage_dead(arg1) return } @@ -471,6 +510,7 @@ fn FOO() -> LocalKey[{built_in impl Sized for u32}] storage_live(_1) storage_live(_2) + storage_live(_2) storage_live(_3) _3 = needs_drop[{built_in impl MetaSized for u32}]() if move _3 { @@ -486,7 +526,10 @@ fn FOO() -> LocalKey[{built_in impl Sized for u32}] } storage_dead(_3) _1 = move _2 + storage_live(_0) _0 = std::thread::local::{LocalKey[TraitClause0]}::new[{built_in impl Sized for u32}](move _1) + storage_dead(_2) + storage_dead(_1) return } @@ -498,6 +541,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/simple/trait-alias.out b/charon/tests/ui/simple/trait-alias.out index a98aa2f4c..20099418a 100644 --- a/charon/tests/ui/simple/trait-alias.out +++ b/charon/tests/ui/simple/trait-alias.out @@ -57,7 +57,9 @@ pub fn clone<'_0>(self: &'_0 Struct) -> Struct let _0: Struct; // return let self: &'1 Struct; // arg #1 + storage_live(_0) _0 = Struct { } + storage_dead(self) return } @@ -115,6 +117,7 @@ where let _2: T; // anonymous local let _3: &'1 T; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -125,6 +128,7 @@ where storage_dead(_2) _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'5>] x + storage_dead(x) return } @@ -135,6 +139,7 @@ fn use_alias() let _1: (); // anonymous local let _2: Struct; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/simple/trait-default-const-cross-crate.out b/charon/tests/ui/simple/trait-default-const-cross-crate.out index fe051af7c..e1d727bf3 100644 --- a/charon/tests/ui/simple/trait-default-const-cross-crate.out +++ b/charon/tests/ui/simple/trait-default-const-cross-crate.out @@ -49,6 +49,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy FOO[impl_Trait_for_T[TraitClause0]] return } @@ -61,6 +62,7 @@ where let _0: (); // return let _1: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = foo[TraitClause0]() diff --git a/charon/tests/ui/simple/trait-default-const.out b/charon/tests/ui/simple/trait-default-const.out index 15a7fcdef..aa0fff686 100644 --- a/charon/tests/ui/simple/trait-default-const.out +++ b/charon/tests/ui/simple/trait-default-const.out @@ -27,6 +27,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 42usize return } @@ -54,6 +55,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy FOO[impl_Trait_for_T[TraitClause0]] return } diff --git a/charon/tests/ui/simple/trivial_generic_function.out b/charon/tests/ui/simple/trivial_generic_function.out index ec9b415e7..592eb12a2 100644 --- a/charon/tests/ui/simple/trivial_generic_function.out +++ b/charon/tests/ui/simple/trivial_generic_function.out @@ -28,9 +28,11 @@ where let _0: (); // return let t: T; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] t + storage_dead(t) return } diff --git a/charon/tests/ui/simple/uncheck-ops.out b/charon/tests/ui/simple/uncheck-ops.out index e52cbdfbe..74978cb32 100644 --- a/charon/tests/ui/simple/uncheck-ops.out +++ b/charon/tests/ui/simple/uncheck-ops.out @@ -10,6 +10,7 @@ fn main() let _4: u8; // anonymous local let _5: u8; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const 255u8 ub.+ const 1u8 diff --git a/charon/tests/ui/simple/vec-push.out b/charon/tests/ui/simple/vec-push.out index 9b45c7564..3caa165e5 100644 --- a/charon/tests/ui/simple/vec-push.out +++ b/charon/tests/ui/simple/vec-push.out @@ -206,6 +206,7 @@ where let self_11: UsizeNoHighBit; // local let _12: NonNull; // anonymous local + storage_live(_0) storage_live(_6) storage_live(end) storage_live(len) @@ -248,6 +249,10 @@ where ((*self_1)).len = copy len wrap.+ const 1usize _0 = &mut (*end) storage_dead(len) + storage_dead(end) + storage_dead(_6) + storage_dead(value) + storage_dead(self_1) return } @@ -263,10 +268,13 @@ where let value: T; // arg #2 let _3: &'3 mut T; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = push_mut<'5, T, A>[TraitClause0, TraitClause1, TraitClause2](move self, move value) storage_dead(_3) + storage_dead(value) + storage_dead(self) return } @@ -277,11 +285,13 @@ fn vec<'_0>(x: &'_0 mut Vec[{built_in impl Sized for u32}, {built_in impl S let x: &'1 mut Vec[{built_in impl Sized for u32}, {built_in impl Sized for Global}]; // arg #1 let _2: &'2 mut Vec[{built_in impl Sized for u32}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &two-phase-mut (*x) _0 = push<'4, u32, Global>[{built_in impl Sized for u32}, {built_in impl Sized for Global}, impl_Destruct_for_Global](move _2, const 42u32) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/simple/vec-with-capacity.out b/charon/tests/ui/simple/vec-with-capacity.out index cc40bbc2e..bd56c78a2 100644 --- a/charon/tests/ui/simple/vec-with-capacity.out +++ b/charon/tests/ui/simple/vec-with-capacity.out @@ -98,6 +98,7 @@ where let _6: &'_ mut [T]; // anonymous local let _7: &'_ mut T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -120,6 +121,13 @@ where continue 0 } } + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) + storage_dead(_7) + storage_dead(_6) return } @@ -142,10 +150,12 @@ where let self: &'1 mut Vec[TraitClause0, TraitClause1]; // arg #1 let _2: &'3 RawVec[TraitClause0, TraitClause1]; // anonymous local + storage_live(_0) storage_live(_2) _2 = &((*self)).buf _0 = ptr<'5, T, A>[TraitClause0, TraitClause1](move _2) storage_dead(_2) + storage_dead(self) return } @@ -162,6 +172,7 @@ where let _4: &'2 mut Vec[TraitClause0, TraitClause1]; // anonymous local let _5: usize; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -176,6 +187,7 @@ where storage_dead(_3) _0 = drop_in_place<[T]>[impl_Destruct_for_slice[TraitClause0]](move _2) storage_dead(_2) + storage_dead(self) return } @@ -190,12 +202,16 @@ where let _2: &'2 mut Vec[TraitClause0, TraitClause1]; // anonymous local let _3: (); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _0 = () _2 = &mut (*_1) _3 = impl_Drop_for_Vec::drop<'4, T, A>[TraitClause0, TraitClause1](move _2) drop[impl_Destruct_for_RawVec::drop_glue<'6, T, A>[TraitClause0, TraitClause1]] ((*_1)).buf + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -212,6 +228,7 @@ where let _4: usize; // anonymous local let _5: A; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy capacity @@ -222,6 +239,8 @@ where storage_dead(_4) _0 = Vec { buf: move _3, len: const 0usize } storage_dead(_3) + storage_dead(alloc) + storage_dead(capacity) return } @@ -236,6 +255,7 @@ where let _2: usize; // anonymous local let _3: Global; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy capacity storage_live(_3) @@ -243,6 +263,7 @@ where _0 = alloc::vec::{Vec[TraitClause0, TraitClause1]}::with_capacity_in[TraitClause0, {built_in impl Sized for Global}, impl_Destruct_for_Global](move _2, move _3) storage_dead(_3) storage_dead(_2) + storage_dead(capacity) return } @@ -252,6 +273,7 @@ fn vec() let _0: (); // return let _1: Vec[{built_in impl Sized for u32}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = with_capacity[{built_in impl Sized for u32}](const 42usize) diff --git a/charon/tests/ui/simple/well-formedness-bound.out b/charon/tests/ui/simple/well-formedness-bound.out index f7cf19be9..d55c86194 100644 --- a/charon/tests/ui/simple/well-formedness-bound.out +++ b/charon/tests/ui/simple/well-formedness-bound.out @@ -29,10 +29,12 @@ pub fn get<'a>(x: &'a u32) -> Option<&'a u32>[{built_in impl Sized for &'a u32}] let x: &'9 u32; // arg #1 let _2: &'10 u32; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = Option::Some { 0: move _2 } storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/simple/wrapping-ops.out b/charon/tests/ui/simple/wrapping-ops.out index ed6864d45..2f4c1a31a 100644 --- a/charon/tests/ui/simple/wrapping-ops.out +++ b/charon/tests/ui/simple/wrapping-ops.out @@ -9,6 +9,7 @@ pub fn wrapping_add(self: u8, rhs: u8) -> u8 let _3: u8; // anonymous local let _4: u8; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy self storage_live(_4) @@ -16,6 +17,8 @@ pub fn wrapping_add(self: u8, rhs: u8) -> u8 _0 = move _3 wrap.+ move _4 storage_dead(_4) storage_dead(_3) + storage_dead(rhs) + storage_dead(self) return } @@ -28,6 +31,7 @@ pub fn wrapping_sub(self: u8, rhs: u8) -> u8 let _3: u8; // anonymous local let _4: u8; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy self storage_live(_4) @@ -35,6 +39,8 @@ pub fn wrapping_sub(self: u8, rhs: u8) -> u8 _0 = move _3 wrap.- move _4 storage_dead(_4) storage_dead(_3) + storage_dead(rhs) + storage_dead(self) return } @@ -47,6 +53,7 @@ pub fn wrapping_mul(self: u8, rhs: u8) -> u8 let _3: u8; // anonymous local let _4: u8; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy self storage_live(_4) @@ -54,6 +61,8 @@ pub fn wrapping_mul(self: u8, rhs: u8) -> u8 _0 = move _3 wrap.* move _4 storage_dead(_4) storage_dead(_3) + storage_dead(rhs) + storage_dead(self) return } @@ -68,6 +77,7 @@ fn main() let _5: u8; // anonymous local let _6: u8; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const 255u8 wrap.+ const 1u8 diff --git a/charon/tests/ui/skip-borrowck.out b/charon/tests/ui/skip-borrowck.out index 09ce17aad..ed631aa1e 100644 --- a/charon/tests/ui/skip-borrowck.out +++ b/charon/tests/ui/skip-borrowck.out @@ -26,6 +26,7 @@ where let _6: bool; // anonymous local let _7: &'6 mut T; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) storage_live(_6) @@ -43,6 +44,9 @@ where _0 = &mut (*_4) storage_dead(_5) storage_dead(_4) + storage_dead(y) + storage_dead(x) + storage_dead(b) return } @@ -67,6 +71,7 @@ pub fn choose_test() let _15: bool; // anonymous local let _16: i32; // anonymous local + storage_live(_0) storage_live(_8) _0 = () storage_live(x) @@ -96,6 +101,7 @@ pub fn choose_test() if move _9 { } else { storage_dead(_10) + storage_dead(_8) panic(core::panicking::panic) } storage_dead(_10) @@ -108,6 +114,7 @@ pub fn choose_test() if move _11 { } else { storage_dead(_12) + storage_dead(_8) panic(core::panicking::panic) } storage_dead(_12) @@ -119,6 +126,7 @@ pub fn choose_test() if move _13 { } else { storage_dead(_14) + storage_dead(_8) panic(core::panicking::panic) } storage_dead(_14) @@ -130,6 +138,7 @@ pub fn choose_test() if move _15 { } else { storage_dead(_16) + storage_dead(_8) panic(core::panicking::panic) } storage_dead(_16) @@ -138,6 +147,7 @@ pub fn choose_test() storage_dead(z) storage_dead(y) storage_dead(x) + storage_dead(_8) return } diff --git a/charon/tests/ui/slice-index-range.out b/charon/tests/ui/slice-index-range.out index 3c0bb7cfc..7b42a8f92 100644 --- a/charon/tests/ui/slice-index-range.out +++ b/charon/tests/ui/slice-index-range.out @@ -55,6 +55,7 @@ fn core::slice::index::slice_index_fail::do_panic::runtime(start: usize, len: us let _18: [u8; 57usize]; // anonymous local let _19: &'36 [u8; 57usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -99,6 +100,15 @@ fn core::slice::index::slice_index_fail::do_panic::runtime(start: usize, len: us storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(len) + storage_dead(start) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -125,6 +135,7 @@ fn core::slice::index::slice_index_fail::do_panic#1::runtime(end: usize, len: us let _18: [u8; 55usize]; // anonymous local let _19: &'36 [u8; 55usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -169,6 +180,15 @@ fn core::slice::index::slice_index_fail::do_panic#1::runtime(end: usize, len: us storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -195,6 +215,7 @@ fn core::slice::index::slice_index_fail::do_panic#2::runtime(start: usize, end: let _18: [u8; 40usize]; // anonymous local let _19: &'36 [u8; 40usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -239,6 +260,15 @@ fn core::slice::index::slice_index_fail::do_panic#2::runtime(start: usize, end: storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(end) + storage_dead(start) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -265,6 +295,7 @@ fn core::slice::index::slice_index_fail::do_panic#3::runtime(end: usize, len: us let _18: [u8; 55usize]; // anonymous local let _19: &'36 [u8; 55usize]; // anonymous local + storage_live(_0) storage_live(_16) storage_live(_17) storage_live(_3) @@ -309,6 +340,15 @@ fn core::slice::index::slice_index_fail::do_panic#3::runtime(end: usize, len: us storage_dead(_14) storage_dead(_13) storage_dead(_12) + storage_dead(_17) + storage_dead(_16) + storage_dead(args_7) + storage_dead(args_4) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + storage_dead(_19) + storage_dead(_18) panic(core::panicking::panic_fmt) } @@ -345,6 +385,7 @@ fn core::slice::index::slice_index_fail::do_panic(start: usize, len: usize) -> ! let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy start @@ -354,6 +395,10 @@ fn core::slice::index::slice_index_fail::do_panic(start: usize, len: usize) -> ! storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(len) + storage_dead(start) + undefined_behavior } fn core::slice::index::slice_index_fail::do_panic#1(end: usize, len: usize) -> ! @@ -365,6 +410,7 @@ fn core::slice::index::slice_index_fail::do_panic#1(end: usize, len: usize) -> ! let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy end @@ -374,6 +420,10 @@ fn core::slice::index::slice_index_fail::do_panic#1(end: usize, len: usize) -> ! storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic#1::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + undefined_behavior } fn core::slice::index::slice_index_fail::do_panic#2(start: usize, end: usize) -> ! @@ -385,6 +435,7 @@ fn core::slice::index::slice_index_fail::do_panic#2(start: usize, end: usize) -> let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy start @@ -394,6 +445,10 @@ fn core::slice::index::slice_index_fail::do_panic#2(start: usize, end: usize) -> storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic#2::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(end) + storage_dead(start) + undefined_behavior } fn core::slice::index::slice_index_fail::do_panic#3(end: usize, len: usize) -> ! @@ -405,6 +460,7 @@ fn core::slice::index::slice_index_fail::do_panic#3(end: usize, len: usize) -> ! let _4: usize; // anonymous local let _5: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy end @@ -414,6 +470,10 @@ fn core::slice::index::slice_index_fail::do_panic#3(end: usize, len: usize) -> ! storage_dead(_5) storage_dead(_4) _0 = core::slice::index::slice_index_fail::do_panic#3::runtime(move _3.0, move _3.1) + storage_dead(_3) + storage_dead(len) + storage_dead(end) + undefined_behavior } // Full name: core::panicking::panic_nounwind_fmt @@ -469,6 +529,7 @@ where let _4: I; // anonymous local let _5: &'5 [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = move index @@ -479,6 +540,8 @@ where storage_dead(_5) storage_dead(_4) storage_dead(_3) + storage_dead(index) + storage_dead(self) return } @@ -525,6 +588,7 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! let _22: usize; // anonymous local let _23: usize; // anonymous local + storage_live(_0) storage_live(_4) storage_live(_5) _5 = copy start @@ -563,6 +627,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_23) _23 = copy len _0 = core::slice::index::slice_index_fail::do_panic#3(move _22, move _23) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } storage_dead(_18) storage_dead(_17) @@ -572,6 +651,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_21) _21 = copy end _19 = core::slice::index::slice_index_fail::do_panic#2(move _20, move _21) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } storage_dead(_12) storage_dead(_11) @@ -581,6 +675,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_15) _15 = copy len _13 = core::slice::index::slice_index_fail::do_panic#1(move _14, move _15) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } storage_dead(_6) storage_dead(_5) @@ -590,6 +699,21 @@ fn slice_index_fail(start: usize, end: usize, len: usize) -> ! storage_live(_9) _9 = copy len _7 = core::slice::index::slice_index_fail::do_panic(move _8, move _9) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(_19) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } // Full name: core::slice::index::get_offset_len_noubcheck @@ -610,6 +734,7 @@ where let _10: *const T; // anonymous local let _11: usize; // anonymous local + storage_live(_0) storage_live(ptr_4) storage_live(_5) storage_live(_6) @@ -635,6 +760,9 @@ where storage_dead(_10) storage_dead(ptr_7) storage_dead(ptr_4) + storage_dead(len) + storage_dead(offset) + storage_dead(ptr_1) return } @@ -656,6 +784,7 @@ where let _10: *mut T; // anonymous local let _11: usize; // anonymous local + storage_live(_0) storage_live(ptr_4) storage_live(_5) storage_live(_6) @@ -681,6 +810,9 @@ where storage_dead(_10) storage_dead(ptr_7) storage_dead(ptr_4) + storage_dead(len) + storage_dead(offset) + storage_dead(ptr_1) return } @@ -727,6 +859,7 @@ where let _23: usize; // anonymous local let _24: &'10 [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) storage_live(_5) @@ -782,6 +915,12 @@ where storage_dead(_4) _0 = &mut (*_3) with_metadata(copy _3.metadata) storage_dead(_3) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(slice) + storage_dead(self) return } else { storage_dead(_11) @@ -804,6 +943,13 @@ where _23 = core::slice::{[T]}::len<'14, T>[TraitClause0](move _24) storage_dead(_24) _20 = slice_index_fail(move _21, move _22, move _23) + storage_dead(_23) + storage_dead(_22) + storage_dead(_21) + storage_dead(_20) + storage_dead(slice) + storage_dead(self) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for Range[{built_in impl Sized for usize}]}::index @@ -833,6 +979,7 @@ where let _19: usize; // anonymous local let _20: &'5 [T]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy (self).end @@ -876,6 +1023,12 @@ where storage_dead(new_len) storage_dead(_3) storage_dead(_7) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) + storage_dead(slice) + storage_dead(self) return } else { storage_dead(_9) @@ -898,6 +1051,13 @@ where _19 = core::slice::{[T]}::len<'9, T>[TraitClause0](move _20) storage_dead(_20) _16 = slice_index_fail(move _17, move _18, move _19) + storage_dead(_19) + storage_dead(_18) + storage_dead(_17) + storage_dead(_16) + storage_dead(slice) + storage_dead(self) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for Range[{built_in impl Sized for usize}]}::get_unchecked_mut::precondition_check @@ -918,6 +1078,7 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked_mut::precondition_check( let _12: Arguments<'3>; // anonymous local let _13: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -940,6 +1101,12 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked_mut::precondition_check( _0 = () storage_dead(_7) storage_dead(_4) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) return } else { storage_dead(_9) @@ -958,6 +1125,13 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked_mut::precondition_check( _12 = from_str<'6>(move _13) storage_dead(_13) _11 = panic_nounwind_fmt<'8>(move _12, const false) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for Range[{built_in impl Sized for usize}]}::get_unchecked_mut @@ -982,6 +1156,7 @@ where let _14: usize; // anonymous local let _15: bool; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_15) _15 = ub_checks @@ -1024,6 +1199,9 @@ where storage_dead(_13) storage_dead(_12) storage_dead(new_len) + storage_dead(_15) + storage_dead(slice) + storage_dead(self) return } @@ -1045,6 +1223,7 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked::precondition_check(star let _12: Arguments<'3>; // anonymous local let _13: &'4 str; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -1067,6 +1246,12 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked::precondition_check(star _0 = () storage_dead(_7) storage_dead(_4) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) return } else { storage_dead(_9) @@ -1085,6 +1270,13 @@ fn impl_SliceIndex_slice_for_Range_usize::get_unchecked::precondition_check(star _12 = from_str<'6>(move _13) storage_dead(_13) _11 = panic_nounwind_fmt<'8>(move _12, const false) + storage_dead(_12) + storage_dead(_11) + storage_dead(msg) + storage_dead(len) + storage_dead(end) + storage_dead(start) + undefined_behavior } // Full name: core::slice::index::{impl SliceIndex<[T]> for Range[{built_in impl Sized for usize}]}::get_unchecked @@ -1109,6 +1301,7 @@ where let _14: usize; // anonymous local let _15: bool; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_15) _15 = ub_checks @@ -1151,6 +1344,9 @@ where storage_dead(_13) storage_dead(_12) storage_dead(new_len) + storage_dead(_15) + storage_dead(slice) + storage_dead(self) return } @@ -1177,6 +1373,7 @@ where let _15: usize; // anonymous local let _16: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy (self).end @@ -1223,6 +1420,8 @@ where storage_dead(new_len) storage_dead(_3) storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } else { storage_dead(_9) @@ -1236,6 +1435,8 @@ where storage_dead(_3) _0 = Option::None { } storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } @@ -1262,6 +1463,7 @@ where let _15: usize; // anonymous local let _16: usize; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy (self).end @@ -1308,6 +1510,8 @@ where storage_dead(new_len) storage_dead(_3) storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } else { storage_dead(_9) @@ -1321,6 +1525,8 @@ where storage_dead(_3) _0 = Option::None { } storage_dead(_7) + storage_dead(slice) + storage_dead(self) return } @@ -1358,6 +1564,7 @@ fn main() let _9: &'_ [i32]; // anonymous local let _10: &'_ i32; // anonymous local + storage_live(_0) _0 = () storage_live(array) array = [const 1i32, const 2i32, const 3i32, const 4i32, const 5i32, const 6i32] @@ -1385,6 +1592,8 @@ fn main() } else { storage_dead(_7) storage_dead(_8) + storage_dead(_10) + storage_dead(_9) panic(core::panicking::panic) } storage_dead(_7) @@ -1394,6 +1603,8 @@ fn main() storage_dead(_3) storage_dead(slice) storage_dead(array) + storage_dead(_10) + storage_dead(_9) return } diff --git a/charon/tests/ui/statics.out b/charon/tests/ui/statics.out index 4fc3b541a..cea1c8a84 100644 --- a/charon/tests/ui/statics.out +++ b/charon/tests/ui/statics.out @@ -5,6 +5,7 @@ fn CONST() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -27,10 +28,13 @@ fn constant() storage_live(_6) storage_live(_7) + storage_live(_7) storage_live(_8) _8 = copy CONST _7 = &_8 + storage_dead(_8) _6 = move _7 + storage_live(_0) storage_live(_5) _0 = () storage_live(_val) @@ -47,6 +51,9 @@ fn constant() storage_dead(_ref_mut) storage_dead(_ref) storage_dead(_val) + storage_dead(_5) + storage_dead(_7) + storage_dead(_6) return } @@ -55,6 +62,7 @@ fn SHARED_STATIC() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -76,6 +84,7 @@ fn shared_static() let _8: &'6 usize; // anonymous local let _9: &'7 usize; // anonymous local + storage_live(_0) _0 = () storage_live(_val) storage_live(_2) @@ -102,6 +111,9 @@ fn shared_static() storage_dead(_4) storage_dead(_ref) storage_dead(_val) + storage_dead(_9) + storage_dead(_8) + storage_dead(_7) return } @@ -110,6 +122,7 @@ fn MUT_STATIC() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -137,6 +150,7 @@ fn mut_static() let _14: *mut usize; // anonymous local let _15: *mut usize; // anonymous local + storage_live(_0) _0 = () storage_live(_val) storage_live(_2) @@ -179,6 +193,11 @@ fn mut_static() storage_dead(_4) storage_dead(_ref) storage_dead(_val) + storage_dead(_15) + storage_dead(_14) + storage_dead(_13) + storage_dead(_12) + storage_dead(_11) return } @@ -190,6 +209,7 @@ fn FOO() -> Foo { let _0: Foo; // return + storage_live(_0) _0 = Foo { } return } @@ -203,8 +223,10 @@ fn method<'_0>(self: &'_0 Foo) let _0: (); // return let self: &'1 Foo; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -216,6 +238,7 @@ fn non_copy_static() let _2: &'2 Foo; // anonymous local let _3: &'3 Foo; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -226,6 +249,7 @@ fn non_copy_static() _0 = method<'5>(move _1) storage_dead(_1) storage_dead(_2) + storage_dead(_3) return } diff --git a/charon/tests/ui/stealing.out b/charon/tests/ui/stealing.out index 673bebd18..9cfca72b3 100644 --- a/charon/tests/ui/stealing.out +++ b/charon/tests/ui/stealing.out @@ -6,6 +6,7 @@ fn SLICE() -> [(); 4usize] let _0: [(); 4usize]; // return let _1: (); // anonymous local + storage_live(_0) storage_live(_1) _1 = () _0 = @ArrayRepeat<(), 4usize>(move _1) @@ -22,9 +23,11 @@ fn four() -> usize let _0: usize; // return let _1: usize; // anonymous local + storage_live(_0) storage_live(_1) _1 = const 2usize panic.+ const 2usize _0 = move _1 + storage_dead(_1) return } @@ -34,6 +37,7 @@ fn BAR() -> [(); 42usize] let _0: [(); 42usize]; // return let _1: (); // anonymous local + storage_live(_0) storage_live(_1) _1 = () _0 = @ArrayRepeat<(), 42usize>(move _1) @@ -49,6 +53,7 @@ fn FOO() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 42usize return } diff --git a/charon/tests/ui/string-literal.out b/charon/tests/ui/string-literal.out index 9cf9d2456..fbea2a4e8 100644 --- a/charon/tests/ui/string-literal.out +++ b/charon/tests/ui/string-literal.out @@ -24,6 +24,7 @@ fn FOO() -> &'static str { let _0: &'1 str; // return + storage_live(_0) _0 = const "hello" return } @@ -40,6 +41,7 @@ fn BAR() -> &'static [u8] let _3: [u8; 5usize]; // anonymous local let _4: &'5 [u8; 5usize]; // anonymous local + storage_live(_0) storage_live(_1) storage_live(_2) storage_live(_3) @@ -51,6 +53,8 @@ fn BAR() -> &'static [u8] _0 = @ArrayToSliceShared<'_, u8, 5usize>(move _1) storage_dead(_2) storage_dead(_1) + storage_dead(_4) + storage_dead(_3) return } @@ -65,6 +69,7 @@ fn main() let _2: &'1 str; // anonymous local let _3: &'2 str; // anonymous local + storage_live(_0) _0 = () storage_live(_s) storage_live(_2) diff --git a/charon/tests/ui/traits.out b/charon/tests/ui/traits.out index dd5605221..c40361475 100644 --- a/charon/tests/ui/traits.out +++ b/charon/tests/ui/traits.out @@ -104,9 +104,11 @@ where let _0: (); // return let _1: &'1 mut (A, B); // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for A}::drop_glue<'2>] (*_1).0 drop[{built_in impl Destruct for B}::drop_glue<'3>] (*_1).1 + storage_dead(_1) return } @@ -135,7 +137,9 @@ where let _0: bool; // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = const true + storage_dead(self) return } @@ -145,7 +149,9 @@ pub fn impl_BoolTrait_for_bool::get_bool<'_0>(self: &'_0 bool) -> bool let _0: bool; // return let self: &'1 bool; // arg #1 + storage_live(_0) _0 = copy (*self) + storage_dead(self) return } @@ -155,7 +161,9 @@ pub fn impl_BoolTrait_for_bool::ret_true<'_0>(self: &'_0 bool) -> bool let _0: bool; // return let self: &'1 bool; // arg #1 + storage_live(_0) _0 = const true + storage_dead(self) return } @@ -176,6 +184,7 @@ pub fn test_bool_trait_bool(x: bool) -> bool let _3: &'1 bool; // anonymous local let _4: &'2 bool; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &x @@ -185,6 +194,7 @@ pub fn test_bool_trait_bool(x: bool) -> bool storage_dead(_3) _0 = const false storage_dead(_2) + storage_dead(x) return } storage_dead(_3) @@ -193,6 +203,7 @@ pub fn test_bool_trait_bool(x: bool) -> bool _0 = impl_BoolTrait_for_bool::ret_true<'6>(move _4) storage_dead(_4) storage_dead(_2) + storage_dead(x) return } @@ -204,15 +215,18 @@ where let _0: bool; // return let self: &'1 Option[TraitClause0]; // arg #1 + storage_live(_0) match (*self) { Option::None => { }, Option::Some => { _0 = const true + storage_dead(self) return }, } _0 = const false + storage_dead(self) return } @@ -224,7 +238,9 @@ where let _0: bool; // return let self: &'1 Option[TraitClause0]; // arg #1 + storage_live(_0) _0 = const true + storage_dead(self) return } @@ -250,6 +266,7 @@ where let _3: &'1 Option[TraitClause0]; // anonymous local let _4: &'2 Option[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &x @@ -266,6 +283,7 @@ where } storage_dead(_2) conditional_drop[impl_Destruct_for_Option::drop_glue<'8, T>[TraitClause0]] x + storage_dead(x) return } @@ -279,11 +297,13 @@ where let x: T; // arg #1 let _2: &'1 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &x _0 = TraitClause1::get_bool<'2>(move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T}::drop_glue<'4>] x + storage_dead(x) return } @@ -301,7 +321,9 @@ pub fn impl_ToU64_for_u64::to_u64(self: u64) -> u64 let _0: u64; // return let self: u64; // arg #1 + storage_live(_0) _0 = copy self + storage_dead(self) return } @@ -326,6 +348,7 @@ where let _5: A; // anonymous local let _6: u64; // anonymous local + storage_live(_0) storage_live(_6) storage_live(_2) storage_live(_3) @@ -342,6 +365,8 @@ where storage_dead(_4) storage_dead(_2) conditional_drop[impl_Destruct_for_tuple::drop_glue<'3, A, A>[TraitClause0]] self + storage_dead(_6) + storage_dead(self) return } @@ -365,11 +390,13 @@ where let x: (T, T); // arg #1 let _2: (T, T); // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = impl_ToU64_for_tuple::to_u64[TraitClause0, TraitClause1](move _2) storage_dead(_2) conditional_drop[impl_Destruct_for_tuple::drop_glue<'1, T, T>[TraitClause0]] x + storage_dead(x) return } @@ -383,11 +410,13 @@ where let x: (T, T); // arg #1 let _2: (T, T); // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = TraitClause1::to_u64(move _2) storage_dead(_2) conditional_drop[impl_Destruct_for_tuple::drop_glue<'1, T, T>[TraitClause0]] x + storage_dead(x) return } @@ -398,10 +427,12 @@ pub fn h0(x: u64) -> u64 let x: u64; // arg #1 let _2: u64; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy x _0 = impl_ToU64_for_u64::to_u64(move _2) storage_dead(_2) + storage_dead(x) return } @@ -421,8 +452,10 @@ where let _0: (); // return let _1: &'1 mut Wrapper[TraitClause0]; // arg #1 + storage_live(_0) _0 = () drop[{built_in impl Destruct for T}::drop_glue<'2>] ((*_1)).x + storage_dead(_1) return } @@ -445,11 +478,13 @@ where let self: Wrapper[TraitClause0]; // arg #1 let _2: T; // anonymous local + storage_live(_0) storage_live(_2) _2 = move (self).x _0 = TraitClause1::to_u64(move _2) storage_dead(_2) conditional_drop[impl_Destruct_for_Wrapper::drop_glue<'1, T>[TraitClause0]] self + storage_dead(self) return } @@ -471,10 +506,12 @@ pub fn h1(x: Wrapper[{built_in impl Sized for u64}]) -> u64 let x: Wrapper[{built_in impl Sized for u64}]; // arg #1 let _2: Wrapper[{built_in impl Sized for u64}]; // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = impl_ToU64_for_Wrapper::to_u64[{built_in impl Sized for u64}, impl_ToU64_for_u64](move _2) storage_dead(_2) + storage_dead(x) return } @@ -488,11 +525,13 @@ where let x: Wrapper[TraitClause0]; // arg #1 let _2: Wrapper[TraitClause0]; // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = impl_ToU64_for_Wrapper::to_u64[TraitClause0, TraitClause1](move _2) storage_dead(_2) conditional_drop[impl_Destruct_for_Wrapper::drop_glue<'1, T>[TraitClause0]] x + storage_dead(x) return } @@ -512,10 +551,12 @@ pub fn impl_ToType_bool_for_u64::to_type(self: u64) -> bool let self: u64; // arg #1 let _2: u64; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy self _0 = move _2 > const 0u64 storage_dead(_2) + storage_dead(self) return } @@ -547,11 +588,13 @@ where let y: T2; // arg #1 let _2: T2; // anonymous local + storage_live(_0) storage_live(_2) _2 = move y _0 = TraitClause2::of_type[TraitClause1, TraitClause3, TraitClause0](move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T2}::drop_glue<'1>] y + storage_dead(y) return } @@ -578,11 +621,13 @@ where let y: T2; // arg #1 let _2: T2; // anonymous local + storage_live(_0) storage_live(_2) _2 = move y _0 = TraitClause2::of_type[TraitClause0](move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for T2}::drop_glue<'1>] y + storage_dead(y) return } @@ -606,10 +651,12 @@ fn impl_TestTrait_for_TestType1::test<'_0>(self: &'_0 TestType1) -> bool let self: &'1 TestType1; // arg #1 let _2: u64; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy ((*self)).0 _0 = move _2 > const 1u64 storage_dead(_2) + storage_dead(self) return } @@ -628,6 +675,7 @@ where let _7: u64; // anonymous local let _8: &'3 TestType1; // anonymous local + storage_live(_0) storage_live(x_3) storage_live(_4) // Remark: we can't write: impl TestTrait for TestType, @@ -658,6 +706,8 @@ where storage_dead(y) storage_dead(x_3) conditional_drop[{built_in impl Destruct for T}::drop_glue<'8>] x_2 + storage_dead(x_2) + storage_dead(self) return } @@ -691,10 +741,12 @@ where let self: BoolWrapper; // arg #1 let _2: bool; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy (self).0 _0 = TraitClause1::to_type(move _2) storage_dead(_2) + storage_dead(self) return } @@ -732,6 +784,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 32usize return } @@ -749,8 +802,11 @@ pub fn impl_WithConstTy_for_bool::f<'_0, '_1>(_1: &'_0 mut u64, _2: &'_1 [u8; 32 let _1: &'1 mut u64; // arg #1 let _2: &'3 [u8; 32usize]; // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(_2) + storage_dead(_1) return } @@ -759,6 +815,7 @@ pub fn LEN1() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 12usize return } @@ -788,6 +845,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const TraitClause1::LEN1 return } @@ -801,9 +859,11 @@ where let _0: (); // return let _1: TraitClause1::W; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for TraitClause1::W}::drop_glue<'0>] _1 + storage_dead(_1) return } @@ -817,11 +877,13 @@ where let x: TraitClause1::W; // arg #1 let _2: TraitClause1::W; // anonymous local + storage_live(_0) storage_live(_2) _2 = move x _0 = TraitClause1::ImpliedClause3::to_u64(move _2) storage_dead(_2) conditional_drop[{built_in impl Destruct for TraitClause1::W}::drop_glue<'1>] x + storage_dead(x) return } @@ -834,8 +896,10 @@ where let _0: (); // return let _x: &'1 T; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_x) return } @@ -849,8 +913,10 @@ where let _0: (); // return let _x: u32; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_x) return } @@ -891,10 +957,12 @@ where let x: &'1 T; // arg #1 let _2: &'2 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = TraitClause1::ImpliedClause1::get_name<'3>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -908,10 +976,12 @@ where let x: &'1 T; // arg #1 let _2: &'2 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = TraitClause1::ImpliedClause1::get_w<'3>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -926,6 +996,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -1045,7 +1116,9 @@ pub fn convert(x: u32) -> u32 let _0: u32; // return let x: u32; // arg #1 + storage_live(_0) _0 = copy x + storage_dead(x) return } @@ -1108,10 +1181,12 @@ where let x: &'1 T; // arg #1 let _2: &'2 T; // anonymous local + storage_live(_0) storage_live(_2) _2 = &(*x) _0 = TraitClause1::get_w<'3>(move _2) storage_dead(_2) + storage_dead(x) return } @@ -1130,6 +1205,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const N return } @@ -1158,6 +1234,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -1188,6 +1265,7 @@ where { let _0: usize; // return + storage_live(_0) _0 = copy impl_Trait_for_Wrapper::LEN[TraitClause0, TraitClause1] return } @@ -1211,6 +1289,7 @@ where { let _0: Result[TraitClause0, {built_in impl Sized for i32}]; // return + storage_live(_0) _0 = Result::Err { 0: const 0i32 } return } @@ -1232,6 +1311,7 @@ where { let _0: Result[TraitClause0, {built_in impl Sized for i32}]; // return + storage_live(_0) _0 = copy FOO[TraitClause0, TraitClause1, TraitClause2] return } @@ -1245,6 +1325,7 @@ where { let _0: Result[TraitClause1, {built_in impl Sized for i32}]; // return + storage_live(_0) _0 = copy FOO[TraitClause1, TraitClause0, TraitClause2] return } @@ -1274,6 +1355,8 @@ pub fn flabada<'a>(_x: &'a ()) -> Wrapper<(bool, &'a ())>[{built_in impl Sized f let _0: Wrapper<(bool, &'9 ())>[{built_in impl Sized for (bool, &'9 ())}]; // return let _x: &'12 (); // arg #1 + storage_live(_0) + storage_dead(_x) panic(core::panicking::panic) } @@ -1287,9 +1370,11 @@ where let _0: (); // return let _1: F; // arg #1 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for F}::drop_glue<'0>] _1 + storage_dead(_1) return } @@ -1299,6 +1384,7 @@ pub fn flibidi() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = call<'0, for<'a> flabada<'a>>[{built_in impl Sized for for<'a> flabada<'a>}, {built_in impl Fn<(&'0 (),)> for for<'a> flabada<'a>}](const flabada<'93>) @@ -1324,6 +1410,7 @@ where { let _0: TraitClause1::Output; // return + storage_live(_0) panic(core::panicking::panic) } diff --git a/charon/tests/ui/traits/default-method-with-item-bound.2.out b/charon/tests/ui/traits/default-method-with-item-bound.2.out index 5c2ef08f0..9f70c7f66 100644 --- a/charon/tests/ui/traits/default-method-with-item-bound.2.out +++ b/charon/tests/ui/traits/default-method-with-item-bound.2.out @@ -49,6 +49,7 @@ where let _0: TraitClause2::Assoc2; // return let self: &'1 Self; // arg #1 + storage_live(_0) loop { continue 0 } @@ -72,6 +73,7 @@ where let _0: TraitClause2::Assoc2; // return let self: &'1 Empty[TraitClause0]; // arg #1 + storage_live(_0) loop { continue 0 } @@ -98,6 +100,7 @@ where let _0: TraitClause1::Assoc2; // return let self: &'1 (); // arg #1 + storage_live(_0) loop { continue 0 } diff --git a/charon/tests/ui/traits/default-method-with-item-bound.3.out b/charon/tests/ui/traits/default-method-with-item-bound.3.out index 0171f114e..6048e62eb 100644 --- a/charon/tests/ui/traits/default-method-with-item-bound.3.out +++ b/charon/tests/ui/traits/default-method-with-item-bound.3.out @@ -51,8 +51,10 @@ where let _0: (); // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -76,8 +78,10 @@ where let _0: (); // return let self: &'1 Empty[TraitClause0]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/traits/default-method-with-item-bound.4.out b/charon/tests/ui/traits/default-method-with-item-bound.4.out index 034692c66..3e43fc77c 100644 --- a/charon/tests/ui/traits/default-method-with-item-bound.4.out +++ b/charon/tests/ui/traits/default-method-with-item-bound.4.out @@ -57,8 +57,10 @@ where let _0: (); // return let self: &'1 mut Empty[TraitClause0]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/traits/default-method-with-item-bound.5.out b/charon/tests/ui/traits/default-method-with-item-bound.5.out index 4161d13d8..c7402e228 100644 --- a/charon/tests/ui/traits/default-method-with-item-bound.5.out +++ b/charon/tests/ui/traits/default-method-with-item-bound.5.out @@ -84,8 +84,10 @@ where let _0: (); // return let self: &'3 mut Iter<'4, T>[TraitClause0]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/traits/default-method-with-item-bound.6.out b/charon/tests/ui/traits/default-method-with-item-bound.6.out index 9964b51de..8a124e3a9 100644 --- a/charon/tests/ui/traits/default-method-with-item-bound.6.out +++ b/charon/tests/ui/traits/default-method-with-item-bound.6.out @@ -49,6 +49,7 @@ where let _2: (); // anonymous local let _3: &'2 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -57,6 +58,7 @@ where storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -69,8 +71,10 @@ where let _0: (); // return let self: &'1 (); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -85,6 +89,7 @@ where let _2: (); // anonymous local let _3: &'2 (); // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -93,6 +98,7 @@ where storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/traits/default-method-with-item-bound.out b/charon/tests/ui/traits/default-method-with-item-bound.out index 54455663d..15ea478ee 100644 --- a/charon/tests/ui/traits/default-method-with-item-bound.out +++ b/charon/tests/ui/traits/default-method-with-item-bound.out @@ -62,8 +62,10 @@ where let _0: (); // return let self: &'1 Self; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -76,8 +78,10 @@ where let _0: (); // return let self: &'1 Option[TraitClause0]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -101,8 +105,10 @@ where let _0: (); // return let self: &'1 String; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/traits/issue-1242-dyn-send-supertrait.out b/charon/tests/ui/traits/issue-1242-dyn-send-supertrait.out index d5380de43..fca11d931 100644 --- a/charon/tests/ui/traits/issue-1242-dyn-send-supertrait.out +++ b/charon/tests/ui/traits/issue-1242-dyn-send-supertrait.out @@ -37,6 +37,7 @@ fn foo<'_0>(x: &'_0 (dyn Trait + '_0)) -> &'_0 (dyn Send + '_0) let _3: &'12 (dyn Send + '13); // anonymous local let _4: &'14 (dyn Trait + '15); // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -47,6 +48,7 @@ fn foo<'_0>(x: &'_0 (dyn Trait + '_0)) -> &'_0 (dyn Send + '_0) _0 = unsize_cast<&'10 (dyn Send + '11), &'20 (dyn Send + '21), at []>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(x) return } diff --git a/charon/tests/ui/traits/issue-513-gat-clause-mismatch.out b/charon/tests/ui/traits/issue-513-gat-clause-mismatch.out index c72742ecb..3eb9f9343 100644 --- a/charon/tests/ui/traits/issue-513-gat-clause-mismatch.out +++ b/charon/tests/ui/traits/issue-513-gat-clause-mismatch.out @@ -61,8 +61,10 @@ where let _0: (); // return let _1: &'1 TraitClause1::Type[TraitClause2]; // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(_1) return } @@ -71,6 +73,7 @@ fn main() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return diff --git a/charon/tests/ui/traits/issue-513-method-clause-mismatch-and-default-call.out b/charon/tests/ui/traits/issue-513-method-clause-mismatch-and-default-call.out index 02e933202..a736f598a 100644 --- a/charon/tests/ui/traits/issue-513-method-clause-mismatch-and-default-call.out +++ b/charon/tests/ui/traits/issue-513-method-clause-mismatch-and-default-call.out @@ -48,11 +48,13 @@ where let self: &'1 Self; // arg #1 let _2: &'2 Self; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &(*self) with_metadata(copy self.metadata) _0 = TraitClause0::fold<'3>[TraitClause1](move _2) storage_dead(_2) + storage_dead(self) return } @@ -62,8 +64,10 @@ fn fold<'_0>(self: &'_0 ()) let _0: (); // return let self: &'1 (); // arg #1 + storage_live(_0) _0 = () _0 = () + storage_dead(self) return } @@ -76,11 +80,13 @@ where let self: &'1 (); // arg #1 let _2: &'2 (); // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = &(*self) _0 = fold<'3>(move _2) storage_dead(_2) + storage_dead(self) return } diff --git a/charon/tests/ui/traits/issue-513-method-clause-mismatch.out b/charon/tests/ui/traits/issue-513-method-clause-mismatch.out index c95999a86..132cd3060 100644 --- a/charon/tests/ui/traits/issue-513-method-clause-mismatch.out +++ b/charon/tests/ui/traits/issue-513-method-clause-mismatch.out @@ -55,9 +55,12 @@ where let self: (); // arg #1 let _other: T; // arg #2 + storage_live(_0) _0 = () _0 = () conditional_drop[{built_in impl Destruct for T}::drop_glue<'0>] _other + storage_dead(_other) + storage_dead(self) return } @@ -75,6 +78,7 @@ fn main() let _1: (); // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) diff --git a/charon/tests/ui/traits/issue-513-method-late-bound-mismatch.out b/charon/tests/ui/traits/issue-513-method-late-bound-mismatch.out index 260dba9bc..b91642194 100644 --- a/charon/tests/ui/traits/issue-513-method-late-bound-mismatch.out +++ b/charon/tests/ui/traits/issue-513-method-late-bound-mismatch.out @@ -27,8 +27,11 @@ fn method(self: (), _other: &'static u32) let self: (); // arg #1 let _other: &'1 u32; // arg #2 + storage_live(_0) _0 = () _0 = () + storage_dead(_other) + storage_dead(self) return } @@ -54,10 +57,13 @@ fn main() storage_live(_6) storage_live(_7) + storage_live(_7) storage_live(_8) _8 = const 1u32 _7 = &_8 + storage_dead(_8) _6 = move _7 + storage_live(_0) storage_live(_5) _0 = () storage_live(_1) @@ -74,6 +80,9 @@ fn main() storage_dead(_4) storage_dead(_1) _0 = () + storage_dead(_5) + storage_dead(_7) + storage_dead(_6) return } diff --git a/charon/tests/ui/traits/pointee-metadata-bounds.out b/charon/tests/ui/traits/pointee-metadata-bounds.out index 4055d7dad..058c649f4 100644 --- a/charon/tests/ui/traits/pointee-metadata-bounds.out +++ b/charon/tests/ui/traits/pointee-metadata-bounds.out @@ -141,6 +141,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -153,6 +154,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = assert_copy<{built_in impl Pointee for T}::Metadata>[{built_in impl Pointee for T}::ImpliedClause0, {built_in impl Pointee for T}::ImpliedClause2]() return diff --git a/charon/tests/ui/traits/remove-self-clause-on-closure.out b/charon/tests/ui/traits/remove-self-clause-on-closure.out index 1d7f62dbd..cf71a0f82 100644 --- a/charon/tests/ui/traits/remove-self-clause-on-closure.out +++ b/charon/tests/ui/traits/remove-self-clause-on-closure.out @@ -81,11 +81,13 @@ pub fn test_crate::Trait::method<'_0, Self>(self: &'_0 Self) let self: &'1 Self; // arg #1 let _2: closure; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = closure { } storage_dead(_2) _0 = () + storage_dead(self) return } @@ -95,7 +97,9 @@ unsafe fn drop_glue<'_0, Self>(_1: &'_0 mut closure) let _0: (); // return let _1: &'1 mut closure; // arg #1 + storage_live(_0) _0 = () + storage_dead(_1) return } @@ -106,7 +110,10 @@ fn call<'_0, Self>(_1: &'_0 closure, tupled_args: ()) -> usize let _1: &'1 closure; // arg #1 let tupled_args: (); // arg #2 + storage_live(_0) _0 = const 0usize + storage_dead(tupled_args) + storage_dead(_1) return } @@ -118,9 +125,13 @@ fn call_mut<'_0, Self>(state: &'_0 mut closure, args: ()) -> usize let args: (); // arg #2 let _3: &'0 closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &(*state) _0 = call<'2, Self>(move _3, move args) + storage_dead(_3) + storage_dead(args) + storage_dead(state) return } @@ -132,10 +143,14 @@ fn call_once(_1: closure, _2: ()) -> usize let _2: (); // arg #2 let _3: &'1 mut closure; // anonymous local + storage_live(_0) storage_live(_3) _3 = &mut _1 _0 = call_mut<'2, Self>(move _3, move _2) drop[drop_glue<'4, Self>] _1 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -182,11 +197,13 @@ pub fn impl_Trait_for_unit::method<'_0>(self: &'_0 ()) let self: &'1 (); // arg #1 let _2: closure<()>; // anonymous local + storage_live(_0) _0 = () storage_live(_2) _2 = closure { } storage_dead(_2) _0 = () + storage_dead(self) return } diff --git a/charon/tests/ui/traits/remove-unused-clauses.out b/charon/tests/ui/traits/remove-unused-clauses.out index f9139f6db..3ec9294f0 100644 --- a/charon/tests/ui/traits/remove-unused-clauses.out +++ b/charon/tests/ui/traits/remove-unused-clauses.out @@ -24,6 +24,7 @@ fn callee() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -35,6 +36,7 @@ pub fn caller() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = callee() @@ -50,6 +52,7 @@ pub fn recursive() let _1: bool; // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const false @@ -74,6 +77,7 @@ pub fn swap_recursive() let _1: bool; // anonymous local let _2: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const false @@ -106,6 +110,7 @@ pub fn clause_dep() let _0: (); // return let _1: bool; // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = const false diff --git a/charon/tests/ui/traits_special.out b/charon/tests/ui/traits_special.out index b4e18a3b0..a6d9740e9 100644 --- a/charon/tests/ui/traits_special.out +++ b/charon/tests/ui/traits_special.out @@ -41,10 +41,12 @@ pub fn from<'_0>(v: &'_0 bool) -> Result[{built_in impl Sized for bool let v: &'1 bool; // arg #1 let _2: bool; // anonymous local + storage_live(_0) storage_live(_2) _2 = copy (*v) _0 = Result::Ok { 0: move _2 } storage_dead(_2) + storage_dead(v) return } diff --git a/charon/tests/ui/type-id.out b/charon/tests/ui/type-id.out index 4f5559fca..f987af314 100644 --- a/charon/tests/ui/type-id.out +++ b/charon/tests/ui/type-id.out @@ -17,6 +17,7 @@ where { let ret: TypeId; // return + storage_live(ret) ret = const TypeId(T) return } @@ -33,9 +34,13 @@ where storage_live(_1) storage_live(_2) + storage_live(_2) _2 = type_id[TraitClause0]() _1 = move _2 + storage_live(_0) _0 = move _1 + storage_dead(_2) + storage_dead(_1) return } @@ -52,6 +57,7 @@ fn type_id_u32() -> TypeId { let _0: TypeId; // return + storage_live(_0) _0 = of[{built_in impl MetaSized for u32}]() return } @@ -64,6 +70,7 @@ where { let _0: TypeId; // return + storage_live(_0) _0 = of[TraitClause0::ImpliedClause0]() return } diff --git a/charon/tests/ui/type_inference_is_order_dependent.out b/charon/tests/ui/type_inference_is_order_dependent.out index 833e6c34f..94ee68ad7 100644 --- a/charon/tests/ui/type_inference_is_order_dependent.out +++ b/charon/tests/ui/type_inference_is_order_dependent.out @@ -95,6 +95,7 @@ where let _13: [u8; 4usize]; // anonymous local let _14: &'26 [u8; 4usize]; // anonymous local + storage_live(_0) _0 = () storage_live(_1) storage_live(_2) @@ -138,6 +139,8 @@ where storage_dead(args_3) storage_dead(_1) _0 = () + storage_dead(_14) + storage_dead(_13) return } @@ -194,6 +197,7 @@ where { let _0: (); // return + storage_live(_0) _0 = () _0 = test[TraitClause0, {built_in impl Sized for bool}, TraitClause3, impl_Right_for_T[TraitClause0, {built_in impl Sized for bool}, impl_Default_for_bool, {impl#4}], impl_Default_for_bool, {impl#4}]() return diff --git a/charon/tests/ui/typenum.out b/charon/tests/ui/typenum.out index 1800c2618..42ce41cf2 100644 --- a/charon/tests/ui/typenum.out +++ b/charon/tests/ui/typenum.out @@ -20,6 +20,7 @@ pub fn foo() { let _0: (); // return + storage_live(_0) _0 = () _0 = () return @@ -31,6 +32,7 @@ pub fn main() let _0: (); // return let _1: (); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = foo, B0>, B0>, B0>, B0>, B0>>() diff --git a/charon/tests/ui/unions.out b/charon/tests/ui/unions.out index 3af37a1e2..860c046a1 100644 --- a/charon/tests/ui/unions.out +++ b/charon/tests/ui/unions.out @@ -13,6 +13,7 @@ fn use_union() let one: Foo; // local let _two: [u32; 2usize]; // local + storage_live(_0) _0 = () storage_live(one) one = Foo { one: const 42u64 } diff --git a/charon/tests/ui/unsafe.out b/charon/tests/ui/unsafe.out index 39077b983..6fd46abcb 100644 --- a/charon/tests/ui/unsafe.out +++ b/charon/tests/ui/unsafe.out @@ -209,6 +209,7 @@ fn call_unsafe_fn() let _2: u32; // anonymous local let _3: *const u32; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = null[{impl#1}[{built_in impl Pointee for u32 where Metadata = ()}]]() @@ -230,6 +231,7 @@ fn deref_raw_ptr() let x: *const u32; // local let _2: u32; // anonymous local + storage_live(_0) _0 = () storage_live(x) x = null[{impl#1}[{built_in impl Pointee for u32 where Metadata = ()}]]() @@ -259,6 +261,7 @@ fn COUNTER() -> usize { let _0: usize; // return + storage_live(_0) _0 = const 0usize return } @@ -274,6 +277,7 @@ fn access_mutable_static() let _2: usize; // anonymous local let _3: *mut usize; // anonymous local + storage_live(_0) storage_live(_2) _0 = () storage_live(_1) @@ -284,6 +288,8 @@ fn access_mutable_static() (*_1) = move _2 storage_dead(_1) _0 = () + storage_dead(_2) + storage_dead(_3) return } @@ -300,6 +306,7 @@ fn access_union_field() let one: Foo; // local let _two: [u32; 2usize]; // local + storage_live(_0) _0 = () storage_live(one) one = Foo { one: const 42u64 } @@ -315,6 +322,7 @@ fn test_crate::assume() { let _0: (); // return + storage_live(_0) _0 = () _0 = core::intrinsics::assume(const true) return diff --git a/charon/tests/ui/unsize.out b/charon/tests/ui/unsize.out index 8bb3b511f..c3f349a58 100644 --- a/charon/tests/ui/unsize.out +++ b/charon/tests/ui/unsize.out @@ -97,6 +97,7 @@ fn foo() let _21: String; // anonymous local let _22: &'24 String; // anonymous local + storage_live(_0) _0 = () storage_live(array) array = @ArrayRepeat(const 0i32) diff --git a/charon/tests/ui/unsized-string-consts.out b/charon/tests/ui/unsized-string-consts.out index 5752e7229..bb85aaed7 100644 --- a/charon/tests/ui/unsized-string-consts.out +++ b/charon/tests/ui/unsized-string-consts.out @@ -27,6 +27,7 @@ fn FOO() -> &'static str let _2: &'_ [u8; 5usize]; // anonymous local let _3: &'2 str; // anonymous local + storage_live(_0) storage_live(_1) _1 = const RawMemory(0x68, 0x65, 0x6c, 0x6c, 0x6f) storage_live(_2) @@ -34,6 +35,9 @@ fn FOO() -> &'static str storage_live(_3) _3 = unsize_cast<&'_ [u8; 5usize], &'2 str, 5usize>(move _2) _0 = move _3 + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -49,6 +53,7 @@ fn BAR() -> &'static [u8] let _3: [u8; 5usize]; // anonymous local let _4: &'5 [u8; 5usize]; // anonymous local + storage_live(_0) storage_live(_1) storage_live(_2) storage_live(_3) @@ -60,6 +65,8 @@ fn BAR() -> &'static [u8] _0 = @ArrayToSliceShared<'_, u8, 5usize>(move _1) storage_dead(_2) storage_dead(_1) + storage_dead(_4) + storage_dead(_3) return } @@ -77,6 +84,7 @@ fn main() let _5: &'_ [u8; 5usize]; // anonymous local let _6: &'3 str; // anonymous local + storage_live(_0) _0 = () storage_live(_s) storage_live(_2) @@ -95,6 +103,9 @@ fn main() _0 = () conditional_drop[drop_glue<'6>] _s storage_dead(_s) + storage_dead(_6) + storage_dead(_5) + storage_dead(_4) return } diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.out b/charon/tests/ui/unsupported/issue-79-bound-regions.out index 16262cd81..6d1923ed2 100644 --- a/charon/tests/ui/unsupported/issue-79-bound-regions.out +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.out @@ -61,10 +61,13 @@ fn main() storage_live(_9) storage_live(_10) + storage_live(_10) storage_live(_11) _11 = [const 0i32] _10 = &_11 + storage_dead(_11) _9 = move _10 + storage_live(_0) storage_live(_8) _0 = () storage_live(slice) @@ -90,6 +93,9 @@ fn main() storage_dead(_4) _0 = () storage_dead(slice) + storage_dead(_8) + storage_dead(_10) + storage_dead(_9) return } diff --git a/charon/tests/ui/variadics.out b/charon/tests/ui/variadics.out index d9bb7aedf..1eb1c6f23 100644 --- a/charon/tests/ui/variadics.out +++ b/charon/tests/ui/variadics.out @@ -107,6 +107,7 @@ pub unsafe extern "C" fn sum(...) -> i32 let _7: i32; // anonymous local let _8: i32; // anonymous local + storage_live(_0) storage_live(_8) storage_live(a) storage_live(_3) @@ -129,6 +130,8 @@ pub unsafe extern "C" fn sum(...) -> i32 storage_dead(b) storage_dead(a) conditional_drop[drop_glue<'20, '21>] ap + storage_dead(_8) + storage_dead(ap) return } @@ -146,6 +149,7 @@ pub fn call() let _4: (); // anonymous local let _5: unsafe extern "C" fn(u32, u64, ...); // anonymous local + storage_live(_0) _0 = () storage_live(_1) _1 = sum(const 1i32, const 2i32) diff --git a/charon/tests/ui/vec-reconstruct-move-values.out b/charon/tests/ui/vec-reconstruct-move-values.out index 0156cf1ae..357d65f64 100644 --- a/charon/tests/ui/vec-reconstruct-move-values.out +++ b/charon/tests/ui/vec-reconstruct-move-values.out @@ -65,6 +65,7 @@ fn move_values(flag: bool) let _17: [NoCopy; 1usize]; // anonymous local let _18: alloc::boxed::Box<[NoCopy; 1usize]>[{built_in impl MetaSized for [NoCopy; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(x_2) x_2 = NoCopy { 0: const 4u8 } @@ -77,6 +78,7 @@ fn move_values(flag: bool) storage_live(_16) _16 = @BoxNew<[NoCopy; 1usize]>[{built_in impl MetaSized for [NoCopy; 1usize]}, {built_in impl Sized for Global}](move _15) storage_live(ret_9) + storage_live(ret_9) storage_live(x_10) storage_live(y_11) storage_dead(_15) @@ -84,6 +86,8 @@ fn move_values(flag: bool) storage_dead(_16) y_11 = unsize_cast[{built_in impl MetaSized for [NoCopy; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[NoCopy]>[{built_in impl MetaSized for [NoCopy]}, {built_in impl Sized for Global}], 1usize>(move x_10) ret_9 = into_vec[{built_in impl Sized for NoCopy}, {built_in impl Sized for Global}](move y_11) + storage_dead(y_11) + storage_dead(x_10) _v = move ret_9 storage_live(_5) _5 = copy flag @@ -99,6 +103,7 @@ fn move_values(flag: bool) storage_live(_18) _18 = @BoxNew<[NoCopy; 1usize]>[{built_in impl MetaSized for [NoCopy; 1usize]}, {built_in impl Sized for Global}](move _17) storage_live(ret_12) + storage_live(ret_12) storage_live(x_13) storage_live(y_14) storage_dead(_17) @@ -106,6 +111,8 @@ fn move_values(flag: bool) storage_dead(_18) y_14 = unsize_cast[{built_in impl MetaSized for [NoCopy; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[NoCopy]>[{built_in impl MetaSized for [NoCopy]}, {built_in impl Sized for Global}], 1usize>(move x_13) ret_12 = into_vec[{built_in impl Sized for NoCopy}, {built_in impl Sized for Global}](move y_14) + storage_dead(y_14) + storage_dead(x_13) _w = move ret_12 _0 = () conditional_drop[impl_Destruct_for_Vec::drop_glue<'6, NoCopy, Global>[{built_in impl Sized for NoCopy}, {built_in impl Sized for Global}]] _w @@ -118,6 +125,9 @@ fn move_values(flag: bool) conditional_drop[impl_Destruct_for_Vec::drop_glue<'4, NoCopy, Global>[{built_in impl Sized for NoCopy}, {built_in impl Sized for Global}]] _v storage_dead(_v) storage_dead(x_2) + storage_dead(flag) + storage_dead(ret_12) + storage_dead(ret_9) return } diff --git a/charon/tests/ui/vec-reconstruct-multiple-adjacent.out b/charon/tests/ui/vec-reconstruct-multiple-adjacent.out index 770f61f80..8e2086dba 100644 --- a/charon/tests/ui/vec-reconstruct-multiple-adjacent.out +++ b/charon/tests/ui/vec-reconstruct-multiple-adjacent.out @@ -88,6 +88,7 @@ fn multiple_adjacent() let _17: [u8; 1usize]; // anonymous local let _18: alloc::boxed::Box<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_a) storage_live(_13) @@ -95,6 +96,7 @@ fn multiple_adjacent() storage_live(_14) _14 = @BoxNew<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}](move _13) storage_live(ret_4) + storage_live(ret_4) storage_live(x_5) storage_live(y_6) storage_dead(_13) @@ -102,6 +104,8 @@ fn multiple_adjacent() storage_dead(_14) y_6 = unsize_cast[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 1usize>(move x_5) ret_4 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y_6) + storage_dead(y_6) + storage_dead(x_5) _a = move ret_4 storage_live(_b) storage_live(_15) @@ -109,6 +113,7 @@ fn multiple_adjacent() storage_live(_16) _16 = @BoxNew<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}](move _15) storage_live(ret_7) + storage_live(ret_7) storage_live(x_8) storage_live(y_9) storage_dead(_15) @@ -116,6 +121,8 @@ fn multiple_adjacent() storage_dead(_16) y_9 = unsize_cast[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 1usize>(move x_8) ret_7 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y_9) + storage_dead(y_9) + storage_dead(x_8) _b = move ret_7 storage_live(_c) storage_live(_17) @@ -123,6 +130,7 @@ fn multiple_adjacent() storage_live(_18) _18 = @BoxNew<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}](move _17) storage_live(ret_10) + storage_live(ret_10) storage_live(x_11) storage_live(y_12) storage_dead(_17) @@ -130,6 +138,8 @@ fn multiple_adjacent() storage_dead(_18) y_12 = unsize_cast[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 1usize>(move x_11) ret_10 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y_12) + storage_dead(y_12) + storage_dead(x_11) _c = move ret_10 _0 = () conditional_drop[impl_Destruct_for_Vec::drop_glue<'8, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}]] _c @@ -138,6 +148,9 @@ fn multiple_adjacent() storage_dead(_b) conditional_drop[impl_Destruct_for_Vec::drop_glue<'10, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}]] _a storage_dead(_a) + storage_dead(ret_10) + storage_dead(ret_7) + storage_dead(ret_4) return } @@ -152,6 +165,7 @@ fn multiple_values() let _5: [u8; 3usize]; // anonymous local let _6: alloc::boxed::Box<[u8; 3usize]>[{built_in impl MetaSized for [u8; 3usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_a) storage_live(_5) @@ -159,6 +173,7 @@ fn multiple_values() storage_live(_6) _6 = @BoxNew<[u8; 3usize]>[{built_in impl MetaSized for [u8; 3usize]}, {built_in impl Sized for Global}](move _5) storage_live(ret) + storage_live(ret) storage_live(x) storage_live(y) storage_dead(_5) @@ -166,10 +181,13 @@ fn multiple_values() storage_dead(_6) y = unsize_cast[{built_in impl MetaSized for [u8; 3usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 3usize>(move x) ret = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y) + storage_dead(y) + storage_dead(x) _a = move ret _0 = () conditional_drop[impl_Destruct_for_Vec::drop_glue<'2, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}]] _a storage_dead(_a) + storage_dead(ret) return } @@ -178,6 +196,7 @@ fn foo() -> u8 { let _0: u8; // return + storage_live(_0) _0 = const 42u8 return } @@ -195,6 +214,7 @@ fn with_fn_calls() let _7: [u8; 2usize]; // anonymous local let _8: alloc::boxed::Box<[u8; 2usize]>[{built_in impl MetaSized for [u8; 2usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_a) storage_live(_2) @@ -208,6 +228,7 @@ fn with_fn_calls() storage_live(_8) _8 = @BoxNew<[u8; 2usize]>[{built_in impl MetaSized for [u8; 2usize]}, {built_in impl Sized for Global}](move _7) storage_live(ret) + storage_live(ret) storage_live(x) storage_live(y) storage_dead(_7) @@ -215,10 +236,13 @@ fn with_fn_calls() storage_dead(_8) y = unsize_cast[{built_in impl MetaSized for [u8; 2usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 2usize>(move x) ret = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y) + storage_dead(y) + storage_dead(x) _a = move ret _0 = () conditional_drop[impl_Destruct_for_Vec::drop_glue<'3, u8, Global>[{built_in impl Sized for u8}, {built_in impl Sized for Global}]] _a storage_dead(_a) + storage_dead(ret) return } @@ -228,6 +252,7 @@ fn repeated() let _0: (); // return let _a: Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; // local + storage_live(_0) _0 = () storage_live(_a) _a = from_elem[{built_in impl Sized for u8}, impl_Clone_for_u8](const 1u8, const 3usize) diff --git a/charon/tests/ui/vec-reconstruct-nested.out b/charon/tests/ui/vec-reconstruct-nested.out index 17c749ba6..9044e4f37 100644 --- a/charon/tests/ui/vec-reconstruct-nested.out +++ b/charon/tests/ui/vec-reconstruct-nested.out @@ -60,6 +60,7 @@ fn nested_vecs() let _17: [u8; 1usize]; // anonymous local let _18: alloc::boxed::Box<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_nested) storage_live(_2) @@ -68,6 +69,7 @@ fn nested_vecs() storage_live(_16) _16 = @BoxNew<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}](move _15) storage_live(ret_4) + storage_live(ret_4) storage_live(x_5) storage_live(y_6) storage_dead(_15) @@ -75,6 +77,8 @@ fn nested_vecs() storage_dead(_16) y_6 = unsize_cast[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 1usize>(move x_5) ret_4 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y_6) + storage_dead(y_6) + storage_dead(x_5) _2 = move ret_4 storage_live(_3) storage_live(_17) @@ -82,6 +86,7 @@ fn nested_vecs() storage_live(_18) _18 = @BoxNew<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}](move _17) storage_live(ret_7) + storage_live(ret_7) storage_live(x_8) storage_live(y_9) storage_dead(_17) @@ -89,6 +94,8 @@ fn nested_vecs() storage_dead(_18) y_9 = unsize_cast[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 1usize>(move x_8) ret_7 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y_9) + storage_dead(y_9) + storage_dead(x_8) _3 = move ret_7 storage_live(_13) _13 = [move _2, move _3] @@ -99,6 +106,7 @@ fn nested_vecs() storage_live(_14) _14 = @BoxNew<[Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 2usize]>[{built_in impl MetaSized for [Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 2usize]}, {built_in impl Sized for Global}](move _13) storage_live(ret_10) + storage_live(ret_10) storage_live(x_11) storage_live(y_12) storage_dead(_13) @@ -106,10 +114,15 @@ fn nested_vecs() storage_dead(_14) y_12 = unsize_cast[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 2usize]>[{built_in impl MetaSized for [Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 2usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]]>[{built_in impl MetaSized for [Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]]}, {built_in impl Sized for Global}], 2usize>(move x_11) ret_10 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}], Global>[{built_in impl Sized for Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]}, {built_in impl Sized for Global}](move y_12) + storage_dead(y_12) + storage_dead(x_11) _nested = move ret_10 _0 = () conditional_drop[impl_Destruct_for_Vec::drop_glue<'10, Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}], Global>[{built_in impl Sized for Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]}, {built_in impl Sized for Global}]] _nested storage_dead(_nested) + storage_dead(ret_10) + storage_dead(ret_7) + storage_dead(ret_4) return } @@ -130,6 +143,7 @@ fn nested_single() let _11: [u8; 1usize]; // anonymous local let _12: alloc::boxed::Box<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}]; // anonymous local + storage_live(_0) _0 = () storage_live(_nested) storage_live(_2) @@ -138,6 +152,7 @@ fn nested_single() storage_live(_12) _12 = @BoxNew<[u8; 1usize]>[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}](move _11) storage_live(ret_3) + storage_live(ret_3) storage_live(x_4) storage_live(y_5) storage_dead(_11) @@ -145,6 +160,8 @@ fn nested_single() storage_dead(_12) y_5 = unsize_cast[{built_in impl MetaSized for [u8; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[u8]>[{built_in impl MetaSized for [u8]}, {built_in impl Sized for Global}], 1usize>(move x_4) ret_3 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}](move y_5) + storage_dead(y_5) + storage_dead(x_4) _2 = move ret_3 storage_live(_9) _9 = [move _2] @@ -153,6 +170,7 @@ fn nested_single() storage_live(_10) _10 = @BoxNew<[Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 1usize]>[{built_in impl MetaSized for [Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 1usize]}, {built_in impl Sized for Global}](move _9) storage_live(ret_6) + storage_live(ret_6) storage_live(x_7) storage_live(y_8) storage_dead(_9) @@ -160,10 +178,14 @@ fn nested_single() storage_dead(_10) y_8 = unsize_cast[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 1usize]>[{built_in impl MetaSized for [Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]; 1usize]}, {built_in impl Sized for Global}], alloc::boxed::Box<[Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]]>[{built_in impl MetaSized for [Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]]}, {built_in impl Sized for Global}], 1usize>(move x_7) ret_6 = into_vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}], Global>[{built_in impl Sized for Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]}, {built_in impl Sized for Global}](move y_8) + storage_dead(y_8) + storage_dead(x_7) _nested = move ret_6 _0 = () conditional_drop[impl_Destruct_for_Vec::drop_glue<'6, Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}], Global>[{built_in impl Sized for Vec[{built_in impl Sized for u8}, {built_in impl Sized for Global}]}, {built_in impl Sized for Global}]] _nested storage_dead(_nested) + storage_dead(ret_6) + storage_dead(ret_3) return } diff --git a/charon/tests/ui/vtable-simple.out b/charon/tests/ui/vtable-simple.out index 5cfa51a28..c7700a2cd 100644 --- a/charon/tests/ui/vtable-simple.out +++ b/charon/tests/ui/vtable-simple.out @@ -63,6 +63,7 @@ where let _3: i32; // anonymous local let _4: &'4 T; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy (*self) panic.+ const 1i32 (*self) = move _3 @@ -70,6 +71,9 @@ where _4 = &(*arg) _0 = TraitClause1::clone<'5>(move _4) storage_dead(_4) + storage_dead(_3) + storage_dead(arg) + storage_dead(self) return } @@ -84,9 +88,13 @@ where let _2: &'_1 T; // arg #2 let _3: &'_0 mut i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = concretize<&'_0 mut (dyn Modifiable + '1), &'_0 mut i32>(move _1) _0 = modify<'_0, '_1, T>[TraitClause0, TraitClause1](move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -100,9 +108,12 @@ where let dyn_self: &'_0 mut (dyn Modifiable + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Modifiable + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -118,6 +129,7 @@ where let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Modifiable + '1)); // anonymous local let _4: fn<'_0_1, '_1_1>(&'_0_1 mut (dyn Modifiable + '4), &'_1_1 T) -> T; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -127,6 +139,10 @@ where storage_live(_4) _4 = cast {vtable_method}<'2, '3, T>[TraitClause0, TraitClause1], fn<'_0_1, '_1_1>(&'_0_1 mut (dyn Modifiable + '4), &'_1_1 T) -> T>(const {vtable_method}<'2, '3, T>[TraitClause0, TraitClause1]) ret = test_crate::Modifiable::{vtable} { size: move size, align: move align, drop: move _3, method_modify: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -164,6 +180,7 @@ where let _6: &'10 mut (dyn Modifiable + '11); // anonymous local let _7: &'12 T; // anonymous local + storage_live(_0) storage_live(x) storage_live(_3) storage_live(_4) @@ -183,6 +200,7 @@ where storage_dead(_6) storage_dead(_5) storage_dead(x) + storage_dead(arg) return } @@ -200,10 +218,13 @@ fn main() storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = const 42i32 _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_1) @@ -217,6 +238,9 @@ fn main() storage_dead(_3) storage_dead(_1) _0 = () + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } diff --git a/charon/tests/ui/vtable_drop.out b/charon/tests/ui/vtable_drop.out index 76c9dfc88..60b7b893b 100644 --- a/charon/tests/ui/vtable_drop.out +++ b/charon/tests/ui/vtable_drop.out @@ -114,6 +114,7 @@ where let _6: alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]; // anonymous local let _7: alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_5) storage_live(_6) @@ -128,6 +129,12 @@ where _4 = &(*arg) _0 = TraitClause1::clone<'5>(move _4) storage_dead(_4) + storage_dead(_7) + storage_dead(_6) + storage_dead(_5) + storage_dead(_3) + storage_dead(arg) + storage_dead(self) return } @@ -143,9 +150,13 @@ where let _2: &'_1 T; // arg #2 let _3: &'_0 mut alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]; // anonymous local + storage_live(_0) storage_live(_3) _3 = concretize<&'_0 mut (dyn Modifiable + '1), &'_0 mut alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]>(move _1) _0 = modify<'_0, '_1, T>[TraitClause0, TraitClause1, TraitClause2](move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -160,10 +171,13 @@ where let dyn_self: &'_0 mut (dyn Modifiable + '0); // arg #1 let target_self: &'_0 mut alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Modifiable + '1), &'_0 mut alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]>(move dyn_self) drop[impl_Destruct_for_Box::drop_glue<'3, i32, Global>[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]] (*target_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -180,6 +194,7 @@ where let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Modifiable + '1)); // anonymous local let _4: fn<'_0_1, '_1_1>(&'_0_1 mut (dyn Modifiable + '4), &'_1_1 T) -> T; // anonymous local + storage_live(ret) storage_live(size) size = size_of[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]> storage_live(align) @@ -189,6 +204,10 @@ where storage_live(_4) _4 = cast {vtable_method}<'2, '3, T>[TraitClause0, TraitClause1, TraitClause2], fn<'_0_1, '_1_1>(&'_0_1 mut (dyn Modifiable + '4), &'_1_1 T) -> T>(const {vtable_method}<'2, '3, T>[TraitClause0, TraitClause1, TraitClause2]) ret = test_crate::Modifiable::{vtable} { size: move size, align: move align, drop: move _3, method_modify: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for alloc::boxed::Box[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -231,6 +250,7 @@ where let _6: &'10 mut (dyn Modifiable + '11); // anonymous local let _7: &'12 T; // anonymous local + storage_live(_0) storage_live(x) storage_live(_3) storage_live(_4) @@ -251,6 +271,7 @@ where drop[impl_Destruct_for_Box::drop_glue<'21, i32, Global>[{built_in impl MetaSized for i32}, {built_in impl Sized for Global}, {built_in impl Destruct for i32}, impl_Destruct_for_Global]] _5 storage_dead(_5) storage_dead(x) + storage_dead(arg) return } @@ -268,10 +289,13 @@ fn main() storage_live(_5) storage_live(_6) + storage_live(_6) storage_live(_7) _7 = const 42i32 _6 = &_7 + storage_dead(_7) _5 = move _6 + storage_live(_0) storage_live(_4) _0 = () storage_live(_1) @@ -285,6 +309,9 @@ fn main() storage_dead(_3) storage_dead(_1) _0 = () + storage_dead(_4) + storage_dead(_6) + storage_dead(_5) return } diff --git a/charon/tests/ui/vtables.out b/charon/tests/ui/vtables.out index 3d04060c0..cc1032500 100644 --- a/charon/tests/ui/vtables.out +++ b/charon/tests/ui/vtables.out @@ -127,6 +127,7 @@ fn super_method<'_0>(self: &'_0 i32, arg: i32) -> i32 let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(_5) storage_live(_3) _3 = copy (*self) @@ -136,6 +137,9 @@ fn super_method<'_0>(self: &'_0 i32, arg: i32) -> i32 _0 = move _5 storage_dead(_4) storage_dead(_3) + storage_dead(_5) + storage_dead(arg) + storage_dead(self) return } @@ -147,9 +151,13 @@ fn impl_Super_i32_for_i32::super_method::{vtable_method}<'_0>(_1: &'_0 (dyn Supe let _2: i32; // arg #2 let _3: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = concretize<&'_0 (dyn Super + '1), &'_0 i32>(move _1) _0 = super_method<'_0>(move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -160,9 +168,12 @@ unsafe fn impl_Super_i32_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (dy let dyn_self: &'_0 mut (dyn Super + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Super + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -175,6 +186,7 @@ fn impl_Super_i32_for_i32::{vtable}() -> test_crate::Super::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Super + '1)); // anonymous local let _4: fn<'_0_1>(&'_0_1 (dyn Super + '3), i32) -> i32; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -184,6 +196,10 @@ fn impl_Super_i32_for_i32::{vtable}() -> test_crate::Super::{vtable} storage_live(_4) _4 = cast impl_Super_i32_for_i32::super_method::{vtable_method}<'2>, fn<'_0_1>(&'_0_1 (dyn Super + '3), i32) -> i32>(const impl_Super_i32_for_i32::super_method::{vtable_method}<'2>) ret = test_crate::Super::{vtable} { size: move size, align: move align, drop: move _3, method_super_method: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -206,6 +222,7 @@ fn check<'_0>(self: &'_0 i32) -> bool let _2: i32; // anonymous local let _3: &'2 i32; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) _3 = &(*self) @@ -213,6 +230,7 @@ fn check<'_0>(self: &'_0 i32) -> bool storage_dead(_3) _0 = move _2 > const 0i32 storage_dead(_2) + storage_dead(self) return } @@ -223,9 +241,12 @@ fn impl_Checkable_i32_for_i32::check::{vtable_method}<'_0>(_1: &'_0 (dyn Checkab let _1: &'_0 (dyn Checkable + '0); // arg #1 let _2: &'_0 i32; // anonymous local + storage_live(_0) storage_live(_2) _2 = concretize<&'_0 (dyn Checkable + '1), &'_0 i32>(move _1) _0 = check<'_0>(move _2) + storage_dead(_2) + storage_dead(_1) return } @@ -236,9 +257,12 @@ unsafe fn impl_Checkable_i32_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut let dyn_self: &'_0 mut (dyn Checkable + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Checkable + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -252,6 +276,7 @@ fn impl_Checkable_i32_for_i32::{vtable}() -> test_crate::Checkable::{vtable}(&'_0_1 (dyn Checkable + '3)) -> bool; // anonymous local let _5: &'static test_crate::Super::{vtable}; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -263,6 +288,11 @@ fn impl_Checkable_i32_for_i32::{vtable}() -> test_crate::Checkable::{vtable}(self: &'_0 i32) let _2: bool; // anonymous local let _3: i32; // anonymous local + storage_live(_0) _0 = () storage_live(_2) storage_live(_3) @@ -310,11 +341,13 @@ fn dummy<'_0>(self: &'_0 i32) if move _2 { } else { storage_dead(_3) + storage_dead(self) panic(core::panicking::panic) } storage_dead(_3) storage_dead(_2) _0 = () + storage_dead(self) return } @@ -337,6 +370,7 @@ where let _3: &'9 (dyn NoParam + '10); // anonymous local let _4: &'11 T; // anonymous local + storage_live(_0) storage_live(_2) storage_live(_3) storage_live(_4) @@ -347,6 +381,7 @@ where _0 = unsize_cast<&'7 (dyn NoParam + '8), &'15 (dyn NoParam + '16), at []>(move _2) storage_dead(_3) storage_dead(_2) + storage_dead(arg) return } @@ -379,6 +414,7 @@ where let _3: i32; // anonymous local let _4: &'4 T; // anonymous local + storage_live(_0) storage_live(_3) _3 = copy (*self) panic.+ const 1i32 (*self) = move _3 @@ -386,6 +422,9 @@ where _4 = &(*arg) _0 = TraitClause1::clone<'5>(move _4) storage_dead(_4) + storage_dead(_3) + storage_dead(arg) + storage_dead(self) return } @@ -400,9 +439,13 @@ where let _2: &'_1 T; // arg #2 let _3: &'_0 mut i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = concretize<&'_0 mut (dyn Modifiable + '1), &'_0 mut i32>(move _1) _0 = modify<'_0, '_1, T>[TraitClause0, TraitClause1](move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -416,9 +459,12 @@ where let dyn_self: &'_0 mut (dyn Modifiable + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Modifiable + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -434,6 +480,7 @@ where let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn Modifiable + '1)); // anonymous local let _4: fn<'_0_1, '_1_1>(&'_0_1 mut (dyn Modifiable + '4), &'_1_1 T) -> T; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -443,6 +490,10 @@ where storage_live(_4) _4 = cast impl_Modifiable_for_i32::modify::{vtable_method}<'2, '3, T>[TraitClause0, TraitClause1], fn<'_0_1, '_1_1>(&'_0_1 mut (dyn Modifiable + '4), &'_1_1 T) -> T>(const impl_Modifiable_for_i32::modify::{vtable_method}<'2, '3, T>[TraitClause0, TraitClause1]) ret = test_crate::Modifiable::{vtable} { size: move size, align: move align, drop: move _3, method_modify: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -480,6 +531,7 @@ where let _6: &'10 mut (dyn Modifiable + '11); // anonymous local let _7: &'12 T; // anonymous local + storage_live(_0) storage_live(x) storage_live(_3) storage_live(_4) @@ -499,6 +551,7 @@ where storage_dead(_6) storage_dead(_5) storage_dead(x) + storage_dead(arg) return } @@ -554,6 +607,7 @@ where let _8: &'8 Self; // anonymous local let _9: &'9 i64; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -574,6 +628,9 @@ where storage_dead(_8) storage_dead(_7) _0 = () + storage_dead(t64) + storage_dead(t32) + storage_dead(self) return } @@ -587,6 +644,7 @@ fn impl_BaseOn_i32_for_i32::operate_on<'_0, '_1>(self: &'_0 i32, t: &'_1 i32) let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -598,12 +656,16 @@ fn impl_BaseOn_i32_for_i32::operate_on<'_0, '_1>(self: &'_0 i32, t: &'_1 i32) } else { storage_dead(_5) storage_dead(_4) + storage_dead(t) + storage_dead(self) panic(core::panicking::panic) } storage_dead(_5) storage_dead(_4) storage_dead(_3) _0 = () + storage_dead(t) + storage_dead(self) return } @@ -615,10 +677,14 @@ fn impl_BaseOn_i32_for_i32::operate_on::{vtable_method}<'_0, '_1>(_1: &'_0 (dyn let _2: &'_1 i32; // arg #2 let _3: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = concretize<&'_0 (dyn BaseOn + '1), &'_0 i32>(move _1) _0 = impl_BaseOn_i32_for_i32::operate_on<'_0, '_1>(move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -629,9 +695,12 @@ unsafe fn impl_BaseOn_i32_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (d let dyn_self: &'_0 mut (dyn BaseOn + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn BaseOn + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -644,6 +713,7 @@ fn impl_BaseOn_i32_for_i32::{vtable}() -> test_crate::BaseOn::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn BaseOn + '1)); // anonymous local let _4: fn<'_0_1, '_1_1>(&'_0_1 (dyn BaseOn + '4), &'_1_1 i32); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -653,6 +723,10 @@ fn impl_BaseOn_i32_for_i32::{vtable}() -> test_crate::BaseOn::{vtable} storage_live(_4) _4 = cast impl_BaseOn_i32_for_i32::operate_on::{vtable_method}<'2, '3>, fn<'_0_1, '_1_1>(&'_0_1 (dyn BaseOn + '4), &'_1_1 i32)>(const impl_BaseOn_i32_for_i32::operate_on::{vtable_method}<'2, '3>) ret = test_crate::BaseOn::{vtable} { size: move size, align: move align, drop: move _3, method_operate_on: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -678,6 +752,7 @@ fn impl_BaseOn_i64_for_i32::operate_on<'_0, '_1>(self: &'_0 i32, t: &'_1 i64) let _5: i32; // anonymous local let _6: i64; // anonymous local + storage_live(_0) _0 = () storage_live(_3) storage_live(_4) @@ -692,12 +767,16 @@ fn impl_BaseOn_i64_for_i32::operate_on<'_0, '_1>(self: &'_0 i32, t: &'_1 i64) } else { storage_dead(_6) storage_dead(_4) + storage_dead(t) + storage_dead(self) panic(core::panicking::panic) } storage_dead(_6) storage_dead(_4) storage_dead(_3) _0 = () + storage_dead(t) + storage_dead(self) return } @@ -709,10 +788,14 @@ fn impl_BaseOn_i64_for_i32::operate_on::{vtable_method}<'_0, '_1>(_1: &'_0 (dyn let _2: &'_1 i64; // arg #2 let _3: &'_0 i32; // anonymous local + storage_live(_0) _0 = () storage_live(_3) _3 = concretize<&'_0 (dyn BaseOn + '1), &'_0 i32>(move _1) _0 = impl_BaseOn_i64_for_i32::operate_on<'_0, '_1>(move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -723,9 +806,12 @@ unsafe fn impl_BaseOn_i64_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut (d let dyn_self: &'_0 mut (dyn BaseOn + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn BaseOn + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -738,6 +824,7 @@ fn impl_BaseOn_i64_for_i32::{vtable}() -> test_crate::BaseOn::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn BaseOn + '1)); // anonymous local let _4: fn<'_0_1, '_1_1>(&'_0_1 (dyn BaseOn + '4), &'_1_1 i64); // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -747,6 +834,10 @@ fn impl_BaseOn_i64_for_i32::{vtable}() -> test_crate::BaseOn::{vtable} storage_live(_4) _4 = cast impl_BaseOn_i64_for_i32::operate_on::{vtable_method}<'2, '3>, fn<'_0_1, '_1_1>(&'_0_1 (dyn BaseOn + '4), &'_1_1 i64)>(const impl_BaseOn_i64_for_i32::operate_on::{vtable_method}<'2, '3>) ret = test_crate::BaseOn::{vtable} { size: move size, align: move align, drop: move _3, method_operate_on: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -768,9 +859,12 @@ unsafe fn impl_Both32And64_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut ( let dyn_self: &'_0 mut (dyn Both32And64 + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn Both32And64 + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -784,6 +878,7 @@ fn impl_Both32And64_for_i32::{vtable}() -> test_crate::Both32And64::{vtable} let _4: &'static test_crate::BaseOn::{vtable}; // anonymous local let _5: &'static test_crate::BaseOn::{vtable}; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -795,6 +890,11 @@ fn impl_Both32And64_for_i32::{vtable}() -> test_crate::Both32And64::{vtable} storage_live(_5) _5 = &impl_BaseOn_i64_for_i32::{vtable} ret = test_crate::Both32And64::{vtable} { size: move size, align: move align, drop: move _3, method_both_operate: const Opaque(shim for default methods aren't yet supported), super_trait_0: const &vtable_of({built_in impl MetaSized for i32}), super_trait_1: move _4, super_trait_2: move _5 } + storage_dead(align) + storage_dead(size) + storage_dead(_5) + storage_dead(_4) + storage_dead(_3) return } @@ -815,6 +915,7 @@ fn impl_Both32And64_for_i32::both_operate<'_0, '_1, '_2>(self: &'_0 i32, t32: &' let _8: &'8 i32; // anonymous local let _9: &'9 i64; // anonymous local + storage_live(_0) _0 = () storage_live(_4) storage_live(_5) @@ -835,6 +936,9 @@ fn impl_Both32And64_for_i32::both_operate<'_0, '_1, '_2>(self: &'_0 i32, t32: &' storage_dead(_8) storage_dead(_7) _0 = () + storage_dead(t64) + storage_dead(t32) + storage_dead(self) return } @@ -883,6 +987,7 @@ fn lifetime_method<'a, '_1>(self: &'_1 i32, arg: &'a i32) -> &'a i32 let _4: i32; // anonymous local let _5: i32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = copy (*self) @@ -893,12 +998,16 @@ fn lifetime_method<'a, '_1>(self: &'_1 i32, arg: &'a i32) -> &'a i32 } else { storage_dead(_5) storage_dead(_4) + storage_dead(arg) + storage_dead(self) panic(core::panicking::panic) } storage_dead(_5) storage_dead(_4) storage_dead(_3) _0 = copy arg + storage_dead(arg) + storage_dead(self) return } @@ -910,9 +1019,13 @@ fn impl_LifetimeTrait_for_i32::lifetime_method::{vtable_method}<'a, '_1>(_1: &'_ let _2: &'a i32; // arg #2 let _3: &'_1 i32; // anonymous local + storage_live(_0) storage_live(_3) _3 = concretize<&'_1 (dyn LifetimeTrait + '1), &'_1 i32>(move _1) _0 = lifetime_method<'a, '_1>(move _3, move _2) + storage_dead(_3) + storage_dead(_2) + storage_dead(_1) return } @@ -923,9 +1036,12 @@ unsafe fn impl_LifetimeTrait_for_i32::{vtable_drop_shim}<'_0>(dyn_self: &'_0 mut let dyn_self: &'_0 mut (dyn LifetimeTrait + '0); // arg #1 let target_self: &'_0 mut i32; // local + storage_live(ret) ret = () storage_live(target_self) target_self = concretize<&'_0 mut (dyn LifetimeTrait + '1), &'_0 mut i32>(move dyn_self) + storage_dead(target_self) + storage_dead(dyn_self) return } @@ -938,6 +1054,7 @@ fn impl_LifetimeTrait_for_i32::{vtable}() -> test_crate::LifetimeTrait::{vtable} let _3: unsafe fn<'_0_1>(&'_0_1 mut (dyn LifetimeTrait + '1)); // anonymous local let _4: fn<'a, '_1_1>(&'_1_1 (dyn LifetimeTrait + '4), &'a i32) -> &'a i32; // anonymous local + storage_live(ret) storage_live(size) size = size_of storage_live(align) @@ -947,6 +1064,10 @@ fn impl_LifetimeTrait_for_i32::{vtable}() -> test_crate::LifetimeTrait::{vtable} storage_live(_4) _4 = cast impl_LifetimeTrait_for_i32::lifetime_method::{vtable_method}<'2, '3>, fn<'a, '_1_1>(&'_1_1 (dyn LifetimeTrait + '4), &'a i32) -> &'a i32>(const impl_LifetimeTrait_for_i32::lifetime_method::{vtable_method}<'2, '3>) ret = test_crate::LifetimeTrait::{vtable} { size: move size, align: move align, drop: move _3, method_lifetime_method: move _4, super_trait_0: const &vtable_of({built_in impl MetaSized for i32}) } + storage_dead(align) + storage_dead(size) + storage_dead(_4) + storage_dead(_3) return } @@ -972,6 +1093,7 @@ fn use_lifetime_trait<'a, '_1>(x: &'_1 (dyn LifetimeTrait + '_1), y: & let _4: &'9 (dyn LifetimeTrait + '10); // anonymous local let _5: &'11 i32; // anonymous local + storage_live(_0) storage_live(_3) storage_live(_4) _4 = &(*x) with_metadata(copy x.metadata) @@ -982,6 +1104,8 @@ fn use_lifetime_trait<'a, '_1>(x: &'_1 (dyn LifetimeTrait + '_1), y: & storage_dead(_5) storage_dead(_4) storage_dead(_3) + storage_dead(y) + storage_dead(x) return } @@ -1007,16 +1131,21 @@ fn use_alias<'_0>(x: &'_0 (dyn Both32And64 + '_0)) storage_live(_11) storage_live(_14) + storage_live(_14) storage_live(_15) _15 = const 200i64 _14 = &_15 + storage_dead(_15) _11 = move _14 storage_live(_10) storage_live(_12) + storage_live(_12) storage_live(_13) _13 = const 100i32 _12 = &_13 + storage_dead(_13) _10 = move _12 + storage_live(_0) storage_live(_8) storage_live(_9) _0 = () @@ -1041,6 +1170,13 @@ fn use_alias<'_0>(x: &'_0 (dyn Both32And64 + '_0)) storage_dead(_5) storage_dead(_2) _0 = () + storage_dead(_9) + storage_dead(_8) + storage_dead(x) + storage_dead(_14) + storage_dead(_12) + storage_dead(_11) + storage_dead(_10) return } @@ -1163,10 +1299,13 @@ fn main() storage_live(_86) storage_live(_95) + storage_live(_95) storage_live(_96) _96 = const 42i32 _95 = &_96 + storage_dead(_96) _86 = move _95 + storage_live(_0) storage_live(_77) storage_live(_78) storage_live(_79) @@ -1193,6 +1332,47 @@ fn main() if move _4 { } else { storage_dead(_5) + storage_dead(_85) + storage_dead(_84) + storage_dead(_83) + storage_dead(_82) + storage_dead(_81) + storage_dead(_80) + storage_dead(_79) + storage_dead(_78) + storage_dead(_77) + storage_dead(_76) + storage_dead(_75) + storage_dead(_74) + storage_dead(_73) + storage_dead(_72) + storage_dead(_71) + storage_dead(kind_70) + storage_dead(_37) + storage_dead(_36) + storage_dead(_35) + storage_dead(_34) + storage_dead(_33) + storage_dead(_32) + storage_dead(kind_31) + storage_dead(_111) + storage_dead(_109) + storage_dead(_107) + storage_dead(_105) + storage_dead(_103) + storage_dead(_101) + storage_dead(_99) + storage_dead(_97) + storage_dead(_95) + storage_dead(_94) + storage_dead(_93) + storage_dead(_92) + storage_dead(_91) + storage_dead(_90) + storage_dead(_89) + storage_dead(_88) + storage_dead(_87) + storage_dead(_86) panic(core::panicking::panic) } storage_dead(_5) @@ -1249,9 +1429,11 @@ fn main() _20 = (copy ((*_21.metadata)).method_modify)(move _21, move _22) storage_live(_87) storage_live(_97) + storage_live(_97) storage_live(_98) _98 = const 100i32 _97 = &_98 + storage_dead(_98) _87 = move _97 storage_dead(_22) storage_dead(_21) @@ -1290,13 +1472,56 @@ fn main() _35 = &(*_36) storage_live(_37) _37 = Option::None { } + storage_dead(_85) + storage_dead(_84) + storage_dead(_83) + storage_dead(_82) + storage_dead(_81) + storage_dead(_80) + storage_dead(_79) + storage_dead(_78) + storage_dead(_77) + storage_dead(_76) + storage_dead(_75) + storage_dead(_74) + storage_dead(_73) + storage_dead(_72) + storage_dead(_71) + storage_dead(kind_70) + storage_dead(_37) + storage_dead(_36) + storage_dead(_35) + storage_dead(_34) + storage_dead(_33) + storage_dead(_32) + storage_dead(kind_31) + storage_dead(_111) + storage_dead(_109) + storage_dead(_107) + storage_dead(_105) + storage_dead(_103) + storage_dead(_101) + storage_dead(_99) + storage_dead(_97) + storage_dead(_95) + storage_dead(_94) + storage_dead(_93) + storage_dead(_92) + storage_dead(_91) + storage_dead(_90) + storage_dead(_89) + storage_dead(_88) + storage_dead(_87) + storage_dead(_86) panic(core::panicking::assert_failed) } storage_live(_88) storage_live(_99) + storage_live(_99) storage_live(_100) _100 = const 42i32 _99 = &_100 + storage_dead(_100) _88 = move _99 storage_dead(_30) storage_dead(_29) @@ -1328,21 +1553,27 @@ fn main() _43 = (copy ((*_44.metadata)).method_dummy)(move _44) storage_live(_91) storage_live(_105) + storage_live(_105) storage_live(_106) _106 = const 200i64 _105 = &_106 + storage_dead(_106) _91 = move _105 storage_live(_90) storage_live(_103) + storage_live(_103) storage_live(_104) _104 = const 100i32 _103 = &_104 + storage_dead(_104) _90 = move _103 storage_live(_89) storage_live(_101) + storage_live(_101) storage_live(_102) _102 = const 42i32 _101 = &_102 + storage_dead(_102) _89 = move _101 storage_dead(_44) storage_dead(_43) @@ -1371,15 +1602,19 @@ fn main() _48 = (copy ((*_49.metadata)).method_both_operate)(move _49, move _50, move _52) storage_live(_93) storage_live(_109) + storage_live(_109) storage_live(_110) _110 = const 10i32 _109 = &_110 + storage_dead(_110) _93 = move _109 storage_live(_92) storage_live(_107) + storage_live(_107) storage_live(_108) _108 = const 42i32 _107 = &_108 + storage_dead(_108) _92 = move _107 storage_dead(_52) storage_dead(_50) @@ -1412,9 +1647,11 @@ fn main() _59 = use_lifetime_trait<'178, '179>(move _60, move _62) storage_live(_94) storage_live(_111) + storage_live(_111) storage_live(_112) _112 = const 10i32 _111 = &_112 + storage_dead(_112) _94 = move _111 storage_dead(_62) storage_dead(_60) @@ -1453,6 +1690,47 @@ fn main() _74 = &(*_75) storage_live(_76) _76 = Option::None { } + storage_dead(_85) + storage_dead(_84) + storage_dead(_83) + storage_dead(_82) + storage_dead(_81) + storage_dead(_80) + storage_dead(_79) + storage_dead(_78) + storage_dead(_77) + storage_dead(_76) + storage_dead(_75) + storage_dead(_74) + storage_dead(_73) + storage_dead(_72) + storage_dead(_71) + storage_dead(kind_70) + storage_dead(_37) + storage_dead(_36) + storage_dead(_35) + storage_dead(_34) + storage_dead(_33) + storage_dead(_32) + storage_dead(kind_31) + storage_dead(_111) + storage_dead(_109) + storage_dead(_107) + storage_dead(_105) + storage_dead(_103) + storage_dead(_101) + storage_dead(_99) + storage_dead(_97) + storage_dead(_95) + storage_dead(_94) + storage_dead(_93) + storage_dead(_92) + storage_dead(_91) + storage_dead(_90) + storage_dead(_89) + storage_dead(_88) + storage_dead(_87) + storage_dead(_86) panic(core::panicking::assert_failed) } storage_dead(_69) @@ -1470,6 +1748,47 @@ fn main() storage_dead(_9) storage_dead(y) storage_dead(x) + storage_dead(_85) + storage_dead(_84) + storage_dead(_83) + storage_dead(_82) + storage_dead(_81) + storage_dead(_80) + storage_dead(_79) + storage_dead(_78) + storage_dead(_77) + storage_dead(_76) + storage_dead(_75) + storage_dead(_74) + storage_dead(_73) + storage_dead(_72) + storage_dead(_71) + storage_dead(kind_70) + storage_dead(_37) + storage_dead(_36) + storage_dead(_35) + storage_dead(_34) + storage_dead(_33) + storage_dead(_32) + storage_dead(kind_31) + storage_dead(_111) + storage_dead(_109) + storage_dead(_107) + storage_dead(_105) + storage_dead(_103) + storage_dead(_101) + storage_dead(_99) + storage_dead(_97) + storage_dead(_95) + storage_dead(_94) + storage_dead(_93) + storage_dead(_92) + storage_dead(_91) + storage_dead(_90) + storage_dead(_89) + storage_dead(_88) + storage_dead(_87) + storage_dead(_86) return } storage_dead(_11) @@ -1479,6 +1798,47 @@ fn main() storage_dead(_15) storage_dead(_14) storage_dead(_12) + storage_dead(_85) + storage_dead(_84) + storage_dead(_83) + storage_dead(_82) + storage_dead(_81) + storage_dead(_80) + storage_dead(_79) + storage_dead(_78) + storage_dead(_77) + storage_dead(_76) + storage_dead(_75) + storage_dead(_74) + storage_dead(_73) + storage_dead(_72) + storage_dead(_71) + storage_dead(kind_70) + storage_dead(_37) + storage_dead(_36) + storage_dead(_35) + storage_dead(_34) + storage_dead(_33) + storage_dead(_32) + storage_dead(kind_31) + storage_dead(_111) + storage_dead(_109) + storage_dead(_107) + storage_dead(_105) + storage_dead(_103) + storage_dead(_101) + storage_dead(_99) + storage_dead(_97) + storage_dead(_95) + storage_dead(_94) + storage_dead(_93) + storage_dead(_92) + storage_dead(_91) + storage_dead(_90) + storage_dead(_89) + storage_dead(_88) + storage_dead(_87) + storage_dead(_86) panic(core::panicking::panic) }