diff options
Diffstat (limited to 'tests')
6 files changed, 9 insertions, 310 deletions
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff index 6779003b693..23e0ab67121 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff @@ -12,6 +12,7 @@ debug _r => _1; } + scope 2 (inlined g) { ++ let mut _5: [generator@$DIR/inline_generator.rs:16:5: 16:8]; + } + scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) { + debug pointer => _3; diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff index 31744be99ec..a5488f6fb28 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff @@ -12,6 +12,7 @@ debug _r => _1; } + scope 2 (inlined g) { ++ let mut _5: [generator@$DIR/inline_generator.rs:16:5: 16:8]; + } + scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) { + debug pointer => _3; @@ -55,7 +56,7 @@ - bb3: { + bb1: { -+ StorageDead(_5); ++ StorageDead(_6); StorageDead(_2); - drop(_4) -> [return: bb4, unwind: bb6]; + drop(_4) -> [return: bb2, unwind: bb4]; diff --git a/tests/mir-opt/mir_subtyping.main.Subtyper.diff b/tests/mir-opt/mir_subtyping.main.Subtyper.diff deleted file mode 100644 index 233915d48d7..00000000000 --- a/tests/mir-opt/mir_subtyping.main.Subtyper.diff +++ /dev/null @@ -1,262 +0,0 @@ -- // MIR for `main` before Subtyper -+ // MIR for `main` after Subtyper - - | User Type Annotations - | 0: user_ty: Canonical { value: TypeOf(DefId(5:284 ~ alloc[be7e]::boxed::{impl#0}::new), UserArgs { args: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(5:282 ~ alloc[be7e]::boxed::{impl#0}), self_ty: std::boxed::Box<^1, ^2> }) }), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/mir_subtyping.rs:34:10: 34:18, inferred_ty: fn(Foo<fn(&u8)>) -> std::boxed::Box<Foo<fn(&u8)>> {std::boxed::Box::<Foo<fn(&u8)>>::new} - | 1: user_ty: Canonical { value: Ty(fn(&'static u8)), max_universe: U0, variables: [] }, span: $DIR/mir_subtyping.rs:34:23: 34:48, inferred_ty: fn(&u8) - | 2: user_ty: Canonical { value: Ty(std::boxed::Box<dyn GetInner<Assoc = std::string::String>>), max_universe: U1, variables: [CanonicalVarInfo { kind: Region(U1) }] }, span: $DIR/mir_subtyping.rs:34:10: 34:87, inferred_ty: std::boxed::Box<dyn GetInner<Assoc = std::string::String>> - | 3: user_ty: Canonical { value: TypeOf(DefId(5:284 ~ alloc[be7e]::boxed::{impl#0}::new), UserArgs { args: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(5:282 ~ alloc[be7e]::boxed::{impl#0}), self_ty: std::boxed::Box<^1, ^2> }) }), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/mir_subtyping.rs:35:10: 35:18, inferred_ty: fn(Foo<for<'a> fn(&'a u8)>) -> std::boxed::Box<Foo<for<'a> fn(&'a u8)>> {std::boxed::Box::<Foo<for<'a> fn(&'a u8)>>::new} - | 4: user_ty: Canonical { value: Ty(std::boxed::Box<dyn GetInner<Assoc = [usize; 3]>>), max_universe: U1, variables: [CanonicalVarInfo { kind: Region(U1) }] }, span: $DIR/mir_subtyping.rs:35:10: 35:83, inferred_ty: std::boxed::Box<dyn GetInner<Assoc = [usize; 3]>> - | 5: user_ty: Canonical { value: TypeOf(DefId(5:284 ~ alloc[be7e]::boxed::{impl#0}::new), UserArgs { args: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(5:282 ~ alloc[be7e]::boxed::{impl#0}), self_ty: std::boxed::Box<^1, ^2> }) }), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/mir_subtyping.rs:37:20: 37:28, inferred_ty: fn(Foo<for<'a> fn(&'a u8)>) -> std::boxed::Box<Foo<for<'a> fn(&'a u8)>> {std::boxed::Box::<Foo<for<'a> fn(&'a u8)>>::new} - | 6: user_ty: Canonical { value: Ty(std::boxed::Box<Foo<fn(&'static u8)>>), max_universe: U0, variables: [] }, span: $DIR/mir_subtyping.rs:38:20: 38:57, inferred_ty: std::boxed::Box<Foo<fn(&u8)>> - | 7: user_ty: Canonical { value: Ty(std::boxed::Box<dyn GetInner<Assoc = std::string::String>>), max_universe: U1, variables: [CanonicalVarInfo { kind: Region(U1) }] }, span: $DIR/mir_subtyping.rs:39:19: 39:64, inferred_ty: std::boxed::Box<dyn GetInner<Assoc = std::string::String>> - | - fn main() -> () { - let mut _0: (); - let _1: Wrapper; - let mut _2: for<'a> fn(&'a u8); - let _3: (); - let mut _4: std::boxed::Box<dyn GetInner<Assoc = std::string::String>>; - let mut _5: std::boxed::Box<dyn GetInner<Assoc = std::string::String>>; - let mut _6: std::boxed::Box<Foo<fn(&u8)>>; - let mut _7: Foo<fn(&u8)>; - let mut _8: fn(&u8); - let mut _9: fn(&u8); - let _10: (); - let mut _11: std::boxed::Box<dyn GetInner<Assoc = [usize; 3]>>; - let mut _12: std::boxed::Box<dyn GetInner<Assoc = [usize; 3]>>; - let mut _13: std::boxed::Box<Foo<for<'a> fn(&'a u8)>>; - let mut _14: Foo<for<'a> fn(&'a u8)>; - let mut _15: for<'a> fn(&'a u8); - let mut _17: Foo<for<'a> fn(&'a u8)>; - let mut _18: for<'b> fn(&'b u8); - let mut _20: std::boxed::Box<Foo<fn(&u8)>>; - let mut _22: std::boxed::Box<dyn GetInner<Assoc = std::string::String>>; - let mut _23: std::boxed::Box<Foo<fn(&u8)>>; - let mut _25: &mut dyn GetInner<Assoc = std::string::String>; - let _26: (); - let mut _27: std::string::String; -+ let mut _28: std::boxed::Box<Foo<for<'a> fn(&'a u8)>>; - scope 1 { - debug wrapper => _1; - let _16: std::boxed::Box<Foo<for<'a> fn(&'a u8)>>; - scope 2 { - debug hr_fnptr => _16; - let _19: std::boxed::Box<Foo<fn(&u8)>>; - scope 3 { - debug lr_fnptr => _19; - let mut _21: std::boxed::Box<dyn GetInner<Assoc = std::string::String>>; - scope 4 { - debug any => _21; - let _24: std::string::String; - scope 5 { - debug evil_string => _24; - } - } - } - } - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = useful as for<'a> fn(&'a u8) (PointerCoercion(ReifyFnPointer)); - _1 = Wrapper(move _2); - StorageDead(_2); - FakeRead(ForLet(None), _1); - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - StorageLive(_6); - StorageLive(_7); - StorageLive(_8); - StorageLive(_9); - _9 = useful as for<'a> fn(&'a u8) (PointerCoercion(ReifyFnPointer)); - AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] }); - _8 = _9; - _7 = Foo::<fn(&u8)>(move _8); - StorageDead(_8); - _6 = Box::<Foo<fn(&u8)>>::new(move _7) -> [return: bb1, unwind: bb28]; - } - - bb1: { - _5 = move _6 as std::boxed::Box<dyn GetInner<Assoc = std::string::String>> (PointerCoercion(Unsize)); - drop(_6) -> [return: bb2, unwind: bb28]; - } - - bb2: { - StorageDead(_7); - StorageDead(_6); - AscribeUserType(_5, o, UserTypeProjection { base: UserType(2), projs: [] }); - _4 = move _5; - _3 = std::mem::drop::<Box<dyn GetInner<Assoc = String>>>(move _4) -> [return: bb3, unwind: bb26]; - } - - bb3: { - StorageDead(_4); - drop(_5) -> [return: bb4, unwind: bb28]; - } - - bb4: { - StorageDead(_9); - StorageDead(_5); - StorageDead(_3); - StorageLive(_10); - StorageLive(_11); - StorageLive(_12); - StorageLive(_13); - StorageLive(_14); - StorageLive(_15); - _15 = useful as for<'a> fn(&'a u8) (PointerCoercion(ReifyFnPointer)); - _14 = Foo::<for<'a> fn(&'a u8)>(move _15); - StorageDead(_15); - _13 = Box::<Foo<for<'a> fn(&'a u8)>>::new(move _14) -> [return: bb5, unwind: bb28]; - } - - bb5: { - _12 = move _13 as std::boxed::Box<dyn GetInner<Assoc = [usize; 3]>> (PointerCoercion(Unsize)); - drop(_13) -> [return: bb6, unwind: bb28]; - } - - bb6: { - StorageDead(_14); - StorageDead(_13); - AscribeUserType(_12, o, UserTypeProjection { base: UserType(4), projs: [] }); - _11 = move _12; - _10 = std::mem::drop::<Box<dyn GetInner<Assoc = [usize; 3]>>>(move _11) -> [return: bb7, unwind: bb24]; - } - - bb7: { - StorageDead(_11); - drop(_12) -> [return: bb8, unwind: bb28]; - } - - bb8: { - StorageDead(_12); - StorageDead(_10); - StorageLive(_16); - StorageLive(_17); - StorageLive(_18); - _18 = (_1.0: for<'b> fn(&'b u8)); - _17 = Foo::<for<'a> fn(&'a u8)>(move _18); - StorageDead(_18); - _16 = Box::<Foo<for<'a> fn(&'a u8)>>::new(move _17) -> [return: bb9, unwind: bb28]; - } - - bb9: { - StorageDead(_17); - FakeRead(ForLet(None), _16); - StorageLive(_19); - StorageLive(_20); -- _20 = move _16; -+ _20 = move (_16 Subtyped as Box<Foo<fn(&u8)>>; - AscribeUserType(_20, o, UserTypeProjection { base: UserType(6), projs: [] }); - _19 = move _20; - FakeRead(ForLet(None), _19); - drop(_20) -> [return: bb10, unwind: bb22]; - } - - bb10: { - StorageDead(_20); - StorageLive(_21); - StorageLive(_22); - StorageLive(_23); - _23 = move _19; - _22 = move _23 as std::boxed::Box<dyn GetInner<Assoc = std::string::String>> (PointerCoercion(Unsize)); - drop(_23) -> [return: bb11, unwind: bb22]; - } - - bb11: { - StorageDead(_23); - AscribeUserType(_22, o, UserTypeProjection { base: UserType(7), projs: [] }); - _21 = move _22; - FakeRead(ForLet(None), _21); - drop(_22) -> [return: bb12, unwind: bb21]; - } - - bb12: { - StorageDead(_22); - StorageLive(_24); - StorageLive(_25); - _25 = &mut (*_21); - _24 = <dyn GetInner<Assoc = String> as GetInner>::muahaha(move _25) -> [return: bb13, unwind: bb21]; - } - - bb13: { - StorageDead(_25); - FakeRead(ForLet(None), _24); - StorageLive(_26); - StorageLive(_27); - _27 = move _24; - _26 = std::mem::drop::<String>(move _27) -> [return: bb14, unwind: bb19]; - } - - bb14: { - StorageDead(_27); - StorageDead(_26); - _0 = const (); - drop(_24) -> [return: bb15, unwind: bb21]; - } - - bb15: { - StorageDead(_24); - drop(_21) -> [return: bb16, unwind: bb22]; - } - - bb16: { - StorageDead(_21); - drop(_19) -> [return: bb17, unwind: bb23]; - } - - bb17: { - StorageDead(_19); - drop(_16) -> [return: bb18, unwind: bb28]; - } - - bb18: { - StorageDead(_16); - StorageDead(_1); - return; - } - - bb19 (cleanup): { - drop(_27) -> [return: bb20, unwind terminate]; - } - - bb20 (cleanup): { - drop(_24) -> [return: bb21, unwind terminate]; - } - - bb21 (cleanup): { - drop(_21) -> [return: bb22, unwind terminate]; - } - - bb22 (cleanup): { - drop(_19) -> [return: bb23, unwind terminate]; - } - - bb23 (cleanup): { - drop(_16) -> [return: bb28, unwind terminate]; - } - - bb24 (cleanup): { - drop(_11) -> [return: bb25, unwind terminate]; - } - - bb25 (cleanup): { - drop(_12) -> [return: bb28, unwind terminate]; - } - - bb26 (cleanup): { - drop(_4) -> [return: bb27, unwind terminate]; - } - - bb27 (cleanup): { - drop(_5) -> [return: bb28, unwind terminate]; - } - - bb28 (cleanup): { - resume; - } - } - diff --git a/tests/mir-opt/mir_subtyping.rs b/tests/mir-opt/mir_subtyping.rs deleted file mode 100644 index 558ccaca9f3..00000000000 --- a/tests/mir-opt/mir_subtyping.rs +++ /dev/null @@ -1,43 +0,0 @@ -// compile-flags: -Z mir-opt-level=0 - -// EMIT_MIR mir_subtyping.main.Subtyper.diff -#![allow(coherence_leak_check)] - -struct Foo<T: 'static>(T); - -fn useful<'a>(_: &'a u8) {} - -pub struct Wrapper(for<'b> fn(&'b u8)); - -trait GetInner { - type Assoc; - fn muahaha(&mut self) -> Self::Assoc; -} - -impl GetInner for Foo<fn(&'static u8)> { - type Assoc = String; - fn muahaha(&mut self) -> String { - panic!("cant do it boss") - } -} - -impl GetInner for Foo<for<'a> fn(&'a u8)> { - type Assoc = [usize; 3]; - fn muahaha(&mut self) -> [usize; 3] { - [100; 3] - } -} - -fn main() { - let wrapper = Wrapper(useful); - - drop(Box::new(Foo(useful as fn(&'static u8))) as Box<dyn GetInner<Assoc = String>>); - drop(Box::new(Foo(useful as fn(&u8))) as Box<dyn GetInner<Assoc = [usize; 3]>>); - - let hr_fnptr = Box::new(Foo::<for<'a> fn(&'a u8)>(wrapper.0)); - let lr_fnptr = hr_fnptr as Box<Foo<fn(&'static u8)>>; - let mut any = lr_fnptr as Box<dyn GetInner<Assoc = String>>; - - let evil_string = any.muahaha(); - drop(evil_string); -} diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir index 67afa50bd58..8a0eb36701a 100644 --- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir +++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -22,7 +22,7 @@ fn main() -> () { let _24: i32; let mut _26: *const i32; let _27: (); - let mut _29: [closure@main::{closure#0}]; + let mut _29: for<'a> fn(&'a i32) -> &'a i32; scope 1 { debug x => _1; let _3: &mut i32; @@ -106,7 +106,8 @@ fn main() -> () { StorageLive(_14); _14 = {closure@main::{closure#0}}; Retag(_14); - _13 = move (_14 Subtyped as for<'a> fn(&'a i32) -> &'a i32 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal))); + _29 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal))); + _13 = move (_29 Subtyped as for<'a> fn(&'a i32) -> &'a i32); StorageDead(_14); StorageLive(_15); StorageLive(_16); diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir index 467b4493bf3..ac1fe555900 100644 --- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir +++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -22,7 +22,7 @@ fn main() -> () { let _24: i32; let mut _26: *const i32; let _27: (); - let mut _29: [closure@main::{closure#0}]; + let mut _29: for<'a> fn(&'a i32) -> &'a i32; scope 1 { debug x => _1; let _3: &mut i32; @@ -106,7 +106,8 @@ fn main() -> () { StorageLive(_14); _14 = {closure@main::{closure#0}}; Retag(_14); - _13 = move (_14 Subtyped as for<'a> fn(&'a i32) -> &'a i32 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal))); + _29 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal))); + _13 = move (_29 Subtyped as for<'a> fn(&'a i32) -> &'a i32); StorageDead(_14); StorageLive(_15); StorageLive(_16); |
