@@ -973,7 +973,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
973
973
///
974
974
/// Meanwhile, if resolution is successful, the side effect of the resolution is returned.
975
975
fn resolve_import < ' r > (
976
- self : & mut CmResolver < ' r , ' ra , ' tcx > ,
976
+ mut self : CmResolver < ' r , ' ra , ' tcx > ,
977
977
import : Import < ' ra > ,
978
978
) -> ( Option < SideEffect < ' ra > > , usize ) {
979
979
debug ! (
@@ -1018,12 +1018,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1018
1018
1019
1019
let mut import_bindings = PerNS :: default ( ) ;
1020
1020
let mut indeterminate_count = 0 ;
1021
- self . reborrow ( ) . per_ns_cm ( |this, ns| {
1021
+
1022
+ // HACK: Use array of namespaces in the same order as `per_ns_mut`.
1023
+ // We can't use `per_ns_cm` because of the invariance on CmResolver (RefOrMut).
1024
+ for ns in [ TypeNS , ValueNS , MacroNS ] {
1022
1025
if !type_ns_only || ns == TypeNS {
1023
1026
if bindings[ ns] . get ( ) != PendingBinding :: Pending {
1024
- return ;
1027
+ continue ;
1025
1028
} ;
1026
- let binding_result = this . reborrow ( ) . maybe_resolve_ident_in_module (
1029
+ let binding_result = self . reborrow ( ) . maybe_resolve_ident_in_module (
1027
1030
module,
1028
1031
source,
1029
1032
ns,
@@ -1033,7 +1036,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1033
1036
let pending_binding = match binding_result {
1034
1037
Ok ( binding) => {
1035
1038
// We need the `target`, `source` can be extracted.
1036
- let imported_binding = this . import ( binding, import) ;
1039
+ let imported_binding = self . import ( binding, import) ;
1037
1040
Some ( Some ( imported_binding) )
1038
1041
}
1039
1042
Err ( Determinacy :: Determined ) => Some ( None ) ,
@@ -1044,8 +1047,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1044
1047
} ;
1045
1048
import_bindings[ ns] = pending_binding;
1046
1049
}
1047
- } ) ;
1048
-
1050
+ }
1049
1051
(
1050
1052
Some ( SideEffect {
1051
1053
imported_module : module,
0 commit comments