Skip to content
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

Merged
merged 6 commits into from
Sep 24, 2021
Merged

Conversation

petrochenkov
Copy link
Contributor

See the individual commits.

@rust-highfive
Copy link
Collaborator

Some changes occurred in intra-doc-links.

cc @jyn514

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 12, 2021
compiler/rustc_resolve/src/lib.rs Outdated Show resolved Hide resolved
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),
Copy link
Contributor

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?

Copy link
Contributor Author

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.

compiler/rustc_resolve/src/build_reduced_graph.rs Outdated Show resolved Hide resolved
@petrochenkov
Copy link
Contributor Author

I've included #88917 into this PR as well.

@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 18, 2021

📌 Commit fd23c8348d27dbfe45916094306672a39c4c7e4a has been approved by cjgillot

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2021
@bors
Copy link
Contributor

bors commented Sep 22, 2021

⌛ Testing commit fd23c8348d27dbfe45916094306672a39c4c7e4a with merge 76a61b10ee24d792ad456dcb526d716df8833711...

@rust-log-analyzer

This comment has been minimized.

@bors

This comment has been minimized.

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 22, 2021
@petrochenkov
Copy link
Contributor Author

r? @cjgillot
@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Sep 22, 2021

📌 Commit 61267440bbba0c29ef89e7bf988f77ab4a5abf16 has been approved by cjgillot

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 22, 2021
@bors
Copy link
Contributor

bors commented Sep 24, 2021

⌛ Testing commit 61267440bbba0c29ef89e7bf988f77ab4a5abf16 with merge 691dbccc3a019db5ce6b6d31f8216b37bef09e9e...

@bors

This comment has been minimized.

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 24, 2021
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 24, 2021
@rust-log-analyzer

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.
@petrochenkov
Copy link
Contributor Author

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Sep 24, 2021

📌 Commit 8f035b8 has been approved by cjgillot

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2021
@bors
Copy link
Contributor

bors commented Sep 24, 2021

⌛ Testing commit 8f035b8 with merge 7342213...

@bors bors mentioned this pull request Sep 24, 2021
@bors
Copy link
Contributor

bors commented Sep 24, 2021

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 7342213 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 24, 2021
@bors bors merged commit 7342213 into rust-lang:master Sep 24, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 24, 2021
@rust-timer
Copy link
Collaborator

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

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 2, 2021
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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants