Commit Graph

55872 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
9fb4fa8e99 Rollup merge of #35539 - cgswords:ts_concat, r=nrc
Implemented a smarter TokenStream concatenation system

The new algorithm performs 'aggressive compacting' during concatenation as follows:

- If the nodes' combined total total length is less than 32, we copy both of
   them into a new vector and build a new leaf node.
- If one node is an internal node and the other is a 'small' leaf (length<32),
   we recur down the internal node on the appropriate side.
 - Otherwise, we construct a new internal node that points to them as left and
 right.

This should produce notably better behavior than the current concatenation implementation.
2016-08-14 20:29:49 +03:00
Eduard-Mihai Burtescu
b1ec5b2ad2 Rollup merge of #35533 - frewsxcv:22984, r=brson
Add regression test for #22894.

None
2016-08-14 20:29:48 +03:00
Eduard-Mihai Burtescu
c35d8dba7f Rollup merge of #35491 - sanxiyn:pub-restricted-span, r=nikomatsakis
Correct span for pub_restricted field

Fix #35435.
2016-08-14 20:29:48 +03:00
Eduard-Mihai Burtescu
6d8af8cf5d Rollup merge of #35447 - frewsxcv:vec-into-iter-as-slice, r=alexcrichton
Introduce `as_slice`/`as_mut_slice` methods on `std::vec::IntoIter` struct.

Similar to the `as_slice` method on `core::slice::Iter` struct.
2016-08-14 20:29:48 +03:00
Eduard-Mihai Burtescu
41e0f2d5e3 Rollup merge of #35444 - alexcrichton:optimize-catch-unwind, r=brson
std: Optimize panic::catch_unwind slightly

The previous implementation of this function was overly conservative with
liberal usage of `Option` and `.unwrap()` which in theory never triggers. This
commit essentially removes the `Option`s in favor of unsafe implementations,
improving the code generation of the fast path for LLVM to see through what's
happening more clearly.

cc #34727
2016-08-14 20:29:48 +03:00
Eduard-Mihai Burtescu
fa57f358a3 Rollup merge of #35392 - malbarbo:cell-from, r=brson
Implement From for Cell, RefCell and UnsafeCell

Considering that `From` is implemented for `Box`, `Rc` and `Arc`, it seems [reasonable](https://internals.rust-lang.org/t/implementing-from-t-for-other-std-types/3744) to implement it for `Cell`, `RefCell` and `UnsafeCell`.
2016-08-14 20:29:47 +03:00
Eduard-Mihai Burtescu
9d1900b417 Rollup merge of #34941 - qolop:patch-2, r=apasel422
Fix typo (privledge->privilege)
2016-08-14 20:29:47 +03:00
bors
92ae4ceb6c Auto merge of #34366 - Diggsey:rust-src-pkg, r=brson
Produce source package in rust-installer format

See rust-lang/rust-buildbot#102

There may be a better way to do this, wasn't sure how to clean-up the `rust-src-image` directory when it's used by multiple make rules.
2016-08-14 09:34:18 -07:00
bors
2e29b126b6 Auto merge of #35534 - michaelwoerister:fix-const-collection2, r=nikomatsakis
Make the translation item collector handle *uses* of 'const' items instead of declarations.

This should fix issue #34754.
2016-08-14 06:42:16 -07:00
bors
d927fa4856 Auto merge of #34206 - petrochenkov:pipdeny, r=nikomatsakis
Make `private_in_public` compatibility lint deny-by-default

In accordance with the [plan](https://internals.rust-lang.org/t/fcp-for-various-future-compatibility-warnings/3590/5?u=petrochenkov).

r? @nikomatsakis
2016-08-14 03:50:50 -07:00
Rahul Sharma
02fa14fc8e updated compile-fail tests 2016-08-14 16:18:58 +05:30
Eduard Burtescu
1bb1444516 Get rid of the .note interpretation of rustc dylib metadata. 2016-08-14 11:16:28 +03:00
bors
eec30ea657 Auto merge of #35453 - jseyfried:hygienize_metavariables, r=nrc
macros: Make metavariables hygienic

This PR makes metavariables hygienic. For example, consider:
```rust
macro_rules! foo {
    ($x:tt) => { // Suppose that this token tree argument is always a metavariable.
        macro_rules! bar { ($x:expr, $y:expr) => { ($x, $y) } }
    }
}

fn main() {
    foo!($z); // This currently compiles.
    foo!($y); // This is an error today but compiles after this PR.
}
```
Today, the `macro_rules! bar { ... }` definition is only valid when the metavariable passed to `foo` is not `$y` (since it unhygienically conflicts with the `$y` in the definition of `bar`) or `$x` (c.f. #35450).

After this PR, the definition of `bar` is always valid (and `bar!(a, b)` always expands to `(a, b)` as expected).

This can break code that was allowed in #34925 (landed two weeks ago). For example,
```rust
macro_rules! outer {
    ($t:tt) => {
        macro_rules! inner { ($i:item) => { $t } }
    }
}

outer!($i); // This `$i` should not interact with the `$i` in the definition of `inner!`.
inner!(fn main() {}); // After this PR, this is an error ("unknown macro variable `i`").
```

Due to the severe limitations on nested `macro_rules!` before #34925, this is not a breaking change for stable/beta.

Fixes #35450.

r? @nrc
2016-08-13 23:37:11 -07:00
Ivan Ukhov
10fce6e2d7 Fix a couple of typos in RawVec 2016-08-14 06:59:43 +02:00
Eduard Burtescu
02aec40dc9 [MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}. 2016-08-14 06:34:14 +03:00
Diggory Blake
b3908d08ee Fix make-tidy lock file checks 2016-08-13 22:36:04 +01:00
Jeffrey Seyfried
4943e96a0c Add regression test. 2016-08-13 20:08:45 +00:00
Jeffrey Seyfried
b08043ee69 Allow attributes to be marked used before cfg proccessing. 2016-08-13 20:08:42 +00:00
bors
2b7ea14cc4 Auto merge of #35414 - jupp0r:feature/test-threads-flag, r=alexcrichton
Add --test-threads option to test binaries

This change allows parallelism of test runs to be specified by a
command line flag names --test-threads in addition to the existing
environment variable RUST_TEST_THREADS. Fixes #25636.
2016-08-13 09:52:49 -07:00
Andrew Cann
0add394ee3 Remove diagnostic E0166 2016-08-14 00:30:05 +08:00
Andrew Cann
c3131f256d Fix bug in PostExpansionVisitor 2016-08-13 21:37:09 +08:00
Andrew Cann
ef1b507535 Fix build after rebase 2016-08-13 21:37:09 +08:00
Andrew Cann
6b8dacee9e Improve comments on ! tests 2016-08-13 21:37:09 +08:00
Andrew Cann
5bd54a2468 Fix make tidy 2016-08-13 21:37:09 +08:00
Andrew Cann
29f3636282 Add explanations to tests 2016-08-13 21:37:09 +08:00
Andrew Cann
bcff5a78b3 Permit ! as T with test 2016-08-13 21:37:09 +08:00
Andrew Cann
06747c669f Add another test for ! 2016-08-13 21:37:09 +08:00
Andrew Cann
00a71ea644 Add tests for ! type 2016-08-13 21:37:09 +08:00
Andrew Cann
2eff282aef Add some tests for ! type 2016-08-13 21:37:09 +08:00
Andrew Cann
c6890e17a0 Revert Ty::is_uninhabited to its original state 2016-08-13 21:37:09 +08:00
Andrew Cann
a4e6009bf0 Minor fixups based on feedback 2016-08-13 21:37:09 +08:00
Andrew Cann
a05560bebe Add run-pass/never_coercions.rs test 2016-08-13 21:37:09 +08:00
Andrew Cann
f019a92b77 Correctly handle AdjustNeverToAny in try_find_coercion_lub 2016-08-13 21:37:09 +08:00
Andrew Cann
69e27614c6 Minor fixup. 2016-08-13 21:37:09 +08:00
Andrew Cann
a6d6fff068 Lookup node type in map rather than using write_ty_expr 2016-08-13 21:37:09 +08:00
Andrew Cann
3639341685 Default diverging types based on feature gate.
Default to either `!` or `()` depending on whether feature(never_type)
is on or not.
2016-08-13 21:37:09 +08:00
Andrew Cann
54c72d8f98 Minor fix 2016-08-13 21:37:09 +08:00
Andrew Cann
8010314190 Un-improve Ty::is_uninabited 2016-08-13 21:37:09 +08:00
Andrew Cann
fadabe08f5 Rename empty/bang to never
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13 21:37:09 +08:00
Andrew Cann
f0a8b6d43f Minor fixups based on @eddyb's feedback
Mainly, remove mk_empty() method and replace with tcx.types.empty
2016-08-13 21:37:09 +08:00
Andrew Cann
5096a8c5c0 Control usage of ! through a feature gate.
Adds the `bang_type` feature gate. `!` in a non-return-type position now
relies on that feature.
2016-08-13 21:37:09 +08:00
Andrew Cann
0e1c2aa52e Make AdjustEmptyToAny actually perform the adjustment 2016-08-13 21:37:09 +08:00
Andrew Cann
ba65d2e15b Remove invalid compile-fail tests related to !
These tests check for the old error messages "`return` in a function
declared as diverging" and "computation may converge in a function
declared as diverging". The first of these is now invalid as `return` is
permitted in functions that return `!`. The second of these is subsumed
by the "mismatched types" error.
2016-08-13 21:37:09 +08:00
Andrew Cann
51c6ae25e2 implement std::cmp::* traits for ! 2016-08-13 21:37:09 +08:00
Andrew Cann
b22beed737 Fix build after rebase to lastest master 2016-08-13 21:37:09 +08:00
Andrew Cann
ed02344fbc Remove obsolete divergence related stuff
Replace FnOutput with Ty
Replace FnConverging(ty) with ty
Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13 21:37:09 +08:00
Andrew Cann
ee78f37e2a impl Debug + Display for ! 2016-08-13 21:37:09 +08:00
Andrew Cann
082915290d Make unused lint ignore unused ! 2016-08-13 21:37:09 +08:00
Andrew Cann
f31d9757f8 Fix super_relate_tys so that ! == ! 2016-08-13 21:37:09 +08:00
Andrew Cann
104963c539 Switch on TyEmpty
Parse -> ! as FnConverging(!)
Add AdjustEmptyToAny coercion to all ! expressions
Some fixes
2016-08-13 21:37:09 +08:00