Skip to content

Commit 7c4e9dd

Browse files
authored
Rollup merge of #108624 - Nilstrieb:move-it-up, r=WaffleLapkin
Make `ExprKind` the first field in `thir::Expr` This makes its `Debug` impl print it first which is useful, as it's the most important part when looking at an expr.
2 parents 0dc12b9 + e3d397a commit 7c4e9dd

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

compiler/rustc_middle/src/thir.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ pub struct LocalVarId(pub hir::HirId);
237237
/// A THIR expression.
238238
#[derive(Clone, Debug, HashStable)]
239239
pub struct Expr<'tcx> {
240+
/// kind of expression
241+
pub kind: ExprKind<'tcx>,
242+
240243
/// The type of this expression
241244
pub ty: Ty<'tcx>,
242245

@@ -246,9 +249,6 @@ pub struct Expr<'tcx> {
246249

247250
/// span of the expression in the source
248251
pub span: Span,
249-
250-
/// kind of expression
251-
pub kind: ExprKind<'tcx>,
252252
}
253253

254254
#[derive(Clone, Debug, HashStable)]

tests/ui/thir-print/thir-flat.stdout

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,40 @@ Thir {
1717
],
1818
exprs: [
1919
Expr {
20-
ty: (),
21-
temp_lifetime: Some(
22-
Node(2),
23-
),
24-
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
2520
kind: Block {
2621
block: b0,
2722
},
28-
},
29-
Expr {
3023
ty: (),
3124
temp_lifetime: Some(
3225
Node(2),
3326
),
3427
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
28+
},
29+
Expr {
3530
kind: Scope {
3631
region_scope: Node(2),
3732
lint_level: Explicit(
3833
HirId(DefId(0:3 ~ thir_flat[45a6]::main).2),
3934
),
4035
value: e0,
4136
},
42-
},
43-
Expr {
4437
ty: (),
4538
temp_lifetime: Some(
4639
Node(2),
4740
),
4841
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
42+
},
43+
Expr {
4944
kind: Scope {
5045
region_scope: Destruction(2),
5146
lint_level: Inherited,
5247
value: e1,
5348
},
49+
ty: (),
50+
temp_lifetime: Some(
51+
Node(2),
52+
),
53+
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
5454
},
5555
],
5656
stmts: [],

0 commit comments

Comments
 (0)