fix the crossing function issue
This commit is contained in:
parent
7cd4b673d0
commit
68ea51602a
2 changed files with 3 additions and 1 deletions
|
@ -876,6 +876,8 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
// Ignore errors in function bodies if this is rustdoc
|
// Ignore errors in function bodies if this is rustdoc
|
||||||
// Be sure not to set this until the function signature has been resolved.
|
// Be sure not to set this until the function signature has been resolved.
|
||||||
let previous_state = replace(&mut this.in_func_body, true);
|
let previous_state = replace(&mut this.in_func_body, true);
|
||||||
|
// We only care block in the same function
|
||||||
|
this.last_block_rib = None;
|
||||||
// Resolve the function body, potentially inside the body of an async closure
|
// Resolve the function body, potentially inside the body of an async closure
|
||||||
this.with_lifetime_rib(
|
this.with_lifetime_rib(
|
||||||
LifetimeRibKind::Elided(LifetimeRes::Infer),
|
LifetimeRibKind::Elided(LifetimeRes::Infer),
|
||||||
|
|
|
@ -616,7 +616,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find in last block rib
|
// Try to find in last block rib
|
||||||
if let Some(rib) = &self.last_block_rib {
|
if let Some(rib) = &self.last_block_rib && let RibKind::NormalRibKind = rib.kind {
|
||||||
for (ident, &res) in &rib.bindings {
|
for (ident, &res) in &rib.bindings {
|
||||||
if let Res::Local(_) = res && path.len() == 1 &&
|
if let Res::Local(_) = res && path.len() == 1 &&
|
||||||
ident.span.eq_ctxt(path[0].ident.span) &&
|
ident.span.eq_ctxt(path[0].ident.span) &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue