Skip to content

Commit

Permalink
Rollup merge of #108624 - Nilstrieb:move-it-up, r=WaffleLapkin
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr authored Mar 2, 2023
2 parents 0dc12b9 + e3d397a commit 7c4e9dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/thir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ pub struct LocalVarId(pub hir::HirId);
/// A THIR expression.
#[derive(Clone, Debug, HashStable)]
pub struct Expr<'tcx> {
/// kind of expression
pub kind: ExprKind<'tcx>,

/// The type of this expression
pub ty: Ty<'tcx>,

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

/// span of the expression in the source
pub span: Span,

/// kind of expression
pub kind: ExprKind<'tcx>,
}

#[derive(Clone, Debug, HashStable)]
Expand Down
18 changes: 9 additions & 9 deletions tests/ui/thir-print/thir-flat.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,40 @@ Thir {
],
exprs: [
Expr {
ty: (),
temp_lifetime: Some(
Node(2),
),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
kind: Block {
block: b0,
},
},
Expr {
ty: (),
temp_lifetime: Some(
Node(2),
),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
},
Expr {
kind: Scope {
region_scope: Node(2),
lint_level: Explicit(
HirId(DefId(0:3 ~ thir_flat[45a6]::main).2),
),
value: e0,
},
},
Expr {
ty: (),
temp_lifetime: Some(
Node(2),
),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
},
Expr {
kind: Scope {
region_scope: Destruction(2),
lint_level: Inherited,
value: e1,
},
ty: (),
temp_lifetime: Some(
Node(2),
),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
},
],
stmts: [],
Expand Down

0 comments on commit 7c4e9dd

Please sign in to comment.