Skip to content

Tracking issue for feature extern_crate_item_prelude #55599

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

Closed
petrochenkov opened this issue Nov 1, 2018 · 6 comments
Closed

Tracking issue for feature extern_crate_item_prelude #55599

petrochenkov opened this issue Nov 1, 2018 · 6 comments
Assignees
Labels
A-edition-2018 Area: The 2018 edition B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-rust_2018_preview `#![feature(rust_2018_preview)]` T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@petrochenkov
Copy link
Contributor

With this feature extern crate foo as bar; item placed into the crate root puts the name bar into extern prelude. This has the next effects:

  • The name is in scope in the whole crate, including inner modules, like other prelude names.
  • On 2018 edition imports can refer to that name use bar::zzz; or use ::bar::zzz;, plus non-import absolute paths can refer to it as well let z = ::bar::zzz;.

More details are available on the implementation PR - #54658.

@petrochenkov petrochenkov added T-lang Relevant to the language team, which will review and decide on the PR/issue. B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-rust_2018_preview `#![feature(rust_2018_preview)]` labels Nov 1, 2018
@Nemo157
Copy link
Member

Nemo157 commented Nov 3, 2018

Is this intended to be stable for the initial 2018 release? It seems important for a nice experience with proc-macros (otherwise you must use crate::proc_macro everywhere).

If not, this appears to have no forward-compat warning when building under 2015, which causes a failure to migrate with cargo fix:

error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
  --> interp-macros/src/lib.rs:12:5
   |
12 | use proc_macro::TokenStream;
   |     ^^^^^^^^^^
   |
   = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable

@SimonSapin
Copy link
Contributor

this appears to have no forward-compat warning

I’ve also hit this and filed #55592

@steveklabnik
Copy link
Member

Knowing if this will ship in 1.31 or not is important for the book, for the reasons that @Nemo157 mentioned. Could we maybe get an answer here?

@SimonSapin
Copy link
Contributor

@petrochenkov, @rust-lang/lang Are there any blockers for stabilizing this feature? How do you feel about backporting its stabilization to 1.31 beta? Should FCP be proposed now?

@SimonSapin
Copy link
Contributor

In servo/servo#22086 I’ve migrated a number of Servo crates to the 2018 editions, but I left out proc-macro and plugin crates in part because of this issue (or lack of other good way to deal with crate dependencies not known to Cargo).

@petrochenkov
Copy link
Contributor Author

petrochenkov commented Nov 14, 2018

@aturon and @steveklabnik wanted to stabilize this for the edition release as well (on #edition-planning discord channel).

This should be ready for stabilization and backport to 1.31 beta once #55884 lands (or some fixes for this feature are extracted from that PR).
I'll prepare a stabilization report.

bors added a commit that referenced this issue Nov 21, 2018
Stabilize `extern_crate_item_prelude`

Closes #55599
@fmease fmease added the A-edition-2018 Area: The 2018 edition label Dec 21, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-edition-2018 Area: The 2018 edition B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC F-rust_2018_preview `#![feature(rust_2018_preview)]` T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants