-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rollup of 9 pull requests #36491
Merged
Merged
Rollup of 9 pull requests #36491
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The span labels for associated types and consts were hardcoded to `Foo` rather than substituting the name of the trait. This also normalizes the wording for associated methods', traits', and consts' span labels. Fixes rust-lang#36428.
the `InvocationCollector` and `PlaceholderExpander` folds.
only assign node ids during monotonic expansion.
…ay that is stable across compilation sessions and crate boundaries.
This is done by creating a little space on the stack. Hokey, but it's the simplest fix I can see.
This flag is a debugging measure designed to detect cases where we start a snapshot, create type variables, register obligations involving those type variables in the fulfillment cx, and then have to unroll the snapshot, leaving "dangling type variables" behind. HOWEVER, in some cases the flag is wrong. In particular, we sometimes create a "mini-fulfilment-cx" in which we enroll obligations. As long as this fulfillment cx is fully drained before we return, this is not a problem, as there won't be any escaping obligations in the main cx. So we add a fn to save/restore the flag.
[T]'s Index implementation is normally not used for indexing, instead the compiler supplied indexing is used. Use the compiler supplied version in Index/IndexMut. This removes an inconsistency: Compiler supplied bound check failures look like this: thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4' If you convince Rust to use the Index impl for slices, bounds check failure looks like this instead: thread 'main' panicked at 'assertion failed: index < self.len()' The latter is used if you for example use Index generically:: use std::ops::Index; fn foo<T: ?Sized>(x: &T) where T: Index<usize> { &x[4]; } foo(&[1, 2, 3][..])
Improve shallow `Clone` deriving `Copy` unions now support `#[derive(Clone)]`. Less code is generated for `#[derive(Clone, Copy)]`. + Unions now support `#[derive(Eq)]`. Less code is generated for `#[derive(Eq)]`. --- Example of code reduction: ``` enum E { A { a: u8, b: u16 }, B { c: [u8; 100] }, } ``` Before: ``` fn clone(&self) -> E { match (&*self,) { (&E::A { a: ref __self_0, b: ref __self_1 },) => { ::std::clone::assert_receiver_is_clone(&(*__self_0)); ::std::clone::assert_receiver_is_clone(&(*__self_1)); *self } (&E::B { c: ref __self_0 },) => { ::std::clone::assert_receiver_is_clone(&(*__self_0)); *self } } } ``` After: ``` fn clone(&self) -> E { { let _: ::std::clone::AssertParamIsClone<u8>; let _: ::std::clone::AssertParamIsClone<u16>; let _: ::std::clone::AssertParamIsClone<[u8; 100]>; *self } } ``` All the matches are removed, bound assertions are more lightweight. `let _: Checker<CheckMe>;`, unlike `checker(&check_me);`, doesn't have to be translated by rustc_trans and then inlined by LLVM, it doesn't even exist in MIR, this means faster compilation. --- Union impls are generated like this: ``` union U { a: u8, b: u16, c: [u8; 100], } ``` ``` fn clone(&self) -> U { { let _: ::std::clone::AssertParamIsCopy<Self>; *self } } ``` Fixes rust-lang#36043 cc @durka r? @alexcrichton
Delete stray ` character in error message.
…bounds, r=eddyb Fix indeterminism in ty::TraitObject representation. Make sure that projection bounds in `ty::TraitObject` are sorted in a way that is stable across compilation sessions and crate boundaries. This PR + moves `DefPathHashes` up into `librustc` so it can be used there to create a stable sort key for `DefId`s, + changes `PolyExistentialProjection::sort_key()` to take advantage of the above, + and removes the unused `PolyProjectionPredicate::sort_key()` and `ProjectionTy::sort_key()` methods. Fixes rust-lang#36155
fix "X is not a member of trait Y" span labels Fixes rust-lang#36428.
Assign node ids during macro expansion After this PR, - The `ExtCtxt` can access `resolve`'s `Resolver` through the trait object `ext::base::Resolver`. - The `Resolver` trait object can load macros and replaces today's `MacroLoader` trait object. - The macro expander uses the `Resolver` trait object to resolve macro invocations. - The macro expander assigns node ids and builds the `Resolver`'s `macros_at_scope` map. - This is groundwork for merging import resolution and expansion. - Performance of expansion together with node id assignment improves by ~5%. **EDIT:** Since Github is reordering the commits, here is `git log`: - b54e1e3: Differentiate between monotonic and non-monotonic expansion and only assign node ids during monotonic expansion. - 78c0039: Expand generated test harnesses and macro registries. - f3c2dca: Remove scope placeholders from the crate root. - c86c8d4: Perform node id assignment and `macros_at_scope` construction during the `InvocationCollector` and `PlaceholderExpander` folds. - 72a6369: Move macro resolution into `librustc_resolve`. - 20b43b2: Rewrite the unit tests in `ext/expand.rs` as a `compile-fail` test. - a9821e1: Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`. - 60440b2: Refactor `noop_fold_stmt_kind` out of `noop_fold_stmt`. - 50f94f6: Avoid needless reexpansions. r? @nrc
…crichton Use primitive indexing in slice's Index/IndexMut [T]'s Index implementation is normally not used for indexing, instead the compiler supplied indexing is used. Use the compiler supplied version in Index/IndexMut. This removes an inconsistency: Compiler supplied bound check failures look like this: thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4' If you convince Rust to use the Index impl for slices, bounds check failure looks like this instead: thread 'main' panicked at 'assertion failed: index < self.len()' The latter is used if you for example use Index generically: ```rust use std::ops::Index; fn foo<T: ?Sized>(x: &T) where T: Index<usize> { &x[4]; } foo(&[1, 2, 3][..]) ```
invoke drop glue with a ptr to (data, meta) This is done by creating a little space on the stack. Hokey, but it's the simplest fix I can see, and I am in "kill regressions" mode right now. Fixes rust-lang#35546 r? @eddyb
clear obligations-added flag with nested fulfillcx This flag is a debugging measure designed to detect cases where we start a snapshot, create type variables, register obligations involving those type variables in the fulfillment cx, and then have to unroll the snapshot, leaving "dangling type variables" behind. HOWEVER, in some cases the flag is wrong. In particular, we sometimes create a "mini-fulfilment-cx" in which we enroll obligations. As long as this fulfillment cx is fully drained before we return, this is not a problem, as there won't be any escaping obligations in the main cx. So we add a fn to save/restore the flag. Fixes rust-lang#36053. r? @arielb1
… r=alexcrichton Add checked operation methods to Duration Addresses rust-lang#35774.
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ p=20 |
📌 Commit ec08128 has been approved by |
This was referenced Sep 15, 2016
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Clone
deriving #36384, Delete stray ` character in error message. #36405, Fix indeterminism in ty::TraitObject representation. #36425, fix "X is not a member of trait Y" span labels #36429, Assign node ids during macro expansion #36438, Use primitive indexing in slice's Index/IndexMut #36454, invoke drop glue with a ptr to (data, meta) #36459, clear obligations-added flag with nested fulfillcx #36461, Add checked operation methods to Duration #36463MacroRulesTT
ofSyntaxExtension
#36444