Skip to content

Commit 7969125

Browse files
authored
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`
2 parents 91b9f98 + 9e9ca4a commit 7969125

File tree

3 files changed

+241
-1
lines changed

3 files changed

+241
-1
lines changed

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
1111
const ENTRY_LIMIT: usize = 900;
1212
// FIXME: The following limits should be reduced eventually.
1313
const ISSUES_ENTRY_LIMIT: usize = 1852;
14-
const ROOT_ENTRY_LIMIT: usize = 867;
14+
const ROOT_ENTRY_LIMIT: usize = 868;
1515

1616
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
1717
"rs", // test source files
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// compile-flags: -Z unpretty=stable-mir
2+
// check-pass
3+
4+
fn foo(i:i32) -> i32 {
5+
i + 1
6+
}
7+
8+
fn bar(vec: &mut Vec<i32>) -> Vec<i32> {
9+
let mut new_vec = vec.clone();
10+
new_vec.push(1);
11+
new_vec
12+
}
13+
14+
fn main(){}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
// WARNING: This is highly experimental output it's intended for stable-mir developers only.
2+
// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir.
3+
fn foo(_0: i32) -> i32 {
4+
let mut _0: (i32, bool);
5+
}
6+
bb0: {
7+
_2 = 1 Add const 1_i32
8+
}
9+
bb1: {
10+
_0 = move _2
11+
}
12+
fn bar(_0: &mut Ty {
13+
id: 10,
14+
kind: RigidTy(
15+
Adt(
16+
AdtDef(
17+
DefId {
18+
id: 3,
19+
name: "std::vec::Vec",
20+
},
21+
),
22+
GenericArgs(
23+
[
24+
Type(
25+
Ty {
26+
id: 11,
27+
kind: Param(
28+
ParamTy {
29+
index: 0,
30+
name: "T",
31+
},
32+
),
33+
},
34+
),
35+
Type(
36+
Ty {
37+
id: 12,
38+
kind: Param(
39+
ParamTy {
40+
index: 1,
41+
name: "A",
42+
},
43+
),
44+
},
45+
),
46+
],
47+
),
48+
),
49+
),
50+
}) -> Ty {
51+
id: 10,
52+
kind: RigidTy(
53+
Adt(
54+
AdtDef(
55+
DefId {
56+
id: 3,
57+
name: "std::vec::Vec",
58+
},
59+
),
60+
GenericArgs(
61+
[
62+
Type(
63+
Ty {
64+
id: 11,
65+
kind: Param(
66+
ParamTy {
67+
index: 0,
68+
name: "T",
69+
},
70+
),
71+
},
72+
),
73+
Type(
74+
Ty {
75+
id: 12,
76+
kind: Param(
77+
ParamTy {
78+
index: 1,
79+
name: "A",
80+
},
81+
),
82+
},
83+
),
84+
],
85+
),
86+
),
87+
),
88+
} {
89+
let mut _0: Ty {
90+
id: 10,
91+
kind: RigidTy(
92+
Adt(
93+
AdtDef(
94+
DefId {
95+
id: 3,
96+
name: "std::vec::Vec",
97+
},
98+
),
99+
GenericArgs(
100+
[
101+
Type(
102+
Ty {
103+
id: 11,
104+
kind: Param(
105+
ParamTy {
106+
index: 0,
107+
name: "T",
108+
},
109+
),
110+
},
111+
),
112+
Type(
113+
Ty {
114+
id: 12,
115+
kind: Param(
116+
ParamTy {
117+
index: 1,
118+
name: "A",
119+
},
120+
),
121+
},
122+
),
123+
],
124+
),
125+
),
126+
),
127+
};
128+
let mut _1: &Ty {
129+
id: 10,
130+
kind: RigidTy(
131+
Adt(
132+
AdtDef(
133+
DefId {
134+
id: 3,
135+
name: "std::vec::Vec",
136+
},
137+
),
138+
GenericArgs(
139+
[
140+
Type(
141+
Ty {
142+
id: 11,
143+
kind: Param(
144+
ParamTy {
145+
index: 0,
146+
name: "T",
147+
},
148+
),
149+
},
150+
),
151+
Type(
152+
Ty {
153+
id: 12,
154+
kind: Param(
155+
ParamTy {
156+
index: 1,
157+
name: "A",
158+
},
159+
),
160+
},
161+
),
162+
],
163+
),
164+
),
165+
),
166+
};
167+
let _2: ();
168+
let mut _3: &mut Ty {
169+
id: 10,
170+
kind: RigidTy(
171+
Adt(
172+
AdtDef(
173+
DefId {
174+
id: 3,
175+
name: "std::vec::Vec",
176+
},
177+
),
178+
GenericArgs(
179+
[
180+
Type(
181+
Ty {
182+
id: 11,
183+
kind: Param(
184+
ParamTy {
185+
index: 0,
186+
name: "T",
187+
},
188+
),
189+
},
190+
),
191+
Type(
192+
Ty {
193+
id: 12,
194+
kind: Param(
195+
ParamTy {
196+
index: 1,
197+
name: "A",
198+
},
199+
),
200+
},
201+
),
202+
],
203+
),
204+
),
205+
),
206+
};
207+
}
208+
bb0: {
209+
_3 = refShared1
210+
}
211+
bb1: {
212+
_5 = refMut {
213+
kind: TwoPhaseBorrow,
214+
}2
215+
}
216+
bb2: {
217+
_0 = move _2
218+
}
219+
bb3: {
220+
}
221+
bb4: {
222+
}
223+
fn main() -> () {
224+
}
225+
bb0: {
226+
}

0 commit comments

Comments
 (0)