Skip to content

Commit 75c497c

Browse files
isolate glob imports
1 parent 77f5e5c commit 75c497c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler/rustc_resolve/src/imports.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,25 @@ pub(crate) struct ImportResolver<'r, 'ra, 'tcx> {
4848

4949
// outputs
5050
determined_imports: Vec<Import<'ra>>,
51+
glob_imports: Vec<Import<'ra>>,
5152
}
5253

5354
struct ImportResolutionOutputs<'ra> {
5455
indeterminate_imports: Vec<Import<'ra>>,
5556
determined_imports: Vec<Import<'ra>>,
57+
glob_imports: Vec<Import<'ra>>,
5658
}
5759

5860
impl<'r, 'ra, 'tcx> ImportResolver<'r, 'ra, 'tcx> {
5961
pub(crate) fn new(cmr: CmResolver<'r, 'ra, 'tcx>, batch: Vec<Import<'ra>>) -> Self {
60-
ImportResolver { r: cmr, batch, determined_imports: Vec::new() }
62+
ImportResolver { r: cmr, batch, determined_imports: Vec::new(), glob_imports: Vec::new() }
6163
}
6264

6365
fn into_outputs(self) -> ImportResolutionOutputs<'ra> {
6466
ImportResolutionOutputs {
6567
indeterminate_imports: self.batch,
6668
determined_imports: self.determined_imports,
69+
glob_imports: self.glob_imports,
6770
}
6871
}
6972
}
@@ -72,6 +75,9 @@ impl<'ra> ImportResolutionOutputs<'ra> {
7275
fn commit<'tcx>(self, r: &mut Resolver<'ra, 'tcx>) {
7376
r.indeterminate_imports = self.indeterminate_imports;
7477
r.determined_imports.extend(self.determined_imports);
78+
for glob in self.glob_imports {
79+
r.resolve_glob_import(glob);
80+
}
7581
}
7682
}
7783

@@ -927,9 +933,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
927933
(source, target, bindings, type_ns_only)
928934
}
929935
ImportKind::Glob { .. } => {
930-
// FIXME: Use mutable resolver directly as a hack, this should be an output of
931-
// specualtive resolution.
932-
self.r.get_mut_unchecked().resolve_glob_import(import);
936+
self.glob_imports.push(import);
933937
return 0;
934938
}
935939
_ => unreachable!(),

0 commit comments

Comments
 (0)