Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b2bf4b6

Browse files
committed
make more pretty
1 parent cbcf9a5 commit b2bf4b6

8 files changed

+51
-107
lines changed

‎compiler/rustc_middle/src/ty/context.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ use std::ops::{Bound, Deref};
8282
impl<'tcx> Interner for TyCtxt<'tcx> {
8383
type AdtDef = ty::AdtDef<'tcx>;
8484
type GenericArgsRef = ty::GenericArgsRef<'tcx>;
85+
type GenericArg = ty::GenericArg<'tcx>;
8586
type DefId = DefId;
8687
type Binder<T> = Binder<'tcx, T>;
8788
type Ty = Ty<'tcx>;

‎compiler/rustc_type_ir/src/lib.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ pub trait HashStableContext {}
4141

4242
pub trait Interner: Sized {
4343
type AdtDef: Clone + Debug + Hash + Ord;
44-
type GenericArgsRef: Clone + DebugWithInfcx<Self> + Hash + Ord;
44+
type GenericArgsRef: Clone
45+
+ DebugWithInfcx<Self>
46+
+ Hash
47+
+ Ord
48+
+ IntoIterator<Item = Self::GenericArg>;
49+
type GenericArg: Clone + DebugWithInfcx<Self> + Hash + Ord;
4550
type DefId: Clone + Debug + Hash + Ord;
4651
type Binder<T>;
4752
type Ty: Clone + DebugWithInfcx<Self> + Hash + Ord;

‎compiler/rustc_type_ir/src/sty.rs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,21 @@ impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
517517
Int(i) => write!(f, "{i:?}"),
518518
Uint(u) => write!(f, "{u:?}"),
519519
Float(float) => write!(f, "{float:?}"),
520-
Adt(d, s) => f.debug_tuple_field2_finish("Adt", d, &this.wrap(s)),
520+
Adt(d, s) => {
521+
write!(f, "{d:?}")?;
522+
let mut s = s.clone().into_iter();
523+
let first = s.next();
524+
match first {
525+
Some(first) => write!(f, "<{:?}", first)?,
526+
None => return Ok(()),
527+
};
528+
529+
for arg in s {
530+
write!(f, ", {:?}", arg)?;
531+
}
532+
533+
write!(f, ">")
534+
}
521535
Foreign(d) => f.debug_tuple_field1_finish("Foreign", d),
522536
Str => write!(f, "str"),
523537
Array(t, c) => write!(f, "[{:?}; {:?}]", &this.wrap(t), &this.wrap(c)),

‎tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
/* generator_layout = GeneratorLayout {
33
field_tys: {
44
_0: GeneratorSavedTy {
5-
ty: Adt(
6-
std::string::String,
7-
[
8-
],
9-
),
5+
ty: std::string::String,
106
source_info: SourceInfo {
117
span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0),
128
scope: scope[0],

‎tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
/* generator_layout = GeneratorLayout {
33
field_tys: {
44
_0: GeneratorSavedTy {
5-
ty: Adt(
6-
std::string::String,
7-
[
8-
],
9-
),
5+
ty: std::string::String,
106
source_info: SourceInfo {
117
span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0),
128
scope: scope[0],

‎tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
/* generator_layout = GeneratorLayout {
33
field_tys: {
44
_0: GeneratorSavedTy {
5-
ty: Adt(
6-
HasDrop,
7-
[
8-
],
9-
),
5+
ty: HasDrop,
106
source_info: SourceInfo {
117
span: $DIR/generator_tiny.rs:20:13: 20:15 (#0),
128
scope: scope[0],

‎tests/ui/thir-print/thir-flat-const-variant.stdout‎

Lines changed: 16 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
DefId(0:8 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR1):
22
Thir {
33
body_type: Const(
4-
Adt(
5-
Foo,
6-
[
7-
],
8-
),
4+
Foo,
95
),
106
arms: [],
117
blocks: [],
@@ -50,11 +46,7 @@ Thir {
5046
base: None,
5147
},
5248
),
53-
ty: Adt(
54-
Foo,
55-
[
56-
],
57-
),
49+
ty: Foo,
5850
temp_lifetime: Some(
5951
Node(3),
6052
),
@@ -68,11 +60,7 @@ Thir {
6860
),
6961
value: e2,
7062
},
71-
ty: Adt(
72-
Foo,
73-
[
74-
],
75-
),
63+
ty: Foo,
7664
temp_lifetime: Some(
7765
Node(3),
7866
),
@@ -84,11 +72,7 @@ Thir {
8472
lint_level: Inherited,
8573
value: e3,
8674
},
87-
ty: Adt(
88-
Foo,
89-
[
90-
],
91-
),
75+
ty: Foo,
9276
temp_lifetime: Some(
9377
Node(3),
9478
),
@@ -102,11 +86,7 @@ Thir {
10286
DefId(0:9 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR2):
10387
Thir {
10488
body_type: Const(
105-
Adt(
106-
Foo,
107-
[
108-
],
109-
),
89+
Foo,
11090
),
11191
arms: [],
11292
blocks: [],
@@ -151,11 +131,7 @@ Thir {
151131
base: None,
152132
},
153133
),
154-
ty: Adt(
155-
Foo,
156-
[
157-
],
158-
),
134+
ty: Foo,
159135
temp_lifetime: Some(
160136
Node(3),
161137
),
@@ -169,11 +145,7 @@ Thir {
169145
),
170146
value: e2,
171147
},
172-
ty: Adt(
173-
Foo,
174-
[
175-
],
176-
),
148+
ty: Foo,
177149
temp_lifetime: Some(
178150
Node(3),
179151
),
@@ -185,11 +157,7 @@ Thir {
185157
lint_level: Inherited,
186158
value: e3,
187159
},
188-
ty: Adt(
189-
Foo,
190-
[
191-
],
192-
),
160+
ty: Foo,
193161
temp_lifetime: Some(
194162
Node(3),
195163
),
@@ -203,11 +171,7 @@ Thir {
203171
DefId(0:10 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR3):
204172
Thir {
205173
body_type: Const(
206-
Adt(
207-
Foo,
208-
[
209-
],
210-
),
174+
Foo,
211175
),
212176
arms: [],
213177
blocks: [],
@@ -252,11 +216,7 @@ Thir {
252216
base: None,
253217
},
254218
),
255-
ty: Adt(
256-
Foo,
257-
[
258-
],
259-
),
219+
ty: Foo,
260220
temp_lifetime: Some(
261221
Node(3),
262222
),
@@ -270,11 +230,7 @@ Thir {
270230
),
271231
value: e2,
272232
},
273-
ty: Adt(
274-
Foo,
275-
[
276-
],
277-
),
233+
ty: Foo,
278234
temp_lifetime: Some(
279235
Node(3),
280236
),
@@ -286,11 +242,7 @@ Thir {
286242
lint_level: Inherited,
287243
value: e3,
288244
},
289-
ty: Adt(
290-
Foo,
291-
[
292-
],
293-
),
245+
ty: Foo,
294246
temp_lifetime: Some(
295247
Node(3),
296248
),
@@ -304,11 +256,7 @@ Thir {
304256
DefId(0:11 ~ thir_flat_const_variant[1f54]::{impl#0}::BAR4):
305257
Thir {
306258
body_type: Const(
307-
Adt(
308-
Foo,
309-
[
310-
],
311-
),
259+
Foo,
312260
),
313261
arms: [],
314262
blocks: [],
@@ -353,11 +301,7 @@ Thir {
353301
base: None,
354302
},
355303
),
356-
ty: Adt(
357-
Foo,
358-
[
359-
],
360-
),
304+
ty: Foo,
361305
temp_lifetime: Some(
362306
Node(3),
363307
),
@@ -371,11 +315,7 @@ Thir {
371315
),
372316
value: e2,
373317
},
374-
ty: Adt(
375-
Foo,
376-
[
377-
],
378-
),
318+
ty: Foo,
379319
temp_lifetime: Some(
380320
Node(3),
381321
),
@@ -387,11 +327,7 @@ Thir {
387327
lint_level: Inherited,
388328
value: e3,
389329
},
390-
ty: Adt(
391-
Foo,
392-
[
393-
],
394-
),
330+
ty: Foo,
395331
temp_lifetime: Some(
396332
Node(3),
397333
),

‎tests/ui/thir-print/thir-tree-match.stdout‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
DefId(0:16 ~ thir_tree_match[fcf8]::has_match):
22
params: [
33
Param {
4-
ty: Adt(Foo, [])
4+
ty: Foo
55
ty_span: Some($DIR/thir-tree-match.rs:15:19: 15:22 (#0))
66
self_kind: None
77
hir_id: Some(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).1))
88
param: Some(
99
Pat: {
10-
ty: Adt(Foo, [])
10+
ty: Foo
1111
span: $DIR/thir-tree-match.rs:15:14: 15:17 (#0)
1212
kind: PatKind {
1313
Binding {
1414
mutability: Not
1515
name: "foo"
1616
mode: ByValue
1717
var: LocalVarId(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).2))
18-
ty: Adt(Foo, [])
18+
ty: Foo
1919
is_primary: true
2020
subpattern: None
2121
}
@@ -73,7 +73,7 @@ body:
7373
Match {
7474
scrutinee:
7575
Expr {
76-
ty: Adt(Foo, [])
76+
ty: Foo
7777
temp_lifetime: Some(Node(26))
7878
span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0)
7979
kind:
@@ -82,7 +82,7 @@ body:
8282
lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).4))
8383
value:
8484
Expr {
85-
ty: Adt(Foo, [])
85+
ty: Foo
8686
temp_lifetime: Some(Node(26))
8787
span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0)
8888
kind:
@@ -96,7 +96,7 @@ body:
9696
Arm {
9797
pattern:
9898
Pat: {
99-
ty: Adt(Foo, [])
99+
ty: Foo
100100
span: $DIR/thir-tree-match.rs:17:9: 17:32 (#0)
101101
kind: PatKind {
102102
Variant {
@@ -110,7 +110,7 @@ body:
110110
variant_index: 0
111111
subpatterns: [
112112
Pat: {
113-
ty: Adt(Bar, [])
113+
ty: Bar
114114
span: $DIR/thir-tree-match.rs:17:21: 17:31 (#0)
115115
kind: PatKind {
116116
Variant {
@@ -169,7 +169,7 @@ body:
169169
Arm {
170170
pattern:
171171
Pat: {
172-
ty: Adt(Foo, [])
172+
ty: Foo
173173
span: $DIR/thir-tree-match.rs:18:9: 18:23 (#0)
174174
kind: PatKind {
175175
Variant {
@@ -183,7 +183,7 @@ body:
183183
variant_index: 0
184184
subpatterns: [
185185
Pat: {
186-
ty: Adt(Bar, [])
186+
ty: Bar
187187
span: $DIR/thir-tree-match.rs:18:21: 18:22 (#0)
188188
kind: PatKind {
189189
Wild
@@ -232,7 +232,7 @@ body:
232232
Arm {
233233
pattern:
234234
Pat: {
235-
ty: Adt(Foo, [])
235+
ty: Foo
236236
span: $DIR/thir-tree-match.rs:19:9: 19:20 (#0)
237237
kind: PatKind {
238238
Variant {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /