"Cachify" ExternPreludeEntry.binding through a Cell.

This commit is contained in:
LorrensP-2158466
2025-07-28 21:21:59 +02:00
parent 7278554d82
commit c39b4479ce
2 changed files with 11 additions and 12 deletions

View File

@@ -984,18 +984,17 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
// more details: https://github.com/rust-lang/rust/pull/111761
return;
}
let entry = self
.r
.extern_prelude
.entry(ident)
.or_insert(ExternPreludeEntry { binding: None, introduced_by_item: true });
let entry = self.r.extern_prelude.entry(ident).or_insert(ExternPreludeEntry {
binding: Cell::new(None),
introduced_by_item: true,
});
if orig_name.is_some() {
entry.introduced_by_item = true;
}
// Binding from `extern crate` item in source code can replace
// a binding from `--extern` on command line here.
if !entry.is_import() {
entry.binding = Some(imported_binding)
entry.binding.set(Some(imported_binding));
} else if ident.name != kw::Underscore {
self.r.dcx().span_delayed_bug(
item.span,