Skip to content

resolve: Simplify import resolution for mixed 2015/2018 edition mode #58349

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 13, 2019

Conversation

petrochenkov
Copy link
Contributor

Non-controversial part of #57745.

Before:

Local edition (per-span) Global edition (--edition) Imports (use foo;) Absolute paths (::foo)
2018 Any Uniform Extern prelude
2015 2015 Crate-relative Crate-relative
2015 2018 Crate-relative with fallback to Uniform (future-proofed to error if the result is not Crate-relative or from Extern prelude) Crate-relative with fallback to Extern prelude

After:

Local edition (per-span) Global edition (--edition) Imports (use foo;) Absolute paths (::foo)
2018 Any Uniform Extern prelude
2015 2015 Crate-relative Crate-relative
2015 2018 Crate-relative with fallback to Extern prelude Crate-relative with fallback to Extern prelude

I.e. only the behavior of the mixed local-2015-global-2018 mode is changed.
This mixed mode has two goals:

(I'll hopefully proceed with #57745 after mid-February.)

r? @Centril

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 10, 2019
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

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

lgtm, assigning over to double check...

@Centril
Copy link
Contributor

Centril commented Feb 11, 2019

r? @nikomatsakis

@nikomatsakis
Copy link
Contributor

r? @pnkfelix -- sorry @petrochenkov for being slow. I've been pretty overloaded so I'm moving the review over to @pnkfelix who hopefully has a bit more time!

@Dylan-DPC-zz
Copy link

ping from triage @pnkfelix waiting for your review on this

@bors
Copy link
Collaborator

bors commented Mar 12, 2019

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

@petrochenkov
Copy link
Contributor Author

This is now blocking another PR - #58805.

@pnkfelix
Copy link
Member

r=me assuming merge conflict is trivial to resolve.

@petrochenkov
Copy link
Contributor Author

@bors r=pnkfelix

@bors
Copy link
Collaborator

bors commented Mar 12, 2019

📌 Commit 1d6f4d6 has been approved by pnkfelix

@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 Mar 12, 2019
@bors
Copy link
Collaborator

bors commented Mar 13, 2019

⌛ Testing commit 1d6f4d6 with merge 8bf1f1c...

bors added a commit that referenced this pull request Mar 13, 2019
resolve: Simplify import resolution for mixed 2015/2018 edition mode

Non-controversial part of #57745.

Before:

| Local edition (per-span) | Global edition (--edition) | Imports (`use foo;`)                                 | Absolute paths (`::foo`)                                 |
| ------------- |----------------|-----------------------------------------|------------------------------------------------|
| 2018          | Any            | Uniform                                 | Extern prelude                                 |
| 2015          | 2015           | Crate-relative                          | Crate-relative                                 |
| 2015          | 2018           | Crate-relative with fallback to Uniform (future-proofed to error if the result is not Crate-relative or from Extern prelude) | Crate-relative with fallback to Extern prelude |

After:

| Local edition (per-span) | Global edition (--edition) | Imports (`use foo;`)                                 | Absolute paths (`::foo`)                                 |
| ------------- |----------------|-----------------------------------------|------------------------------------------------|
| 2018          | Any            | Uniform                                 | Extern prelude                                 |
| 2015          | 2015           | Crate-relative                          | Crate-relative                                 |
| 2015          | 2018           | Crate-relative with fallback to Extern prelude | Crate-relative with fallback to Extern prelude |

I.e. only the behavior of the mixed local-2015-global-2018 mode is changed.
This mixed mode has two goals:
- Address regressions from #56053 (comment).
Both "before" and "after" variants address those regressions.
- Be retrofit-able to "full 2015" edition (#57745).
Any more complex fallback scheme (with more candidates) than "Crate-relative with fallback to Extern prelude" will give more regressions than #57745 (comment) and is therefore less retrofit-able while also being, well, more complex.
So, we can settle on "Crate-relative with fallback to Extern prelude".

(I'll hopefully proceed with #57745 after mid-February.)

r? @Centril
@bors
Copy link
Collaborator

bors commented Mar 13, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: pnkfelix
Pushing 8bf1f1c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 13, 2019
@bors bors merged commit 1d6f4d6 into rust-lang:master Mar 13, 2019
@petrochenkov petrochenkov deleted the uni201x branch June 5, 2019 16:33
# for free to join this conversation on GitHub. Already have an account? # 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.

7 participants