]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #55275 - petrochenkov:extself, r=eddyb
authorbors <bors@rust-lang.org>
Sat, 1 Dec 2018 12:45:52 +0000 (12:45 +0000)
committerbors <bors@rust-lang.org>
Sat, 1 Dec 2018 12:45:52 +0000 (12:45 +0000)
experiment: Support aliasing local crate root in extern prelude

This PR provides some minimally invasive solution for the 2018 edition migration issue described in https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/pull/54658, thus resolving https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/issues/54647


Trivial merge