Skip to content

Commit 9761db0

Browse files
committed
resolve: Correctly mark break and continue for determinate errors
Existing but private bindings - break, everything else - continue.
1 parent 674d287 commit 9761db0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_resolve/src/ident.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
626626
Err(ControlFlow::Break(Determinacy::Undetermined)) => {
627627
return ControlFlow::Break(Err(Determinacy::determined(force)));
628628
}
629-
Err(ControlFlow::Break(Determinacy::Determined)) => Err(Determined),
629+
// Privacy errors, do not happen during in scope resolution.
630+
Err(ControlFlow::Break(Determinacy::Determined)) => unreachable!(),
630631
}
631632
}
632633
Scope::MacroUsePrelude => match self.macro_use_prelude.get(&ident.name).cloned() {
@@ -951,7 +952,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
951952
let resolution = &*self
952953
.resolution_or_default(module, key)
953954
.try_borrow_mut_unchecked()
954-
.map_err(|_| ControlFlow::Break(Determined))?;
955+
.map_err(|_| ControlFlow::Continue(Determined))?;
955956

956957
// If the primary binding is unusable, search further and return the shadowed glob
957958
// binding if it exists. What we really want here is having two separate scopes in
@@ -1086,7 +1087,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10861087
}
10871088

10881089
// No resolution and no one else can define the name - determinate error.
1089-
Err(ControlFlow::Break(Determined))
1090+
Err(ControlFlow::Continue(Determined))
10901091
}
10911092

10921093
fn finalize_module_binding(
@@ -1102,7 +1103,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
11021103
let Finalize { path_span, report_private, used, root_span, .. } = finalize;
11031104

11041105
let Some(binding) = binding else {
1105-
return Err(ControlFlow::Break(Determined));
1106+
return Err(ControlFlow::Continue(Determined));
11061107
};
11071108

11081109
if !self.is_accessible_from(binding.vis, parent_scope.module) {

0 commit comments

Comments
 (0)