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

rustc: implement a #[no_implicit_prelude] attribute. #7844

Closed
wants to merge 7 commits into from

Conversation

huonw
Copy link
Member

@huonw huonw commented Jul 17, 2013

It disables the insertion of use std::prelude::*; into the top of
all the modules below the item on which it is placed (including that
item itself).

(Similar to GHC's -XNoImplicitPrelude.)

pnkfelix and others added 7 commits July 10, 2013 09:35
… semantics.

Also added unit tests of range code to test refactoring.  The
num-range-rev.rs test will need to be updated when the range_rev
semantics change.
…fclosedness-issue5270-2ndpr, r=cmr

Changes int/uint range_rev to iterate over range `(hi,lo]` instead of `[hi,lo)`.

Fix rust-lang#5270.

Also:
* Adds unit tests for int/uint range functions
* Updates the uses of `range_rev` to account for the new semantics.  (Note that pretty much all of the updates there were strict improvements to the code in question; yay!)
* Exposes new function, `range_step_inclusive`, which does the range `[hi,lo]`, (at least when `hi-lo` is a multiple of the `step` parameter).
* Special-cases when `|step| == 1` removing unnecessary bounds-check.  (I did not check whether LLVM was already performing this optimization; I figure it would be a net win to not leave that analysis to the compiler.  If reviewer objects, I can easily remove that from the refactored code.)

(This pull request is a rebased version of PR rust-lang#7524, which went stale due to recent unrelated changes to num libraries.)
Allowing them in type signatures is a significant amount of extra work, unfortunately. This also doesn't apply to static values, which takes a different code path.
It disables the insertion of `use std::prelude::*;` into the top of
all the modules below the item on which it is placed (including that
item itself).
@alexcrichton
Copy link
Member

We also really need a spot to document things like this...

That along with asserting that some attributes are crate-level instead of somewhere else would be nice (not in the scope of this PR though).

@Kimundi
Copy link
Member

Kimundi commented Jul 17, 2013

Nice! I found the fact that the prelude effectively pollutes the global namespace always a bit worrying, but with this you have a way out in those situations.

bors added a commit that referenced this pull request Jul 17, 2013
It disables the insertion of `use std::prelude::*;` into the top of
all the modules below the item on which it is placed (including that
item itself).

(Similar to GHC's `-XNoImplicitPrelude`.)
@bors bors closed this Jul 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants