forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#118375 - ouz-a:add_emit_stable_mir_tests, r…
…=compiler-errors Add -Zunpretty=stable-mir output test As strongly suggested here rust-lang#118364 (comment) this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? `@compiler-errors`
- Loading branch information
Showing
3 changed files
with
241 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// compile-flags: -Z unpretty=stable-mir | ||
// check-pass | ||
|
||
fn foo(i:i32) -> i32 { | ||
i + 1 | ||
} | ||
|
||
fn bar(vec: &mut Vec<i32>) -> Vec<i32> { | ||
let mut new_vec = vec.clone(); | ||
new_vec.push(1); | ||
new_vec | ||
} | ||
|
||
fn main(){} |
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,226 @@ | ||
// WARNING: This is highly experimental output it's intended for stable-mir developers only. | ||
// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir. | ||
fn foo(_0: i32) -> i32 { | ||
let mut _0: (i32, bool); | ||
} | ||
bb0: { | ||
_2 = 1 Add const 1_i32 | ||
} | ||
bb1: { | ||
_0 = move _2 | ||
} | ||
fn bar(_0: &mut Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}) -> Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
} { | ||
let mut _0: Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}; | ||
let mut _1: &Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}; | ||
let _2: (); | ||
let mut _3: &mut Ty { | ||
id: 10, | ||
kind: RigidTy( | ||
Adt( | ||
AdtDef( | ||
DefId { | ||
id: 3, | ||
name: "std::vec::Vec", | ||
}, | ||
), | ||
GenericArgs( | ||
[ | ||
Type( | ||
Ty { | ||
id: 11, | ||
kind: Param( | ||
ParamTy { | ||
index: 0, | ||
name: "T", | ||
}, | ||
), | ||
}, | ||
), | ||
Type( | ||
Ty { | ||
id: 12, | ||
kind: Param( | ||
ParamTy { | ||
index: 1, | ||
name: "A", | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
}; | ||
} | ||
bb0: { | ||
_3 = refShared1 | ||
} | ||
bb1: { | ||
_5 = refMut { | ||
kind: TwoPhaseBorrow, | ||
}2 | ||
} | ||
bb2: { | ||
_0 = move _2 | ||
} | ||
bb3: { | ||
} | ||
bb4: { | ||
} | ||
fn main() -> () { | ||
} | ||
bb0: { | ||
} |