metadata/resolve: Minor refactoring to "tcx -> cstore" conversions

This commit is contained in:
Vadim Petrochenkov 2023-02-22 18:47:59 +04:00
parent 98cce81917
commit 4a61922ef0
2 changed files with 14 additions and 9 deletions

View file

@ -1431,9 +1431,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}
fn crate_loader<T>(&mut self, f: impl FnOnce(&mut CrateLoader<'_, '_>) -> T) -> T {
let mut cstore = self.tcx.untracked().cstore.write();
let cstore = cstore.untracked_as_any().downcast_mut().unwrap();
f(&mut CrateLoader::new(self.tcx, &mut *cstore, &mut self.used_extern_options))
f(&mut CrateLoader::new(
self.tcx,
&mut CStore::from_tcx_mut(self.tcx),
&mut self.used_extern_options,
))
}
fn cstore(&self) -> MappedReadGuard<'_, CStore> {