-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove ItemLikeVisitor impls from rustc_typeck #96531
Remove ItemLikeVisitor impls from rustc_typeck #96531
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
80650cd
to
abad872
Compare
@@ -1,4 +1,4 @@ | |||
error: no path from `x::<impl Foo for char>` to `typeck` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjgillot the modifications in compiler/rustc_typeck/src/coherence/inherent_impls.rs
caused this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current code checks each module independently. Having those checks performed on the whole crate at once create new dependency edges. This may be what causes the diagnostic changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be resolved by adding a eval_always
to the hir_crate_items
query declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hir_crate_items
already has eval_always
.
/// All items in the crate.
query hir_crate_items(_: ()) -> rustc_middle::hir::ModuleItems {
storage(ArenaCacheSelector<'tcx>)
eval_always
desc { "get HIR crate items" }
}
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit abad872c7640a34667505b3420af54f8631893e8 with merge 630a088a8b3689dbbaa9db4b857353a49586c7fe... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a first read through from afar. The current code performs typechecking by module, and isolates modules from each another using dedicated queries. What is the benefit of removing the queries? Can't they be implemented using hir_module_items
?
@@ -1,4 +1,4 @@ | |||
error: no path from `x::<impl Foo for char>` to `typeck` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current code checks each module independently. Having those checks performed on the whole crate at once create new dependency edges. This may be what causes the diagnostic changes.
@cjgillot Sorry, maybe I missed something. This is the current code using those two queries like this: tcx.sess.time("item_types_checking", || {
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
});
// and
tcx.hir().for_each_module(module| tcx.ensure().check_mod_impl_wf(module)) }); It seemed to me, that in both of these cases, the code is going over all of the I was not going to remove the queries but that is the only place where they are used so I removed them. I can put them back? |
I agree that query and no-query code basically do the same thing. |
I will do that. Looks like I need to research/learn more about the query system. I will message you in Zulip with questions :) |
☀️ Try build successful - checks-actions |
Queued 630a088a8b3689dbbaa9db4b857353a49586c7fe with parent 1388b38, future comparison URL. |
Finished benchmarking commit (630a088a8b3689dbbaa9db4b857353a49586c7fe): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
r? @cjgillot |
abad872
to
c966b98
Compare
I added back the two queries and addressed the feedback. |
c966b98
to
b9d15d3
Compare
tcx.ensure().typeck(it.def_id); | ||
maybe_check_static_with_link_section(tcx, it.def_id, it.span); | ||
check_static_inhabited(tcx, it.def_id, it.span); | ||
match tcx.hir().def_kind(id.def_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match tcx.hir().def_kind(id.def_id) { | |
match tcx.def_kind(id.def_id) { |
tcx.def_kind
is a query, and is cached. tcx.hir().def_kind
recomputes the value every time, and should be made inaccessible in favor of the query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I see there are some I left over. I'll make an update.
let inferred_outlives_of = tcx.inferred_outlives_of(id.def_id); | ||
struct_span_err!( | ||
tcx.sess, | ||
tcx.hir().span(id.hir_id()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tcx.hir().span(id.hir_id()), | |
tcx.def_span(id.def_id), |
@bors try @rust-timer queue |
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
…l_wf query Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
f0bb18a
to
91ef3ba
Compare
@cjgillot I fixed the conflict. Let me know if there is anything else that I should address. |
@bors r+ |
📌 Commit 91ef3ba has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f6e5570): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
…-rustc-typeck, r=cjgillot Remove ItemLikeVisitor impls from rustc_typeck Issue rust-lang#95004 cc `@cjgillot`
Issue #95004
cc @cjgillot