Uh oh!
There was an error while loading. Please reload this page.
resolve: Replace visibility table in resolver outputs with query feeding - #118657
Conversation
rustbot
commented
Dec 5, 2023
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
petrochenkov
commented
Dec 5, 2023
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Dec 5, 2023
resolve: Replace visibility table in resolver outputs with query feeding I suspect that in general this approach should work for queries that are 1) executed for most keys and 2) have results that are cheap to hash (do not have spans, in particular). Visibility query matches that description, so let's check.
bors
commented
Dec 5, 2023
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Dec 6, 2023
Finished benchmarking commit (526830d): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 675.495s -> 674.636s (-0.13%) |
66f2439 to
18d2bd2Comparepetrochenkov
commented
Dec 6, 2023
@rustbot ready |
@cjgillot |
cjgillot
commented
Dec 9, 2023
Yes. I'm not sure this is actually useful, but I wanted to avoid ICEing too eagerly.
We check that the fingerprints match. If the fingerprints do not match, we delay a bug. If the query is no-hash, we panic. |
| // Unique types created for closures participate in type privacy checking. | ||
| // They have visibilities inherited from the module they are defined in. | ||
| Node::Expr(hir::Expr { kind: hir::ExprKind::Closure { .. }, .. }) => { | ||
| ty::Visibility::Restricted(tcx.parent_module_from_def_id(def_id).to_def_id()) |
There was a problem hiding this comment.
Is there a way to get rid of this completely?
There was a problem hiding this comment.
Yes, but I wanted to do it in a separate PR because it may have a negative performance impact.
(Visibilities for item-like nodes are always queried anyway because they are encoded into metadata, but visibilities for closures are rarely queried so it makes sense to do it on demand.)
cjgillot
commented
Dec 9, 2023
@bors r+ |
bors
commented
Dec 9, 2023
| tcx.sess.opts.dep_tracking_hash(true).hash_stable(&mut hcx, &mut stable_hasher); | ||
| tcx.stable_crate_id(LOCAL_CRATE).hash_stable(&mut hcx, &mut stable_hasher); | ||
| // Hash visibility information since it does not appear in HIR. | ||
| resolutions.visibilities.hash_stable(&mut hcx, &mut stable_hasher); |
There was a problem hiding this comment.
This is now hashed into tcx.hir_crate(()).opt_hir_hash? Or how do we ensure that changing visibilities still affect the crate hash?
There was a problem hiding this comment.
I have restored the previous visibility hashing logic in a slightly simplified form.
bors
commented
Dec 9, 2023
resolve: Replace visibility table in resolver outputs with query feeding Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily. I suspect that in general this approach should work for queries that are 1) executed for most keys and 2) have results that are cheap to hash (do not have spans, in particular). Visibility query matches that description.
bors
commented
Dec 9, 2023
☀️ Try build successful - checks-actions |
petrochenkov
commented
Dec 12, 2023
This comment was marked as resolved.
This comment was marked as resolved.
cjgillot
commented
Dec 17, 2023
r=me after rebase |
Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily.
petrochenkov
commented
Dec 18, 2023
@bors r=cjgillot |
bors
commented
Dec 18, 2023
bors
commented
Dec 18, 2023
bors
commented
Dec 18, 2023
☀️ Test successful - checks-actions |
rust-timer
commented
Dec 18, 2023
Finished benchmarking commit (321b656): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 670.368s -> 675.09s (0.70%) |
resolve: Eagerly feed closure visibilities Addresses rust-lang#118657 (comment)
resolve: Eagerly feed closure visibilities Also factor out all tcx-dependent operations performed for every created definition into `TyCtxt::create_def`. Addresses rust-lang#118657 (comment)
danielhjacobs
commented
Dec 20, 2023
This PR seems to be causing an ICE in #119126 |
Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily.
I suspect that in general this approach should work for queries that are 1) executed for most keys and 2) have results that are cheap to hash (do not have spans, in particular).
Visibility query matches that description.