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

experiment: Support aliasing local crate root in extern prelude #55275

Merged
merged 1 commit into from
Dec 1, 2018

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Oct 22, 2018

This PR provides some minimally invasive solution for the 2018 edition migration issue described in #54647 and affecting proc macro crates.

extern crate NAME as RENAME; now accepts NAME=self and interprets it as referring to the local crate.
As with other extern crate items, RENAME in this case gets into extern prelude in accordance with #54658, thus resolving #54647.

extern crate self as serde; // Adds local crate to extern prelude as `serde`

This solution doesn't introduce any new syntax and has minimal maintenance cost, so it can be easily deprecated if something better is found in the future.

Closes #54647

@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(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 Oct 22, 2018
@petrochenkov
Copy link
Contributor Author

cc @rust-lang/lang

@petrochenkov petrochenkov added T-lang Relevant to the language team, which will review and decide on the PR/issue. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). F-rust_2018_preview `#![feature(rust_2018_preview)]` and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 22, 2018
@Centril
Copy link
Contributor

Centril commented Oct 22, 2018

Seems fine by me (but I can't speak for everyone in the team).
The syntax=>semantics are fairly obvious and it seems like a nice reuse of the syntax that we have.

@michaelwoerister
Copy link
Member

r? @eddyb maybe? I know too little about name resolution.

@bors
Copy link
Contributor

bors commented Oct 25, 2018

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

@bors
Copy link
Contributor

bors commented Oct 28, 2018

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

@eddyb
Copy link
Member

eddyb commented Nov 3, 2018

Implementation LGTM.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Nov 3, 2018

Team member @eddyb has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Nov 3, 2018
@bors
Copy link
Contributor

bors commented Nov 21, 2018

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

@nikomatsakis nikomatsakis added this to the Rust 2018 Release milestone Nov 21, 2018
@nikomatsakis
Copy link
Contributor

(Tagged @pnkfelix as they are on PTO)

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Nov 21, 2018
@rfcbot
Copy link

rfcbot commented Nov 21, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot
Copy link

rfcbot commented Dec 1, 2018

The final comment period, with a disposition to merge, as per the review above, is now complete.

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Dec 1, 2018
@petrochenkov
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Dec 1, 2018

📌 Commit 549bd45 has been approved by eddyb

@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-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Dec 1, 2018
@bors
Copy link
Contributor

bors commented Dec 1, 2018

⌛ Testing commit 549bd45 with merge d311571...

bors added a commit that referenced this pull request Dec 1, 2018
experiment: Support aliasing local crate root in extern prelude

This PR provides some minimally invasive solution for the 2018 edition migration issue described in #54647 and affecting proc macro crates.

`extern crate NAME as RENAME;` now accepts `NAME`=`self` and interprets it as referring to the local crate.
As with other `extern crate` items, `RENAME` in this case gets into extern prelude in accordance with #54658, thus resolving #54647.
```rust
extern crate self as serde; // Adds local crate to extern prelude as `serde`
```
This solution doesn't introduce any new syntax and has minimal maintenance cost, so it can be easily deprecated if something better is found in the future.

Closes #54647
@Centril
Copy link
Contributor

Centril commented Dec 1, 2018

@petrochenkov Hmm; If we are adding the unstable feature extern_crate_self, where's the tracking issue? =P (I thought we were doing it on 1.32...?)

@petrochenkov
Copy link
Contributor Author

petrochenkov commented Dec 1, 2018

I'll add it today (maybe in this PR if checkin fails).

UPDATE: Done in #56412.

@petrochenkov
Copy link
Contributor Author

Tracking issue: #56409.

@bors
Copy link
Contributor

bors commented Dec 1, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing d311571 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. F-rust_2018_preview `#![feature(rust_2018_preview)]` finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants