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

Projects
None yet
8 participants
@petrochenkov
Contributor

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

This comment has been minimized.

Collaborator

rust-highfive commented Oct 22, 2018

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@petrochenkov

This comment has been minimized.

Contributor

petrochenkov commented Oct 22, 2018

@Centril

This comment has been minimized.

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

This comment has been minimized.

Contributor

michaelwoerister commented Oct 23, 2018

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

@bors

This comment has been minimized.

Contributor

bors commented Oct 25, 2018

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

@petrochenkov petrochenkov force-pushed the petrochenkov:extself branch from 53cfa62 to fab06ae Oct 25, 2018

@bors

This comment has been minimized.

Contributor

bors commented Oct 28, 2018

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

@petrochenkov petrochenkov force-pushed the petrochenkov:extself branch from fab06ae to 3fc0609 Oct 28, 2018

@eddyb

eddyb approved these changes Nov 3, 2018

@eddyb

This comment has been minimized.

Member

eddyb commented Nov 3, 2018

Implementation LGTM.

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

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.

@bors

This comment has been minimized.

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

This comment has been minimized.

Contributor

nikomatsakis commented Nov 21, 2018

(Tagged @pnkfelix as they are on PTO)

@rfcbot

This comment has been minimized.

rfcbot commented Nov 21, 2018

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

@petrochenkov petrochenkov force-pushed the petrochenkov:extself branch from 3fc0609 to 0681e33 Nov 21, 2018

@nikomatsakis nikomatsakis removed this from the Rust 2018 Release milestone Nov 21, 2018

@rfcbot

This comment has been minimized.

rfcbot commented Dec 1, 2018

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

@petrochenkov petrochenkov force-pushed the petrochenkov:extself branch from 0681e33 to 549bd45 Dec 1, 2018

@petrochenkov

This comment has been minimized.

Contributor

petrochenkov commented Dec 1, 2018

@bors r=eddyb

@bors

This comment has been minimized.

Contributor

bors commented Dec 1, 2018

📌 Commit 549bd45 has been approved by eddyb

@bors

This comment has been minimized.

Contributor

bors commented Dec 1, 2018

⌛️ Testing commit 549bd45 with merge d311571...

bors added a commit that referenced this pull request Dec 1, 2018

Auto merge of #55275 - petrochenkov:extself, r=eddyb
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

This comment has been minimized.

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

This comment has been minimized.

Contributor

petrochenkov commented Dec 1, 2018

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

UPDATE: Done in #56412.

@petrochenkov

This comment has been minimized.

Contributor

petrochenkov commented Dec 1, 2018

Tracking issue: #56409.

@bors

This comment has been minimized.

Contributor

bors commented Dec 1, 2018

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

@bors bors merged commit 549bd45 into rust-lang:master Dec 1, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment