Skip to content

Commit 2062325

Browse files
Rollup merge of rust-lang#121084 - oli-obk:create_def_forever_red2, r=WaffleLapkin
Make sure `tcx.create_def` also depends on the forever red node, instead of just `tcx.at(span).create_def` oversight from rust-lang#119136 Not actually an issue, because all uses of `tcx.create_def` were in the resolver, which is `eval_always`, but still good to harden against future uses of `create_def` cc `@petrochenkov` `@WaffleLapkin`
2 parents c2ae07d + 2e900ed commit 2062325

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/rustc_middle/src/ty/context.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1053,12 +1053,6 @@ impl<'tcx> TyCtxtAt<'tcx> {
10531053
name: Symbol,
10541054
def_kind: DefKind,
10551055
) -> TyCtxtFeed<'tcx, LocalDefId> {
1056-
// This function modifies `self.definitions` using a side-effect.
1057-
// We need to ensure that these side effects are re-run by the incr. comp. engine.
1058-
// Depending on the forever-red node will tell the graph that the calling query
1059-
// needs to be re-evaluated.
1060-
self.dep_graph.read_index(DepNodeIndex::FOREVER_RED_NODE);
1061-
10621056
// The following call has the side effect of modifying the tables inside `definitions`.
10631057
// These very tables are relied on by the incr. comp. engine to decode DepNodes and to
10641058
// decode the on-disk cache.
@@ -1087,6 +1081,12 @@ impl<'tcx> TyCtxt<'tcx> {
10871081
let data = def_kind.def_path_data(name);
10881082
let def_id = self.untracked.definitions.write().create_def(parent, data);
10891083

1084+
// This function modifies `self.definitions` using a side-effect.
1085+
// We need to ensure that these side effects are re-run by the incr. comp. engine.
1086+
// Depending on the forever-red node will tell the graph that the calling query
1087+
// needs to be re-evaluated.
1088+
self.dep_graph.read_index(DepNodeIndex::FOREVER_RED_NODE);
1089+
10901090
let feed = self.feed_local_def_id(def_id);
10911091
feed.def_kind(def_kind);
10921092
// Unique types created for closures participate in type privacy checking.

0 commit comments

Comments
 (0)