]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agorustc: split off BodyOwnerKind from MirSource.
Eduard-Mihai Burtescu [Fri, 10 Nov 2017 17:20:35 +0000 (19:20 +0200)]
rustc: split off BodyOwnerKind from MirSource.

6 years agorustc: remove unused MirSource::GeneratorDrop.
Eduard-Mihai Burtescu [Fri, 10 Nov 2017 12:23:51 +0000 (14:23 +0200)]
rustc: remove unused MirSource::GeneratorDrop.

6 years agorustc_mir: drive passes directly with a macro.
Eduard-Mihai Burtescu [Fri, 10 Nov 2017 11:58:06 +0000 (13:58 +0200)]
rustc_mir: drive passes directly with a macro.

6 years agorustc: move the MIR pass infrastructure and list to rustc_mir.
Eduard-Mihai Burtescu [Thu, 9 Nov 2017 22:49:51 +0000 (00:49 +0200)]
rustc: move the MIR pass infrastructure and list to rustc_mir.

6 years agoAuto merge of #45909 - sinkuu:issue-45885, r=arielb1
bors [Tue, 14 Nov 2017 02:05:37 +0000 (02:05 +0000)]
Auto merge of #45909 - sinkuu:issue-45885, r=arielb1

Normalize inlined function in MIR inliner

Fixes #45885

r? @arielb1

6 years agoAuto merge of #45436 - zilbuz:issue-44837, r=nikomatsakis
bors [Mon, 13 Nov 2017 23:36:07 +0000 (23:36 +0000)]
Auto merge of #45436 - zilbuz:issue-44837, r=nikomatsakis

MIR-borrowck: add permisson checks to `fn access_lvalue`

WIP : Some FIXME left and some broken tests.

Fix #44837

6 years agoAuto merge of #45903 - nrc:rustfmt-dist, r=alexcrichton
bors [Mon, 13 Nov 2017 21:06:11 +0000 (21:06 +0000)]
Auto merge of #45903 - nrc:rustfmt-dist, r=alexcrichton

Distribute Rustfmt

r? @alexcrichton

6 years agomir-borrowck: Test for `check_access_permissions()`
Basile Desloges [Sat, 21 Oct 2017 19:15:28 +0000 (21:15 +0200)]
mir-borrowck: Test for `check_access_permissions()`

6 years agomir-borrowck: Check access permissions in `access_lvalue()`
Basile Desloges [Sat, 21 Oct 2017 19:15:04 +0000 (21:15 +0200)]
mir-borrowck: Check access permissions in `access_lvalue()`

6 years agomir-borrowck: Move `is_static_mut()` to `ty/utils.rs`
Basile Desloges [Sun, 12 Nov 2017 11:40:56 +0000 (12:40 +0100)]
mir-borrowck: Move `is_static_mut()` to `ty/utils.rs`

6 years agoAuto merge of #45890 - arielb1:self-first, r=eddyb
bors [Mon, 13 Nov 2017 17:42:13 +0000 (17:42 +0000)]
Auto merge of #45890 - arielb1:self-first, r=eddyb

check::method - unify receivers before normalizing method signatures

Normalizing method signatures can unify inference variables, which can
cause receiver unification to fail. Unify the receivers first to avoid
that.

Fixes #36701.
Fixes #45801.
Fixes #45855.

r? @eddyb

beta-nominating because #43880 made this ICE happen in more cases (the code in that issue ICEs post-#43880 only, but the unit test here ICEs on all versions).

6 years agoAuto merge of #45824 - dotdash:stack_pop, r=alexcrichton
bors [Mon, 13 Nov 2017 14:20:15 +0000 (14:20 +0000)]
Auto merge of #45824 - dotdash:stack_pop, r=alexcrichton

Update LLVM to fix miscompiles with -Copt-level=z on Windows

Fixes #45034

6 years agoAuto merge of #45810 - SimonSapin:ac-dc, r=aturon
bors [Mon, 13 Nov 2017 11:46:55 +0000 (11:46 +0000)]
Auto merge of #45810 - SimonSapin:ac-dc, r=aturon

Disable LLVM assertions on Nightly, enable them in "alt" builds.

Per IRC discussion https://mozilla.logbot.info/rust-infra/20171106#c13812170-c13812204

Background: https://internals.rust-lang.org/t/disabling-llvm-assertions-in-nightly-builds/5388/14

6 years agoAuto merge of #45956 - kennytm:rollup, r=kennytm
bors [Mon, 13 Nov 2017 09:13:00 +0000 (09:13 +0000)]
Auto merge of #45956 - kennytm:rollup, r=kennytm

Rollup of 9 pull requests

- Successful merges: #45828, #45892, #45893, #45914, #45917, #45927, #45933, #45952, #45954
- Failed merges:

6 years agoRollup merge of #45954 - udoprog:fix-style, r=kennytm
kennytm [Mon, 13 Nov 2017 09:09:48 +0000 (17:09 +0800)]
Rollup merge of #45954 - udoprog:fix-style, r=kennytm

Fix style in interner test

6 years agoRollup merge of #45952 - zackmdavis:singular_projection, r=estebank
kennytm [Mon, 13 Nov 2017 09:09:47 +0000 (17:09 +0800)]
Rollup merge of #45952 - zackmdavis:singular_projection, r=estebank

deduplicate projection error (E0271) messages

The `ErrorId` variant takes a u16 so that `DiagnosticMessageId` can retain
its `Copy` status (the present author's first choice having been the "EXXX"
code as a string).

The duplicated "type mismatch resolving `{}`" literal is unfortunate, but
the `struct_span_err!` macro (which we want to mark that error code as
used) is fussy about taking a literal, and the one-time-diagnostics set
needs an owned string.

This is concerning #33941 and probably #45805!

r? @estebank

6 years agoRollup merge of #45933 - shanavas786:refactor-filter, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:46 +0000 (17:09 +0800)]
Rollup merge of #45933 - shanavas786:refactor-filter, r=alexcrichton

Refactor Option::filter method

6 years agoRollup merge of #45927 - sinkuu:mir-borrowck-closure, r=estebank
kennytm [Mon, 13 Nov 2017 09:09:45 +0000 (17:09 +0800)]
Rollup merge of #45927 - sinkuu:mir-borrowck-closure, r=estebank

MIR-borrowck: fix diagnostics for closures

Emit notes for captured variables in the same manner as AST borrowck.

```
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
  --> $DIR/borrowck-closures-two-mut.rs:24:24
   |
23 |     let c1 = to_fn_mut(|| x = 4);
   |                        -- - previous borrow occurs due to use of `x` in closure
   |                        |
   |                        first mutable borrow occurs here
24 |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
   |                        ^^ - borrow occurs due to use of `x` in closure
   |                        |
   |                        second mutable borrow occurs here
25 | }
   | - first borrow ends here

error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
  --> $DIR/borrowck-closures-two-mut.rs:24:24
   |
23 |     let c1 = to_fn_mut(|| x = 4);
   |                        -- - previous borrow occurs due to use of `x` in closure
   |                        |
   |                        first mutable borrow occurs here
24 |     let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
   |                        ^^ - borrow occurs due to use of `x` in closure
   |                        |
   |                        second mutable borrow occurs here
25 | }
   | - first borrow ends here
```

Fixes #45362.

6 years agoRollup merge of #45917 - ollie27:compiletest_stamp, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:44 +0000 (17:09 +0800)]
Rollup merge of #45917 - ollie27:compiletest_stamp, r=alexcrichton

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.

6 years agoRollup merge of #45914 - michaelwoerister:fix-test-header-parsing, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:43 +0000 (17:09 +0800)]
Rollup merge of #45914 - michaelwoerister:fix-test-header-parsing, r=alexcrichton

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.

6 years agoRollup merge of #45893 - redox-os:futex_timeout, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:42 +0000 (17:09 +0800)]
Rollup merge of #45893 - redox-os:futex_timeout, r=alexcrichton

Redox: Use futex timeout to implement CondVar::wait_timeout

`CondVar::wait_timeout` is implemented by supplying a `TimeSpec` pointer to `futex`. In addition, all calls to `unimplemented!()` have been removed from the Redox `sys` module.

Related to https://github.com/rust-lang/rust/pull/45892

6 years agoRollup merge of #45892 - redox-os:is_absolute_fix, r=alexcrichton
kennytm [Mon, 13 Nov 2017 09:09:41 +0000 (17:09 +0800)]
Rollup merge of #45892 - redox-os:is_absolute_fix, r=alexcrichton

Redox: Return true from Path::is_absolute if a Path contains root or a scheme

In Redox, different subsystems have different filesystem paths. However, the majority of applications using the `Path::is_absolute` function really only want to know if a path is absolute from the perspective of the scheme it is currently running in, usually `file:`. This makes both `file:/` and `/` return `true` from `Path::is_absolute`, meaning that most code does not have to check if it is running on Redox.

Code that wants to know if a path contains a scheme can implement such a check on its own.

Related to https://github.com/rust-lang/rust/pull/45893

6 years agoRollup merge of #45828 - pornel:printoption, r=nrc
kennytm [Mon, 13 Nov 2017 09:09:40 +0000 (17:09 +0800)]
Rollup merge of #45828 - pornel:printoption, r=nrc

Remove deprecated message

Follow up of #43067

6 years agoFix style in interner test
John-John Tedro [Mon, 13 Nov 2017 06:55:20 +0000 (07:55 +0100)]
Fix style in interner test

6 years agoAuto merge of #45673 - GuillaumeGomez:rustdoc-type-search-generic, r=QuietMisdreavus
bors [Mon, 13 Nov 2017 06:54:24 +0000 (06:54 +0000)]
Auto merge of #45673 - GuillaumeGomez:rustdoc-type-search-generic, r=QuietMisdreavus

Search over generic types in docs

This is what I was talking about @QuietMisdreavus. Now we have generics.

Waiting for #45617 to get merged.

6 years agodeduplicate projection error (E0271) messages
Zack M. Davis [Mon, 13 Nov 2017 03:13:07 +0000 (19:13 -0800)]
deduplicate projection error (E0271) messages

The `ErrorId` variant takes a u16 so that `DiagnosticMessageId` can retain
its `Copy` status (the present author's first choice having been the "EXXX"
code as a string).

The duplicated "type mismatch resolving `{}`" literal is unfortunate, but
the `struct_span_err!` macro (which we want to mark that error code as
used) is fussy about taking a literal, and the one-time-diagnostics set
needs an owned string.

This is concerning #33941 and probably #45805!

6 years agoFix comments
Shotaro Yamada [Mon, 13 Nov 2017 03:21:05 +0000 (12:21 +0900)]
Fix comments

6 years agoAuto merge of #45949 - Mark-Simulacrum:cargo-next, r=alexcrichton
bors [Mon, 13 Nov 2017 01:53:12 +0000 (01:53 +0000)]
Auto merge of #45949 - Mark-Simulacrum:cargo-next, r=alexcrichton

Bump cargo to master

Includes a few bugfixes, and updates the Cargo book.

Critically includes https://github.com/rust-lang/cargo/pull/4716. This
unblocks (in theory) crater runs.

6 years agoAuto merge of #45623 - mneumann:dragonfly-ci, r=alexcrichton
bors [Sun, 12 Nov 2017 23:31:58 +0000 (23:31 +0000)]
Auto merge of #45623 - mneumann:dragonfly-ci, r=alexcrichton

Add ci for DragonFly

6 years agoBump cargo to master.
Mark Simulacrum [Sun, 12 Nov 2017 23:21:00 +0000 (16:21 -0700)]
Bump cargo to master.

Includes a few bugfixes, and updates the Cargo book.

Critically includes https://github.com/rust-lang/cargo/pull/4716. This
unblocks (in theory) crater runs.

6 years agoreview changes
Nick Cameron [Sun, 12 Nov 2017 21:46:46 +0000 (10:46 +1300)]
review changes

6 years agoDistribute Rustfmt
Nick Cameron [Fri, 10 Nov 2017 02:09:39 +0000 (15:09 +1300)]
Distribute Rustfmt

6 years agoAuto merge of #44167 - cengizIO:master, r=nikomatsakis
bors [Sun, 12 Nov 2017 21:04:41 +0000 (21:04 +0000)]
Auto merge of #44167 - cengizIO:master, r=nikomatsakis

Improve SubSupConflict with a named and an anonymous lifetime parameter #42701

Hello!

This fixes #42701.

## UPDATE 01
Tests are producing different results between different env builds.
This inconsistency might take a long time to investigate and fix. So, be patient

## UPDATE 02
Changed an `FxHashMap` with a `BTreeMap`. Inconsistency seems to be resolved for now.

6 years agoAdd "As parameters" items as well
Guillaume Gomez [Sun, 12 Nov 2017 12:19:15 +0000 (13:19 +0100)]
Add "As parameters" items as well

6 years agoImprove result output
Guillaume Gomez [Sat, 11 Nov 2017 22:53:37 +0000 (23:53 +0100)]
Improve result output

6 years agoBig JS optimization
Guillaume Gomez [Sat, 11 Nov 2017 22:24:04 +0000 (23:24 +0100)]
Big JS optimization

6 years agoAdd elements count in tab search title
Guillaume Gomez [Thu, 2 Nov 2017 00:01:51 +0000 (01:01 +0100)]
Add elements count in tab search title

6 years agoJS big updates
Guillaume Gomez [Wed, 1 Nov 2017 16:38:37 +0000 (17:38 +0100)]
JS big updates

6 years agoGenerate generics on search-index
Guillaume Gomez [Tue, 31 Oct 2017 19:44:31 +0000 (20:44 +0100)]
Generate generics on search-index

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 agoAdd ci for DragonFly (disabled for now)
Michael Neumann [Sun, 29 Oct 2017 21:07:13 +0000 (22:07 +0100)]
Add ci for DragonFly (disabled for now)

6 years agoupdate project-fn-test-invariant test
Cengiz Can [Sun, 12 Nov 2017 17:58:05 +0000 (17:58 +0000)]
update project-fn-test-invariant test

6 years agoremove trailing whitespace from comment block
Cengiz Can [Wed, 8 Nov 2017 20:25:25 +0000 (23:25 +0300)]
remove trailing whitespace from comment block

6 years agoadd reasons of using BTreeMap to a comment
Cengiz Can [Wed, 8 Nov 2017 20:11:24 +0000 (23:11 +0300)]
add reasons of using BTreeMap to a comment

6 years agoupdate failing E0621 tests
Cengiz Can [Wed, 8 Nov 2017 13:35:05 +0000 (13:35 +0000)]
update failing E0621 tests

6 years agouse BTreeMap for region constraints
Cengiz Can [Tue, 7 Nov 2017 21:29:28 +0000 (21:29 +0000)]
use BTreeMap for region constraints

6 years agoUpdate fn-ret-invariant test assertion
Cengiz Can [Mon, 6 Nov 2017 18:07:48 +0000 (18:07 +0000)]
Update fn-ret-invariant test assertion

6 years agoImprove SubSupConflict case with one named, one anonymous lifetime parameter #42701
Cengiz Can [Mon, 28 Aug 2017 23:01:53 +0000 (02:01 +0300)]
Improve SubSupConflict case with one named, one anonymous lifetime parameter #42701

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 agoUpdate LLVM to fix miscompiles with -Copt-level=z on Windows
Björn Steinbrink [Tue, 7 Nov 2017 08:55:55 +0000 (09:55 +0100)]
Update LLVM to fix miscompiles with -Copt-level=z on Windows

Fixes #45034

6 years agoDo not silence output in run-make/sanitizer-memory
Simon Sapin [Sun, 12 Nov 2017 13:56:45 +0000 (14:56 +0100)]
Do not silence output in run-make/sanitizer-memory

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 agoMIR-borrowck: fix diagnostics for closures
Shotaro Yamada [Sat, 11 Nov 2017 09:15:26 +0000 (18:15 +0900)]
MIR-borrowck: fix diagnostics for closures

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 agoMake the try branch use alternate builds.
Simon Sapin [Tue, 7 Nov 2017 06:31:06 +0000 (07:31 +0100)]
Make the try branch use alternate builds.

6 years agoDisable LLVM assertions on Nightly, enable them in "alt" builds.
Simon Sapin [Mon, 6 Nov 2017 17:57:51 +0000 (18:57 +0100)]
Disable LLVM assertions on Nightly, enable them in "alt" builds.

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 agoRefactor Option::filter method
Shanavas M [Sat, 11 Nov 2017 14:01:55 +0000 (17:01 +0300)]
Refactor Option::filter method

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 agocompiletest: Fix a couple of test re-run issues
Oliver Middleton [Fri, 10 Nov 2017 18:17:03 +0000 (18:17 +0000)]
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.

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 agoFix test case header parsing code in presence of multiple revisions.
Michael Woerister [Fri, 10 Nov 2017 16:26:10 +0000 (17:26 +0100)]
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.

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 agoNormalize inlined function in MIR inliner
Shotaro Yamada [Fri, 10 Nov 2017 11:31:51 +0000 (20:31 +0900)]
Normalize inlined function in MIR inliner

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