Commit Graph

69676 Commits

Author SHA1 Message Date
bors
19e63bd50e 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
2017-11-12 09:46:00 +00:00
bors
b087dedf3f 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.
2017-11-12 07:31:08 +00:00
bors
c1aacdcb30 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
2017-11-12 05:08:09 +00:00
Shotaro Yamada
d3e9881ed1 MIR-borrowck: fix diagnostics for closures 2017-11-12 11:27:21 +09:00
bors
e9f8542014 Auto merge of #45848 - nrc:rls-bugs-4, r=eddyb
save-analysis: two fixes + rustfmt

Fix two regressions and run rustfmt.

r? @eddyb
2017-11-12 01:58:12 +00:00
Simon Sapin
8b8bdb63a4 Make the try branch use alternate builds. 2017-11-11 23:31:41 +01:00
Simon Sapin
325a769a21 Disable LLVM assertions on Nightly, enable them in "alt" builds. 2017-11-11 23:31:37 +01:00
bors
45caff88d1 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.
2017-11-11 20:41:36 +00:00
Jeroen Bollen
0fb37fc67d Improvided map_entry_replace examples
The current examples should be more realistic.
2017-11-11 19:45:32 +01:00
bors
24bb4d1e75 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)
```
2017-11-11 18:17:14 +00:00
bors
b22679366a 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
2017-11-11 15:49:36 +00:00
Jeroen Bollen
0f8ee171b2 Changed tabs back into spaces to fix formatting. 2017-11-11 16:23:16 +01:00
Jeroen Bollen
0df7f00a04 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.
2017-11-11 16:23:16 +01:00
Alkis Evlogimenos
2ca111b6b9 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)
```
2017-11-11 16:00:26 +01:00
Shanavas M
abff092f90 Refactor Option::filter method 2017-11-11 17:32:29 +03:00
bors
965ace59f2 Auto merge of #45932 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 4 pull requests

- Successful merges: #45631, #45812, #45877, #45919
- Failed merges:
2017-11-11 13:30:16 +00:00
Vadim Petrochenkov
f7b4b88840 Always report patterns more complex than mut IDENT as errors 2017-11-11 15:45:40 +03:00
Vadim Petrochenkov
1055bdfb2a Accept interpolated patterns in trait method parameters
Remove some outdated messages from "no patterns allowed" errors
2017-11-11 15:44:19 +03:00
Guillaume Gomez
04785f7e33 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.
2017-11-11 13:38:08 +01:00
Guillaume Gomez
5d07d73ffb 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
2017-11-11 13:38:07 +01:00
Guillaume Gomez
fec24adea8 Rollup merge of #45812 - GuillaumeGomez:links-and-search, r=QuietMisdreavus
Fix navbar click while in a search

Fixes #45790.
2017-11-11 13:38:06 +01:00
Guillaume Gomez
cb71247861 Rollup merge of #45631 - GuillaumeGomez:file-ext-docs, r=frewsxcv
Add missing links and examples for FileExt

r? @rust-lang/docs
2017-11-11 13:38:05 +01:00
Guillaume Gomez
c09adc4f1c Add missing links and examples for FileExt 2017-11-11 13:36:42 +01:00
bors
69ee5a8a97 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.
2017-11-11 09:56:22 +00:00
bors
bd7ce71aab Auto merge of #45807 - tommyip:format_err, r=estebank
Make positional argument error in format! clearer

r? @estebank

Fixes #44954
2017-11-11 07:33:31 +00:00
bors
c703ff275f 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
2017-11-11 02:11:34 +00:00
Guillaume Gomez
0d898998b1 Few improvements on search, history and title 2017-11-11 00:44:36 +01:00
Ramana Venkata
fbb7df0f82 Fix MIR borrowck EndRegion not found
Updated tests

Fixes #45702
2017-11-11 04:40:23 +05:30
bors
25cc4a86c0 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.
2017-11-10 21:42:09 +00:00
Lukas H
6443873821
Fix broken link markup in Hasher::finish docs
There were apostrophes when there needed to be backticks.
2017-11-10 20:58:03 +01:00
bors
a35a3abcda 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
2017-11-10 19:10:12 +00:00
Guillaume Gomez
72338b8ccb Allow to go back to previous search 2017-11-10 19:40:46 +01:00
Oliver Middleton
ec15924a06 compiletest: Fix a couple of test re-run issues
* Re-run rustdoc tests if rustdoc or htmldocck.py was updated.
* Put stamp files in the correct subdirectories to avoid clashes when
the file names match but the subdirectory doesn't.
2017-11-10 18:17:03 +00:00
Michael Woerister
67d2b1b7fd incr.comp.: Don't crash in DepGraph::try_mark_green() when encountering a removed input node. 2017-11-10 17:50:15 +01:00
bors
75d25acd97 Auto merge of #45804 - gnzlbg:div_intr, r=alexcrichton
[intrinsics] add missing div and rem vector intrinsics
2017-11-10 16:42:49 +00:00
Michael Woerister
6a9fa50f4a Fix test case header parsing code in presence of multiple revisions.
The previous code would parse the TestProps, and then parse them
again with a revision set, adding some elements (like aux_builds)
a second time to the existing TestProps.
2017-11-10 17:26:10 +01:00
bors
563dc5171f 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
2017-11-10 14:10:07 +00:00
sinkuu
114252410d Separately eliminate self-assignments 2017-11-10 21:02:43 +09:00
sinkuu
ae5553d7b0 Fix MIR CopyPropagation errneously propagating assignments to function arguments 2017-11-10 21:02:43 +09:00
Shotaro Yamada
3c96c3012d Normalize inlined function in MIR inliner 2017-11-10 20:54:58 +09:00
bors
968b6206cb Auto merge of #45785 - arielb1:unsafe-fixes, r=eddyb
fixes to MIR effectck

r? @eddyb

beta-nominating because regression (MIR effectck is new)
2017-11-10 11:37:32 +00:00
Alex Crichton
f6cc9ee7ad 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
2017-11-10 01:39:07 -08:00
Robin Kruppe
59524410a7 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
2017-11-10 10:12:30 +01:00
bors
c0d326f06d 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:
2017-11-10 09:08:15 +00:00
kennytm
6a9931c3fb Rollup merge of #45901 - rkruppe:fix-typo, r=kennytm
Fix typo in -Zsaturating-float-casts test
2017-11-10 17:07:12 +08:00
kennytm
9c76885909 Rollup merge of #45895 - arielb1:inline-debug, r=eddyb
add a bunch of debug logging to MIR inlining

r? @eddyb

@bors rollup
2017-11-10 17:07:11 +08:00
kennytm
253d18e3f9 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
2017-11-10 17:07:10 +08:00
kennytm
20e11db8f7 Rollup merge of #45882 - japaric:gh45802, r=kennytm
fix core for targets with max-atomic-width = 0

closes #45802

cc @kennytm
2017-11-10 17:07:09 +08:00
kennytm
e26bcbe4d4 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.
2017-11-10 17:07:08 +08:00
kennytm
91cdb0f9bd Rollup merge of #45869 - GuillaumeGomez:debug-doc, r=frewsxcv
Add missing example for Debug trait

r? @rust-lang/docs
2017-11-10 17:07:07 +08:00