-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Refactor away the prelude injection fold #34108
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
Conversation
da9d458
to
4b1f006
Compare
a0cdaec
to
1f01752
Compare
This prevents using prelude in the same crate it is defined in, right? Something similar to |
EDIT: outdated comment
That isn't possible today (besides by using
Agreed, I want this too. I'm envisioning #![feature(local_prelude)]
mod prelude {
#[local_prelude]
mod v1 { /* the libcore or libstd prelude */ }
} or #![feature(local_prelude)]
#![local_prelude]
mod prelude {
mod v1 { /* the libcore or libstd prelude */ }
} Either would very simple to implement after this PR.
If
Yeah, the rebase straightforward though -- I'll PR against your branch if this happens to land first. |
Sure, I just expected custom and built-in, local and non-local preludes to work through the same mechanism without additional special attributes:
I'll use this argument the next time I come up with some horrible hack :) |
Note, that with |
1f01752
to
970e15d
Compare
@petrochenkov good points, I updated this PR accordingly (see the edited initial comment). I think it's simpler to keep |
@bors: r+ |
📌 Commit 970e15d has been approved by |
…n, r=nrc Refactor away the prelude injection fold Instead, just inject `#[prelude_import] use [core|std]::prelude::v1::*;` at the crate root while injecting `extern crate [core|std];` and process `#[no_implicit_prelude]` attributes in `resolve`. r? @nrc
Refactor away the prelude injection fold Instead, just inject `#[prelude_import] use [core|std]::prelude::v1::*;` at the crate root while injecting `extern crate [core|std];` and process `#[no_implicit_prelude]` attributes in `resolve`. r? @nrc
Instead, just inject
#[prelude_import] use [core|std]::prelude::v1::*;
at the crate root while injectingextern crate [core|std];
and process#[no_implicit_prelude]
attributes inresolve
.r? @nrc