put hir::AnonConst
on the hir arena
This commit is contained in:
parent
e7da0fa62f
commit
4dc46f7f17
11 changed files with 47 additions and 41 deletions
|
@ -375,7 +375,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_array_length(&mut self, len: &'hir ArrayLen) {
|
||||
fn visit_array_length(&mut self, len: &'hir ArrayLen<'hir>) {
|
||||
match len {
|
||||
ArrayLen::Infer(inf) => self.insert(inf.span, inf.hir_id, Node::ArrayLenInfer(inf)),
|
||||
ArrayLen::Body(..) => intravisit::walk_array_len(self, len),
|
||||
|
|
|
@ -1588,11 +1588,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
}),
|
||||
)),
|
||||
)),
|
||||
default: Some(hir::AnonConst {
|
||||
default: Some(self.arena.alloc(hir::AnonConst {
|
||||
def_id: anon_const,
|
||||
hir_id: const_id,
|
||||
body: const_body,
|
||||
}),
|
||||
})),
|
||||
is_host_effect: true,
|
||||
},
|
||||
colon_span: None,
|
||||
|
|
|
@ -1181,10 +1181,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
tokens: None,
|
||||
};
|
||||
|
||||
let ct = self.with_new_scopes(span, |this| hir::AnonConst {
|
||||
def_id,
|
||||
hir_id: this.lower_node_id(node_id),
|
||||
body: this.lower_const_body(path_expr.span, Some(&path_expr)),
|
||||
let ct = self.with_new_scopes(span, |this| {
|
||||
self.arena.alloc(hir::AnonConst {
|
||||
def_id,
|
||||
hir_id: this.lower_node_id(node_id),
|
||||
body: this
|
||||
.lower_const_body(path_expr.span, Some(&path_expr)),
|
||||
})
|
||||
});
|
||||
return GenericArg::Const(ConstArg {
|
||||
value: ct,
|
||||
|
@ -2318,7 +2321,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen {
|
||||
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen<'hir> {
|
||||
match c.value.kind {
|
||||
ExprKind::Underscore => {
|
||||
if self.tcx.features().generic_arg_infer {
|
||||
|
@ -2341,12 +2344,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
fn lower_anon_const(&mut self, c: &AnonConst) -> hir::AnonConst {
|
||||
self.with_new_scopes(c.value.span, |this| hir::AnonConst {
|
||||
fn lower_anon_const(&mut self, c: &AnonConst) -> &'hir hir::AnonConst {
|
||||
self.arena.alloc(self.with_new_scopes(c.value.span, |this| hir::AnonConst {
|
||||
def_id: this.local_def_id(c.id),
|
||||
hir_id: this.lower_node_id(c.id),
|
||||
body: this.lower_const_body(c.value.span, Some(&c.value)),
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn lower_unsafe_source(&mut self, u: UnsafeSource) -> hir::UnsafeSource {
|
||||
|
@ -2653,7 +2656,7 @@ impl<'hir> GenericArgsCtor<'hir> {
|
|||
|
||||
lcx.children.push((def_id, hir::MaybeOwner::NonOwner(hir_id)));
|
||||
self.args.push(hir::GenericArg::Const(hir::ConstArg {
|
||||
value: hir::AnonConst { def_id, hir_id, body },
|
||||
value: lcx.arena.alloc(hir::AnonConst { def_id, hir_id, body }),
|
||||
span,
|
||||
is_desugared_from_effects: true,
|
||||
}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue