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 refactorings in preparation for uniform paths 2.0 #54336

Merged
merged 8 commits into from
Oct 5, 2018

Conversation

petrochenkov
Copy link
Contributor

The main result is that in-scope resolution performed during macro expansion / import resolution is now consolidated in a single function (fn early_resolve_ident_in_lexical_scope), which can now be used for resolving first import segments as well when uniform paths are enabled.

r? @ghost

@petrochenkov
Copy link
Contributor Author

r? @eddyb

@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2018
@@ -591,7 +575,29 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
// should be available before the derive is expanded for compatibility.
// It's mess in general, so we are being conservative for now.

assert!(ns == TypeNS || ns == MacroNS);
enum WhereToResolve<'a> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd almost want this to be named Scope and to replace some of the other infrastructure, like ModuleOrUniformRoot. But we can leave it like this for now.

Copy link
Contributor Author

@petrochenkov petrochenkov Sep 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there's still a lot of place for refactoring, e.g. I want to merge this early_resolve_ident_in_lexical_scope with resolve_ident_in_lexical_scope eventually as well.

@eddyb
Copy link
Member

eddyb commented Sep 19, 2018

LGTM overall. This seems to also include a different PR? (the "after derive" bit)
cc @alexcrichton @nikomatsakis

@petrochenkov
Copy link
Contributor Author

The "after derive" (or rather "test/bench") bit is included because it was a temporary restriction for beta, but now it can be removed due to one of the previous commits from this PR (1892126), so it's kinda logically related.

@petrochenkov
Copy link
Contributor Author

r? @alexcrichton who reviewed the previous related PRs

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Sep 24, 2018

📌 Commit 28f4b6df2e303b893d4f411c44d8203e21e7890f has been approved by alexcrichton

@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, 2018
@bors
Copy link
Contributor

bors commented Sep 24, 2018

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout preuni (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self preuni --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
warning: Cannot merge binary files: src/Cargo.lock (HEAD vs. heads/homu-tmp)
Auto-merging src/test/run-pass-fulldeps/macro-crate.rs
Auto-merging src/libsyntax/feature_gate.rs
Auto-merging src/librustc_resolve/macros.rs
Auto-merging src/librustc_resolve/lib.rs
Auto-merging src/Cargo.lock
CONFLICT (content): Merge conflict in src/Cargo.lock
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 24, 2018
@bors
Copy link
Contributor

bors commented Sep 26, 2018

☔ The latest upstream changes (presumably #54575) made this pull request unmergeable. Please resolve the merge conflicts.

@petrochenkov
Copy link
Contributor Author

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Sep 26, 2018

📌 Commit 0f34a51fb4f9d83f0c0264479448dddd8062265e has been approved by alexcrichton

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 26, 2018
@bors
Copy link
Contributor

bors commented Sep 26, 2018

☔ The latest upstream changes (presumably #53824) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 26, 2018
@petrochenkov
Copy link
Contributor Author

Blocked on #54605 (which will become un-backportable if this PR is landed first).

@petrochenkov petrochenkov added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Sep 27, 2018
@petrochenkov petrochenkov removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 27, 2018
@petrochenkov
Copy link
Contributor Author

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Oct 4, 2018

📌 Commit b6a366e116511712930d5261ad8c4449e2bf481c has been approved by alexcrichton

@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-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Oct 4, 2018
@bors
Copy link
Contributor

bors commented Oct 4, 2018

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout preuni (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self preuni --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
warning: Cannot merge binary files: src/Cargo.lock (HEAD vs. heads/homu-tmp)
Auto-merging src/Cargo.lock
CONFLICT (content): Merge conflict in src/Cargo.lock
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 4, 2018
@petrochenkov
Copy link
Contributor Author

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Oct 5, 2018

📌 Commit 0d8e9cd has been approved by alexcrichton

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 5, 2018
@bors
Copy link
Contributor

bors commented Oct 5, 2018

⌛ Testing commit 0d8e9cd with merge 60c8460...

bors added a commit that referenced this pull request Oct 5, 2018
resolve: Some refactorings in preparation for uniform paths 2.0

The main result is that in-scope resolution performed during macro expansion / import resolution is now consolidated in a single function (`fn early_resolve_ident_in_lexical_scope`), which can now be used for resolving first import segments as well when uniform paths are enabled.

r? @ghost
@bors
Copy link
Contributor

bors commented Oct 5, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 60c8460 to master...

@bors bors merged commit 0d8e9cd into rust-lang:master Oct 5, 2018
@petrochenkov petrochenkov deleted the preuni branch June 5, 2019 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants