Skip to content

Commit 3238b4b

Browse files
committed
Add comments
1 parent faea5ff commit 3238b4b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc_resolve/resolve_imports.rs

+4
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ impl<'a> ::ModuleS<'a> {
317317
fn update_resolution<T, F>(&self, name: Name, ns: Namespace, update: F) -> T
318318
where F: FnOnce(&mut NameResolution<'a>) -> T
319319
{
320+
// Ensure that `resolution` isn't borrowed during `define_in_glob_importers`,
321+
// where it might end up getting re-defined via a glob cycle.
320322
let (new_binding, t) = {
321323
let mut resolution = &mut *self.resolution(name, ns).borrow_mut();
322324
let was_known = resolution.binding().is_some();
@@ -650,6 +652,8 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
650652
// Add to target_module's glob_importers
651653
target_module.glob_importers.borrow_mut().push((module_, directive));
652654

655+
// Ensure that `resolutions` isn't borrowed during `try_define_child`,
656+
// since it might get updated via a glob cycle.
653657
let bindings = target_module.resolutions.borrow().iter().filter_map(|(name, resolution)| {
654658
resolution.borrow().binding().map(|binding| (*name, binding))
655659
}).collect::<Vec<_>>();

0 commit comments

Comments
 (0)