Skip to content

Commit 68ea516

Browse files
committed
fix the crossing function issue
1 parent 7cd4b67 commit 68ea516

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/rustc_resolve/src/late.rs

+2
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,8 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
876876
// Ignore errors in function bodies if this is rustdoc
877877
// Be sure not to set this until the function signature has been resolved.
878878
let previous_state = replace(&mut this.in_func_body, true);
879+
// We only care block in the same function
880+
this.last_block_rib = None;
879881
// Resolve the function body, potentially inside the body of an async closure
880882
this.with_lifetime_rib(
881883
LifetimeRibKind::Elided(LifetimeRes::Infer),

compiler/rustc_resolve/src/late/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
616616
}
617617

618618
// Try to find in last block rib
619-
if let Some(rib) = &self.last_block_rib {
619+
if let Some(rib) = &self.last_block_rib && let RibKind::NormalRibKind = rib.kind {
620620
for (ident, &res) in &rib.bindings {
621621
if let Res::Local(_) = res && path.len() == 1 &&
622622
ident.span.eq_ctxt(path[0].ident.span) &&

0 commit comments

Comments
 (0)