-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
resolve: Some module-related refactorings #88872
Conversation
Some changes occurred in intra-doc-links. cc @jyn514 |
(rust-highfive has picked a reviewer for you, use r? to override) |
ec5dbc2
to
7e407f9
Compare
self.cstore().module_expansion_untracked(def_id, &self.session), | ||
self.cstore().get_span_untracked(def_id, &self.session), | ||
)); | ||
// FIXME: Account for `#[no_implicit_prelude]` attributes. | ||
parent.map_or(false, |module| module.no_implicit_prelude), |
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 ModuleData::new
used to set no_implicit_module
to false. What are the consequences of this change in behaviour?
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.
For enums and traits there should be no consequences (we are jumping out of these modules during resolution and don't use their no_implicit_prelude
flags), for foreign modules there may be some effect on macros 2.0 - identifiers from macros with def-site located in a foreign no_implicit_prelude
module should now skip prelude during resolution.
However, because the #[no_implicit_prelude]
attributes are still not applied to foreign modules the inherited value is always false
, so no change in behavior right now.
7e407f9
to
fd23c83
Compare
I've included #88917 into this PR as well. |
@bors r+ |
📌 Commit fd23c8348d27dbfe45916094306672a39c4c7e4a has been approved by |
⌛ Testing commit fd23c8348d27dbfe45916094306672a39c4c7e4a with merge 76a61b10ee24d792ad456dcb526d716df8833711... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
fd23c83
to
6126744
Compare
📌 Commit 61267440bbba0c29ef89e7bf988f77ab4a5abf16 has been approved by |
⌛ Testing commit 61267440bbba0c29ef89e7bf988f77ab4a5abf16 with merge 691dbccc3a019db5ce6b6d31f8216b37bef09e9e... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Construction of all modules is now centralized and performed by `fn new_module`.
The `Option<Module>` version is supported for the case where we don't know whether the `DefId` refers to a module or not. Non-local traits and enums are also correctly found now.
6126744
to
8f035b8
Compare
@bors r=cjgillot |
📌 Commit 8f035b8 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (7342213): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
resolve: Cache module loading for all foreign modules It was previously cached for modules loaded from `fn get_module`, but not for modules loaded from `fn build_reduced_graph_for_external_crate_res`. This also makes all foreign modules use their real parent, span and expansion instead of possibly a parent/span/expansion of their reexport. Modules are also often compared using referential equality (`ptr::eq`), this change makes such comparisons correct in all cases. An ICE happening on attempt to decode expansions for foreign enums and traits is avoided. Also local enums and traits are now added to the module map. Follow up to rust-lang#88872. r? `@cjgillot`
See the individual commits.