Commit Graph

55724 Commits

Author SHA1 Message Date
Alexandre Oliveira
a026e2c727 Update error E0365 to new format 2016-08-14 16:33:25 -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
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
Diggory Blake
b3908d08ee Fix make-tidy lock file checks 2016-08-13 22:36:04 +01: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
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
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
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
Diggory Blake
7341d68a40 Produce source package in rust-installer format in addition to vanilla tarball
Copy source files from rust code

Add missing wildcard

Remove unused function

Remove use of tar --transform
2016-08-12 18:13:18 +01: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
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
Eduard Burtescu
23f0494114 test: add more extensive tests for impl Trait. 2016-08-12 06:46:31 +03:00
Eduard Burtescu
08bf9f69b9 typeck: leak auto trait obligations through impl Trait. 2016-08-12 06:46:31 +03:00
Eduard Burtescu
d92e594c38 typeck: record impl Trait concrete resolutions. 2016-08-12 06:43:34 +03:00
Eduard Burtescu
1ef7ddfda3 typeck: disallow impl Trait outside of return types of functions and impl methods. 2016-08-12 06:43:34 +03:00
Eduard Burtescu
ef11d4e3c7 rustc: add TyAnon (impl Trait) to the typesystem. 2016-08-12 06:43:34 +03:00
Eduard Burtescu
f0baec691f syntax: add anonymized type syntax, i.e. impl TraitA+TraitB. 2016-08-12 06:43:34 +03:00
Eduard Burtescu
c976e073fd rustc: don't reveal specializable polymorphic projections. 2016-08-12 06:43:34 +03:00
Eduard Burtescu
ab26dbb96f rustc: always normalize projections in ty::layout regardless where they appear. 2016-08-12 06:43:34 +03:00
Eduard Burtescu
d1d16c94c5 rustc: rename ProjectionMode and its variant to be more memorable. 2016-08-12 06:43:34 +03:00
Vadim Petrochenkov
b052dd6240 Add test for #28514
Fixes #28514
2016-08-11 23:19:04 +03:00
Vadim Petrochenkov
737961b6c6 Make private_in_public compatibility lint deny-by-default 2016-08-11 23:19:04 +03:00
bors
8787a12334 Auto merge of #35592 - jonathandturner:rollup, r=jonathandturner
Rollup of 23 pull requests

- Successful merges: #35279, #35331, #35358, #35375, #35445, #35448, #35482, #35486, #35505, #35528, #35530, #35532, #35536, #35537, #35541, #35552, #35554, #35555, #35557, #35562, #35565, #35569, #35576
- Failed merges: #35395, #35415, #35563
2016-08-11 13:14:28 -07:00
Scott A Carr
d77a136437 add SetDiscriminant StatementKind to enable deaggregation of enums 2016-08-11 11:51:20 -07:00
Jonathan Turner
d3af9a38ed Fix tidy warning 2016-08-11 10:17:12 -07:00
bors
11f8805887 Auto merge of #34193 - petrochenkov:privalias, r=nikomatsakis
privacy: Substitute type aliases in private-in-public checker

Closes https://github.com/rust-lang/rust/issues/30503
Closes https://github.com/rust-lang/rust/issues/34293

Everyone in the issue discussion seemed to be in favor, @huonw also spoke about this [here](https://www.reddit.com/r/rust/comments/3xldr9/surfaces_and_signatures_component_privacy_versus/cy615wq), but the issue haven't got any movement.
I think it's reasonable to do this before turning `private_in_public` warnings into errors.

r? @nikomatsakis
2016-08-11 10:09:10 -07:00
Jonathan Turner
cdedad530f Rollup merge of #35576 - circuitfox:E0072-update-error-format, r=jonathandturner
E0072 update error format

Part of  #35233

Fixes #35506

r? @jonathandturner

The bonus for this issue currently seems to be impossible to do reliably, as the compiler seems to lack span information for item names alone, like `Foo` in `struct Foo { ... }`. It would be possible to hack something together by computing span offsets, but that seems like a solution that would be begging for trouble.

A proper solution to this would, of course, be to add span information to the right place (seems to be `rustc::hir::Item::name` but I may be wrong).
2016-08-11 06:34:02 -07:00
Jonathan Turner
0e92c5e8b2 Rollup merge of #35569 - pietroalbini:fix-typo, r=steveklabnik
Fix docs typo in std::os::unix::net::SocketAddr::is_unnamed
2016-08-11 06:34:02 -07:00
Jonathan Turner
efbed8ba79 Rollup merge of #35565 - wdv4758h:E0133, r=jonathandturner
Update E0133 to new format

Part of #35233
Fix #35509
r? @jonathandturner
2016-08-11 06:34:01 -07:00
Jonathan Turner
6692f41e12 Rollup merge of #35562 - birkenfeld:as-mut-doc, r=steveklabnik
Remove redundant `&mut ref mut` in doc for Result::as_mut()

While a good example of how `&mut ref mut` is a no-op, I don't think we should show that here :)
See https://users.rust-lang.org/t/mnemonic-for-reading-qualifiers/6853

r? @steveklabnik
2016-08-11 06:34:01 -07:00
Jonathan Turner
aaed538b24 Rollup merge of #35557 - Limeth:master, r=jonathandturner
E0263 updated to new format.

Fixes #35518. Part of #35233.
r? @jonathandturner
2016-08-11 06:34:01 -07:00
Jonathan Turner
a5408a5415 Rollup merge of #35555 - circuitfox:E0128-update-error-format, r=jonathandturner
E0128 update error format

Fixes #35508

Part of #35233

r? @jonathandturner
2016-08-11 06:34:00 -07:00
Jonathan Turner
b76ca890dd Rollup merge of #35554 - murarth:insert-str-issue, r=apasel422
Add tracking issue for `String::insert_str`
2016-08-11 06:34:00 -07:00
Jonathan Turner
b758688505 Rollup merge of #35552 - theypsilon:master, r=jonathandturner
Update error message E0384 to new format

Part of #35233
Fixes #35184

r? @jonathandturner
2016-08-11 06:34:00 -07:00
Jonathan Turner
08d5df8f5f Rollup merge of #35541 - hank-der-hafenarbeiter:E0045, r=jonathandturner
Updated E0045 to new error format (no bonus)

Part of #35501
r? @jonathandturner
2016-08-11 06:34:00 -07:00
Jonathan Turner
8d63269b8a Rollup merge of #35537 - munyari:e0038, r=jonathandturner
Update E0038 to the new error format

Part of #35233

Addresses #35500
"r? @jonathandturner

This doesn't compile yet, and I need help. In my naive solution, adding the span label makes our error message a mutable `errors::DiagnosticBuilder` pointer.

```bash
python src/bootstrap/bootstrap.py --step check-cfail E0038 --stage 1
```

```
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc v0.0.0 (file:///home/nash/code/rust/src/librustc)
src/librustc/traits/error_reporting.rs:735:9: 735:12 error: mismatched types [E0308]
src/librustc/traits/error_reporting.rs:735         err
                                                   ^~~
src/librustc/traits/error_reporting.rs:735:9: 735:12 help: run `rustc --explain E0308` to see a detailed explanation
src/librustc/traits/error_reporting.rs:735:9: 735:12 note: expected type `core::option::Option<errors::DiagnosticBuilder<'tcx>>`
src/librustc/traits/error_reporting.rs:735:9: 735:12 note:    found type `core::option::Option<&mut errors::DiagnosticBuilder<'_>>`
error: aborting due to previous error
error: Could not compile `rustc`.

To learn more, run the command again with --verbose.

command did not execute successfully: "/home/nash/code/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "--release" "--features" " jemalloc" "--manifest-path" "/home/nash/code/rust/src/rustc/Cargo.toml"
expected success, got: exit code: 101
```
2016-08-11 06:34:00 -07:00
Jonathan Turner
294ac7b561 Rollup merge of #35536 - hank-der-hafenarbeiter:E0433, r=jonathandturner
Updated E0433 to new error message. (no bonus)

Part of #35345
r? @jonathandturner
2016-08-11 06:33:59 -07:00
Jonathan Turner
d0922f6dc1 Rollup merge of #35532 - KiChjang:e0004-follow-up, r=jonathandturner
Do not span across nodes for E0004

Part of #35233.
Fixes #35529.

r? @arielb1
2016-08-11 06:33:59 -07:00
Jonathan Turner
c7513d79a1 Rollup merge of #35530 - srdja:master, r=jonathandturner
Update E0008 and E0007 to new format

Part of #35233
A fix for #35496

r? @jonathandturner
2016-08-11 06:33:59 -07:00
Jonathan Turner
0283443522 Rollup merge of #35528 - Vassah:master, r=jonathandturner
Update Error Format for E0091 and E0092

Addresses [#35228](https://github.com/rust-lang/rust/issues/35228) and [#35229](https://github.com/rust-lang/rust/issues/35229) as part of [#35233](https://github.com/rust-lang/rust/issues/35233).

Please let me know if there are any issues; first time contributor.

r? @jonathandturner
2016-08-11 06:33:59 -07:00
Jonathan Turner
ea342549a8 Rollup merge of #35505 - futile:test_29053, r=nikomatsakis
Add test for issue #29053

This PR adds a test for #29053 (currently fails on stage 0, but works with stage 1, as it should).

Fixes #29053
2016-08-11 06:33:59 -07:00
Jonathan Turner
853fe86906 Rollup merge of #35486 - KiChjang:e0081-bonus, r=jonathandturner
Shrink span to variant discriminant expression for E0081

Part of #35233.
Extension of #35353.
Fixes #35224.

r? @jonathandturner
2016-08-11 06:33:58 -07:00
Jonathan Turner
d423c25e08 Rollup merge of #35482 - frewsxcv:patch-31, r=GuillaumeGomez
Remove unnecessary `main` functions in doc examples.
2016-08-11 06:33:58 -07:00
Jonathan Turner
b17904234a Rollup merge of #35448 - srinivasreddy:rf_compiletest, r=nikomatsakis
run rustfmt on compiletest folder in src/tools/ folder
2016-08-11 06:33:58 -07:00