1
Fork 0

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.
This commit is contained in:
Nilstrieb 2023-03-01 20:56:17 +00:00
parent 5157d938c4
commit e3d397a5f6
2 changed files with 12 additions and 12 deletions

View file

@ -237,6 +237,9 @@ pub struct LocalVarId(pub hir::HirId);
/// A THIR expression. /// A THIR expression.
#[derive(Clone, Debug, HashStable)] #[derive(Clone, Debug, HashStable)]
pub struct Expr<'tcx> { pub struct Expr<'tcx> {
/// kind of expression
pub kind: ExprKind<'tcx>,
/// The type of this expression /// The type of this expression
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
@ -246,9 +249,6 @@ pub struct Expr<'tcx> {
/// span of the expression in the source /// span of the expression in the source
pub span: Span, pub span: Span,
/// kind of expression
pub kind: ExprKind<'tcx>,
} }
#[derive(Clone, Debug, HashStable)] #[derive(Clone, Debug, HashStable)]

View file

@ -17,21 +17,16 @@ Thir {
], ],
exprs: [ exprs: [
Expr { Expr {
ty: (),
temp_lifetime: Some(
Node(2),
),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
kind: Block { kind: Block {
block: b0, block: b0,
}, },
},
Expr {
ty: (), ty: (),
temp_lifetime: Some( temp_lifetime: Some(
Node(2), Node(2),
), ),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0), span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
},
Expr {
kind: Scope { kind: Scope {
region_scope: Node(2), region_scope: Node(2),
lint_level: Explicit( lint_level: Explicit(
@ -39,18 +34,23 @@ Thir {
), ),
value: e0, value: e0,
}, },
},
Expr {
ty: (), ty: (),
temp_lifetime: Some( temp_lifetime: Some(
Node(2), Node(2),
), ),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0), span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
},
Expr {
kind: Scope { kind: Scope {
region_scope: Destruction(2), region_scope: Destruction(2),
lint_level: Inherited, lint_level: Inherited,
value: e1, value: e1,
}, },
ty: (),
temp_lifetime: Some(
Node(2),
),
span: $DIR/thir-flat.rs:4:15: 4:17 (#0),
}, },
], ],
stmts: [], stmts: [],