Add hir::Node::PreciseCapturingNonLifetimeArg
This commit is contained in:
parent
42ba57c013
commit
02d7317af2
14 changed files with 110 additions and 38 deletions
|
@ -385,4 +385,21 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
|
|||
fn visit_pattern_type_pattern(&mut self, p: &'hir hir::Pat<'hir>) {
|
||||
self.visit_pat(p)
|
||||
}
|
||||
|
||||
fn visit_precise_capturing_arg(
|
||||
&mut self,
|
||||
arg: &'hir PreciseCapturingArg<'hir>,
|
||||
) -> Self::Result {
|
||||
match arg {
|
||||
PreciseCapturingArg::Lifetime(_) => {
|
||||
// This is represented as a `Node::Lifetime`, intravisit will get to it below.
|
||||
}
|
||||
PreciseCapturingArg::Param(param) => self.insert(
|
||||
param.ident.span,
|
||||
param.hir_id,
|
||||
Node::PreciseCapturingNonLifetimeArg(param),
|
||||
),
|
||||
}
|
||||
intravisit::walk_precise_capturing_arg(self, arg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1790,11 +1790,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
PreciseCapturingArg::Lifetime(lt) => {
|
||||
hir::PreciseCapturingArg::Lifetime(self.lower_lifetime(lt))
|
||||
}
|
||||
PreciseCapturingArg::Arg(_, node_id) => {
|
||||
PreciseCapturingArg::Arg(ident, node_id) => {
|
||||
let res = self.resolver.get_partial_res(*node_id).map_or(Res::Err, |partial_res| {
|
||||
partial_res.full_res().expect("no partial res expected for precise capture arg")
|
||||
});
|
||||
hir::PreciseCapturingArg::Param(self.lower_res(res), self.lower_node_id(*node_id))
|
||||
hir::PreciseCapturingArg::Param(hir::PreciseCapturingNonLifetimeArg {
|
||||
hir_id: self.lower_node_id(*node_id),
|
||||
ident: self.lower_ident(*ident),
|
||||
res: self.lower_res(res),
|
||||
})
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue