Auto merge of #119136 - petrochenkov:feedvis3, r=WaffleLapkin

resolve: Eagerly feed closure visibilities

Also factor out all tcx-dependent operations performed for every created definition into `TyCtxt::create_def`.

Addresses https://github.com/rust-lang/rust/pull/118657#discussion_r1421424277
This commit is contained in:
bors 2023-12-20 14:03:00 +00:00
commit 8fca8295cb
4 changed files with 23 additions and 22 deletions

View file

@ -1225,10 +1225,7 @@ impl<'tcx> Resolver<'_, 'tcx> {
);
// FIXME: remove `def_span` body, pass in the right spans here and call `tcx.at().create_def()`
let def_id = self.tcx.untracked().definitions.write().create_def(parent, data);
let feed = self.tcx.feed_local_def_id(def_id);
feed.def_kind(def_kind);
let def_id = self.tcx.create_def(parent, name, def_kind);
// Create the definition.
if expn_id != ExpnId::root() {