Rollup merge of #37577 - nnethercote:shrink-Expr-slightly, r=eddyb
Shrink `hir::Expr` slightly r? @eddyb
This commit is contained in:
commit
07cf4b418f
@ -1233,7 +1233,7 @@ impl<'a> LoweringContext<'a> {
|
|||||||
hir::ExprInlineAsm(P(hir_asm), outputs, inputs)
|
hir::ExprInlineAsm(P(hir_asm), outputs, inputs)
|
||||||
}
|
}
|
||||||
ExprKind::Struct(ref path, ref fields, ref maybe_expr) => {
|
ExprKind::Struct(ref path, ref fields, ref maybe_expr) => {
|
||||||
hir::ExprStruct(self.lower_path(path),
|
hir::ExprStruct(P(self.lower_path(path)),
|
||||||
fields.iter().map(|x| self.lower_field(x)).collect(),
|
fields.iter().map(|x| self.lower_field(x)).collect(),
|
||||||
maybe_expr.as_ref().map(|x| self.lower_expr(x)))
|
maybe_expr.as_ref().map(|x| self.lower_expr(x)))
|
||||||
}
|
}
|
||||||
@ -1737,7 +1737,7 @@ impl<'a> LoweringContext<'a> {
|
|||||||
e: Option<P<hir::Expr>>,
|
e: Option<P<hir::Expr>>,
|
||||||
attrs: ThinVec<Attribute>) -> P<hir::Expr> {
|
attrs: ThinVec<Attribute>) -> P<hir::Expr> {
|
||||||
let def = self.resolver.resolve_generated_global_path(&path, false);
|
let def = self.resolver.resolve_generated_global_path(&path, false);
|
||||||
let expr = self.expr(sp, hir::ExprStruct(path, fields, e), attrs);
|
let expr = self.expr(sp, hir::ExprStruct(P(path), fields, e), attrs);
|
||||||
self.resolver.record_resolution(expr.id, def);
|
self.resolver.record_resolution(expr.id, def);
|
||||||
expr
|
expr
|
||||||
}
|
}
|
||||||
|
@ -840,8 +840,8 @@ pub enum UnsafeSource {
|
|||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
|
||||||
pub struct Expr {
|
pub struct Expr {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub node: Expr_,
|
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
pub node: Expr_,
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -946,7 +946,7 @@ pub enum Expr_ {
|
|||||||
///
|
///
|
||||||
/// For example, `Foo {x: 1, y: 2}`, or
|
/// For example, `Foo {x: 1, y: 2}`, or
|
||||||
/// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
|
/// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
|
||||||
ExprStruct(Path, HirVec<Field>, Option<P<Expr>>),
|
ExprStruct(P<Path>, HirVec<Field>, Option<P<Expr>>),
|
||||||
|
|
||||||
/// An array literal constructed from one repeated element.
|
/// An array literal constructed from one repeated element.
|
||||||
///
|
///
|
||||||
|
@ -314,7 +314,7 @@ pub fn const_expr_to_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
.collect::<Result<_, _>>()?;
|
.collect::<Result<_, _>>()?;
|
||||||
PatKind::Struct(path.clone(), field_pats, false)
|
PatKind::Struct((**path).clone(), field_pats, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::ExprArray(ref exprs) => {
|
hir::ExprArray(ref exprs) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user