Commit Graph

55781 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
f73f1282f5 Rollup merge of #35646 - theypsilon:master, r=jonathandturner
E0094 error message updated

Part of #35233
Fixes #35231

r? @jonathandturner
2016-08-14 20:29:52 +03:00
Eduard-Mihai Burtescu
50aa568709 Rollup merge of #35644 - garekkream:update-E0302-new-error-format, r=jonathandturner
Update E0302 to the new format

Part of #35233.
Fixes #35523.

r? @jonathandturner
2016-08-14 20:29:52 +03:00
Eduard-Mihai Burtescu
f91d242ad6 Rollup merge of #35643 - garekkream:update-E0301-new-error-format, r=jonathandturner
Update E0301 to the new format

Part of #35233.
Fixes #35522.

r? @jonathandturner
2016-08-14 20:29:52 +03:00
Eduard-Mihai Burtescu
42b3df23e2 Rollup merge of #35640 - ahmedcharles:dead, r=alexcrichton
compiletest: Remove dead code.
2016-08-14 20:29:52 +03:00
Eduard-Mihai Burtescu
2294fc4e4b Rollup merge of #35622 - matthew-piziak:convert-docs-typos, r=apasel422
fix small typos in std::convert documentation

Fix subject-verb agreement in copypasta: "`AsRef` dereference" to
"`AsRef` dereferences".

Formalize "eg" to "e.g." Italicization of common Latin abbreviations
seems to be going out of style in written English, so I left it plain.
2016-08-14 20:29:52 +03:00
Eduard-Mihai Burtescu
5766b42572 Rollup merge of #35620 - cvubrugier:master, r=Manishearth
book: fix the hidden find() functions in error-handling.md

The hidden find() functions always returns None. Consequently, one of the
examples using find() prints "No file extension found" instead of
"File extension: rs" which is the expected output.

This patch fixes the issue by implementing find() with std::str::find().

Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
2016-08-14 20:29:51 +03:00
Eduard-Mihai Burtescu
15f66ad326 Rollup merge of #35616 - clementmiao:E0067_new_error_format, r=jonathandturner
changed E0067 to new error format

Updated E0067 to new error format.
Part of #35233
Fixes #35502

Passes all the tests when running:
`python src/bootstrap/bootstrap.py --step check-cfail --stage 1`

**This seems strange, given that the format for E0067 has been changed.**
It feels like it should fail some unit tests maybe?

Let me know if I'm mistaken. Otherwise I can create a unit test for it.

Thanks for letting me help!

r? @jonathandturner
2016-08-14 20:29:51 +03:00
Eduard-Mihai Burtescu
c5a9228068 Rollup merge of #35615 - clementmiao:E0070_new_error_format, r=jonathandturner
Update E0070 to new error format

Updated E0070 to new error format.
Part of #35233
Fixes #35503

Thanks for letting me help!

r? @jonathandturner
2016-08-14 20:29:51 +03:00
Eduard-Mihai Burtescu
80510b800a Rollup merge of #35611 - jonathandturner:ptr-helper, r=nikomatsakis
Improve &-ptr printing

This PR replaces printing `&-ptr` with a more readable description.  To do so it uses a few heuristics.

If the name of the type is unknown, too long (longer than just saying "reference"), or too complex (a type with explicit lifetime annotations), it will instead opt to print either "reference" or "mutable reference", depending on the mutability of the type.

Before:

```
error[E0308]: mismatched types
  --> src/test/compile-fail/issue-7061.rs:14:46
   |
14 |     fn foo(&'a mut self) -> Box<BarStruct> { self }
   |                                              ^^^^ expected box, found &-ptr
   |
   = note: expected type `Box<BarStruct>`
   = note:    found type `&'a mut BarStruct`

error: aborting due to previous error
```

After:

```
error[E0308]: mismatched types
  --> src/test/compile-fail/issue-7061.rs:14:46
   |
14 |     fn foo(&'a mut self) -> Box<BarStruct> { self }
   |                                              ^^^^ expected box, found mutable reference
   |
   = note: expected type `Box<BarStruct>`
   = note:    found type `&'a mut BarStruct`

error: aborting due to previous error
```
2016-08-14 20:29:51 +03:00
Eduard-Mihai Burtescu
7aaa83a7d8 Rollup merge of #35606 - Mark-Simulacrum:no-std-fix, r=brson
Change stabilization version of no_std from 1.0 to 1.6.

I don't know if more than this is needed.

Fixes #35579.
2016-08-14 20:29:51 +03:00
Eduard-Mihai Burtescu
b975a120e1 Rollup merge of #35598 - tshepang:needless-binding, r=steveklabnik
string: remove needless binding
2016-08-14 20:29:50 +03:00
Eduard-Mihai Burtescu
322aa6e021 Rollup merge of #35597 - tshepang:it-is-a-slice, r=steveklabnik
doc: a value of type `&str` is called a "string slice"
2016-08-14 20:29:50 +03:00
Eduard-Mihai Burtescu
812a8c1e33 Rollup merge of #35596 - crypto-universe:E0254_style_and_tests, r=jonathandturner
Add label to E0254

This issue #35513 is a part of #35233.
r? @jonathandturner
2016-08-14 20:29:50 +03:00
Eduard-Mihai Burtescu
e3a94b4909 Rollup merge of #35594 - shepmaster:configure-llvm-39, r=alexcrichton
Allow compiling against a custom LLVM 3.9 installation
2016-08-14 20:29:50 +03:00
Eduard-Mihai Burtescu
955458e346 Rollup merge of #35588 - Antti:fix-atomics-docs, r=alexcrichton
Use an existing constant name as an example.

By reading atomics documentation I tried to use `INIT_ATOMIC_BOOL`, which I couldn't find. Turns out it was renamed to `ATOMIC_BOOL_INIT`.
2016-08-14 20:29:50 +03:00
Eduard-Mihai Burtescu
b65ff08d46 Rollup merge of #35586 - shyaamsundhar:SqushCom, r=jonathandturner
E0248, E0267 & E0268 Change into issue format

r? @jonathandturner  Part of #35391, #35519 and #35520. I have squashed all changes into a single commit. Please review the changes.

E0248 Change in issue format

E0267 UT New Format

E0268 UT New Format

E0267 & E0268 New Error Format
2016-08-14 20:29:49 +03:00
Eduard-Mihai Burtescu
da2328b0b1 Rollup merge of #35577 - japaric:relax, r=alexcrichton
add -mrelax-relocations=no to i686-musl and i586-gnu

I've been experiencing #34978 with these two targets. This applies the
hack in #35178 to these targets as well.

r? @alexcrichton
2016-08-14 20:29:49 +03:00
Eduard-Mihai Burtescu
8ade28e9a2 Rollup merge of #35574 - badboy:emscripten-test-fixes, r=brson
Emscripten test fixes

This picks up parts of #31623 to disable certain tests that emscripten can't run, as threads/processes are not supported.
I re-applied @tomaka's changes manually, I can rebase those commits with his credentials if he wants.

It also disables jemalloc for emscripten (at least in Rustbuild, I have to check if there is another setting for the same thing in the old makefile approach).

This should not impact anything for normal builds.
2016-08-14 20:29:49 +03:00
Eduard-Mihai Burtescu
c3cede2257 Rollup merge of #35573 - wdv4758h:E0138, r=jonathandturner
Update E0138 to new format

Part of #35233
Fix #35510
r? @jonathandturner

![e0138](https://cloud.githubusercontent.com/assets/2716047/17562415/7200d93c-5f5d-11e6-98ff-e15c29f40e03.png)

Question: How can I only underline the function name ? I have observed the debug output and the struct of item, but I can't find the `Span` for function name. Should I modify the struct I get to save function name's position or there is another way to get it ? (I can only find `Span`s for function attributes, inputs, outputs, blocks)
2016-08-14 20:29:49 +03:00
Eduard-Mihai Burtescu
9c347b93a4 Rollup merge of #35558 - lukehinds:master, r=nikomatsakis
Update error message for E0253 #35512

Fixes #35512. Part of #35233.
2016-08-14 20:29:49 +03:00
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
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
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
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
José manuel Barroso Galindo
85388f0958 E0094 error message updated
Part of #35233
Fixes #35231
2016-08-13 16:32:43 +07:00
bors
e64f68817d Auto merge of #35348 - scottcarr:discriminant2, r=nikomatsakis
[MIR] Add explicit SetDiscriminant StatementKind for deaggregating enums

cc #35186

To deaggregate enums, we need to be able to explicitly set the discriminant.  This PR implements a new StatementKind that does that.

I think some of the places that have `panics!` now could maybe do something smarter.
2016-08-13 01:20:46 -07:00
Clement Miao
bd90a16151 updated E0067 to new error format 2016-08-13 00:03:04 -07:00
Ahmed Charles
08e470f9e1 compiletest: Remove dead code. 2016-08-12 23:52:35 -07:00
bors
d3c3de8abe Auto merge of #35138 - petrochenkov:clarify, r=eddyb
Implement RFC 1506 "Clarify the relationships between various kinds of structs and variants"

cc https://github.com/rust-lang/rust/issues/35626
2016-08-12 19:38:46 -07:00
Krzysztof Garczynski
5402d28fe7 Update E0302 to the new format 2016-08-13 02:33:52 +02:00
Krzysztof Garczynski
302a423047 Update E0301 to the new format 2016-08-13 01:33:42 +02:00
Vadim Petrochenkov
f6624782d4 Parse numeric fields in struct expressions and patterns 2016-08-13 00:08:14 +03:00
Vadim Petrochenkov
59be332a1b Remove restrictions from tuple structs/variants
Hard errors are turned into feature gates
2016-08-13 00:08:14 +03:00
Clement Miao
4ab00e4397 updated E0070 to new error format 2016-08-12 10:15:54 -07:00
Matthew Piziak
bfca761c8c fix small typos in std::convert documentation
Fix subject-verb agreement in copypasta: "`AsRef` dereference" to
"`AsRef` dereferences".

Formalize "eg" to "e.g." Italicization of common Latin abbreviations
seems to be going out of style in written English, so I left it plain.
2016-08-12 12:20:56 -04:00
Michael Woerister
09e73a5b03 Make the translation item collector handle *uses* of 'const' items instead of declarations. 2016-08-12 12:07:51 -04:00
bors
1deb02ea69 Auto merge of #35431 - GuillaumeGomez:err_codes, r=jonathandturner
Err codes

r? @jonathandturner
2016-08-12 08:58:55 -07:00
Christophe Vu-Brugier
3042fba44c book: fix the hidden find() functions in error-handling.md
The hidden find() functions always returns None. Consequently, one of the
examples using find() prints "No file extension found" instead of
"File extension: rs" which is the expected output.

This patch fixes the issue by implementing find() with std::str::find().

Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
2016-08-12 14:49:16 +02:00
Seo Sanghyeon
f76a737bae Correct span for pub_restricted field 2016-08-12 21:08:02 +09:00
bors
f55ac6944a Auto merge of #35091 - eddyb:impl-trait, r=nikomatsakis
Implement `impl Trait` in return type position by anonymization.

This is the first step towards implementing `impl Trait` (cc #34511).
`impl Trait` types are only allowed in function and inherent method return types, and capture all named lifetime and type parameters, being invariant over them.
No lifetimes that are not explicitly named lifetime parameters are allowed to escape from the function body.
The exposed traits are only those listed explicitly, i.e. `Foo` and `Clone` in `impl Foo + Clone`, with the exception of "auto traits" (like `Send` or `Sync`) which "leak" the actual contents.

The implementation strategy is anonymization, i.e.:
```rust
fn foo<T>(xs: Vec<T>) -> impl Iterator<Item=impl FnOnce() -> T> {
    xs.into_iter().map(|x| || x)
}

// is represented as:
type A</*invariant over*/ T> where A<T>: Iterator<Item=B<T>>;
type B</*invariant over*/ T> where B<T>: FnOnce() -> T;
fn foo<T>(xs: Vec<T>) -> A<T> {
    xs.into_iter().map(|x| || x): $0 where $0: Iterator<Item=$1>, $1: FnOnce() -> T
}
```
`$0` and `$1` are resolved (to `iter::Map<vec::Iter<T>, closure>` and the closure, respectively) and assigned to `A` and `B`, after checking the body of `foo`. `A` and `B` are *never* resolved for user-facing type equality (typeck), but always for the low-level representation and specialization (trans).

The "auto traits" exception is implemented by collecting bounds like `impl Trait: Send` that have failed for the obscure `impl Trait` type (i.e. `A` or `B` above), pretending they succeeded within the function and trying them again after type-checking the whole crate, by replacing `impl Trait` with the real type.

While passing around values which have explicit lifetime parameters (of the function with `-> impl Trait`) in their type *should* work, regionck appears to assign inference variables in *way* too many cases, and never properly resolving them to either explicit lifetime parameters, or `'static`.
We might not be able to handle lifetime parameters in `impl Trait` without changes to lifetime inference, but type parameters can have arbitrary lifetimes in them from the caller, so most type-generic usecases (or not generic at all) should not run into this problem.

cc @rust-lang/lang
2016-08-12 01:26:12 -07:00
Jeffrey Seyfried
95b68aa5ea Fix fallout in tests. 2016-08-12 07:21:34 +00:00
bors
68d9284a9b Auto merge of #34811 - DanielJCampbell:Expander, r=jseyfried
Extended expand.rs to support alternate expansion behaviours (eg. stepwise expansion)

r? nrc
2016-08-11 22:10:16 -07:00
Jonathan Turner
42247372c6 Improve &-ptr printing 2016-08-11 21:47:56 -07:00