]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoDistribute Rustfmt
Nick Cameron [Fri, 10 Nov 2017 02:09:39 +0000 (15:09 +1300)]
Distribute Rustfmt

6 years agoAuto merge of #45908 - alexcrichton:disable-thinlto-libtest, r=Mark-Simulacrum
bors [Sun, 12 Nov 2017 18:06:46 +0000 (18:06 +0000)]
Auto merge of #45908 - alexcrichton:disable-thinlto-libtest, r=Mark-Simulacrum

rustbuild: Disable ThinLTO for libtest

Right now ThinLTO is generating bad dwarf which is tracked by #45511, but this
is causing issues on OSX (#45768) where `dsymutil` is segfaulting and failing to
produce output.

Closes #45768

6 years agoAuto merge of #45753 - sinkuu:mir_copyprop_arg, r=arielb1
bors [Sun, 12 Nov 2017 15:38:13 +0000 (15:38 +0000)]
Auto merge of #45753 - sinkuu:mir_copyprop_arg, r=arielb1

Fix MIR CopyPropagation errneously propagating assignments to function args

Compiling this code with MIR CopyPropagation activated will result in printing `5`,
because CopyProp errneously propagates the assignment of `5` to all `x`:

```rust
fn bar(mut x: u8) {
    println!("{}", x);
    x = 5;
}

fn main() {
    bar(123);
}

```

If a local is propagated, it will result in an ICE at trans due to an use-before-def:

```rust
fn dummy(x: u8) -> u8 { x }

fn foo(mut x: u8) {
    x = dummy(x); // this will assign a local to `x`
}
```
Currently CopyProp conservatively gives up if there are multiple assignments to a local,
but it is not took into account that arguments are already assigned from the beginning.
This PR fixes the problem by preventing propagation of assignments to function arguments.

6 years agoAuto merge of #45902 - nrc:component-update, r=alexcrichton
bors [Sun, 12 Nov 2017 12:20:07 +0000 (12:20 +0000)]
Auto merge of #45902 - nrc:component-update, r=alexcrichton

Update RLS and Rustfmt

r? @alexcrichton

6 years agoAuto merge of #45900 - rkruppe:u128-to-f32-saturation-by-default, r=alexcrichton
bors [Sun, 12 Nov 2017 09:46:00 +0000 (09:46 +0000)]
Auto merge of #45900 - rkruppe:u128-to-f32-saturation-by-default, r=alexcrichton

Make saturating u128 -> f32 casts the default behavior

... rather than being gated by `-Z saturating-float-casts`. There are several reasons for this:

1. Const eval already implements this behavior.
2. Unlike with float->int casts, this behavior is uncontroversially the right behavior and it is not as performance critical. Thus there is no particular need to make the bug fix for u128->f32 casts opt-in.
3. Having two orthogonal features under one flag is silly, and never should have happened in the first place.
4. Benchmarking float->int casts with the -Z flag should not pick up performance changes due to the u128->f32 casts (assuming there are any).

Fixes #41799

6 years agoAuto merge of #45870 - mikeyhew:arbitrary_self_types, r=arielb1
bors [Sun, 12 Nov 2017 07:31:08 +0000 (07:31 +0000)]
Auto merge of #45870 - mikeyhew:arbitrary_self_types, r=arielb1

Implement arbitrary_self_types

r? @arielb1
cc @nikomatsakis

Partial implementation of #44874.  Supports trait and struct methods with arbitrary self types, as long as the type derefs (transitively) to `Self`. Doesn't support raw-pointer `self` yet.

Methods with non-standard self types (i.e. anything other than `&self, &mut self, and Box<Self>`) are not object safe, because dynamic dispatch hasn't been implemented for them yet.

I believe this is also a (partial) fix for #27941.

6 years agoAuto merge of #45864 - nikomatsakis:issue-30046-infer-fn-once-in-closures, r=eddyb
bors [Sun, 12 Nov 2017 05:08:09 +0000 (05:08 +0000)]
Auto merge of #45864 - nikomatsakis:issue-30046-infer-fn-once-in-closures, r=eddyb

adjust closure kind based on the guarantor's upvar note

Fixes #30046.

r? @eddyb

6 years agoAuto merge of #45848 - nrc:rls-bugs-4, r=eddyb
bors [Sun, 12 Nov 2017 01:58:12 +0000 (01:58 +0000)]
Auto merge of #45848 - nrc:rls-bugs-4, r=eddyb

save-analysis: two fixes + rustfmt

Fix two regressions and run rustfmt.

r? @eddyb

6 years agoAuto merge of #45152 - Binero:master, r=dtolnay
bors [Sat, 11 Nov 2017 20:41:36 +0000 (20:41 +0000)]
Auto merge of #45152 - Binero:master, r=dtolnay

Addressed issues raised in #44286. (`OccupiedEntry::replace_entry`)

This commit renames the `replace` function to `replace_entry`, and
creates a seperate `replace_key` function for `OccupiedEntry`. The
original `replace` function did not solve the use-case where the
key needed to be replaced, but not the value. Documentation and
naming has also been updated to better reflect what the original
replace function does.

6 years agoImprovided map_entry_replace examples
Jeroen Bollen [Sat, 11 Nov 2017 15:21:49 +0000 (16:21 +0100)]
Improvided map_entry_replace examples

The current examples should be more realistic.

6 years agoAuto merge of #45333 - alkis:master, r=bluss
bors [Sat, 11 Nov 2017 18:17:14 +0000 (18:17 +0000)]
Auto merge of #45333 - alkis:master, r=bluss

Improve SliceExt::binary_search performance

Improve the performance of binary_search by reducing the number of unpredictable conditional branches in the loop. In addition improve the benchmarks to test performance in l1, l2 and l3 caches on sorted arrays with or without dups.

Before:

```
test slice::binary_search_l1                               ... bench:          48 ns/iter (+/- 1)
test slice::binary_search_l2                               ... bench:          63 ns/iter (+/- 0)
test slice::binary_search_l3                               ... bench:         152 ns/iter (+/- 12)
test slice::binary_search_l1_with_dups                     ... bench:          36 ns/iter (+/- 0)
test slice::binary_search_l2_with_dups                     ... bench:          64 ns/iter (+/- 1)
test slice::binary_search_l3_with_dups                     ... bench:         153 ns/iter (+/- 6)
```

After:

```
test slice::binary_search_l1                               ... bench:          15 ns/iter (+/- 0)
test slice::binary_search_l2                               ... bench:          23 ns/iter (+/- 0)
test slice::binary_search_l3                               ... bench:         100 ns/iter (+/- 17)
test slice::binary_search_l1_with_dups                     ... bench:          15 ns/iter (+/- 0)
test slice::binary_search_l2_with_dups                     ... bench:          23 ns/iter (+/- 0)
test slice::binary_search_l3_with_dups                     ... bench:          98 ns/iter (+/- 14)
```

6 years agoAuto merge of #45775 - petrochenkov:patnopat, r=nikomatsakis
bors [Sat, 11 Nov 2017 15:49:36 +0000 (15:49 +0000)]
Auto merge of #45775 - petrochenkov:patnopat, r=nikomatsakis

Accept interpolated patterns in trait method parameters

Permit this, basically
```rust
macro_rules! m {
    ($pat: pat) => {
        trait Tr {
            fn f($pat: u8) {}
        }
    }
}
```
it previously caused a parsing error during expansion because trait methods accept only very restricted set of patterns during parsing due to ambiguities caused by [anonymous parameters](https://github.com/rust-lang/rust/issues/41686), and this set didn't include interpolated patterns.

Some outdated messages from "no patterns allowed" errors are also removed.

Addresses https://github.com/rust-lang/rust/issues/35203#issuecomment-341937159

6 years agoChanged tabs back into spaces to fix formatting.
Jeroen Bollen [Thu, 12 Oct 2017 09:18:16 +0000 (11:18 +0200)]
Changed tabs back into spaces to fix formatting.

6 years agoAddressed issues raised in #44286.
Jeroen Bollen [Mon, 9 Oct 2017 19:06:20 +0000 (21:06 +0200)]
Addressed issues raised in #44286.

This commit renames the `replace` function to `replace_entry`, and
creates a seperate `replace_key` function for `OccupiedEntry`. The
original `replace` function did not solve the use-case where the
key needed to be replaced, but not the value. Documentation and
naming has also been updated to better reflect what the original
replace function does.

6 years agoImprove the performance of binary_search by reducing the number of
Alkis Evlogimenos [Mon, 16 Oct 2017 12:05:16 +0000 (14:05 +0200)]
Improve the performance of binary_search by reducing the number of
unpredictable conditional branches in the loop. In addition improve the
benchmarks to test performance in l1, l2 and l3 caches on sorted arrays
with or without dups.

Before:

```
test slice::binary_search_l1                               ... bench:  48 ns/iter (+/- 1)
test slice::binary_search_l2                               ... bench:  63 ns/iter (+/- 0)
test slice::binary_search_l3                               ... bench: 152 ns/iter (+/- 12)
test slice::binary_search_l1_with_dups                     ... bench:  36 ns/iter (+/- 0)
test slice::binary_search_l2_with_dups                     ... bench:  64 ns/iter (+/- 1)
test slice::binary_search_l3_with_dups                     ... bench: 153 ns/iter (+/- 6)
```

After:

```
test slice::binary_search_l1                               ... bench:  15 ns/iter (+/- 0)
test slice::binary_search_l2                               ... bench:  23 ns/iter (+/- 0)
test slice::binary_search_l3                               ... bench: 100 ns/iter (+/- 17)
test slice::binary_search_l1_with_dups                     ... bench:  15 ns/iter (+/- 0)
test slice::binary_search_l2_with_dups                     ... bench:  23 ns/iter (+/- 0)
test slice::binary_search_l3_with_dups                     ... bench:  98 ns/iter (+/- 14)
```

6 years agoAuto merge of #45932 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sat, 11 Nov 2017 13:30:16 +0000 (13:30 +0000)]
Auto merge of #45932 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 4 pull requests

- Successful merges: #45631, #45812, #45877, #45919
- Failed merges:

6 years agoAlways report patterns more complex than `mut IDENT` as errors
Vadim Petrochenkov [Sun, 5 Nov 2017 02:08:41 +0000 (05:08 +0300)]
Always report patterns more complex than `mut IDENT` as errors

6 years agoAccept interpolated patterns in trait method parameters
Vadim Petrochenkov [Sun, 5 Nov 2017 01:22:18 +0000 (04:22 +0300)]
Accept interpolated patterns in trait method parameters

Remove some outdated messages from "no patterns allowed" errors

6 years agoRollup merge of #45919 - lukaramu:patch-1, r=kennytm
Guillaume Gomez [Sat, 11 Nov 2017 12:38:08 +0000 (13:38 +0100)]
Rollup merge of #45919 - lukaramu:patch-1, r=kennytm

Fix broken link markup in Hasher::finish docs

Just a quick fix: there were apostrophes when there needed to be backticks.

6 years agoRollup merge of #45877 - mikhail-m1:mir-borrowck-act-on-moved, r=arielb1
Guillaume Gomez [Sat, 11 Nov 2017 12:38:07 +0000 (13:38 +0100)]
Rollup merge of #45877 - mikhail-m1:mir-borrowck-act-on-moved, r=arielb1

restore move out dataflow, add report of move out errors

fix https://github.com/rust-lang/rust/issues/45363
r? @arielb1

6 years agoRollup merge of #45812 - GuillaumeGomez:links-and-search, r=QuietMisdreavus
Guillaume Gomez [Sat, 11 Nov 2017 12:38:06 +0000 (13:38 +0100)]
Rollup merge of #45812 - GuillaumeGomez:links-and-search, r=QuietMisdreavus

Fix navbar click while in a search

Fixes #45790.

6 years agoRollup merge of #45631 - GuillaumeGomez:file-ext-docs, r=frewsxcv
Guillaume Gomez [Sat, 11 Nov 2017 12:38:05 +0000 (13:38 +0100)]
Rollup merge of #45631 - GuillaumeGomez:file-ext-docs, r=frewsxcv

Add missing links and examples for FileExt

r? @rust-lang/docs

6 years agoAdd missing links and examples for FileExt
Guillaume Gomez [Mon, 30 Oct 2017 12:48:26 +0000 (13:48 +0100)]
Add missing links and examples for FileExt

6 years agoAuto merge of #45772 - leodasvacas:fix-auto-bounds-in-trait-objects, r=nikomatsakis
bors [Sat, 11 Nov 2017 09:56:22 +0000 (09:56 +0000)]
Auto merge of #45772 - leodasvacas:fix-auto-bounds-in-trait-objects, r=nikomatsakis

Fix checking of auto trait bounds in trait objects.

Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were [emitting twice](https://play.rust-lang.org/?gist=37dbbdbbec62dec423bb8f6d92f137cc&version=stable).

Note: This was the last use of `Send` in the compiler, meaning after a new `stage0` we could remove the `send` lang item.

6 years agoAuto merge of #45807 - tommyip:format_err, r=estebank
bors [Sat, 11 Nov 2017 07:33:31 +0000 (07:33 +0000)]
Auto merge of #45807 - tommyip:format_err, r=estebank

Make positional argument error in format! clearer

r? @estebank

Fixes #44954

6 years agoAuto merge of #45806 - alexcrichton:update-llvm-for-mips, r=michaelwoerister
bors [Sat, 11 Nov 2017 02:11:34 +0000 (02:11 +0000)]
Auto merge of #45806 - alexcrichton:update-llvm-for-mips, r=michaelwoerister

rustbuild: Re-enable ThinLTO for MIPS

Now that the upstream LLVM bug is now fixed this commit cherry-picks the commit
onto our LLVM and then re-enables the ThinLTO paths for MIPS.

Closes #45654

6 years agoFew improvements on search, history and title
Guillaume Gomez [Fri, 10 Nov 2017 22:47:36 +0000 (23:47 +0100)]
Few improvements on search, history and title

6 years agoAuto merge of #45707 - Ryman:deprecated-item-name, r=nikomatsakis
bors [Fri, 10 Nov 2017 21:42:09 +0000 (21:42 +0000)]
Auto merge of #45707 - Ryman:deprecated-item-name, r=nikomatsakis

rustc: add item name to deprecated lint warning

It can sometimes be difficult to know what is actually deprecated when you have `foo.bar()` and `bar` comes from a trait in another crate.

6 years agoFix broken link markup in Hasher::finish docs
Lukas H [Fri, 10 Nov 2017 19:58:03 +0000 (20:58 +0100)]
Fix broken link markup in Hasher::finish docs

There were apostrophes when there needed to be backticks.

6 years agoAuto merge of #45050 - petrochenkov:ambind, r=nikomatsakis
bors [Fri, 10 Nov 2017 19:10:12 +0000 (19:10 +0000)]
Auto merge of #45050 - petrochenkov:ambind, r=nikomatsakis

resolve: Use same rules for disambiguating fresh bindings in `match` and `let`

Resolve `Unit` as a unit struct pattern in
```rust
struct Unit;

let Unit = x;
```
consistently with
```rust
match x {
    Unit => {}
}
```
It was previously an error.
(The change also applies to unit variants and constants.)

Fixes https://users.rust-lang.org/t/e0530-cannot-shadow-unit-structs-what-in-the-earthly-what/13054
(This particular change doesn't depend on a fix for the issue mentioned in https://users.rust-lang.org/t/e0530-cannot-shadow-unit-structs-what-in-the-earthly-what/13054/4)

cc @rust-lang/lang
r? @nikomatsakis

6 years agoAllow to go back to previous search
Guillaume Gomez [Fri, 10 Nov 2017 18:40:46 +0000 (19:40 +0100)]
Allow to go back to previous search

6 years agoAuto merge of #45804 - gnzlbg:div_intr, r=alexcrichton
bors [Fri, 10 Nov 2017 16:42:49 +0000 (16:42 +0000)]
Auto merge of #45804 - gnzlbg:div_intr, r=alexcrichton

[intrinsics] add missing div and rem vector intrinsics

6 years agoAuto merge of #45791 - eddyb:quote-unquote, r=jseyfried
bors [Fri, 10 Nov 2017 14:10:07 +0000 (14:10 +0000)]
Auto merge of #45791 - eddyb:quote-unquote, r=jseyfried

Prefer libproc_macro APIs to libsyntax ones in the quasi-quoter.

The shift to using `proc_macro`'s own APIs in `proc_macro::quote`, both in the implementation of the quasi-quoter and the Rust code it generates to build `TokenStream`s at runtime, greatly reduces the dependency on `libsyntax`, with the generated runtime code being completely free of it.

This is a prerequirement for introducing more abstraction/indirection between `proc_macro` and compiler implementation details (mainly those from `libsyntax`), which I want to attempt.

cc @alexcrichton @jseyfried @nrc

6 years agoSeparately eliminate self-assignments
sinkuu [Mon, 6 Nov 2017 03:35:43 +0000 (12:35 +0900)]
Separately eliminate self-assignments

6 years agoFix MIR CopyPropagation errneously propagating assignments to function arguments
sinkuu [Sun, 5 Nov 2017 13:08:30 +0000 (22:08 +0900)]
Fix MIR CopyPropagation errneously propagating assignments to function arguments

6 years agoAuto merge of #45785 - arielb1:unsafe-fixes, r=eddyb
bors [Fri, 10 Nov 2017 11:37:32 +0000 (11:37 +0000)]
Auto merge of #45785 - arielb1:unsafe-fixes, r=eddyb

fixes to MIR effectck

r? @eddyb

beta-nominating because regression (MIR effectck is new)

6 years agorustbuild: Disable ThinLTO for libtest
Alex Crichton [Fri, 10 Nov 2017 09:39:07 +0000 (01:39 -0800)]
rustbuild: Disable ThinLTO for libtest

Right now ThinLTO is generating bad dwarf which is tracked by #45511, but this
is causing issues on OSX (#45768) where `dsymutil` is segfaulting and failing to
produce output.

Closes #45768

6 years agoMake saturating u128 -> f32 casts the default behavior
Robin Kruppe [Thu, 9 Nov 2017 23:24:05 +0000 (00:24 +0100)]
Make saturating u128 -> f32 casts the default behavior

... rather than being gated by -Z saturating-float-casts.
There are several reasons for this:

1. Const eval already implements this behavior.
2. Unlike with float->int casts, this behavior is uncontroversially the
right behavior and it is not as performance critical. Thus there is no
particular need to make the bug fix for u128->f32 casts opt-in.
3. Having two orthogonal features under one flag is silly, and never
should have happened in the first place.
4. Benchmarking float->int casts with the -Z flag should not pick up
performance changes due to the u128->f32 casts (assuming there are any).

Fixes #41799

6 years agoAuto merge of #45907 - kennytm:rollup, r=kennytm
bors [Fri, 10 Nov 2017 09:08:15 +0000 (09:08 +0000)]
Auto merge of #45907 - kennytm:rollup, r=kennytm

Rollup of 9 pull requests

- Successful merges: #45783, #45856, #45863, #45869, #45878, #45882, #45887, #45895, #45901
- Failed merges:

6 years agoRollup merge of #45901 - rkruppe:fix-typo, r=kennytm
kennytm [Fri, 10 Nov 2017 09:07:12 +0000 (17:07 +0800)]
Rollup merge of #45901 - rkruppe:fix-typo, r=kennytm

Fix typo in -Zsaturating-float-casts test

6 years agoRollup merge of #45895 - arielb1:inline-debug, r=eddyb
kennytm [Fri, 10 Nov 2017 09:07:11 +0000 (17:07 +0800)]
Rollup merge of #45895 - arielb1:inline-debug, r=eddyb

add a bunch of debug logging to MIR inlining

r? @eddyb

@bors rollup

6 years agoRollup merge of #45887 - xfix:assert-eq-trailling-comma, r=dtolnay
kennytm [Fri, 10 Nov 2017 09:07:10 +0000 (17:07 +0800)]
Rollup merge of #45887 - xfix:assert-eq-trailling-comma, r=dtolnay

Allow a trailling comma in assert_eq/ne macro

From Rust beginners IRC:

&lt;???> It sure does annoy me that assert_eq!() does not accept a trailing comma after the last argument.
&lt;???> ???: File an issue against https://github.com/rust-lang/rust and CC @rust-lang/libs

Figured that might as well submit it. Will become insta-stable after merging (danger zone).

cc @rust-lang/libs

6 years agoRollup merge of #45882 - japaric:gh45802, r=kennytm
kennytm [Fri, 10 Nov 2017 09:07:09 +0000 (17:07 +0800)]
Rollup merge of #45882 - japaric:gh45802, r=kennytm

fix core for targets with max-atomic-width = 0

closes #45802

cc @kennytm

6 years agoRollup merge of #45878 - jhford:use-get-in-get-example, r=kennytm
kennytm [Fri, 10 Nov 2017 09:07:08 +0000 (17:07 +0800)]
Rollup merge of #45878 - jhford:use-get-in-get-example, r=kennytm

get() example should use get() not get_mut()

I'm really new to Rust, this is the first thing I've ever actually pushed to github in a rust project, so please double check that it's correct.  I noticed that the in-doc example for the string's get() function was referring to get_mut().  Looks like a copy/paste issue.

```rust
fn main() {
    let v = String::from("🗻∈🌏");

    assert_eq!(Some("🗻"), v.get(0..4));

    // indices not on UTF-8 sequence boundaries
    assert!(v.get(1..).is_none());
    assert!(v.get(..8).is_none());

    // out of bounds
    assert!(v.get(..42).is_none());
}
```
results in:
```
jhford-work:~/rust/redish $ cat get-example.rs
fn main() {
    let v = String::from("🗻∈🌏");

    assert_eq!(Some("🗻"), v.get(0..4));

    // indices not on UTF-8 sequence boundaries
    assert!(v.get(1..).is_none());
    assert!(v.get(..8).is_none());

    // out of bounds
    assert!(v.get(..42).is_none());
}
jhford-work:~/rust/redish $ rustc get-example.rs
jhford-work:~/rust/redish $ ./get-example ; echo $?
0
```

I did not build an entire rust toolchain as I'm not totally sure how to do that.

6 years agoRollup merge of #45869 - GuillaumeGomez:debug-doc, r=frewsxcv
kennytm [Fri, 10 Nov 2017 09:07:07 +0000 (17:07 +0800)]
Rollup merge of #45869 - GuillaumeGomez:debug-doc, r=frewsxcv

Add missing example for Debug trait

r? @rust-lang/docs

6 years agoRollup merge of #45863 - LukasKalbertodt:add-option-filter, r=dtolnay
kennytm [Fri, 10 Nov 2017 09:07:06 +0000 (17:07 +0800)]
Rollup merge of #45863 - LukasKalbertodt:add-option-filter, r=dtolnay

Add `Option::filter()` according to RFC 2124

(*old PR: https://github.com/rust-lang/rust/pull/44996*)

This is the implementation of [RFC "Add `Option::filter` to the standard library"](https://github.com/rust-lang/rfcs/pull/2124). Tracking issue: https://github.com/rust-lang/rust/issues/45860

**Questions for code reviewers:**

- Is the documentation sufficiently long?
- Is the documentation easy enough to understand?
- Is the position of the new method (after `and_then()`) a good one?

6 years agoRollup merge of #45856 - estebank:issue-45829, r=nikomatsakis
kennytm [Fri, 10 Nov 2017 09:07:05 +0000 (17:07 +0800)]
Rollup merge of #45856 - estebank:issue-45829, r=nikomatsakis

Fix help for duplicated names: `extern crate (...) as (...)`

On the case of duplicated names caused by an `extern crate` statement
with a rename, don't include the inline suggestion, instead using a span
label with only the text to avoid incorrect rust code output.

Fix #45829.

6 years agoRollup merge of #45783 - kennytm:compiler-test-fixes, r=alexcrichton
kennytm [Fri, 10 Nov 2017 09:07:04 +0000 (17:07 +0800)]
Rollup merge of #45783 - kennytm:compiler-test-fixes, r=alexcrichton

Miscellaneous changes for CI, Docker and compiletest.

This PR contains 7 independent commits that improves interaction with CI, Docker and compiletest.

1. a4e5c91cb8 — Forces a newline every 100 dots when testing in quiet mode. Prevents spurious timeouts when abusing the CI to test Android jobs.

2. 1b5aaf22e8 — Use vault.centos.org for dist-powerpc64le-linux, see #45744.

3. 33400fbbcd — Modify `src/ci/docker/run.sh` so that the docker images can be run from Docker Toolbox for Windows on Windows 7. I haven't checked the behavior of the newer Docker for Windows on Windows 10. Also, "can run" does not mean all the test can pass successfully (the UDP tests failed last time I checked)

4. d517668a08 — Don't emit a real warning the linker segfault, which affects UI tests like https://github.com/rust-lang/rust/pull/45489#issuecomment-340134944. Log it instead.

5. 51e2247948 — During run-pass, trim the output if stdout/stderr exceeds 416 KB (top 160 KB + bottom 256 KB). This is an attempt to avoid spurious failures like https://github.com/rust-lang/rust/pull/45384#issuecomment-341755788

6. 9cfdabaf3c — Force `gem update --system` before deploy. This is an attempt to prevent spurious error #44159.

7. eee10cc482 — Tries to print the crash log on macOS on failure. This is an attempt to debug #45230.

6 years agoUpdate RLS submodule
Nick Cameron [Fri, 10 Nov 2017 00:56:16 +0000 (13:56 +1300)]
Update RLS submodule

6 years agoAuto merge of #45773 - Badel2:dotdoteq, r=petrochenkov
bors [Fri, 10 Nov 2017 01:40:21 +0000 (01:40 +0000)]
Auto merge of #45773 - Badel2:dotdoteq, r=petrochenkov

Add error for `...` in expressions

Follow-up to https://github.com/rust-lang/rust/pull/44709
Tracking issue: https://github.com/rust-lang/rust/issues/28237

* Using `...` in expressions was a warning, now it's an error
* The error message suggests using `..` or `..=` instead, and explains the difference
* Updated remaining occurrences of `...` to `..=`

r? petrochenkov

6 years agoUpdate rustfmt submodule
Nick Cameron [Fri, 10 Nov 2017 00:30:56 +0000 (13:30 +1300)]
Update rustfmt submodule

6 years agoFix typo in -Zsaturating-float-casts test
Robin Kruppe [Fri, 10 Nov 2017 00:26:22 +0000 (01:26 +0100)]
Fix typo in -Zsaturating-float-casts test

6 years agoAuto merge of #45761 - gnzlbg:xsave_feature, r=alexcrichton
bors [Thu, 9 Nov 2017 23:17:13 +0000 (23:17 +0000)]
Auto merge of #45761 - gnzlbg:xsave_feature, r=alexcrichton

[xsave] whitelist xsave target feature

Required for https://github.com/rust-lang-nursery/stdsimd/issues/171

6 years agoadd a bunch of debug logging to transform::inline
Ariel Ben-Yehuda [Thu, 9 Nov 2017 21:03:03 +0000 (23:03 +0200)]
add a bunch of debug logging to transform::inline

6 years agoRetain information on whether a format argument has explicit position
Tommy Ip [Thu, 9 Nov 2017 17:16:25 +0000 (17:16 +0000)]
Retain information on whether a format argument has explicit position

6 years agoAuto merge of #45757 - mikhail-m1:change-mir-dump-filename, r=nikomatsakis
bors [Thu, 9 Nov 2017 20:46:39 +0000 (20:46 +0000)]
Auto merge of #45757 - mikhail-m1:change-mir-dump-filename, r=nikomatsakis

change MIR dump filenames from `rustc.nodeN...` to `rustc.<DefPath>`

r? @nikomatsakis

6 years agoAuto merge of #45725 - alexcrichton:std-less-rand, r=dtolnay
bors [Thu, 9 Nov 2017 18:14:48 +0000 (18:14 +0000)]
Auto merge of #45725 - alexcrichton:std-less-rand, r=dtolnay

Working towards a libc-less (wasm32) libstd

This is a series of commits I was able to extract from prepare to comiple libstd on a "bare libc-less" target, notably wasm32. The actual wasm32 bits I intend to send in a PR later, this is just some internal refactorings required for libstd to work with a `libc` that's empty and a few other assorted refactorings.

No functional change should be included in this PR for users of libstd, this is intended to just be internal refactorings.

6 years agoadd run-pass tests
Michael Hewson [Thu, 9 Nov 2017 16:42:41 +0000 (11:42 -0500)]
add run-pass tests

6 years agoDon't emit the feature error if it's an invalid self type
Michael Hewson [Thu, 9 Nov 2017 16:03:27 +0000 (11:03 -0500)]
Don't emit the feature error if it's an invalid self type

6 years agostd: Avoid use of `libc` in portable modules
Alex Crichton [Wed, 1 Nov 2017 20:04:03 +0000 (13:04 -0700)]
std: Avoid use of `libc` in portable modules

This commit removes usage of the `libc` crate in "portable" modules like
those at the top level and `sys_common`. Instead common types like `*mut
u8` or `u32` are used instead of `*mut c_void` or `c_int` as well as
switching to platform-specific functions like `sys::strlen` instead of
`libc::strlen`.

6 years agoAuto merge of #45741 - oli-obk:refactor_suggestions, r=estebank
bors [Thu, 9 Nov 2017 15:42:26 +0000 (15:42 +0000)]
Auto merge of #45741 - oli-obk:refactor_suggestions, r=estebank

Refactor internal suggestion API

~~The only functional change is that whitespace, which is suggested to be added, also gets `^^^^` under it. An example is shown in the tests (the only test that changed).~~

Continuation of #41876

r? @nagisa

the changes are probably best viewed [without whitespace](https://github.com/rust-lang/rust/pull/45741/files?w=1)

6 years agoadd a comment explaining the bugfix to infer::region_inference::add_constraint
Michael Hewson [Thu, 9 Nov 2017 14:56:14 +0000 (09:56 -0500)]
add a comment explaining the bugfix to infer::region_inference::add_constraint

6 years agoadd reinit test
Mikhail Modin [Thu, 9 Nov 2017 14:46:35 +0000 (17:46 +0300)]
add reinit test

6 years agoupdate test/ui/static-lifetime.stderr with new error message
Michael Hewson [Thu, 9 Nov 2017 14:21:54 +0000 (09:21 -0500)]
update test/ui/static-lifetime.stderr with new error message

6 years agofixed all the compile-fail error messages
Michael Hewson [Thu, 9 Nov 2017 14:16:55 +0000 (09:16 -0500)]
fixed all the compile-fail error messages
now that we've fixed the bug where constraint origins were getting overwritten, the good error messages are back (with some tweaks)

6 years agofix the bug in region_inference where constraint origins were being overwritten
Michael Hewson [Thu, 9 Nov 2017 13:39:02 +0000 (08:39 -0500)]
fix the bug in region_inference where constraint origins were being overwritten

6 years agoAllow a trailing comma in assert_eq/ne macro
Konrad Borowski [Thu, 9 Nov 2017 11:36:38 +0000 (12:36 +0100)]
Allow a trailing comma in assert_eq/ne macro

6 years agochange separator from `.` to `-`
Mikhail Modin [Sun, 5 Nov 2017 08:14:00 +0000 (11:14 +0300)]
change separator from `.` to `-`

6 years agochange MIR dump filenames from `nodeN` to `DefPath`
Mikhail Modin [Sat, 4 Nov 2017 11:27:08 +0000 (14:27 +0300)]
change MIR dump filenames from `nodeN` to `DefPath`

6 years agoAdd `TerminatorKind::DropAndReplace` handling
Mikhail Modin [Thu, 9 Nov 2017 08:55:23 +0000 (11:55 +0300)]
Add `TerminatorKind::DropAndReplace` handling

6 years agostd: Move the `cmath` module into the `sys` module
Alex Crichton [Wed, 1 Nov 2017 19:59:40 +0000 (12:59 -0700)]
std: Move the `cmath` module into the `sys` module

This commit moves the `f32::cmath` and `f64::cmath` modules into the
`sys` module. Note that these are not publicly exported modules, simply
implementation details. These modules are already platform-specific with
shims on MSVC and this is mostly just a reflection of that reality. This
should also help cut down on `#[cfg]` traffic if platforms are brought on
which don't directly support these functions.

6 years agostd: Change how EBADF is handled in `sys`
Alex Crichton [Wed, 1 Nov 2017 19:50:13 +0000 (12:50 -0700)]
std: Change how EBADF is handled in `sys`

This commit removes the reexport of `EBADF_ERR` as a constant from
libstd's portability facade, instead opting for a platform-specific
function that specifically queries an `io::Error`. Not all platforms may
have a constant for this, so it makes the intent a little more clear
that a code need not be supplied, just an answer to a query.

6 years agostd: Remove `rand` crate and module
Alex Crichton [Wed, 1 Nov 2017 19:32:13 +0000 (12:32 -0700)]
std: Remove `rand` crate and module

This commit removes the `rand` crate from the standard library facade as
well as the `__rand` module in the standard library. Neither of these
were used in any meaningful way in the standard library itself. The only
need for randomness in libstd is to initialize the thread-local keys of
a `HashMap`, and that unconditionally used `OsRng` defined in the
standard library anyway.

The cruft of the `rand` crate and the extra `rand` support in the
standard library makes libstd slightly more difficult to port to new
platforms, namely WebAssembly which doesn't have any randomness at all
(without interfacing with JS). The purpose of this commit is to clarify
and streamline randomness in libstd, focusing on how it's only required
in one location, hashmap seeds.

Note that the `rand` crate out of tree has almost always been a drop-in
replacement for the `rand` crate in-tree, so any usage (accidental or
purposeful) of the crate in-tree should switch to the `rand` crate on
crates.io. This then also has the further benefit of avoiding
duplication (mostly) between the two crates!

6 years agoAuto merge of #45736 - oli-obk:rvalue_promotable_map, r=nikomatsakis
bors [Thu, 9 Nov 2017 04:14:28 +0000 (04:14 +0000)]
Auto merge of #45736 - oli-obk:rvalue_promotable_map, r=nikomatsakis

Use a `Set<T>` instead of a `Map<T, bool>`

r? @nikomatsakis

introduced in #44501

6 years agoAuto merge of #45688 - Gankro:layout-tests, r=alexcrichton
bors [Thu, 9 Nov 2017 00:50:56 +0000 (00:50 +0000)]
Auto merge of #45688 - Gankro:layout-tests, r=alexcrichton

Add reftest that checks the layout of repr(int) on non-c-like enums

This verifies the first layout specified in https://github.com/rust-lang/rfcs/pull/2195

The second (`repr(C)`) layout isn't included here because it doesn't actually exist today. However if/when that's implemented a second test could be fairly easily derived from this one.

CC @eddyb

6 years agoproc_macro: use the proc_macro API at runtime to construct quasi-quoted TokenStream's.
Eduard-Mihai Burtescu [Sun, 5 Nov 2017 18:21:05 +0000 (20:21 +0200)]
proc_macro: use the proc_macro API at runtime to construct quasi-quoted TokenStream's.

6 years agoproc_macro: process proc_macro tokens instead of libsyntax ones in the quasi-quoter.
Eduard-Mihai Burtescu [Sun, 5 Nov 2017 16:25:45 +0000 (18:25 +0200)]
proc_macro: process proc_macro tokens instead of libsyntax ones in the quasi-quoter.

6 years agofix core for targets with max-atomic-width = 0
Jorge Aparicio [Wed, 8 Nov 2017 23:20:55 +0000 (00:20 +0100)]
fix core for targets with max-atomic-width = 0

closes #45802

6 years agoAuto merge of #45867 - michaelwoerister:check-ich-stability, r=nikomatsakis
bors [Wed, 8 Nov 2017 22:27:06 +0000 (22:27 +0000)]
Auto merge of #45867 - michaelwoerister:check-ich-stability, r=nikomatsakis

incr.comp.: Verify stability of incr. comp. hashes and clean up various other things.

The main contribution of this PR is that it adds the `-Z incremental-verify-ich` functionality. Normally, when the red-green tracking system determines that a certain query result has not changed, it does not re-compute the incr. comp. hash (ICH) for that query result because that hash is already known. `-Z incremental-verify-ich` tells the compiler to re-hash the query result and compare the new hash against the cached hash. This is a rather thorough way of
- testing hashing implementation stability,
- finding missing `[input]` annotations on `DepNodes`, and
- finding missing read-edges,

since both a missed read and a missing `[input]` annotation can lead to something being marked as green instead of red and thus will have a different hash than it should have.

Case in point, implementing this verification logic and activating it for all `src/test/incremental` tests has revealed several such oversights, all of which are fixed in this PR.

r? @nikomatsakis

6 years agoget() example should use get() not get_mut()
John Ford [Wed, 8 Nov 2017 21:40:35 +0000 (22:40 +0100)]
get() example should use get() not get_mut()

I'm really new to Rust, this is the first thing I've ever actually pushed to github in a rust project, so please double check that it's correct.  I noticed that the in-doc example for the string's get() function was referring to get_mut().  Looks like a copy/paste issue.

```rust
fn main() {
    let v = String::from("🗻∈🌏");

    assert_eq!(Some("🗻"), v.get(0..4));

    // indices not on UTF-8 sequence boundaries
    assert!(v.get(1..).is_none());
    assert!(v.get(..8).is_none());

    // out of bounds
    assert!(v.get(..42).is_none());
}
```
results in:
```
jhford-work:~/rust/redish $ cat get-example.rs
fn main() {
    let v = String::from("🗻∈🌏");

    assert_eq!(Some("🗻"), v.get(0..4));

    // indices not on UTF-8 sequence boundaries
    assert!(v.get(1..).is_none());
    assert!(v.get(..8).is_none());

    // out of bounds
    assert!(v.get(..42).is_none());
}
jhford-work:~/rust/redish $ rustc get-example.rs
jhford-work:~/rust/redish $ ./get-example ; echo $?
0
```

I did not build an entire rust toolchain as I'm not totally sure how to do that.

6 years agoupdate ui test to new error message
Michael Hewson [Wed, 8 Nov 2017 21:12:34 +0000 (16:12 -0500)]
update ui test to new error message

6 years agofix error message in arbitrary-self-types-not-object-safe test
Michael Hewson [Wed, 8 Nov 2017 21:12:12 +0000 (16:12 -0500)]
fix error message in arbitrary-self-types-not-object-safe test
put the error message on one line so the test suite does not think it is two errors
use a substring of the error message so it fits in 100 chars for tidy

6 years agoshorten line length for tidy
Michael Hewson [Wed, 8 Nov 2017 21:09:58 +0000 (16:09 -0500)]
shorten line length for tidy

6 years agotidy things up a bit
Michael Hewson [Wed, 8 Nov 2017 15:57:57 +0000 (10:57 -0500)]
tidy things up a bit

6 years agoAuto merge of #45452 - estebank:colon-typo, r=nikomatsakis
bors [Wed, 8 Nov 2017 20:00:41 +0000 (20:00 +0000)]
Auto merge of #45452 - estebank:colon-typo, r=nikomatsakis

Detect `=` -> `:` typo in let bindings

When encountering a let binding type error, attempt to parse as
initializer instead. If successful, it is likely just a typo:

```rust
fn main() {
    let x: Vec::with_capacity(10);
}
```

```
error: expected type, found `10`
 --> file.rs:3:31
  |
3 |     let x: Vec::with_capacity(10, 20);
  |         --                    ^^
  |         ||
  |         |help: did you mean assign here?: `=`
  |         while parsing the type for `x`
```

Fix #43703.

6 years agorestore move out dataflow, add report of move out errors
Mikhail Modin [Wed, 8 Nov 2017 15:32:08 +0000 (18:32 +0300)]
restore move out dataflow, add report of move out errors

6 years agoFix help for duplicated names: `extern crate (...) as (...)`
Esteban Küber [Wed, 8 Nov 2017 02:01:35 +0000 (18:01 -0800)]
Fix help for duplicated names: `extern crate (...) as (...)`

On the case of duplicated names caused by an `extern crate` statement
with a rename, don't include the inline suggestion, instead using a span
label with only the text to avoid incorrect rust code output.

6 years agoAdd reftest that checks the layout of repr(int) on non-c-like enums
Alexis Beingessner [Wed, 1 Nov 2017 15:46:17 +0000 (11:46 -0400)]
Add reftest that checks the layout of repr(int) on non-c-like enums

This verifies the layout specified in rfc #2195

6 years agoAuto merge of #45205 - rkruppe:saturating-casts, r=eddyb
bors [Wed, 8 Nov 2017 17:27:56 +0000 (17:27 +0000)]
Auto merge of #45205 - rkruppe:saturating-casts, r=eddyb

Saturating casts between integers and floats

Introduces a new flag, `-Z saturating-float-casts`, which makes code generation for int->float and float->int casts safe (`undef`-free), implementing [the saturating semantics laid out by](https://github.com/rust-lang/rust/issues/10184#issuecomment-299229143) @jorendorff for float->int casts and overflowing to infinity for `u128::MAX` -> `f32`.
Constant evaluation in trans was changed to behave like HIR const eval already did, i.e., saturate for u128->f32 and report an error for problematic float->int casts.

Many thanks to @eddyb, whose APFloat port simplified many parts of this patch, and made HIR constant evaluation recognize dangerous float casts as mentioned above.
Also thanks to @ActuallyaDeviloper whose branchless implementation served as inspiration for this implementation.

cc #10184 #41799
fixes #45134

6 years agoAuto merge of #45866 - JohnColanduoni:issue-45731, r=alexcrichton
bors [Wed, 8 Nov 2017 14:54:03 +0000 (14:54 +0000)]
Auto merge of #45866 - JohnColanduoni:issue-45731, r=alexcrichton

Disable `mmap`  in `libbacktrace` on Apple platforms

Fixes #45731

libbacktrace uses mmap if available to map ranges of the files containing debug information. On macOS `mmap` will succeed even if the mapped range does not exist, and a SIGBUS (with an unusual EXC_BAD_ACCESS code 10) will occur when the program attempts to page in the memory. To combat this we force `libbacktrace` to be built with the simple `read` based fallback on Apple platforms.

6 years agoDisable u128 <-> float tests on emscripten
Robin Kruppe [Wed, 8 Nov 2017 13:54:03 +0000 (14:54 +0100)]
Disable u128 <-> float tests on emscripten

6 years agoincr.comp.: Provide session to some more decoding contexts.
Michael Woerister [Wed, 8 Nov 2017 13:52:00 +0000 (14:52 +0100)]
incr.comp.: Provide session to some more decoding contexts.

6 years agoRemove the error check that I think is redundant, and change the test error messages...
Michael Hewson [Wed, 8 Nov 2017 13:31:08 +0000 (08:31 -0500)]
Remove the error check that I think is redundant, and change the test error messages that I don't understand why they changed, so the tests pass

6 years agoadd a NOTE comment to the object safety test so that it passes
Michael Hewson [Wed, 8 Nov 2017 13:29:47 +0000 (08:29 -0500)]
add a NOTE comment to the object safety test so that it passes

6 years agoSwitch from using At::eq to InferCtxt::can_eq and demand_eqtype_with_origin
Michael Hewson [Wed, 8 Nov 2017 13:28:36 +0000 (08:28 -0500)]
Switch from using At::eq to InferCtxt::can_eq and demand_eqtype_with_origin

I doubt this changes anything, I was just trying to fix an issue with
error messages and ended up doing this along with other things.
Committing it separately so I can undo it easily.

6 years agonormalize associated types in both self_ty and self_arg_ty
Michael Hewson [Wed, 8 Nov 2017 13:24:33 +0000 (08:24 -0500)]
normalize associated types in both self_ty and self_arg_ty

I was only doing it for self_arg_ty, and ended up causing
run-pass/associated-types-projection-from-known-type-in-impl.rs to fail.

6 years agoAdd missing example for Debug trait
Guillaume Gomez [Wed, 8 Nov 2017 13:11:27 +0000 (14:11 +0100)]
Add missing example for Debug trait

6 years agoAuto merge of #45575 - michaelwoerister:tweak-inline-trans-items, r=nikomatsakis
bors [Wed, 8 Nov 2017 12:23:34 +0000 (12:23 +0000)]
Auto merge of #45575 - michaelwoerister:tweak-inline-trans-items, r=nikomatsakis

Only instantiate inline- and const-fns if they are referenced (again).

It seems that we have regressed on not translating `#[inline]` functions unless they are actually used. This should bring back this optimization. I also added a regression test this time so it doesn't happen again accidentally.

Fixes #40392.

r? @alexcrichton

UPDATE & PSA
---------------------
This patch **makes translation very lazy** -- in general this is a good thing (we don't want the compiler to do unnecessary work) but it has two consequences:
1. Some error messages are only generated when an item is actually translated. Consequently, this patch will lead to more cases where the compiler will only start emitting errors when the erroneous function is actually used. This has always been true to some extend (e.g. when passing generic values to an intrinsic) but since this is something user-facing it's worth mentioning.
2. When writing tests, one has to make sure that the functions in question are actually generated. In other words, it must not be dead code. This can usually  be achieved by either
    1. making sure the function is exported from the resulting binary or
    2. by making sure the function is called from something that is exported (or `main()`).

Note that it depends on the crate type what functions are exported:
   1. For rlibs and dylibs everything that is reachable from the outside is exported.
   2. For executables, cdylibs, and staticlibs, items are only exported if they are additionally `#[no_mangle]` or have an `#[export_name]`.

The commits in this PR contain many examples of how tests can be updated to comply to the new requirements.

6 years agoincr.comp.: Remove unused DepKind::WorkProduct.
Michael Woerister [Wed, 8 Nov 2017 10:44:55 +0000 (11:44 +0100)]
incr.comp.: Remove unused DepKind::WorkProduct.

6 years agoincr.comp.: Remove outdated comment about TraitSelect dep-node.
Michael Woerister [Wed, 8 Nov 2017 10:34:09 +0000 (11:34 +0100)]
incr.comp.: Remove outdated comment about TraitSelect dep-node.