forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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#132161 - celinval:smir-fix-indent, r=compiler-errors [StableMIR] A few fixes to pretty printing Improve identation, and a few other rvalue printing try-job: x86_64-msvc try-job: test-various
- Loading branch information
Showing
4 changed files
with
395 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort | ||
//@ check-pass | ||
//@ only-x86_64 | ||
//@ needs-unwind unwind edges are different with panic=abort | ||
//! Check how stable mir pretty printer prints different operands and abort strategy. | ||
|
||
pub fn operands(val: u8) { | ||
let array = [val; 10]; | ||
let first = array[0]; | ||
let last = array[10 - 1]; | ||
assert_eq!(first, last); | ||
|
||
let reference = &first; | ||
let dereferenced = *reference; | ||
assert_eq!(dereferenced, first); | ||
|
||
let tuple = (first, last); | ||
let (first_again, _) = tuple; | ||
let first_again_again = tuple.0; | ||
assert_eq!(first_again, first_again_again); | ||
|
||
let length = array.len(); | ||
let size_of = std::mem::size_of_val(&length); | ||
assert_eq!(length, size_of); | ||
} | ||
|
||
pub struct Dummy { | ||
c: char, | ||
i: i32, | ||
} | ||
|
||
pub enum Ctors { | ||
Unit, | ||
StructLike { d: Dummy }, | ||
TupLike(bool), | ||
} | ||
|
||
pub fn more_operands() -> [Ctors; 3] { | ||
let dummy = Dummy { c: 'a', i: i32::MIN }; | ||
let unit = Ctors::Unit; | ||
let struct_like = Ctors::StructLike { d: dummy }; | ||
let tup_like = Ctors::TupLike(false); | ||
[unit, struct_like, tup_like] | ||
} | ||
|
||
pub fn closures(x: bool, z: bool) -> impl FnOnce(bool) -> bool { | ||
move |y: bool| (x ^ y) || z | ||
} |
Oops, something went wrong.