-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Decouple rustc_resolve and rustc_ast_lowering #90451
Conversation
This comment has been minimized.
This comment has been minimized.
|
||
/// Resolutions for nodes that have a single resolution. | ||
pub partial_res_map: NodeMap<hir::def::PartialRes>, | ||
/// Resolutions for import nodes, which have multiple resolutions in different namespaces. |
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.
Do they necessarily have resolutions in multiple namespaces?
/// Resolutions for import nodes, which have multiple resolutions in different namespaces. | |
/// Resolutions for import nodes, which can have multiple resolutions in different namespaces. |
This comment has been minimized.
This comment has been minimized.
1d13c8a
to
fbf8b82
Compare
This comment has been minimized.
This comment has been minimized.
fbf8b82
to
fca3de8
Compare
I think @petrochenkov might be more qualified to review this. |
r? @petrochenkov (let me know if you don't want to review) |
This comment has been minimized.
This comment has been minimized.
fca3de8
to
60431ec
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
60431ec
to
56f46ed
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
56f46ed
to
63e9a5a
Compare
Queued 11af4eda005db3083b170328e09db3f9625d6adf with parent d3f3004, future comparison URL. |
Finished benchmarking commit (11af4eda005db3083b170328e09db3f9625d6adf): comparison url. Summary: This change led to small relevant mixed results 🤷 in compiler performance.
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 led 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 |
r=me on 5c4f828, f19a7f1 and baef1d2. I need more context for other changes, why are they useful? |
63e9a5a
to
87fae88
Compare
The context is #88186: the objective is to make lowering a query. For this to happen, we need:
I agree these two commits do not bring any obvious value right now. I can delay them to another PR if you prefer. |
|
||
/// HACK(Centril): there is a cyclic dependency between the parser and lowering | ||
/// if we don't have this function pointer. To avoid that dependency so that | ||
/// `rustc_middle` is independent of the parser, we use dynamic dispatch here. | ||
nt_to_tokenstream: NtToTokenstream, | ||
|
||
item_generics_num_lifetimes: fn(&Session, &CrateStoreDyn, DefId) -> usize, |
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.
Maybe it's better to make this a method on the CrateStore
trait?
fn legacy_const_generic_args(&mut self, expr: &Expr) -> Option<Vec<usize>>; | ||
|
||
/// Obtains resolution for a `NodeId` with a single resolution. | ||
trait ResolverAstLoweringExt { |
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.
Why does this need to be a trait rather than a set of inherent methods?
@cjgillot The main question is how mutable are I expected It also doesn't feel right that a bunch of tables in Perhaps we need more separate structures created using the next criteria? |
The basic idea is to make lowering incremental, so we will have to keep some resolver outputs longer than we currently have to. The issue you have with mutable vs immutable outputs probably comes from a poor choice of mine when splitting up #88186. If you don't mind, I will close this PR and try to make the splitting more logical.
|
Make lowering pull-based ~Based on rust-lang#90451 Part of rust-lang#88186 The current lowering code visits all the item-likes in the AST in order, and lowers them one by one. This PR changes it to index the AST and then proceed to lowering on-demand. This is closer to the logic of query-based lowering.
Based on #89090 and #90446.Part of #88186.
This PR removes the
ResolverAstLowering
trait which existed to pass information from resolution to lowering. The required information is passed through theResolverOutputs
struct.r? @michaelwoerister