forked from softdevteam/alloy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from GcSmartPointer trait to Gc lang_item
The GcSmartPointer trait was a hangover which let the compiler identify `Gc<T>` structs when they were defined as part of a non-rustc library. Now that the `Gc` implementation is part of the standard library, this is unnecessary and adds complexity. This requires the prevent_early_finalization mir-opt tests to be temporarily ignored due to an issue with non-deterministic builds when bringing in the alloc crate across different machines. [1] [1]: softdevteam#45
- Loading branch information
1 parent
0513c67
commit 391856a
Showing
13 changed files
with
358 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 60 additions & 26 deletions
86
tests/mir-opt/prevent_early_finalization.preserve_args.PreventEarlyFinalization.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,75 @@ | ||
- // MIR for `preserve_args` before PreventEarlyFinalization | ||
+ // MIR for `preserve_args` after PreventEarlyFinalization | ||
|
||
| User Type Annotations | ||
| 0: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }], value: TypeOf(DefId(5:4632 ~ alloc[ed55]::gc::{impl#5}::new), UserSubsts { substs: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(5:4630 ~ alloc[ed55]::gc::{impl#5}), self_ty: std::gc::Gc<^1> }) }) } at $DIR/prevent_early_finalization.rs:25:35: 25:42 | ||
| 1: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }], value: TypeOf(DefId(5:4632 ~ alloc[ed55]::gc::{impl#5}::new), UserSubsts { substs: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(5:4630 ~ alloc[ed55]::gc::{impl#5}), self_ty: std::gc::Gc<^1> }) }) } at $DIR/prevent_early_finalization.rs:25:64: 25:71 | ||
| | ||
fn preserve_args() -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/prevent_early_finalization.rs:28:20: 28:20 | ||
let _1: Finalizable; // in scope 0 at $DIR/prevent_early_finalization.rs:29:9: 29:12 | ||
let mut _2: Finalizable; // in scope 0 at $DIR/prevent_early_finalization.rs:29:35: 29:51 | ||
let mut _3: Finalizable; // in scope 0 at $DIR/prevent_early_finalization.rs:29:53: 29:69 | ||
let mut _0: (); // return place in scope 0 at $DIR/prevent_early_finalization.rs:24:20: 24:20 | ||
let _1: std::gc::Gc<NeedsFinalize>; // in scope 0 at $DIR/prevent_early_finalization.rs:25:9: 25:12 | ||
let mut _2: std::gc::Gc<NeedsFinalize>; // in scope 0 at $DIR/prevent_early_finalization.rs:25:35: 25:62 | ||
let mut _3: NeedsFinalize; // in scope 0 at $DIR/prevent_early_finalization.rs:25:43: 25:61 | ||
let mut _4: std::gc::Gc<NeedsFinalize>; // in scope 0 at $DIR/prevent_early_finalization.rs:25:64: 25:91 | ||
let mut _5: NeedsFinalize; // in scope 0 at $DIR/prevent_early_finalization.rs:25:72: 25:90 | ||
scope 1 { | ||
debug ret => _1; // in scope 1 at $DIR/prevent_early_finalization.rs:29:9: 29:12 | ||
debug ret => _1; // in scope 1 at $DIR/prevent_early_finalization.rs:25:9: 25:12 | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 0 at $DIR/prevent_early_finalization.rs:29:9: 29:12 | ||
StorageLive(_2); // scope 0 at $DIR/prevent_early_finalization.rs:29:35: 29:51 | ||
_2 = Finalizable(const 123_usize); // scope 0 at $DIR/prevent_early_finalization.rs:29:35: 29:51 | ||
StorageLive(_3); // scope 0 at $DIR/prevent_early_finalization.rs:29:53: 29:69 | ||
_3 = Finalizable(const 456_usize); // scope 0 at $DIR/prevent_early_finalization.rs:29:53: 29:69 | ||
_1 = preserve_args_inner(move _2, move _3) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/prevent_early_finalization.rs:29:15: 29:70 | ||
StorageLive(_1); // scope 0 at $DIR/prevent_early_finalization.rs:25:9: 25:12 | ||
StorageLive(_2); // scope 0 at $DIR/prevent_early_finalization.rs:25:35: 25:62 | ||
StorageLive(_3); // scope 0 at $DIR/prevent_early_finalization.rs:25:43: 25:61 | ||
_3 = NeedsFinalize(const 123_usize); // scope 0 at $DIR/prevent_early_finalization.rs:25:43: 25:61 | ||
_2 = Gc::<NeedsFinalize>::new(move _3) -> [return: bb1, unwind: bb5]; // scope 0 at $DIR/prevent_early_finalization.rs:25:35: 25:62 | ||
// mir::Constant | ||
// + span: $DIR/prevent_early_finalization.rs:29:15: 29:34 | ||
// + literal: Const { ty: fn(Finalizable, Finalizable) -> Finalizable {preserve_args_inner}, val: Value(Scalar(<ZST>)) } | ||
// + span: $DIR/prevent_early_finalization.rs:25:35: 25:42 | ||
// + user_ty: UserType(0) | ||
// + literal: Const { ty: fn(NeedsFinalize) -> std::gc::Gc<NeedsFinalize> {std::gc::Gc::<NeedsFinalize>::new}, val: Value(Scalar(<ZST>)) } | ||
} | ||
|
||
bb1: { | ||
StorageDead(_3); // scope 0 at $DIR/prevent_early_finalization.rs:29:69: 29:70 | ||
StorageDead(_2); // scope 0 at $DIR/prevent_early_finalization.rs:29:69: 29:70 | ||
FakeRead(ForLet, _1); // scope 0 at $DIR/prevent_early_finalization.rs:29:9: 29:12 | ||
_0 = const (); // scope 0 at $DIR/prevent_early_finalization.rs:28:20: 30:2 | ||
- StorageDead(_1); // scope 0 at $DIR/prevent_early_finalization.rs:30:1: 30:2 | ||
+ nop; // scope 0 at $DIR/prevent_early_finalization.rs:30:1: 30:2 | ||
+ llvm_asm!(LlvmInlineAsmInner { asm: "", asm_str_style: Cooked, outputs: [], inputs: ["r"], clobbers: ["memory"], volatile: true, alignstack: false, dialect: Att } : [] : [($DIR/prevent_early_finalization.rs:1:1: 1:1 (#0), _1)]); // scope 0 at $DIR/prevent_early_finalization.rs:30:2: 30:2 | ||
+ StorageDead(_1); // scope 0 at $DIR/prevent_early_finalization.rs:30:2: 30:2 | ||
return; // scope 0 at $DIR/prevent_early_finalization.rs:30:2: 30:2 | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; // scope 0 at $DIR/prevent_early_finalization.rs:28:1: 30:2 | ||
StorageDead(_3); // scope 0 at $DIR/prevent_early_finalization.rs:25:61: 25:62 | ||
StorageLive(_4); // scope 0 at $DIR/prevent_early_finalization.rs:25:64: 25:91 | ||
StorageLive(_5); // scope 0 at $DIR/prevent_early_finalization.rs:25:72: 25:90 | ||
_5 = NeedsFinalize(const 456_usize); // scope 0 at $DIR/prevent_early_finalization.rs:25:72: 25:90 | ||
_4 = Gc::<NeedsFinalize>::new(move _5) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/prevent_early_finalization.rs:25:64: 25:91 | ||
// mir::Constant | ||
// + span: $DIR/prevent_early_finalization.rs:25:64: 25:71 | ||
// + user_ty: UserType(1) | ||
// + literal: Const { ty: fn(NeedsFinalize) -> std::gc::Gc<NeedsFinalize> {std::gc::Gc::<NeedsFinalize>::new}, val: Value(Scalar(<ZST>)) } | ||
} | ||
|
||
bb2: { | ||
StorageDead(_5); // scope 0 at $DIR/prevent_early_finalization.rs:25:90: 25:91 | ||
_1 = preserve_args_inner(move _2, move _4) -> [return: bb3, unwind: bb6]; // scope 0 at $DIR/prevent_early_finalization.rs:25:15: 25:92 | ||
// mir::Constant | ||
// + span: $DIR/prevent_early_finalization.rs:25:15: 25:34 | ||
// + literal: Const { ty: fn(std::gc::Gc<NeedsFinalize>, std::gc::Gc<NeedsFinalize>) -> std::gc::Gc<NeedsFinalize> {preserve_args_inner}, val: Value(Scalar(<ZST>)) } | ||
} | ||
|
||
bb3: { | ||
StorageDead(_4); // scope 0 at $DIR/prevent_early_finalization.rs:25:91: 25:92 | ||
StorageDead(_2); // scope 0 at $DIR/prevent_early_finalization.rs:25:91: 25:92 | ||
FakeRead(ForLet(None), _1); // scope 0 at $DIR/prevent_early_finalization.rs:25:9: 25:12 | ||
_0 = const (); // scope 0 at $DIR/prevent_early_finalization.rs:24:20: 26:2 | ||
- StorageDead(_1); // scope 0 at $DIR/prevent_early_finalization.rs:26:1: 26:2 | ||
+ nop; // scope 0 at $DIR/prevent_early_finalization.rs:26:1: 26:2 | ||
+ llvm_asm!(LlvmInlineAsmInner { asm: "", asm_str_style: Cooked, outputs: [], inputs: ["r"], clobbers: ["memory"], volatile: true, alignstack: false, dialect: Att } : [] : [(no-location (#0), _1)]); // scope 0 at $DIR/prevent_early_finalization.rs:26:2: 26:2 | ||
+ StorageDead(_1); // scope 0 at $DIR/prevent_early_finalization.rs:26:2: 26:2 | ||
return; // scope 0 at $DIR/prevent_early_finalization.rs:26:2: 26:2 | ||
} | ||
|
||
bb4 (cleanup): { | ||
drop(_5) -> bb6; // scope 0 at $DIR/prevent_early_finalization.rs:25:90: 25:91 | ||
} | ||
|
||
bb5 (cleanup): { | ||
drop(_3) -> bb6; // scope 0 at $DIR/prevent_early_finalization.rs:25:61: 25:62 | ||
} | ||
|
||
bb6 (cleanup): { | ||
resume; // scope 0 at $DIR/prevent_early_finalization.rs:24:1: 26:2 | ||
} | ||
} | ||
|
Oops, something went wrong.