forked from rust-lang/rust
-
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.
Rollup merge of rust-lang#97025 - ouz-a:mini-derefer-generator, r=dav…
…idtwco Add validation layer for Derefer _Follow up work to rust-lang#96549 rust-lang#96116 rust-lang#95857 #95649_ This adds validation for Derefer making sure it is always the first projection. r? rust-lang/mir-opt
- Loading branch information
Showing
39 changed files
with
297 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
- // MIR for `main` before Derefer | ||
+ // MIR for `main` after Derefer | ||
|
||
fn main() -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/derefer_inline_test.rs:7:11: 7:11 | ||
let _1: std::boxed::Box<std::boxed::Box<i32>>; // in scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
let mut _2: usize; // in scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
let mut _3: usize; // in scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
let mut _4: *mut u8; // in scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
let mut _5: std::boxed::Box<std::boxed::Box<i32>>; // in scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
let mut _6: (); // in scope 0 at $DIR/derefer_inline_test.rs:8:11: 8:12 | ||
scope 1 { | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
_2 = SizeOf(std::boxed::Box<i32>); // scope 1 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
_3 = AlignOf(std::boxed::Box<i32>); // scope 1 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 1 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
// mir::Constant | ||
// + span: $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) } | ||
} | ||
|
||
bb1: { | ||
StorageLive(_5); // scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
_5 = ShallowInitBox(move _4, std::boxed::Box<i32>); // scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
(*_5) = f() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/derefer_inline_test.rs:8:9: 8:12 | ||
// mir::Constant | ||
// + span: $DIR/derefer_inline_test.rs:8:9: 8:10 | ||
// + literal: Const { ty: fn() -> Box<i32> {f}, val: Value(Scalar(<ZST>)) } | ||
} | ||
|
||
bb2: { | ||
_1 = move _5; // scope 0 at $DIR/derefer_inline_test.rs:8:5: 8:12 | ||
goto -> bb3; // scope 0 at $DIR/derefer_inline_test.rs:8:11: 8:12 | ||
} | ||
|
||
bb3: { | ||
StorageDead(_5); // scope 0 at $DIR/derefer_inline_test.rs:8:11: 8:12 | ||
drop(_1) -> [return: bb4, unwind: bb6]; // scope 0 at $DIR/derefer_inline_test.rs:8:12: 8:13 | ||
} | ||
|
||
bb4: { | ||
StorageDead(_1); // scope 0 at $DIR/derefer_inline_test.rs:8:12: 8:13 | ||
_0 = const (); // scope 0 at $DIR/derefer_inline_test.rs:7:11: 9:2 | ||
return; // scope 0 at $DIR/derefer_inline_test.rs:9:2: 9:2 | ||
} | ||
|
||
bb5 (cleanup): { | ||
goto -> bb8; // scope 0 at $DIR/derefer_inline_test.rs:8:11: 8:12 | ||
} | ||
|
||
bb6 (cleanup): { | ||
resume; // scope 0 at $DIR/derefer_inline_test.rs:7:1: 9:2 | ||
} | ||
|
||
bb7 (cleanup): { | ||
_6 = alloc::alloc::box_free::<Box<i32>, std::alloc::Global>(move (_5.0: std::ptr::Unique<std::boxed::Box<i32>>), move (_5.1: std::alloc::Global)) -> bb6; // scope 0 at $DIR/derefer_inline_test.rs:8:11: 8:12 | ||
// mir::Constant | ||
// + span: $DIR/derefer_inline_test.rs:8:11: 8:12 | ||
// + literal: Const { ty: unsafe fn(Unique<Box<i32>>, std::alloc::Global) {alloc::alloc::box_free::<Box<i32>, std::alloc::Global>}, val: Value(Scalar(<ZST>)) } | ||
} | ||
|
||
bb8 (cleanup): { | ||
goto -> bb7; // scope 0 at $DIR/derefer_inline_test.rs:8:11: 8:12 | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// EMIT_MIR derefer_inline_test.main.Derefer.diff | ||
#![feature(box_syntax)] | ||
#[inline] | ||
fn f() -> Box<i32> { | ||
box 0 | ||
} | ||
fn main() { | ||
box f(); | ||
} |
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
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
Oops, something went wrong.