Auto merge of #122551 - RayMuir:copy_fmt, r=saethlin

Added "copy" to Debug fmt for copy operands

In MIR's debug mode (--emit mir) the printing for Operands is slightly inconsistent.

The RValues - values on the right side of an Assign - are usually printed with their Operand when they are Places.

Example:
_2 = move _3

But for arguments, the operand is omitted.

_2 = _1

I propose a change be made, to display the place with the operand.

_2 = copy _1

Move and copy have different semantics, meaning this difference is important and helpful to the user. It also adds consistency to the pretty printing.

-- EDIT --

 Consider this example Rust program and its MIR output with the **updated pretty printer.**

This was generated with the arguments --emit mir --crate-type lib -Zmir-opt-level=0 (Otherwise, it's optimised away since it's a junk program).

```rust
fn main(foo: i32) {
    let v = 10;

    if v == 20 {
        foo;
    }
    else {
        v;
    }
}
```

```MIR
// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
fn main(_1: i32) -> () {
    debug foo => _1;
    let mut _0: ();
    let _2: i32;
    let mut _3: bool;
    let mut _4: i32;
    let _5: i32;
    let _6: i32;
    scope 1 {
        debug v => _2;
    }

    bb0: {
        StorageLive(_2);
        _2 = const 10_i32;
        StorageLive(_3);
        StorageLive(_4);
        _4 = copy _2;
        _3 = Eq(move _4, const 20_i32);
        switchInt(move _3) -> [0: bb2, otherwise: bb1];
    }

    bb1: {
        StorageDead(_4);
        StorageLive(_5);
        _5 = copy _1;
        StorageDead(_5);
        _0 = const ();
        goto -> bb3;
    }

    bb2: {
        StorageDead(_4);
        StorageLive(_6);
        _6 = copy _2;
        StorageDead(_6);
        _0 = const ();
        goto -> bb3;
    }

    bb3: {
        StorageDead(_3);
        StorageDead(_2);
        return;
    }
}
```

In this example program, we can see that when we move a place, it is preceded by "move". e.g. ``` _3 = Eq(move _4, const 20_i32);```. However, when we copy a place such as ```_5 = _1;```, it is not preceded by the operand in the original printout. I propose to change the print to include the copy ```_5 = copy _1``` as in this example.

Regarding the arguments part. When I originally submitted this PR, I was under the impression this only affected the print for arguments to a function, but actually, it affects anything that uses a copy. This is preferable anyway with regard to consistency. The PR is about making ```copy``` explicit.
This commit is contained in:
bors 2024-08-19 23:10:46 +00:00
commit 79611d90b6
725 changed files with 3926 additions and 3924 deletions

View File

@ -25,3 +25,5 @@ b2d2184edea578109a48ec3d8decbee5948e8f35
ec2cc761bc7067712ecc7734502f703fe3b024c8
# format use declarations
84ac80f1921afc243d71fd0caaa4f2838c294102
# bless mir-opt tests to add `copy`
99cb0c6bc399fb94a0ddde7e9b38e9c00d523bad

View File

@ -1159,7 +1159,7 @@ impl<'tcx> Debug for Operand<'tcx> {
use self::Operand::*;
match *self {
Constant(ref a) => write!(fmt, "{a:?}"),
Copy(ref place) => write!(fmt, "{place:?}"),
Copy(ref place) => write!(fmt, "copy {place:?}"),
Move(ref place) => write!(fmt, "move {place:?}"),
}
}

View File

@ -140,7 +140,7 @@ fn address_of_reborrow() -> () {
StorageLive(_6);
_6 = &raw const (*_1);
AscribeUserType(_6, o, UserTypeProjection { base: UserType(0), projs: [] });
_5 = _6;
_5 = copy _6;
StorageDead(_6);
StorageDead(_5);
StorageLive(_7);
@ -153,7 +153,7 @@ fn address_of_reborrow() -> () {
_9 = move _10 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_10);
AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] });
_8 = _9;
_8 = copy _9;
StorageDead(_9);
StorageDead(_8);
StorageLive(_11);
@ -194,7 +194,7 @@ fn address_of_reborrow() -> () {
StorageLive(_22);
_22 = &raw const (*_3);
AscribeUserType(_22, o, UserTypeProjection { base: UserType(10), projs: [] });
_21 = _22;
_21 = copy _22;
StorageDead(_22);
StorageDead(_21);
StorageLive(_23);
@ -207,7 +207,7 @@ fn address_of_reborrow() -> () {
_25 = move _26 as *const dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_26);
AscribeUserType(_25, o, UserTypeProjection { base: UserType(11), projs: [] });
_24 = _25;
_24 = copy _25;
StorageDead(_25);
StorageDead(_24);
StorageLive(_27);
@ -242,7 +242,7 @@ fn address_of_reborrow() -> () {
StorageLive(_36);
_36 = &raw mut (*_3);
AscribeUserType(_36, o, UserTypeProjection { base: UserType(20), projs: [] });
_35 = _36;
_35 = copy _36;
StorageDead(_36);
StorageDead(_35);
StorageLive(_37);
@ -255,7 +255,7 @@ fn address_of_reborrow() -> () {
_39 = move _40 as *mut dyn std::marker::Send (PointerCoercion(Unsize));
StorageDead(_40);
AscribeUserType(_39, o, UserTypeProjection { base: UserType(21), projs: [] });
_38 = _39;
_38 = copy _39;
StorageDead(_39);
StorageDead(_38);
StorageLive(_41);

View File

@ -33,17 +33,17 @@ fn main() -> () {
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
_6 = _3;
_6 = copy _3;
_5 = foo(move _6) -> [return: bb1, unwind unreachable];
}
bb1: {
StorageDead(_6);
StorageLive(_7);
_7 = _2;
_7 = copy _2;
_8 = Len(_1);
_9 = Lt(_7, _8);
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable];
_9 = Lt(copy _7, copy _8);
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb2, unwind unreachable];
}
bb2: {

View File

@ -33,17 +33,17 @@ fn main() -> () {
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
_6 = _3;
_6 = copy _3;
_5 = foo(move _6) -> [return: bb1, unwind continue];
}
bb1: {
StorageDead(_6);
StorageLive(_7);
_7 = _2;
_7 = copy _2;
_8 = Len(_1);
_9 = Lt(_7, _8);
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue];
_9 = Lt(copy _7, copy _8);
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb2, unwind continue];
}
bb2: {

View File

@ -15,7 +15,7 @@ fn main() {
// CHECK: debug x => [[x:_.*]];
// CHECK: debug y => [[y:_.*]];
// CHECK: [[y]] = const 1_usize;
// CHECK: [[tmp:_.*]] = [[y]];
// CHECK: [[tmp:_.*]] = copy [[y]];
// CHECK: [[x]][[[tmp]]] =
let mut x = [42, 43, 44];
let mut y = 1;

View File

@ -22,7 +22,7 @@ yields ()
bb0: {
StorageLive(_3);
_3 = (_1.0: i32);
_3 = copy (_1.0: i32);
FakeRead(ForLet(None), _3);
StorageLive(_4);
_4 = &_3;

View File

@ -22,7 +22,7 @@ yields ()
bb0: {
StorageLive(_3);
_3 = (_1.0: i32);
_3 = copy (_1.0: i32);
FakeRead(ForLet(None), _3);
StorageLive(_4);
_4 = &_3;

View File

@ -22,7 +22,7 @@ yields ()
bb0: {
StorageLive(_3);
_3 = (_1.0: i32);
_3 = copy (_1.0: i32);
FakeRead(ForLet(None), _3);
StorageLive(_4);
_4 = &_3;

View File

@ -22,7 +22,7 @@ yields ()
bb0: {
StorageLive(_3);
_3 = (_1.0: i32);
_3 = copy (_1.0: i32);
FakeRead(ForLet(None), _3);
StorageLive(_4);
_4 = &_3;

View File

@ -4,7 +4,7 @@ fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.r
let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10};
bb0: {
_0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: ((*_1).0: &i32) };
_0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) };
return;
}
}

View File

@ -4,7 +4,7 @@ fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.r
let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10};
bb0: {
_0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: ((*_1).0: &i32) };
_0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) };
return;
}
}

View File

@ -27,7 +27,7 @@
_1 = const false;
StorageLive(_2);
StorageLive(_3);
_3 = _1;
_3 = copy _1;
_2 = move _3;
StorageDead(_3);
StorageLive(_4);

View File

@ -31,7 +31,7 @@ fn main() -> () {
FakeRead(ForLet(None), _1);
StorageLive(_2);
StorageLive(_3);
_3 = _1;
_3 = copy _1;
_2 = move _3;
StorageDead(_3);
StorageLive(_4);

View File

@ -7,7 +7,7 @@
fn main() {
// CHECK-LABEL: fn main(
// CHECK: [[box:_.*]] = ShallowInitBox(
// CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S);
// CHECK: [[ptr:_.*]] = copy ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S);
// CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]];
// CHECK: [[ret]]: {
// CHECK: [[box2:_.*]] = move [[box]];

View File

@ -151,7 +151,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) ->
StorageLive(_13);
StorageLive(_14);
StorageLive(_15);
_15 = _38;
_15 = copy _38;
_14 = move _15;
goto -> bb6;
}
@ -194,8 +194,8 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) ->
bb10: {
StorageLive(_17);
_17 = ((_9 as Ready).0: ());
_3 = _17;
_17 = copy ((_9 as Ready).0: ());
_3 = copy _17;
StorageDead(_17);
StorageDead(_14);
StorageDead(_12);
@ -253,7 +253,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) ->
StorageLive(_29);
StorageLive(_30);
StorageLive(_31);
_31 = _38;
_31 = copy _38;
_30 = move _31;
goto -> bb18;
}
@ -291,8 +291,8 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) ->
bb21: {
StorageLive(_33);
_33 = ((_25 as Ready).0: ());
_37 = _33;
_33 = copy ((_25 as Ready).0: ());
_37 = copy _33;
StorageDead(_33);
StorageDead(_30);
StorageDead(_28);

View File

@ -9,8 +9,8 @@ fn adt() -> Onion {
bb0: {
_1 = const 1_i32;
_2 = Foo { a: const 1_i32, b: const 2_i32 };
_3 = Bar::Foo(move _2, _1);
_0 = Onion { neon: ((_3 as variant#0).1: i32) };
_3 = Bar::Foo(move _2, copy _1);
_0 = Onion { neon: copy ((_3 as variant#0).1: i32) };
return;
}
}

View File

@ -8,7 +8,7 @@ fn array() -> [i32; 2] {
bb0: {
_1 = [const 42_i32, const 43_i32];
_2 = const 1_i32;
_1 = [_2, const 2_i32];
_1 = [copy _2, const 2_i32];
_0 = move _1;
return;
}

View File

@ -6,17 +6,17 @@ fn arbitrary_let(_1: i32) -> i32 {
let mut _3: i32;
bb0: {
_2 = _1;
_2 = copy _1;
goto -> bb2;
}
bb1: {
_0 = _3;
_0 = copy _3;
return;
}
bb2: {
_3 = _2;
_3 = copy _2;
goto -> bb1;
}
}

View File

@ -8,7 +8,7 @@ fn arrays() -> usize {
bb0: {
_1 = [const 5_i32; C];
_2 = Len(_1);
_0 = _2;
_0 = copy _2;
return;
}
}

View File

@ -4,7 +4,7 @@ fn float_to_int(_1: f32) -> i32 {
let mut _0: i32;
bb0: {
_0 = _1 as i32 (FloatToInt);
_0 = copy _1 as i32 (FloatToInt);
return;
}
}

View File

@ -4,7 +4,7 @@ fn int_to_int(_1: u32) -> i32 {
let mut _0: i32;
bb0: {
_0 = _1 as i32 (IntToInt);
_0 = copy _1 as i32 (IntToInt);
return;
}
}

View File

@ -4,7 +4,7 @@ fn int_to_ptr(_1: usize) -> *const i32 {
let mut _0: *const i32;
bb0: {
_0 = _1 as *const i32 (PointerWithExposedProvenance);
_0 = copy _1 as *const i32 (PointerWithExposedProvenance);
return;
}
}

View File

@ -4,7 +4,7 @@ fn assume_local(_1: bool) -> () {
let mut _0: ();
bb0: {
assume(_1);
assume(copy _1);
return;
}
}

View File

@ -4,7 +4,7 @@ fn assume_place(_1: (bool, u8)) -> () {
let mut _0: ();
bb0: {
assume((_1.0: bool));
assume(copy (_1.0: bool));
return;
}
}

View File

@ -4,7 +4,7 @@ fn switch_bool(_1: bool) -> u32 {
let mut _0: u32;
bb0: {
switchInt(_1) -> [1: bb1, 0: bb2, otherwise: bb2];
switchInt(copy _1) -> [1: bb1, 0: bb2, otherwise: bb2];
}
bb1: {

View File

@ -6,7 +6,7 @@ fn switch_option(_1: Option<()>) -> bool {
bb0: {
_2 = discriminant(_1);
switchInt(_2) -> [0: bb1, 1: bb2, otherwise: bb2];
switchInt(copy _2) -> [0: bb1, 1: bb2, otherwise: bb2];
}
bb1: {

View File

@ -6,7 +6,7 @@ fn switch_option_repr(_1: Bool) -> bool {
bb0: {
_2 = discriminant(_1);
switchInt(_2) -> [0: bb2, otherwise: bb1];
switchInt(copy _2) -> [0: bb2, otherwise: bb1];
}
bb1: {

View File

@ -5,26 +5,26 @@ fn f(_1: i32, _2: bool) -> i32 {
let mut _3: (i32, bool);
bb0: {
_1 = Neg(_1);
_2 = Not(_2);
_1 = Add(_1, _1);
_1 = Sub(_1, _1);
_1 = Mul(_1, _1);
_1 = Div(_1, _1);
_1 = Rem(_1, _1);
_1 = BitXor(_1, _1);
_1 = BitAnd(_1, _1);
_1 = Shl(_1, _1);
_1 = Shr(_1, _1);
_2 = Eq(_1, _1);
_2 = Lt(_1, _1);
_2 = Le(_1, _1);
_2 = Ge(_1, _1);
_2 = Gt(_1, _1);
_3 = AddWithOverflow(_1, _1);
_2 = (_3.1: bool);
_1 = (_3.0: i32);
_0 = _1;
_1 = Neg(copy _1);
_2 = Not(copy _2);
_1 = Add(copy _1, copy _1);
_1 = Sub(copy _1, copy _1);
_1 = Mul(copy _1, copy _1);
_1 = Div(copy _1, copy _1);
_1 = Rem(copy _1, copy _1);
_1 = BitXor(copy _1, copy _1);
_1 = BitAnd(copy _1, copy _1);
_1 = Shl(copy _1, copy _1);
_1 = Shr(copy _1, copy _1);
_2 = Eq(copy _1, copy _1);
_2 = Lt(copy _1, copy _1);
_2 = Le(copy _1, copy _1);
_2 = Ge(copy _1, copy _1);
_2 = Gt(copy _1, copy _1);
_3 = AddWithOverflow(copy _1, copy _1);
_2 = copy (_3.1: bool);
_1 = copy (_3.0: i32);
_0 = copy _1;
return;
}
}

View File

@ -6,8 +6,8 @@ fn g(_1: *const i32, _2: *const [i32]) -> () {
let mut _4: usize;
bb0: {
_3 = PtrMetadata(_1);
_4 = PtrMetadata(_2);
_3 = PtrMetadata(copy _1);
_4 = PtrMetadata(copy _2);
return;
}
}

View File

@ -6,7 +6,7 @@ fn copy_for_deref(_1: (&i32, i32)) -> i32 {
bb0: {
_2 = deref_copy (_1.0: &i32);
_0 = (*_2);
_0 = copy (*_2);
return;
}
}

View File

@ -6,8 +6,8 @@ fn simple_index(_1: [i32; 10], _2: &[i32]) -> i32 {
bb0: {
_3 = const 3_usize;
_0 = _1[_3];
_0 = (*_2)[_3];
_0 = copy _1[_3];
_0 = copy (*_2)[_3];
return;
}
}

View File

@ -4,8 +4,8 @@ fn tuples(_1: (u32, i32)) -> (u32, i32) {
let mut _0: (u32, i32);
bb0: {
(_0.0: u32) = (_1.0: u32);
(_0.1: i32) = (_1.1: i32);
(_0.0: u32) = copy (_1.0: u32);
(_0.1: i32) = copy (_1.1: i32);
return;
}
}

View File

@ -4,7 +4,7 @@ fn unions(_1: U) -> i32 {
let mut _0: i32;
bb0: {
_0 = (_1.0: i32);
_0 = copy (_1.0: i32);
return;
}
}

View File

@ -4,7 +4,7 @@ fn unwrap(_1: Option<i32>) -> i32 {
let mut _0: i32;
bb0: {
_0 = ((_1 as variant#1).0: i32);
_0 = copy ((_1 as variant#1).0: i32);
return;
}
}

View File

@ -4,7 +4,7 @@ fn unwrap_deref(_1: Option<&i32>) -> i32 {
let mut _0: i32;
bb0: {
_0 = (*((_1 as variant#1).0: &i32));
_0 = copy (*((_1 as variant#1).0: &i32));
return;
}
}

View File

@ -4,7 +4,7 @@ fn raw_pointer_offset(_1: *const i32) -> *const i32 {
let mut _0: *const i32;
bb0: {
_0 = Offset(_1, const 1_isize);
_0 = Offset(copy _1, const 1_isize);
return;
}
}

View File

@ -7,14 +7,14 @@ fn simple(_1: i32) -> i32 {
bb0: {
StorageLive(_2);
_2 = _1;
_2 = copy _1;
goto -> bb1;
}
bb1: {
_3 = move _2;
StorageDead(_2);
_0 = _3;
_0 = copy _3;
return;
}
}

View File

@ -4,7 +4,7 @@ fn assert_nonzero(_1: i32) -> () {
let mut _0: ();
bb0: {
switchInt(_1) -> [0: bb1, otherwise: bb2];
switchInt(copy _1) -> [0: bb1, otherwise: bb2];
}
bb1: {

View File

@ -4,7 +4,7 @@ fn direct_call(_1: i32) -> i32 {
let mut _0: i32;
bb0: {
_0 = ident::<i32>(_1) -> [return: bb1, unwind continue];
_0 = ident::<i32>(copy _1) -> [return: bb1, unwind continue];
}
bb1: {

View File

@ -4,7 +4,7 @@ fn indirect_call(_1: i32, _2: fn(i32) -> i32) -> i32 {
let mut _0: i32;
bb0: {
_0 = _2(_1) -> [return: bb1, unwind continue];
_0 = copy _2(copy _1) -> [return: bb1, unwind continue];
}
bb1: {

View File

@ -5,7 +5,7 @@ fn tail_call(_1: i32) -> i32 {
let mut _2: i32;
bb0: {
_2 = Add(_1, const 42_i32);
tailcall ident::<i32>(Spanned { node: _2, span: $DIR/terminators.rs:32:28: 32:29 (#0) });
_2 = Add(copy _1, const 42_i32);
tailcall ident::<i32>(Spanned { node: copy _2, span: $DIR/terminators.rs:32:28: 32:29 (#0) });
}
}

View File

@ -12,8 +12,8 @@ fn bar(_1: Bar) -> usize {
StorageLive(_2);
_2 = move _1;
_3 = discriminant(_2);
_4 = _3 as u8 (IntToInt);
_5 = Le(_4, const 1_u8);
_4 = copy _3 as u8 (IntToInt);
_5 = Le(copy _4, const 1_u8);
assume(move _5);
_0 = move _3 as usize (IntToInt);
StorageDead(_2);

View File

@ -12,8 +12,8 @@ fn boo(_1: Boo) -> usize {
StorageLive(_2);
_2 = move _1;
_3 = discriminant(_2);
_4 = _3 as u8 (IntToInt);
_5 = Le(_4, const 1_u8);
_4 = copy _3 as u8 (IntToInt);
_5 = Le(copy _4, const 1_u8);
assume(move _5);
_0 = move _3 as usize (IntToInt);
StorageDead(_2);

View File

@ -31,8 +31,8 @@ fn droppy() -> () {
StorageLive(_4);
_4 = move _2;
_5 = discriminant(_4);
_6 = _5 as u8 (IntToInt);
_7 = Le(_6, const 2_u8);
_6 = copy _5 as u8 (IntToInt);
_7 = Le(copy _6, const 2_u8);
assume(move _7);
_3 = move _5 as usize (IntToInt);
drop(_4) -> [return: bb1, unwind: bb4];

View File

@ -12,8 +12,8 @@ fn far(_1: Far) -> isize {
StorageLive(_2);
_2 = move _1;
_3 = discriminant(_2);
_4 = _3 as u16 (IntToInt);
_5 = Le(_4, const 1_u16);
_4 = copy _3 as u16 (IntToInt);
_5 = Le(copy _4, const 1_u16);
assume(move _5);
_0 = move _3 as isize (IntToInt);
StorageDead(_2);

View File

@ -14,9 +14,9 @@ fn offsetty(_1: NotStartingAtZero) -> u32 {
StorageLive(_2);
_2 = move _1;
_3 = discriminant(_2);
_4 = _3 as u8 (IntToInt);
_5 = Ge(_4, const 4_u8);
_6 = Le(_4, const 8_u8);
_4 = copy _3 as u8 (IntToInt);
_5 = Ge(copy _4, const 4_u8);
_6 = Le(copy _4, const 8_u8);
_7 = BitAnd(move _5, move _6);
assume(move _7);
_0 = move _3 as u32 (IntToInt);

View File

@ -14,9 +14,9 @@ fn signy(_1: SignedAroundZero) -> i16 {
StorageLive(_2);
_2 = move _1;
_3 = discriminant(_2);
_4 = _3 as u16 (IntToInt);
_5 = Ge(_4, const 65534_u16);
_6 = Le(_4, const 2_u16);
_4 = copy _3 as u16 (IntToInt);
_5 = Ge(copy _4, const 65534_u16);
_6 = Le(copy _4, const 2_u16);
_7 = BitOr(move _5, move _6);
assume(move _7);
_0 = move _3 as i16 (IntToInt);

View File

@ -16,7 +16,7 @@ fn _f(_1: !, _2: !) -> () {
StorageLive(_4);
StorageLive(_5);
StorageLive(_6);
_6 = _1;
_6 = copy _1;
unreachable;
}
@ -25,7 +25,7 @@ fn _f(_1: !, _2: !) -> () {
StorageLive(_7);
StorageLive(_8);
StorageLive(_9);
_9 = _2;
_9 = copy _2;
unreachable;
}

View File

@ -55,7 +55,7 @@ fn main() -> () {
}
bb6: {
_5 = ((_1 as Some).0: u8);
_5 = copy ((_1 as Some).0: u8);
_0 = const ();
StorageDead(_5);
StorageDead(_1);

View File

@ -25,7 +25,7 @@ fn main() -> () {
StorageLive(_3);
_3 = const true;
PlaceMention(_3);
switchInt(_3) -> [0: bb4, otherwise: bb6];
switchInt(copy _3) -> [0: bb4, otherwise: bb6];
}
bb3: {

View File

@ -54,7 +54,7 @@ fn test_complex() -> () {
StorageLive(_6);
StorageLive(_7);
_7 = Droppy(const 0_u8);
_6 = (_7.0: u8);
_6 = copy (_7.0: u8);
_5 = Gt(move _6, const 0_u8);
switchInt(move _5) -> [0: bb10, otherwise: bb9];
}
@ -92,7 +92,7 @@ fn test_complex() -> () {
StorageLive(_9);
StorageLive(_10);
_10 = Droppy(const 1_u8);
_9 = (_10.0: u8);
_9 = copy (_10.0: u8);
_8 = Gt(move _9, const 1_u8);
switchInt(move _8) -> [0: bb16, otherwise: bb15];
}

View File

@ -14,7 +14,7 @@ fn test_or() -> () {
StorageLive(_2);
StorageLive(_3);
_3 = Droppy(const 0_u8);
_2 = (_3.0: u8);
_2 = copy (_3.0: u8);
_1 = Gt(move _2, const 0_u8);
switchInt(move _1) -> [0: bb2, otherwise: bb1];
}
@ -44,7 +44,7 @@ fn test_or() -> () {
StorageLive(_5);
StorageLive(_6);
_6 = Droppy(const 1_u8);
_5 = (_6.0: u8);
_5 = copy (_6.0: u8);
_4 = Gt(move _5, const 1_u8);
switchInt(move _4) -> [0: bb7, otherwise: bb6];
}

View File

@ -26,7 +26,7 @@ fn foo(_1: Option<String>) -> i32 {
}
bb2: {
_6 = <str as PartialEq>::eq(_5, const "a") -> [return: bb3, unwind unreachable];
_6 = <str as PartialEq>::eq(copy _5, const "a") -> [return: bb3, unwind unreachable];
}
bb3: {
@ -52,7 +52,7 @@ fn foo(_1: Option<String>) -> i32 {
}
bb7: {
switchInt(_2) -> [0: bb9, otherwise: bb8];
switchInt(copy _2) -> [0: bb9, otherwise: bb8];
}
bb8: {

View File

@ -19,7 +19,7 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
bb0: {
PlaceMention(_1);
switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1];
switchInt(copy (_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1];
}
bb1: {
@ -33,26 +33,26 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
}
bb3: {
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1];
switchInt(copy (((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1];
}
bb4: {
_5 = Le(const 6_u32, (_1.3: u32));
_5 = Le(const 6_u32, copy (_1.3: u32));
switchInt(move _5) -> [0: bb5, otherwise: bb7];
}
bb5: {
_3 = Le(const 13_u32, (_1.3: u32));
_3 = Le(const 13_u32, copy (_1.3: u32));
switchInt(move _3) -> [0: bb1, otherwise: bb6];
}
bb6: {
_4 = Le((_1.3: u32), const 16_u32);
_4 = Le(copy (_1.3: u32), const 16_u32);
switchInt(move _4) -> [0: bb1, otherwise: bb8];
}
bb7: {
_6 = Le((_1.3: u32), const 9_u32);
_6 = Le(copy (_1.3: u32), const 9_u32);
switchInt(move _6) -> [0: bb5, otherwise: bb8];
}
@ -62,13 +62,13 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
bb9: {
StorageLive(_7);
_7 = (_1.0: u32);
_7 = copy (_1.0: u32);
StorageLive(_8);
_8 = (_1.3: u32);
_8 = copy (_1.3: u32);
StorageLive(_9);
_9 = _7;
_9 = copy _7;
StorageLive(_10);
_10 = _8;
_10 = copy _8;
_0 = BitXor(move _9, move _10);
StorageDead(_10);
StorageDead(_9);

View File

@ -59,9 +59,9 @@ fn full_tested_match() -> () {
bb7: {
StorageLive(_9);
_9 = ((_2 as Some).0: i32);
_9 = copy ((_2 as Some).0: i32);
StorageLive(_10);
_10 = _9;
_10 = copy _9;
_1 = (const 2_i32, move _10);
StorageDead(_10);
StorageDead(_9);
@ -89,9 +89,9 @@ fn full_tested_match() -> () {
FakeRead(ForMatchGuard, _3);
FakeRead(ForGuardBinding, _6);
StorageLive(_5);
_5 = ((_2 as Some).0: i32);
_5 = copy ((_2 as Some).0: i32);
StorageLive(_8);
_8 = _5;
_8 = copy _5;
_1 = (const 1_i32, move _8);
StorageDead(_8);
StorageDead(_5);

View File

@ -42,9 +42,9 @@ fn full_tested_match2() -> () {
bb3: {
StorageLive(_9);
_9 = ((_2 as Some).0: i32);
_9 = copy ((_2 as Some).0: i32);
StorageLive(_10);
_10 = _9;
_10 = copy _9;
_1 = (const 2_i32, move _10);
StorageDead(_10);
StorageDead(_9);
@ -89,9 +89,9 @@ fn full_tested_match2() -> () {
FakeRead(ForMatchGuard, _3);
FakeRead(ForGuardBinding, _6);
StorageLive(_5);
_5 = ((_2 as Some).0: i32);
_5 = copy ((_2 as Some).0: i32);
StorageLive(_8);
_8 = _5;
_8 = copy _5;
_1 = (const 1_i32, move _8);
StorageDead(_8);
StorageDead(_5);

View File

@ -61,7 +61,7 @@ fn main() -> () {
bb5: {
StorageLive(_14);
_14 = _2;
_14 = copy _2;
_1 = const 4_i32;
StorageDead(_14);
goto -> bb22;
@ -86,7 +86,7 @@ fn main() -> () {
_3 = &fake shallow _2;
StorageLive(_12);
StorageLive(_13);
_13 = (*_11);
_13 = copy (*_11);
_12 = guard2(move _13) -> [return: bb18, unwind: bb24];
}
@ -96,7 +96,7 @@ fn main() -> () {
bb11: {
StorageLive(_9);
_9 = _2;
_9 = copy _2;
_1 = const 2_i32;
StorageDead(_9);
goto -> bb22;
@ -123,7 +123,7 @@ fn main() -> () {
FakeRead(ForMatchGuard, _3);
FakeRead(ForGuardBinding, _7);
StorageLive(_6);
_6 = ((_2 as Some).0: i32);
_6 = copy ((_2 as Some).0: i32);
_1 = const 1_i32;
StorageDead(_6);
StorageDead(_7);
@ -150,7 +150,7 @@ fn main() -> () {
FakeRead(ForMatchGuard, _3);
FakeRead(ForGuardBinding, _11);
StorageLive(_10);
_10 = ((_2 as Some).0: i32);
_10 = copy ((_2 as Some).0: i32);
_1 = const 3_i32;
StorageDead(_10);
StorageDead(_11);

View File

@ -6,7 +6,7 @@ fn match_bool(_1: bool) -> usize {
bb0: {
PlaceMention(_1);
switchInt(_1) -> [0: bb1, otherwise: bb2];
switchInt(copy _1) -> [0: bb1, otherwise: bb2];
}
bb1: {

View File

@ -16,18 +16,18 @@ fn constant_eq(_1: &str, _2: bool) -> u32 {
bb0: {
StorageLive(_3);
StorageLive(_4);
_4 = _1;
_4 = copy _1;
StorageLive(_5);
_5 = _2;
_5 = copy _2;
_3 = (move _4, move _5);
StorageDead(_5);
StorageDead(_4);
PlaceMention(_3);
_9 = <str as PartialEq>::eq((_3.0: &str), const "a") -> [return: bb9, unwind: bb19];
_9 = <str as PartialEq>::eq(copy (_3.0: &str), const "a") -> [return: bb9, unwind: bb19];
}
bb1: {
switchInt((_3.1: bool)) -> [0: bb10, otherwise: bb11];
switchInt(copy (_3.1: bool)) -> [0: bb10, otherwise: bb11];
}
bb2: {
@ -35,7 +35,7 @@ fn constant_eq(_1: &str, _2: bool) -> u32 {
}
bb3: {
switchInt((_3.1: bool)) -> [0: bb1, otherwise: bb4];
switchInt(copy (_3.1: bool)) -> [0: bb1, otherwise: bb4];
}
bb4: {
@ -43,11 +43,11 @@ fn constant_eq(_1: &str, _2: bool) -> u32 {
}
bb5: {
_8 = <str as PartialEq>::eq((_3.0: &str), const "b") -> [return: bb8, unwind: bb19];
_8 = <str as PartialEq>::eq(copy (_3.0: &str), const "b") -> [return: bb8, unwind: bb19];
}
bb6: {
switchInt((_3.1: bool)) -> [0: bb1, otherwise: bb7];
switchInt(copy (_3.1: bool)) -> [0: bb1, otherwise: bb7];
}
bb7: {

View File

@ -13,7 +13,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 {
bb0: {
PlaceMention(_1);
_6 = Le(const 0_i32, _1);
_6 = Le(const 0_i32, copy _1);
switchInt(move _6) -> [0: bb3, otherwise: bb8];
}
@ -27,7 +27,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 {
}
bb3: {
_4 = Le(const 10_i32, _1);
_4 = Le(const 10_i32, copy _1);
switchInt(move _4) -> [0: bb5, otherwise: bb7];
}
@ -36,7 +36,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 {
}
bb5: {
switchInt(_1) -> [4294967295: bb6, otherwise: bb1];
switchInt(copy _1) -> [4294967295: bb6, otherwise: bb1];
}
bb6: {
@ -44,12 +44,12 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 {
}
bb7: {
_5 = Le(_1, const 20_i32);
_5 = Le(copy _1, const 20_i32);
switchInt(move _5) -> [0: bb5, otherwise: bb4];
}
bb8: {
_7 = Lt(_1, const 10_i32);
_7 = Lt(copy _1, const 10_i32);
switchInt(move _7) -> [0: bb3, otherwise: bb2];
}
@ -66,7 +66,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 {
bb11: {
_3 = &fake shallow _1;
StorageLive(_8);
_8 = _2;
_8 = copy _2;
switchInt(move _8) -> [0: bb13, otherwise: bb12];
}

View File

@ -25,7 +25,7 @@ fn disjoint_ranges(x: i32, b: bool) -> u32 {
// CHECK-LABEL: fn disjoint_ranges(
// CHECK: debug b => _2;
// CHECK: bb0: {
// CHECK: switchInt(_2) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}];
// CHECK: switchInt(copy _2) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}];
// CHECK: [[jump]]: {
// CHECK-NEXT: _0 = const 3_u32;
// CHECK-NEXT: return;

View File

@ -38,7 +38,7 @@ fn main() -> () {
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
_4 = _1;
_4 = copy _1;
_3 = move _4 as *const Test (PointerCoercion(MutToConstPointer));
StorageDead(_4);
_2 = Test::x(move _3) -> [return: bb2, unwind: bb4];
@ -63,7 +63,7 @@ fn main() -> () {
StorageLive(_10);
StorageLive(_11);
StorageLive(_12);
_12 = (*(*(*(*_5))));
_12 = copy (*(*(*(*_5))));
_11 = move _12 as *const Test (PointerCoercion(MutToConstPointer));
StorageDead(_12);
_10 = Test::x(move _11) -> [return: bb3, unwind: bb4];

View File

@ -44,12 +44,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128;
StorageLive(_6);
StorageLive(_7);
StorageLive(_8);
_8 = _1;
_8 = copy _1;
StorageLive(_9);
_9 = _3;
_10 = _9 as u8 (IntToInt);
_9 = copy _3;
_10 = copy _9 as u8 (IntToInt);
_11 = Lt(move _10, const 8_u8);
assert(move _11, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7];
assert(move _11, "attempt to shift right by `{}`, which would overflow", copy _9) -> [success: bb1, unwind: bb7];
}
bb1: {
@ -58,12 +58,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128;
StorageDead(_8);
StorageLive(_12);
StorageLive(_13);
_13 = _1;
_13 = copy _1;
StorageLive(_14);
_14 = _4;
_15 = _14 as u32 (IntToInt);
_14 = copy _4;
_15 = copy _14 as u32 (IntToInt);
_16 = Lt(move _15, const 8_u32);
assert(move _16, "attempt to shift right by `{}`, which would overflow", _14) -> [success: bb2, unwind: bb7];
assert(move _16, "attempt to shift right by `{}`, which would overflow", copy _14) -> [success: bb2, unwind: bb7];
}
bb2: {
@ -72,12 +72,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128;
StorageDead(_13);
StorageLive(_17);
StorageLive(_18);
_18 = _1;
_18 = copy _1;
StorageLive(_19);
_19 = _5;
_20 = _19 as u128 (IntToInt);
_19 = copy _5;
_20 = copy _19 as u128 (IntToInt);
_21 = Lt(move _20, const 8_u128);
assert(move _21, "attempt to shift right by `{}`, which would overflow", _19) -> [success: bb3, unwind: bb7];
assert(move _21, "attempt to shift right by `{}`, which would overflow", copy _19) -> [success: bb3, unwind: bb7];
}
bb3: {
@ -91,12 +91,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128;
StorageLive(_22);
StorageLive(_23);
StorageLive(_24);
_24 = _2;
_24 = copy _2;
StorageLive(_25);
_25 = _3;
_26 = _25 as u8 (IntToInt);
_25 = copy _3;
_26 = copy _25 as u8 (IntToInt);
_27 = Lt(move _26, const 128_u8);
assert(move _27, "attempt to shift left by `{}`, which would overflow", _25) -> [success: bb4, unwind: bb7];
assert(move _27, "attempt to shift left by `{}`, which would overflow", copy _25) -> [success: bb4, unwind: bb7];
}
bb4: {
@ -105,12 +105,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128;
StorageDead(_24);
StorageLive(_28);
StorageLive(_29);
_29 = _2;
_29 = copy _2;
StorageLive(_30);
_30 = _4;
_31 = _30 as u32 (IntToInt);
_30 = copy _4;
_31 = copy _30 as u32 (IntToInt);
_32 = Lt(move _31, const 128_u32);
assert(move _32, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb5, unwind: bb7];
assert(move _32, "attempt to shift left by `{}`, which would overflow", copy _30) -> [success: bb5, unwind: bb7];
}
bb5: {
@ -119,12 +119,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128;
StorageDead(_29);
StorageLive(_33);
StorageLive(_34);
_34 = _2;
_34 = copy _2;
StorageLive(_35);
_35 = _5;
_36 = _35 as u128 (IntToInt);
_35 = copy _5;
_36 = copy _35 as u128 (IntToInt);
_37 = Lt(move _36, const 128_u128);
assert(move _37, "attempt to shift left by `{}`, which would overflow", _35) -> [success: bb6, unwind: bb7];
assert(move _37, "attempt to shift left by `{}`, which would overflow", copy _35) -> [success: bb6, unwind: bb7];
}
bb6: {

View File

@ -38,11 +38,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12
StorageLive(_6);
StorageLive(_7);
StorageLive(_8);
_8 = _1;
_8 = copy _1;
StorageLive(_9);
_9 = _3;
_10 = Lt(_9, const 8_u8);
assert(move _10, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7];
_9 = copy _3;
_10 = Lt(copy _9, const 8_u8);
assert(move _10, "attempt to shift right by `{}`, which would overflow", copy _9) -> [success: bb1, unwind: bb7];
}
bb1: {
@ -51,11 +51,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
_12 = _1;
_12 = copy _1;
StorageLive(_13);
_13 = _4;
_14 = Lt(_13, const 8_u32);
assert(move _14, "attempt to shift right by `{}`, which would overflow", _13) -> [success: bb2, unwind: bb7];
_13 = copy _4;
_14 = Lt(copy _13, const 8_u32);
assert(move _14, "attempt to shift right by `{}`, which would overflow", copy _13) -> [success: bb2, unwind: bb7];
}
bb2: {
@ -64,11 +64,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12
StorageDead(_12);
StorageLive(_15);
StorageLive(_16);
_16 = _1;
_16 = copy _1;
StorageLive(_17);
_17 = _5;
_18 = Lt(_17, const 8_u128);
assert(move _18, "attempt to shift right by `{}`, which would overflow", _17) -> [success: bb3, unwind: bb7];
_17 = copy _5;
_18 = Lt(copy _17, const 8_u128);
assert(move _18, "attempt to shift right by `{}`, which would overflow", copy _17) -> [success: bb3, unwind: bb7];
}
bb3: {
@ -82,11 +82,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12
StorageLive(_19);
StorageLive(_20);
StorageLive(_21);
_21 = _2;
_21 = copy _2;
StorageLive(_22);
_22 = _3;
_23 = Lt(_22, const 128_u8);
assert(move _23, "attempt to shift left by `{}`, which would overflow", _22) -> [success: bb4, unwind: bb7];
_22 = copy _3;
_23 = Lt(copy _22, const 128_u8);
assert(move _23, "attempt to shift left by `{}`, which would overflow", copy _22) -> [success: bb4, unwind: bb7];
}
bb4: {
@ -95,11 +95,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12
StorageDead(_21);
StorageLive(_24);
StorageLive(_25);
_25 = _2;
_25 = copy _2;
StorageLive(_26);
_26 = _4;
_27 = Lt(_26, const 128_u32);
assert(move _27, "attempt to shift left by `{}`, which would overflow", _26) -> [success: bb5, unwind: bb7];
_26 = copy _4;
_27 = Lt(copy _26, const 128_u32);
assert(move _27, "attempt to shift left by `{}`, which would overflow", copy _26) -> [success: bb5, unwind: bb7];
}
bb5: {
@ -108,11 +108,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12
StorageDead(_25);
StorageLive(_28);
StorageLive(_29);
_29 = _2;
_29 = copy _2;
StorageLive(_30);
_30 = _5;
_31 = Lt(_30, const 128_u128);
assert(move _31, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb6, unwind: bb7];
_30 = copy _5;
_31 = Lt(copy _30, const 128_u128);
assert(move _31, "attempt to shift left by `{}`, which would overflow", copy _30) -> [success: bb6, unwind: bb7];
}
bb6: {

View File

@ -15,7 +15,7 @@ fn while_loop(c: bool) {
// CHECK: bb1: {
// CHECK-NEXT: StorageLive(_3);
// CHECK-NEXT: StorageLive(_2);
// CHECK-NEXT: _2 = _1;
// CHECK-NEXT: _2 = copy _1;
// CHECK-NEXT: _3 = get_bool(move _2) -> [return: bb2, unwind
// CHECK: bb2: {
// CHECK-NEXT: switchInt(move _3) -> [0: bb3, otherwise: bb4];
@ -29,7 +29,7 @@ fn while_loop(c: bool) {
// CHECK-NEXT: StorageDead(_2);
// CHECK-NEXT: StorageLive(_5);
// CHECK-NEXT: StorageLive(_4);
// CHECK-NEXT: _4 = _1;
// CHECK-NEXT: _4 = copy _1;
// CHECK-NEXT: _5 = get_bool(move _4) -> [return: bb5, unwind
// CHECK: bb5: {
// CHECK-NEXT: switchInt(move _5) -> [0: bb6, otherwise: bb7];

View File

@ -20,7 +20,7 @@ fn while_loop(_1: bool) -> () {
bb1: {
StorageLive(_3);
StorageLive(_2);
_2 = _1;
_2 = copy _1;
_3 = get_bool(move _2) -> [return: bb2, unwind unreachable];
}
@ -40,7 +40,7 @@ fn while_loop(_1: bool) -> () {
StorageDead(_2);
StorageLive(_5);
StorageLive(_4);
_4 = _1;
_4 = copy _1;
_5 = get_bool(move _4) -> [return: bb5, unwind unreachable];
}

View File

@ -20,7 +20,7 @@ fn while_loop(_1: bool) -> () {
bb1: {
StorageLive(_3);
StorageLive(_2);
_2 = _1;
_2 = copy _1;
_3 = get_bool(move _2) -> [return: bb2, unwind continue];
}
@ -40,7 +40,7 @@ fn while_loop(_1: bool) -> () {
StorageDead(_2);
StorageLive(_5);
StorageLive(_4);
_4 = _1;
_4 = copy _1;
_5 = get_bool(move _4) -> [return: bb5, unwind continue];
}

View File

@ -9,7 +9,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
_1 = (*_2);
_1 = copy (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();

View File

@ -9,7 +9,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
_1 = (*_2);
_1 = copy (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();

View File

@ -9,7 +9,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
_1 = (*_2);
_1 = copy (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();

View File

@ -9,7 +9,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
_1 = (*_2);
_1 = copy (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();

View File

@ -9,7 +9,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC4: &&Packed};
_1 = (*_2);
_1 = copy (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();

View File

@ -9,7 +9,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = const {ALLOC2: &&Packed};
_1 = (*_2);
_1 = copy (*_2);
StorageDead(_2);
StorageDead(_1);
_0 = const ();

View File

@ -22,7 +22,7 @@
}
bb3: {
switchInt(_1) -> [0: bb5, otherwise: bb4];
switchInt(copy _1) -> [0: bb5, otherwise: bb4];
}
bb4: {

View File

@ -34,10 +34,10 @@
- StorageLive(_5);
+ nop;
StorageLive(_6);
_6 = (_2.1: bool);
_6 = copy (_2.1: bool);
_5 = Not(move _6);
StorageDead(_6);
_0 = _5;
_0 = copy _5;
- StorageDead(_5);
+ nop;
StorageDead(_3);

View File

@ -10,13 +10,13 @@ pub fn fn0() -> bool {
// CHECK: (*[[ptr]]) = const true;
// CHECK-NOT: = const false;
// CHECK-NOT: = const true;
// CHECK: [[tmp:_.*]] = ([[pair]].1: bool);
// CHECK: [[tmp:_.*]] = copy ([[pair]].1: bool);
// CHECK-NOT: = const false;
// CHECK-NOT: = const true;
// CHECK: [[ret]] = Not(move [[tmp]]);
// CHECK-NOT: = const false;
// CHECK-NOT: = const true;
// CHECK: _0 = [[ret]];
// CHECK: _0 = copy [[ret]];
let mut pair = (1, false);
let ptr = core::ptr::addr_of_mut!(pair.1);
pair = (1, false);

View File

@ -24,11 +24,11 @@
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_5 = _1;
_5 = copy _1;
- _4 = (const 0_i32, move _5);
+ _4 = (const 0_i32, _1);
+ _4 = (const 0_i32, copy _1);
StorageDead(_5);
- _3 = (_4.0: i32);
- _3 = copy (_4.0: i32);
- _2 = Add(move _3, const 1_i32);
+ _3 = const 0_i32;
+ _2 = const 1_i32;
@ -38,11 +38,11 @@
StorageLive(_7);
StorageLive(_8);
StorageLive(_9);
_9 = _1;
_9 = copy _1;
- _8 = (move _9, const 1_i32);
+ _8 = (_1, const 1_i32);
+ _8 = (copy _1, const 1_i32);
StorageDead(_9);
- _7 = (_8.1: i32);
- _7 = copy (_8.1: i32);
- _6 = Add(move _7, const 2_i32);
+ _7 = const 1_i32;
+ _6 = const 3_i32;

View File

@ -24,11 +24,11 @@
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_5 = _1;
_5 = copy _1;
- _4 = (const 0_i32, move _5);
+ _4 = (const 0_i32, _1);
+ _4 = (const 0_i32, copy _1);
StorageDead(_5);
- _3 = (_4.0: i32);
- _3 = copy (_4.0: i32);
- _2 = Add(move _3, const 1_i32);
+ _3 = const 0_i32;
+ _2 = const 1_i32;
@ -38,11 +38,11 @@
StorageLive(_7);
StorageLive(_8);
StorageLive(_9);
_9 = _1;
_9 = copy _1;
- _8 = (move _9, const 1_i32);
+ _8 = (_1, const 1_i32);
+ _8 = (copy _1, const 1_i32);
StorageDead(_9);
- _7 = (_8.1: i32);
- _7 = copy (_8.1: i32);
- _6 = Add(move _7, const 2_i32);
+ _7 = const 1_i32;
+ _6 = const 3_i32;

View File

@ -18,7 +18,7 @@
StorageLive(_2);
StorageLive(_3);
_3 = (const 0_i32, const 1_u8, const 2_i32);
- _2 = (_3.1: u8);
- _2 = copy (_3.1: u8);
- _1 = Add(move _2, const 0_u8);
+ _2 = const 1_u8;
+ _1 = const 1_u8;
@ -26,7 +26,7 @@
StorageDead(_3);
StorageLive(_4);
StorageLive(_5);
- _5 = _1;
- _5 = copy _1;
- _4 = foo(move _5) -> [return: bb1, unwind unreachable];
+ _5 = const 1_u8;
+ _4 = foo(const 1_u8) -> [return: bb1, unwind unreachable];

View File

@ -18,7 +18,7 @@
StorageLive(_2);
StorageLive(_3);
_3 = (const 0_i32, const 1_u8, const 2_i32);
- _2 = (_3.1: u8);
- _2 = copy (_3.1: u8);
- _1 = Add(move _2, const 0_u8);
+ _2 = const 1_u8;
+ _1 = const 1_u8;
@ -26,7 +26,7 @@
StorageDead(_3);
StorageLive(_4);
StorageLive(_5);
- _5 = _1;
- _5 = copy _1;
- _4 = foo(move _5) -> [return: bb1, unwind continue];
+ _5 = const 1_u8;
+ _4 = foo(const 1_u8) -> [return: bb1, unwind continue];

View File

@ -19,15 +19,15 @@
StorageLive(_3);
_3 = const 2_usize;
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
- _5 = Lt(copy _3, copy _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = _2[_3];
- _1 = copy _2[_3];
+ _1 = const 2_u32;
StorageDead(_3);
StorageDead(_2);

View File

@ -19,15 +19,15 @@
StorageLive(_3);
_3 = const 2_usize;
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
- _5 = Lt(copy _3, copy _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = _2[_3];
- _1 = copy _2[_3];
+ _1 = const 2_u32;
StorageDead(_3);
StorageDead(_2);

View File

@ -19,15 +19,15 @@
StorageLive(_3);
_3 = const 2_usize;
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
- _5 = Lt(copy _3, copy _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = _2[_3];
- _1 = copy _2[_3];
+ _1 = const 2_u32;
StorageDead(_3);
StorageDead(_2);

View File

@ -19,15 +19,15 @@
StorageLive(_3);
_3 = const 2_usize;
- _4 = Len(_2);
- _5 = Lt(_3, _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
- _5 = Lt(copy _3, copy _4);
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue];
+ _4 = const 4_usize;
+ _5 = const true;
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = _2[_3];
- _1 = copy _2[_3];
+ _1 = const 2_u32;
StorageDead(_3);
StorageDead(_2);

View File

@ -23,8 +23,8 @@
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
- _4 = Eq(_3, const 0_i32);
- _3 = copy _1;
- _4 = Eq(copy _3, const 0_i32);
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable];
+ _3 = const 0_i32;
+ _4 = const true;
@ -32,10 +32,10 @@
}
bb1: {
- _5 = Eq(_3, const -1_i32);
- _5 = Eq(copy _3, const -1_i32);
- _6 = Eq(const 1_i32, const i32::MIN);
- _7 = BitAnd(move _5, move _6);
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable];
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind unreachable];
+ _5 = const false;
+ _6 = const false;
+ _7 = const false;

View File

@ -23,8 +23,8 @@
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
- _4 = Eq(_3, const 0_i32);
- _3 = copy _1;
- _4 = Eq(copy _3, const 0_i32);
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue];
+ _3 = const 0_i32;
+ _4 = const true;
@ -32,10 +32,10 @@
}
bb1: {
- _5 = Eq(_3, const -1_i32);
- _5 = Eq(copy _3, const -1_i32);
- _6 = Eq(const 1_i32, const i32::MIN);
- _7 = BitAnd(move _5, move _6);
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue];
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind continue];
+ _5 = const false;
+ _6 = const false;
+ _7 = const false;

View File

@ -23,8 +23,8 @@
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
- _4 = Eq(_3, const 0_i32);
- _3 = copy _1;
- _4 = Eq(copy _3, const 0_i32);
- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable];
+ _3 = const 0_i32;
+ _4 = const true;
@ -32,10 +32,10 @@
}
bb1: {
- _5 = Eq(_3, const -1_i32);
- _5 = Eq(copy _3, const -1_i32);
- _6 = Eq(const 1_i32, const i32::MIN);
- _7 = BitAnd(move _5, move _6);
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable];
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind unreachable];
+ _5 = const false;
+ _6 = const false;
+ _7 = const false;

View File

@ -23,8 +23,8 @@
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
- _4 = Eq(_3, const 0_i32);
- _3 = copy _1;
- _4 = Eq(copy _3, const 0_i32);
- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind continue];
+ _3 = const 0_i32;
+ _4 = const true;
@ -32,10 +32,10 @@
}
bb1: {
- _5 = Eq(_3, const -1_i32);
- _5 = Eq(copy _3, const -1_i32);
- _6 = Eq(const 1_i32, const i32::MIN);
- _7 = BitAnd(move _5, move _6);
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue];
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind continue];
+ _5 = const false;
+ _6 = const false;
+ _7 = const false;

View File

@ -33,15 +33,15 @@
StorageLive(_6);
_6 = const 3_usize;
_7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
+ _8 = Lt(const 3_usize, _7);
- _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable];
+ _8 = Lt(const 3_usize, copy _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _5 = (*_1)[_6];
+ _5 = (*_1)[3 of 4];
- _5 = copy (*_1)[_6];
+ _5 = copy (*_1)[3 of 4];
StorageDead(_6);
_0 = const ();
StorageDead(_5);

View File

@ -33,15 +33,15 @@
StorageLive(_6);
_6 = const 3_usize;
_7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
+ _8 = Lt(const 3_usize, _7);
- _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue];
+ _8 = Lt(const 3_usize, copy _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _5 = (*_1)[_6];
+ _5 = (*_1)[3 of 4];
- _5 = copy (*_1)[_6];
+ _5 = copy (*_1)[3 of 4];
StorageDead(_6);
_0 = const ();
StorageDead(_5);

View File

@ -33,15 +33,15 @@
StorageLive(_6);
_6 = const 3_usize;
_7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
+ _8 = Lt(const 3_usize, _7);
- _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable];
+ _8 = Lt(const 3_usize, copy _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _5 = (*_1)[_6];
+ _5 = (*_1)[3 of 4];
- _5 = copy (*_1)[_6];
+ _5 = copy (*_1)[3 of 4];
StorageDead(_6);
_0 = const ();
StorageDead(_5);

View File

@ -33,15 +33,15 @@
StorageLive(_6);
_6 = const 3_usize;
_7 = Len((*_1));
- _8 = Lt(_6, _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
+ _8 = Lt(const 3_usize, _7);
- _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue];
+ _8 = Lt(const 3_usize, copy _7);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue];
}
bb1: {
- _5 = (*_1)[_6];
+ _5 = (*_1)[3 of 4];
- _5 = copy (*_1)[_6];
+ _5 = copy (*_1)[3 of 4];
StorageDead(_6);
_0 = const ();
StorageDead(_5);

View File

@ -8,7 +8,7 @@ fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
// CHECK: debug _b => [[b:_.*]];
// CHECK: [[b]] = (*[[a]])[3 of 4];
// CHECK: [[b]] = copy (*[[a]])[3 of 4];
let a: *const [_] = &[1, 2, 3];
unsafe {
let _b = (*a)[3];

View File

@ -22,22 +22,22 @@
- StorageLive(_3);
+ nop;
StorageLive(_4);
_4 = _2;
_4 = copy _2;
- _3 = BitOr(move _4, const true);
+ _3 = const true;
StorageDead(_4);
- StorageLive(_5);
+ nop;
StorageLive(_6);
_6 = _1;
_6 = copy _1;
- _5 = BitAnd(move _6, const false);
+ _5 = const false;
StorageDead(_6);
StorageLive(_7);
- _7 = _3;
- _7 = copy _3;
+ _7 = const true;
StorageLive(_8);
- _8 = _5;
- _8 = copy _5;
- _0 = BitAnd(move _7, move _8);
+ _8 = const false;
+ _0 = const false;

View File

@ -32,15 +32,15 @@
bb1: {
StorageLive(_7);
_7 = ShallowInitBox(move _6, i32);
_8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
_8 = copy (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
(*_8) = const 42_i32;
_3 = move _7;
StorageDead(_7);
_9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
_2 = (*_9);
_9 = copy (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
_2 = copy (*_9);
- _1 = Add(move _2, const 0_i32);
- StorageDead(_2);
+ _1 = _2;
+ _1 = copy _2;
+ nop;
drop(_3) -> [return: bb2, unwind unreachable];
}

View File

@ -32,15 +32,15 @@
bb1: {
StorageLive(_7);
_7 = ShallowInitBox(move _6, i32);
_8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
_8 = copy (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
(*_8) = const 42_i32;
_3 = move _7;
StorageDead(_7);
_9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
_2 = (*_9);
_9 = copy (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32);
_2 = copy (*_9);
- _1 = Add(move _2, const 0_i32);
- StorageDead(_2);
+ _1 = _2;
+ _1 = copy _2;
+ nop;
drop(_3) -> [return: bb2, unwind: bb3];
}

View File

@ -11,8 +11,8 @@ fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]];
// CHECK: (*{{_.*}}) = const 42_i32;
// CHECK: [[tmp:_.*]] = (*{{_.*}});
// CHECK: [[x]] = [[tmp]];
// CHECK: [[tmp:_.*]] = copy (*{{_.*}});
// CHECK: [[x]] = copy [[tmp]];
let x = *(#[rustc_box]
Box::new(42))
+ 0;

View File

@ -26,7 +26,7 @@
}
bb1: {
- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2];
- switchInt(copy ((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2];
+ switchInt(const true) -> [0: bb3, otherwise: bb2];
}

View File

@ -26,7 +26,7 @@
}
bb1: {
- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2];
- switchInt(copy ((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2];
+ switchInt(const true) -> [0: bb3, otherwise: bb2];
}

Some files were not shown because too many files have changed in this diff Show More