Skip to content

Commit bb0dac2

Browse files
committed
Provide used_crates in Resolver.clone_outputs
This is necessary for Rustdoc to work, since we never end up calling `Resolver.into_outputs`
1 parent df71d38 commit bb0dac2

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/librustc_metadata/creader.rs

+4
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,10 @@ impl<'a> CrateLoader<'a> {
858858
});
859859
}
860860

861+
pub fn loaded_crates(&self) -> &FxHashSet<Symbol> {
862+
self.loaded_crates.as_ref().unwrap()
863+
}
864+
861865
pub fn take_loaded_crates(&mut self) -> FxHashSet<Symbol> {
862866
self.loaded_crates.take().unwrap()
863867
}

src/librustc_resolve/lib.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,6 @@ impl<'a> Resolver<'a> {
12761276
.iter()
12771277
.map(|(ident, entry)| (ident.name, entry.introduced_by_item))
12781278
.collect(),
1279-
// The used crates are finalized at this point
12801279
used_crates: Some(used_crates),
12811280
}
12821281
}
@@ -1296,13 +1295,7 @@ impl<'a> Resolver<'a> {
12961295
.iter()
12971296
.map(|(ident, entry)| (ident.name, entry.introduced_by_item))
12981297
.collect(),
1299-
// The used crates are not finalized at this point - lowering the AST
1300-
// may cause us to call `Resolver.extern_prelude_get`,
1301-
// which may update the set of used crates even if a
1302-
// new crate is not loaded from disk
1303-
// We should never actually need to access this, but we set it to
1304-
// `None` so that we get an ICE if we try to unwrap it
1305-
used_crates: None,
1298+
used_crates: Some(self.crate_loader.loaded_crates().clone()),
13061299
}
13071300
}
13081301

0 commit comments

Comments
 (0)