]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #54362 - tromey:travis-gdb-batch-mode, r=nikomatsakis
kennytm [Thu, 20 Sep 2018 13:36:35 +0000 (21:36 +0800)]
Rollup merge of #54362 - tromey:travis-gdb-batch-mode, r=nikomatsakis

Pass --batch to gdb

In one of my travis builds, I was surprised to find that the gdb
pager was in use and caused travis to time out.  Adding `--batch`
to the gdb invocation will disable the pager.  Note that the
`-ex q` is retained, to make sure gdb exits with status 0, just in
case `set -e` is in effect somehow.

5 years agoRollup merge of #54346 - eddyb:constant-horror, r=nikomatsakis
kennytm [Thu, 20 Sep 2018 13:36:34 +0000 (21:36 +0800)]
Rollup merge of #54346 - eddyb:constant-horror, r=nikomatsakis

rustc: future-proof error reporting for polymorphic constants in types.

Currently, we have 3 categories of positions where a constant can be used (`const` and associated `const` can be considered "aliases" for an expression):
* runtime - if the function is polymorphic, we could even just warn and emit a panic
* `static` - always monomorphic, so we can error at definition site
* type-system - **must** *enforce* evaluation success where it was written

That last one is the tricky one, because we can't easily turn *the presence* a type with an erroring const into a runtime panic, and we'd have to do post-monomorphization errors (which we'd rather avoid).

<hr/>

The solution we came up with, as part of the plans for const generics, is to require successful evaluation wherever a constant shows up in a type (currently in array lengths, and values for const parameters in the future), *through* the WF system, which means that in certain situations (e.g. function signatures) we can assume evaluation *will* succeed, and require it of users (e.g. callers) instead (we've been doing this for lifetime bounds, for a long time now, and it's pretty ergonomic).

So once we do sth about #43408, this example *should* work, by propagating the responsability, to callers of `foo::<X>`, of proving `std::mem::size_of::<X>()` succeeds (and those callers can do the same).
```rust
pub fn foo<T>(_: [u8; std::mem::size_of::<T>()]) {}
```
But this one *shouldn't*, as there is nothing in the signature/bounds to indicate it:
```rust
pub fn bar<T>() {
    let _: [u8; std::mem::size_of::<T>()];
}
```

<hr/>

I've come across some bit of code in the compiler that ignores const-evaluation errors *even when* they come from a constant in a type, and I've added an ICE *only when* there are no other reported errors (e.g. it's fine to ignore evaluation errors if the constant doesn't even type-check).

r? @nikomatsakis cc @oli-obk @RalfJung @Centril

5 years agoRollup merge of #54337 - ericho:remove_clone_tests, r=Mark-Simulacrum
kennytm [Thu, 20 Sep 2018 13:36:32 +0000 (21:36 +0800)]
Rollup merge of #54337 - ericho:remove_clone_tests, r=Mark-Simulacrum

Remove unneeded clone() from tests in librustdoc

The expected.clone() calls were not needed for the tests. This is
just to keep consistency between the test cases.

5 years agoRollup merge of #54333 - steveklabnik:update-book, r=frewsxcv
kennytm [Thu, 20 Sep 2018 13:36:31 +0000 (21:36 +0800)]
Rollup merge of #54333 - steveklabnik:update-book, r=frewsxcv

Update The Book to latest

Let's check out https://github.com/rust-lang/book/pull/1505 on nightly.

5 years agoRollup merge of #54298 - RalfJung:miri-field-align, r=eddyb
kennytm [Thu, 20 Sep 2018 13:36:29 +0000 (21:36 +0800)]
Rollup merge of #54298 - RalfJung:miri-field-align, r=eddyb

miri: correctly compute expected alignment for field

This is the miri version of https://github.com/rust-lang/rust/pull/53998. A test is added by https://github.com/solson/miri/pull/457.

r? @eddyb

5 years agoRollup merge of #54295 - ljedrz:cleanups_rustc_traits, r=nikomatsakis
kennytm [Thu, 20 Sep 2018 13:36:27 +0000 (21:36 +0800)]
Rollup merge of #54295 - ljedrz:cleanups_rustc_traits, r=nikomatsakis

A few cleanups and minor improvements to rustc/traits

It's a little bigger than usual, so bear with me ^^:

- introduce `TyCtxt::all_impls` and use it to avoid inefficiently allocating push loops
- modify `ArgKind::from_expected_ty` to take an `Option<Span>` argument to make it more versatile
- replace `ArgKind::Arg("_".to_owned(), "_".to_owned())` with `ArgKind::empty`
- move early `return`s earlier where possible
- if all branches of a `match` end with the same expression, move it after it
- change a hacky `match` expression to an `if else` chain
- move the `push` out from a push loop closure to reduce the number of allocations
- correct the vector size for `pretty_predicates` (under `specialize`)
- take advantage of the fact that `if else` is an expression
- prefer `cloned()` to `map(|&x| x)` and `map(|x| *x)`
- prefer `vec![x; y.len()]` to `y.map(|_| x).collect()`
- use `unwrap_or_else` instead of `match` where applicable
- use `if let` instead of `match` when only one branch matters
- prefer `to_owned` to `to_string` for string literals
- remove explicit `return`s
- remove superfluous braces
- whitespace fixes
- several other minor improvements

5 years agoRollup merge of #54292 - memoryruins:issue-53712, r=estebank
kennytm [Thu, 20 Sep 2018 13:36:26 +0000 (21:36 +0800)]
Rollup merge of #54292 - memoryruins:issue-53712, r=estebank

Suggest array indexing when tuple indexing on an array

Closes #53712

r? @varkor
cc @estebank

5 years agoRollup merge of #54290 - michaelwoerister:aarch64-back-to-msvc, r=alexcrichton
kennytm [Thu, 20 Sep 2018 13:36:25 +0000 (21:36 +0800)]
Rollup merge of #54290 - michaelwoerister:aarch64-back-to-msvc, r=alexcrichton

Switch linker for aarch64-pc-windows-msvc from LLD to MSVC

The MSVC linker does not seem to have the same problems with Rust symbols that LLD currently has on Windows (see https://github.com/rust-lang/rust/issues/54190#issuecomment-421288625). This PR makes MSVC the default linker for `aarch64-pc-windows-msvc`.

r? @alexcrichton

5 years agoRollup merge of #54266 - LionNatsu:master, r=nikomatsakis
kennytm [Thu, 20 Sep 2018 13:36:23 +0000 (21:36 +0800)]
Rollup merge of #54266 - LionNatsu:master, r=nikomatsakis

Update LLVM to fix "bool" arguments on PPC32

Fixes #50960.

5 years agoRollup merge of #54258 - alexcrichton:lld-fatal-warnings, r=eddyb
kennytm [Thu, 20 Sep 2018 13:36:22 +0000 (21:36 +0800)]
Rollup merge of #54258 - alexcrichton:lld-fatal-warnings, r=eddyb

Enable fatal warnings for the wasm32 linker

Historically LLD has emitted warnings for various reasons but all the bugs have
since been fixed (yay!) and by enabling fatal warnings we should be able to head
off bugs like #53390 sooner.

5 years agoRollup merge of #54257 - alexcrichton:wasm-math-symbols, r=TimNN
kennytm [Thu, 20 Sep 2018 13:36:21 +0000 (21:36 +0800)]
Rollup merge of #54257 - alexcrichton:wasm-math-symbols, r=TimNN

Switch wasm math symbols to their original names

The names `Math_*` were given to help undefined symbol messages indicate how to
implement them, but these are all implemented in compiler-rt now so there's no
need to rename them! This change should make it so wasm binaries by default, no
matter the math symbols used, will not have unresolved symbols.

5 years agoRollup merge of #54233 - irinagpopa:llvm-3.9, r=tromey
kennytm [Thu, 20 Sep 2018 13:36:19 +0000 (21:36 +0800)]
Rollup merge of #54233 - irinagpopa:llvm-3.9, r=tromey

Remove LLVM 3.9 workaround.

5 years agoRollup merge of #53470 - bjorn3:warn_metadata_errors, r=alexcrichton
kennytm [Thu, 20 Sep 2018 13:36:18 +0000 (21:36 +0800)]
Rollup merge of #53470 - bjorn3:warn_metadata_errors, r=alexcrichton

Warn about metadata loader errors

Output when writing corrupting to libcore.rlib

```
warning: no metadata found: failed to read rlib metadata in '/Users/bjorn/Documents/rust_fork/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps/libcore-857d662d379c5d0c.rlib': File too small to be an archive

error[E0463]: can't find crate for `core`

error: aborting due to previous error
```

Fixes #53381

5 years agoRollup merge of #52813 - newpavlov:duration_mul_div_extras, r=alexcrichton
kennytm [Thu, 20 Sep 2018 13:36:16 +0000 (21:36 +0800)]
Rollup merge of #52813 - newpavlov:duration_mul_div_extras, r=alexcrichton

Duration div mul extras

Successor of #52556.

This PR adds the following `impl`s:
- `impl Mul<Duration> for u32` (to allow `10*SECOND` in addition to `SECOND*10`)
- `impl Mul<f64> for Duration` (to allow `2.5*SECOND` vs `2*SECOND + 500*MILLISECOND`)
- `impl Mul<Duration> for f64`
- `impl MulAssign<f64> for Duration`
- `impl Div<f64> for Duration`
- `impl DivAssign<f64> for Duration`
- `impl Div<Duration> for Duration` (`Output = f64`, can be useful e.g. for `duration/MINUTE`)

`f64` is chosen over `f32` to minimize rounding errors. (52 bits fraction precision vs `Duration`'s ~94 bit)

5 years agoAuto merge of #54255 - spastorino:use-of-moved-value-error, r=nikomatsakis
bors [Thu, 20 Sep 2018 09:02:46 +0000 (09:02 +0000)]
Auto merge of #54255 - spastorino:use-of-moved-value-error, r=nikomatsakis

Inspect parents paths when checking for moves

Closes #52669

5 years agoAuto merge of #54241 - vi:suggest_with_applicability, r=estebank
bors [Thu, 20 Sep 2018 06:34:22 +0000 (06:34 +0000)]
Auto merge of #54241 - vi:suggest_with_applicability, r=estebank

Remove usages of span_suggestion without Applicability

Use `Applicability::Unspecified` for all of them instead.

Shall deprecations for the non-`_with_applicability` functions be added?

Shall clippy be addressed somehow?

r? @estebank

5 years agoAuto merge of #54301 - alexcrichton:update-curl, r=Mark-Simulacrum
bors [Thu, 20 Sep 2018 02:51:56 +0000 (02:51 +0000)]
Auto merge of #54301 - alexcrichton:update-curl, r=Mark-Simulacrum

Update some `*-sys` dependencies of Cargo/RLS

This is intended to help solve #54206 on nightly where the RLS on MinGW is
having build issues with accidentally building a `curl` library which links to
pthread symbols on Windows (where it should use native mutex locking instead).
The build system for these `*-sys` crates have all been rewritten to be based on
`cc` to bypass native build systems and platform detection to make sure we
configure them correctly.

5 years agoUpdate some `*-sys` dependencies of Cargo/RLS
Alex Crichton [Mon, 17 Sep 2018 16:52:02 +0000 (09:52 -0700)]
Update some `*-sys` dependencies of Cargo/RLS

This is intended to help solve #54206 on nightly where the RLS on MinGW is
having build issues with accidentally building a `curl` library which links to
pthread symbols on Windows (where it should use native mutex locking instead).
The build system for these `*-sys` crates have all been rewritten to be based on
`cc` to bypass native build systems and platform detection to make sure we
configure them correctly.

5 years agoAuto merge of #54211 - nnethercote:keccak-Liveness-memory, r=nikomatsakis
bors [Thu, 20 Sep 2018 00:16:46 +0000 (00:16 +0000)]
Auto merge of #54211 - nnethercote:keccak-Liveness-memory, r=nikomatsakis

Split `Liveness::users` into three.

This reduces memory usage on some benchmarks because no space is wasted
for padding. For a `check-clean` build of `keccak` it reduces `max-rss`
by 20%.

r? @nikomatsakis, but I want to do a perf run. Locally, I had these results:
- instructions: slight regression
- max-rss: big win on "Clean" builds
- faults: big win on "Clean" and "Nll" builds
- wall-time: small win on "Clean" and "Nll" builds

So I want to see how a different machine compares.

5 years agoAuto merge of #54174 - parched:park, r=alexcrichton
bors [Wed, 19 Sep 2018 17:08:28 +0000 (17:08 +0000)]
Auto merge of #54174 - parched:park, r=alexcrichton

Fix `thread` `park`/`unpark` synchronization

Previously the code below would not be guaranteed to exit when the
second unpark took the `return, // already unparked` path because there
was no write to synchronize with a read in `park`.

EDIT: doesn't actually require third thread
```
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread::{current, spawn, park};

static FLAG: AtomicBool = AtomicBool::new(false);

fn main() {
    let thread_0 = current();
    spawn(move || {
        thread_0.unpark();
        FLAG.store(true, Ordering::Relaxed);
        thread_0.unpark();
    });

    while !FLAG.load(Ordering::Relaxed) {
        park();
    }
}
```

I have some other ideas on how to improve the performance of `park` and `unpark` using fences, avoiding any atomic RMW when the state is already `NOTIFIED`, and also how to avoid calling `notify_one` without the mutex locked. But I need to write some micro benchmarks first, so I'll submit those changes at a later date if they prove to be faster.

Fixes https://github.com/rust-lang/rust/issues/53366 I hope.

5 years agoPass --batch to gdb
Tom Tromey [Wed, 19 Sep 2018 15:46:22 +0000 (09:46 -0600)]
Pass --batch to gdb

In one of my travis builds, I was surprised to find that the gdb
pager was in use and caused travis to time out.  Adding `--batch`
to the gdb invocation will disable the pager.  Note that the
`-ex q` is retained, to make sure gdb exits with status 0, just in
case `set -e` is in effect somehow.

5 years agoAdded tracking issue, fixed check, 1.30 -> 1.31
Artyom Pavlov [Wed, 19 Sep 2018 15:40:33 +0000 (18:40 +0300)]
Added tracking issue, fixed check, 1.30 -> 1.31

5 years agoAuto merge of #54101 - osa1:issue_54099, r=nikomatsakis
bors [Wed, 19 Sep 2018 09:20:36 +0000 (09:20 +0000)]
Auto merge of #54101 - osa1:issue_54099, r=nikomatsakis

Fix camel case type warning for types with trailing underscores

Fixes #54099

5 years agorustc: future-proof error reporting for polymorphic constants in types.
Eduard-Mihai Burtescu [Wed, 19 Sep 2018 08:07:43 +0000 (11:07 +0300)]
rustc: future-proof error reporting for polymorphic constants in types.

5 years agoAuto merge of #53877 - withoutboats:compositional-pin, r=aturon
bors [Wed, 19 Sep 2018 06:56:19 +0000 (06:56 +0000)]
Auto merge of #53877 - withoutboats:compositional-pin, r=aturon

Update to a new pinning API.

~~Blocked on #53843 because of method resolution problems with new pin type.~~

@r? @cramertj

cc @RalfJung @pythonesque anyone interested in #49150

5 years agoAuto merge of #54318 - nnethercote:use-HybridBitSet-in-SparseBitMatrix, r=pnkfelix
bors [Wed, 19 Sep 2018 02:37:37 +0000 (02:37 +0000)]
Auto merge of #54318 - nnethercote:use-HybridBitSet-in-SparseBitMatrix, r=pnkfelix

Use `HybridBitSet` in `SparseBitMatrix`.

This fixes most of the remaining NLL memory regression.

r? @pnkfelix, because you reviewed #54286.
cc @nikomatsakis, because NLL
cc @Mark-Simulacrum, because this removes `array_vec.rs`
cc @lqd, because this massively improves `unic-ucd-name`, and probably other public crates

5 years agoAuto merge of #53995 - davidtwco:issue-53807, r=nikomatsakis
bors [Wed, 19 Sep 2018 00:01:51 +0000 (00:01 +0000)]
Auto merge of #53995 - davidtwco:issue-53807, r=nikomatsakis

NLL: Deduplicate errors for incorrect move in loop

Fixes #53807.

r? @nikomatsakis

5 years agoRemove unneeded clone() from tests
Erich Cordoba [Tue, 18 Sep 2018 23:32:29 +0000 (18:32 -0500)]
Remove unneeded clone() from tests

The expected.clone() calls were not needed for the tests. This is
just to keep consistency between the test cases.

5 years agoCleanup Deref impls and add ?Sized bound to &mut T impls
Taylor Cramer [Tue, 18 Sep 2018 18:48:03 +0000 (11:48 -0700)]
Cleanup Deref impls and add ?Sized bound to &mut T impls

5 years agoUpdate The Book to latest
steveklabnik [Tue, 18 Sep 2018 20:52:47 +0000 (16:52 -0400)]
Update The Book to latest

Let's check out https://github.com/rust-lang/book/pull/1505 on nightly

5 years agoUse expr's span
memoryruins [Tue, 18 Sep 2018 19:35:04 +0000 (15:35 -0400)]
Use expr's span

5 years agoSet diagnostic applicability based on array length
memoryruins [Tue, 18 Sep 2018 18:41:34 +0000 (14:41 -0400)]
Set diagnostic applicability based on array length

5 years agoExpand synchronization comments in `park`/`unpark`
James Duley [Tue, 18 Sep 2018 16:51:49 +0000 (17:51 +0100)]
Expand synchronization comments in `park`/`unpark`

5 years agoSwitched from FxHashMap to BTreeMap to preserve ordering when iterating.
David Wood [Tue, 11 Sep 2018 14:01:53 +0000 (16:01 +0200)]
Switched from FxHashMap to BTreeMap to preserve ordering when iterating.

5 years agoDe-duplicate moved variable errors.
David Wood [Thu, 6 Sep 2018 13:48:33 +0000 (15:48 +0200)]
De-duplicate moved variable errors.

By introducing a new map that tracks the errors reported and the
`Place`s that spawned those errors against the move out that the error
was referring to, we are able to silence duplicate errors by emitting
only the error which corresponds to the most specific `Place` (that which
other `Place`s which reported errors are prefixes of).

This generally is an improvement, however there is a case -
`liveness-move-in-while` - where the output regresses.

5 years agoLog when buffering a diagnostic.
David Wood [Thu, 6 Sep 2018 11:07:14 +0000 (13:07 +0200)]
Log when buffering a diagnostic.

This is useful in debugging when and where errors are emitted in
logs.

5 years agoAuto merge of #54034 - pnkfelix:issue-15287-bind-by-move-pattern-guards, r=nikomatsakis
bors [Tue, 18 Sep 2018 11:39:51 +0000 (11:39 +0000)]
Auto merge of #54034 - pnkfelix:issue-15287-bind-by-move-pattern-guards, r=nikomatsakis

Add feature to enable bind by move pattern guards

Implement #15287 as described on https://github.com/rust-lang/rust/issues/15287#issuecomment-404827419

5 years agoAuto merge of #54319 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 18 Sep 2018 09:06:42 +0000 (09:06 +0000)]
Auto merge of #54319 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 9 pull requests

Successful merges:

 - #53522 (Add doc for impl From for Addr)
 - #54097 (rustdoc: Remove namespace for keywords)
 - #54205 (Add treat-err-as-bug flag in rustdoc)
 - #54225 (Regression test for rust-lang/rust#53675.)
 - #54232 (add `-Z dont-buffer-diagnostics`)
 - #54273 (Suggest to change numeric literal instead of casting)
 - #54299 (Issue 54246)
 - #54311 (Remove README with now-out-of-date docs about docs.)
 - #54313 (OsStr: Document that it's not NUL terminated)

Failed merges:

r? @ghost

5 years agoRemove outdated rustdoc PinBox tests
Taylor Cramer [Tue, 18 Sep 2018 08:42:27 +0000 (01:42 -0700)]
Remove outdated rustdoc PinBox tests

5 years agoRollup merge of #54313 - cgwalters:osstr-ref-cstr, r=joshtriplett
Guillaume Gomez [Tue, 18 Sep 2018 08:21:44 +0000 (10:21 +0200)]
Rollup merge of #54313 - cgwalters:osstr-ref-cstr, r=joshtriplett

OsStr: Document that it's not NUL terminated

I somehow got confused into thinking this was the case, but
it's definitely not.  Let's help the common case of people who
have an `OsStr` and need to call e.g. Unix APIs.

5 years agoRollup merge of #54311 - frewsxcv:frewsxcv-readme, r=GuillaumeGomez
Guillaume Gomez [Tue, 18 Sep 2018 08:21:42 +0000 (10:21 +0200)]
Rollup merge of #54311 - frewsxcv:frewsxcv-readme, r=GuillaumeGomez

Remove README with now-out-of-date docs about docs.

These docs haven't really been touched in years, and from what I tried, the `rustdoc` commands don't work. Seems like we don't need this?

5 years agoRollup merge of #54299 - snaedis:issue-54246, r=varkor
Guillaume Gomez [Tue, 18 Sep 2018 08:21:41 +0000 (10:21 +0200)]
Rollup merge of #54299 - snaedis:issue-54246, r=varkor

Issue 54246

I added the option of providing a help message for deprecated features, that takes precedence over the default `help: remove this attribute` message, along with messages for the features that mention replacements in the reason for deprecation.

Fixes #54246.

5 years agoRollup merge of #54273 - csmoe:lint_ty_lit, r=estebank
Guillaume Gomez [Tue, 18 Sep 2018 08:21:40 +0000 (10:21 +0200)]
Rollup merge of #54273 - csmoe:lint_ty_lit, r=estebank

Suggest to change numeric literal instead of casting

Closes #54160
r? @estebank

5 years agoRollup merge of #54232 - pnkfelix:add-way-to-disable-diagnostic-buffering, r=nikomatsakis
Guillaume Gomez [Tue, 18 Sep 2018 08:21:39 +0000 (10:21 +0200)]
Rollup merge of #54232 - pnkfelix:add-way-to-disable-diagnostic-buffering, r=nikomatsakis

add `-Z dont-buffer-diagnostics`

Add `-Z dont-buffer-diagnostics`, a way to force NLL to immediately its diagnostics.

This is mainly intended for developers who want to see the error in its original context in the control flow. Two uses cases for that are:

  1. `-Z treat-err-as-bug` (which then allows extraction of a stack-trace to the origin of the error)

  2. RUST_LOG=... rustc, in which case it is often useful to see the logging statements that occurred immediately prior to the point where the diagnostic was signalled.

5 years agoRollup merge of #54225 - pnkfelix:issue-53675-add-test-called-panic, r=petrochenkov
Guillaume Gomez [Tue, 18 Sep 2018 08:21:37 +0000 (10:21 +0200)]
Rollup merge of #54225 - pnkfelix:issue-53675-add-test-called-panic, r=petrochenkov

Regression test for rust-lang/rust#53675.

(Includes a couple variations on the theme. I confirmed that the ones
in `in_expression_position` and `what_if_we_use_panic_directly_in_expr`
both failed back on "rustc 1.30.0-nightly (0f063aef6 2018-09-03)".)

Fix #53675

5 years agoRollup merge of #54205 - GuillaumeGomez:treat-err-as-bug, r=QuietMisdreavus
Guillaume Gomez [Tue, 18 Sep 2018 08:21:36 +0000 (10:21 +0200)]
Rollup merge of #54205 - GuillaumeGomez:treat-err-as-bug, r=QuietMisdreavus

Add treat-err-as-bug flag in rustdoc

cc @nikomatsakis
r? @QuietMisdreavus

5 years agoRollup merge of #54097 - GuillaumeGomez:remove-keyword-namespace, r=QuietMisdreavus
Guillaume Gomez [Tue, 18 Sep 2018 08:21:35 +0000 (10:21 +0200)]
Rollup merge of #54097 - GuillaumeGomez:remove-keyword-namespace, r=QuietMisdreavus

rustdoc: Remove namespace for keywords

Fixes #54084.

r? @QuietMisdreavus

5 years agoRollup merge of #53522 - phungleson:fix-impl-from-for-addr, r=TimNN
Guillaume Gomez [Tue, 18 Sep 2018 08:21:33 +0000 (10:21 +0200)]
Rollup merge of #53522 - phungleson:fix-impl-from-for-addr, r=TimNN

Add doc for impl From for Addr

As part of issue #51430 (cc @skade).

The impl is very simple, let me know if we need to go into any details.

Additionally, I added `#[inline]` for the conversion method, let me know if it is un-necessary or might break something.

5 years agoA few cleanups and minor improvements to rustc/traits
ljedrz [Wed, 12 Sep 2018 14:57:19 +0000 (16:57 +0200)]
A few cleanups and minor improvements to rustc/traits

5 years agoUse `HybridBitSet` for rows within `SparseBitMatrix`.
Nicholas Nethercote [Tue, 18 Sep 2018 04:21:41 +0000 (14:21 +1000)]
Use `HybridBitSet` for rows within `SparseBitMatrix`.

This requires adding a few extra methods to `HybridBitSet`. (These are
tested in a new unit test.)

This commit reduces the `max-rss` for `nll-check` builds of `html5ever`
by 46%, `ucd` by 45%, `clap-rs` by 23%, `inflate` by 14%. And the
results for the `unic-ucd-name` crate are even more impressive: a 21%
reduction in instructions, a 60% reduction in wall-time, a 96%
reduction in `max-rss`, and a 97% reduction in faults!

Fixes #52028.

5 years agoRemove `array_vec.rs`.
Nicholas Nethercote [Tue, 18 Sep 2018 03:51:20 +0000 (13:51 +1000)]
Remove `array_vec.rs`.

`SparseBitSet` is the only remaining user of `ArrayVec`. This commit
switches it to using `SmallVec`, and removes `array_vec.rs`.

Why the switch? Although `SparseBitSet` is size-limited and doesn't need
the ability to spill to the heap, `SmallVec` has many more features than
`ArrayVec`. In particular, it's now possible to keep `SparseBitSet`'s
elements in sorted order, which gives in-order iteration, which is a
requirement for the next commit.

5 years agoUse `elem` instead of `bit` consistently for arguments.
Nicholas Nethercote [Tue, 18 Sep 2018 03:40:19 +0000 (13:40 +1000)]
Use `elem` instead of `bit` consistently for arguments.

5 years agoAuto merge of #53900 - davidtwco:issue-53771, r=nikomatsakis
bors [Tue, 18 Sep 2018 06:24:56 +0000 (06:24 +0000)]
Auto merge of #53900 - davidtwco:issue-53771, r=nikomatsakis

NLL regresses diagnostic for impl-trait/static-return-lifetime-infered.rs

Fixes #53771.

r? @nikomatsakis
cc @pnkfelix @estebank

5 years agoAuto merge of #54286 - nnethercote:BitSet, r=pnkfelix
bors [Tue, 18 Sep 2018 03:52:39 +0000 (03:52 +0000)]
Auto merge of #54286 - nnethercote:BitSet, r=pnkfelix

Merge `bitvec.rs` and `indexed_set.rs`

Because it's not good to have two separate implementations. Also, I will combine the best parts of each to improve NLL memory usage on some benchmarks significantly.

5 years agoOsStr: Document that it's not NUL terminated
Colin Walters [Tue, 18 Sep 2018 01:10:36 +0000 (21:10 -0400)]
OsStr: Document that it's not NUL terminated

I somehow got confused into thinking this was the case, but
it's definitely not.  Let's help the common case of people who
have an `OsStr` and need to call e.g. Unix APIs.

5 years agoRemove REAMDE with now-out-of-date docs about docs.
Corey Farwell [Tue, 18 Sep 2018 00:11:29 +0000 (20:11 -0400)]
Remove REAMDE with now-out-of-date docs about docs.

5 years agoCleanup and fix method resolution issue
Taylor Cramer [Sat, 15 Sep 2018 00:40:52 +0000 (17:40 -0700)]
Cleanup and fix method resolution issue

5 years agoAuto merge of #52036 - collin5:b50509-2, r=collin5
bors [Mon, 17 Sep 2018 21:15:12 +0000 (21:15 +0000)]
Auto merge of #52036 - collin5:b50509-2, r=collin5

Clean up dependency tracking in Rustbuild [2/2]

Make `clear_if_dirty` calls in `Builder::cargo` with stamp dependencies for the given Mode.

Continuation of #50904
Ref issue #50509
r? @Mark-Simulacrum

5 years agoSome "word"-related improvements.
Nicholas Nethercote [Mon, 17 Sep 2018 04:39:59 +0000 (14:39 +1000)]
Some "word"-related improvements.

- Rename `BitSet::data` and `BitMatrix::vector` as `words`, because that's
  what they are.

- Remove `BitSet::words_mut()`, which is no longer necessary.

- Better distinguish multiple meanins of "word", i.e. "word index" vs
  "word ref" vs "word" (i.e. the value itself).

5 years agoEliminate `BitwiseOperator`.
Nicholas Nethercote [Mon, 17 Sep 2018 03:52:35 +0000 (13:52 +1000)]
Eliminate `BitwiseOperator`.

`BitwiseOperator` is an unnecessarily low-level thing. This commit
replaces it with `BitSetOperator`, which works on `BitSet`s instead of
words. Within `bit_set.rs`, the commit eliminates `Intersect`, `Union`,
and `Subtract` by instead passing a function to `bitwise()`.

5 years agoMerge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.
Nicholas Nethercote [Fri, 14 Sep 2018 05:07:25 +0000 (15:07 +1000)]
Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.

Currently we have two files implementing bitsets (and 2D bit matrices).
This commit combines them into one, taking the best features from each.

This involves renaming a lot of things. The high level changes are as
follows.
- bitvec.rs              --> bit_set.rs
- indexed_set.rs         --> (removed)
- BitArray + IdxSet      --> BitSet (merged, see below)
- BitVector              --> GrowableBitSet
- {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet
- BitMatrix              --> BitMatrix
- SparseBitMatrix        --> SparseBitMatrix

The changes within the bitset types themselves are as follows.

```
OLD             OLD             NEW
BitArray<C>     IdxSet<T>       BitSet<T>
--------        ------          ------
grow            -               grow
new             -               (remove)
new_empty       new_empty       new_empty
new_filled      new_filled      new_filled
-               to_hybrid       to_hybrid
clear           clear           clear
set_up_to       set_up_to       set_up_to
clear_above     -               clear_above
count           -               count
contains(T)     contains(&T)    contains(T)
contains_all    -               superset
is_empty        -               is_empty
insert(T)       add(&T)         insert(T)
insert_all      -               insert_all()
remove(T)       remove(&T)      remove(T)
words           words           words
words_mut       words_mut       words_mut
-               overwrite       overwrite
merge           union           union
-               subtract        subtract
-               intersect       intersect
iter            iter            iter
```

In general, when choosing names I went with:
- names that are more obvious (e.g. `BitSet` over `IdxSet`).
- names that are more like the Rust libraries (e.g. `T` over `C`,
  `insert` over `add`);
- names that are more set-like (e.g. `union` over `merge`, `superset`
  over `contains_all`, `domain_size` over `num_bits`).

Also, using `T` for index arguments seems more sensible than `&T` --
even though the latter is standard in Rust collection types -- because
indices are always copyable. It also results in fewer `&` and `*`
sigils in practice.

5 years agoAuto merge of #54277 - petrochenkov:afterder, r=alexcrichton
bors [Mon, 17 Sep 2018 18:13:26 +0000 (18:13 +0000)]
Auto merge of #54277 - petrochenkov:afterder, r=alexcrichton

Temporarily prohibit proc macro attributes placed after derives

... and also proc macro attributes used together with `#[test]`/`#[bench]`.

Addresses item 6 from https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393.

The end goal is straightforward predictable left-to-right expansion order for attributes.
Right now derives are expanded last regardless of their relative ordering with macro attributes and right now it's simpler to temporarily prohibit macro attributes placed after derives than changing the expansion order.
I'm not sure whether the new beta is already released or not, but if it's released, then this patch needs to be backported, so the solution needs to be minimal.

How to fix broken code (derives):
- Move macro attributes above derives. This won't change expansion order, they are expanded before derives anyway.

Using attribute macros on same items with `#[test]` and `#[bench]` is prohibited for similar expansion order reasons, but this one is going to be reverted much sooner than restrictions on derives.

How to fix broken code (test/bench):
- Enable `#![feature(plugin)]` (don't ask why).

r? @ghost

5 years agoWhitespace fix again.
Vitaly _Vi Shukela [Mon, 17 Sep 2018 17:13:08 +0000 (20:13 +0300)]
Whitespace fix again.

5 years agoInspect parents paths when checking for moves
Santiago Pastorino [Sat, 15 Sep 2018 15:29:29 +0000 (12:29 -0300)]
Inspect parents paths when checking for moves

5 years agolibsyntax: add optional help message for deprecated features
Alva Snædís [Mon, 17 Sep 2018 03:40:31 +0000 (03:40 +0000)]
libsyntax: add optional help message for deprecated features

5 years agomiri: correctly compute expected alignment for field
Ralf Jung [Mon, 17 Sep 2018 16:05:17 +0000 (18:05 +0200)]
miri: correctly compute expected alignment for field

5 years agoAuto merge of #54293 - flip1995:clippyup, r=Manishearth
bors [Mon, 17 Sep 2018 15:39:00 +0000 (15:39 +0000)]
Auto merge of #54293 - flip1995:clippyup, r=Manishearth

Update Clippy

Fix Clippy test-fail due to #53910

r? @Manishearth @SimonSapin

5 years agoUpdate Clippy
flip1995 [Mon, 17 Sep 2018 13:37:19 +0000 (15:37 +0200)]
Update Clippy

5 years agoBetter trick for allowing trailing comma at forward!
Vitaly _Vi Shukela [Mon, 17 Sep 2018 13:33:37 +0000 (16:33 +0300)]
Better trick for allowing trailing comma at forward!

5 years agoSuggest array indexing when tuple indexing on an array.
memoryruins [Mon, 17 Sep 2018 13:09:45 +0000 (09:09 -0400)]
Suggest array indexing when tuple indexing on an array.

5 years agoSwitch linker for aarch64-pc-windows-msvc from LLD to MSVC, since that seems to work...
Michael Woerister [Mon, 17 Sep 2018 12:41:09 +0000 (14:41 +0200)]
Switch linker for aarch64-pc-windows-msvc from LLD to MSVC, since that seems to work better.

5 years agoAdd -Z dont-buffer-diagnostics, a way to force NLL to immediately emit its diagnostics.
Felix S. Klock II [Sat, 15 Sep 2018 04:27:55 +0000 (06:27 +0200)]
Add -Z dont-buffer-diagnostics, a way to force NLL to immediately emit its diagnostics.

This is mainly intended for `rustc` developers who want to see a
diagnostic in its original context in the control flow.  Two uses
cases for that are:

 * `-Z treat-err-as-bug` which then allows extraction of a stack-trace to the origin of the error
   (a case that is so important that we make that flag imply this one, effectively).

 * `RUST_LOG=... rustc`, in which case it is often useful to see the logging statements that
   occurred immediately prior to the point where the diagnostic was signalled.

Drive-by: Added some documentation pointing future devs at
HandlerFlags, and documented the fields of `HandlerFlags` itself.

5 years agolibsyntax: fix casing in error message
Alva Snædís [Mon, 17 Sep 2018 03:38:15 +0000 (03:38 +0000)]
libsyntax: fix casing in error message

5 years agoOn nightly with NLL, suggest `#![feature(bind_by_move_pattern_guards)]` when it might...
Felix S. Klock II [Mon, 10 Sep 2018 09:47:28 +0000 (11:47 +0200)]
On nightly with NLL, suggest `#![feature(bind_by_move_pattern_guards)]` when it might fix the code.

5 years agoTests for `feature(bind_by_move_pattern_guards)`.
Felix S. Klock II [Fri, 7 Sep 2018 15:52:49 +0000 (17:52 +0200)]
Tests for `feature(bind_by_move_pattern_guards)`.

Apparently copyright notices are no longer necessary apparently.
(See #43498 and #53654.)

5 years agoAdd `feature(bind_by_move_pattern_guards)`.
Felix S. Klock II [Fri, 7 Sep 2018 15:52:27 +0000 (17:52 +0200)]
Add `feature(bind_by_move_pattern_guards)`.

Note it requires MIR-borrowck to be enabled to actually do anything.

Note also that it implicitly turns off our AST-based check for
mutation in guards.

5 years agorefactor Builder::cargo, clean deps for cmd!=test
Collins Abitekaniza [Mon, 17 Sep 2018 11:19:44 +0000 (14:19 +0300)]
refactor Builder::cargo, clean deps for cmd!=test

5 years agoFixed some remaining whitespace issues.
Vitaly _Vi Shukela [Mon, 17 Sep 2018 09:52:08 +0000 (12:52 +0300)]
Fixed some remaining whitespace issues.

(Not sure if it is correct although).

5 years agoAuto merge of #54249 - RalfJung:miri, r=eddyb
bors [Mon, 17 Sep 2018 08:59:11 +0000 (08:59 +0000)]
Auto merge of #54249 - RalfJung:miri, r=eddyb

Update miri

5 years agoupdate miri
Ralf Jung [Mon, 17 Sep 2018 07:20:03 +0000 (09:20 +0200)]
update miri

5 years agoAuto merge of #54260 - maxdeviant:public-scope-fields, r=petrochenkov
bors [Mon, 17 Sep 2018 06:34:29 +0000 (06:34 +0000)]
Auto merge of #54260 - maxdeviant:public-scope-fields, r=petrochenkov

Make rustc::middle::region::Scope's fields public

This PR makes the following changes to `rustc::middle::region::Scope`:

- [x] Makes `region::Scope`'s fields public
- [x] Removes the `impl Scope` block with constructors (as per [this comment](https://github.com/rust-lang/rust/pull/54032#discussion_r216618208))
- [x] Updates call sites throughout the compiler

Closes #54122.

5 years agoadd test for float/integer
csmoe [Mon, 17 Sep 2018 01:29:57 +0000 (09:29 +0800)]
add test for float/integer

5 years agomerge into/literal suggestion for DRY
csmoe [Mon, 17 Sep 2018 01:24:33 +0000 (09:24 +0800)]
merge into/literal suggestion for DRY

5 years agoAuto merge of #54254 - RalfJung:miri-dangling, r=eddyb
bors [Mon, 17 Sep 2018 03:58:41 +0000 (03:58 +0000)]
Auto merge of #54254 - RalfJung:miri-dangling, r=eddyb

miri engine: keep around some information for dead allocations

We use it to test if a dangling ptr is aligned and non-NULL. This makes some code pass that should pass (writing a ZST to a properly aligned dangling pointer), and makes some code fail that should fail (writing a ZST to a pointer obtained via pointer arithmetic from a real location, but ouf-of-bounds -- that pointer could be NULL, so we cannot allow writing to it).

CTFE does not allow these operations; tests are added to miri with https://github.com/solson/miri/pull/453.

5 years agoAuto merge of #54247 - Munksgaard:better-error-message-in-no_lookup_host_duplicates...
bors [Mon, 17 Sep 2018 01:36:58 +0000 (01:36 +0000)]
Auto merge of #54247 - Munksgaard:better-error-message-in-no_lookup_host_duplicates, r=alexcrichton

Improve output if no_lookup_host_duplicates test fails

If the test fails, output the offending addresses and a helpful error message.
Also slightly improve legibility of the preceding line that puts the addresses
into a HashMap.

5 years agoFill in suggestions Applicability according to @estebank
Vitaly _Vi Shukela [Mon, 17 Sep 2018 00:16:08 +0000 (03:16 +0300)]
Fill in suggestions Applicability according to @estebank

Also fix some formatting along the way.

5 years agoFix tidy's too long lines.
Vitaly _Vi Shukela [Sun, 16 Sep 2018 23:51:50 +0000 (02:51 +0300)]
Fix tidy's too long lines.

5 years agoChange diagnostic_builder's forward! macro to enforce trailing argument comma
Vitaly _Vi Shukela [Sun, 16 Sep 2018 23:50:00 +0000 (02:50 +0300)]
Change diagnostic_builder's forward! macro to enforce trailing argument comma

5 years agoFix style according to review comments.
Vitaly _Vi Shukela [Sun, 16 Sep 2018 23:40:44 +0000 (02:40 +0300)]
Fix style according to review comments.

5 years agoAuto merge of #53910 - IsaacWoods:unify_cvoid, r=SimonSapin
bors [Sun, 16 Sep 2018 23:13:30 +0000 (23:13 +0000)]
Auto merge of #53910 - IsaacWoods:unify_cvoid, r=SimonSapin

Move std::os::raw::c_void into libcore and re-export in libstd

Implements the first part of [RFC 2521](https://github.com/rust-lang/rfcs/pull/2521).

cc #53856

5 years agoAuto merge of #53461 - petrochenkov:pmu, r=alexcrichton
bors [Sun, 16 Sep 2018 20:28:21 +0000 (20:28 +0000)]
Auto merge of #53461 - petrochenkov:pmu, r=alexcrichton

resolve: Do not error on access to proc macros imported with `#[macro_use]`

This error is artificial, but previously, when `#[macro_use] extern crate x;` was stable, but non-derive proc macros were not, it worked like kind of a feature gate. Now both features are stable, so the error is no longer necessary.

This PR simplifies how `#[macro_use] extern crate x;` works - it takes all items from macro namespace of `x`'s root and puts them into macro prelude from which they all can now be accessed.

5 years agoFixup inaccurate rebase
Vitaly _Vi Shukela [Sun, 16 Sep 2018 19:13:41 +0000 (22:13 +0300)]
Fixup inaccurate rebase

5 years agotrailing whitespace fix
Vitaly _Vi Shukela [Sat, 15 Sep 2018 13:12:17 +0000 (16:12 +0300)]
trailing whitespace fix

5 years agoDeprecate *_suggestion* that are without explicit applicability
Vitaly _Vi Shukela [Sat, 15 Sep 2018 11:58:25 +0000 (14:58 +0300)]
Deprecate *_suggestion* that are without explicit applicability

5 years agoAttach Applicability to multipart_suggestion and span_suggestions
Vitaly _Vi Shukela [Sat, 15 Sep 2018 12:03:02 +0000 (15:03 +0300)]
Attach Applicability to multipart_suggestion and span_suggestions

5 years agoAdd multipart_suggestion_with_applicability
Vitaly _Vi Shukela [Sat, 15 Sep 2018 11:44:28 +0000 (14:44 +0300)]
Add multipart_suggestion_with_applicability

5 years agoRemove usages of span_suggestion without Applicability
Vitaly _Vi Shukela [Sat, 15 Sep 2018 00:18:29 +0000 (03:18 +0300)]
Remove usages of span_suggestion without Applicability

Use Applicability::Unspecified for all of them instead.

5 years agoresolve: Do not error on access to proc macros imported with `#[macro_use]`
Vadim Petrochenkov [Fri, 17 Aug 2018 23:04:50 +0000 (02:04 +0300)]
resolve: Do not error on access to proc macros imported with `#[macro_use]`

5 years agoAuto merge of #53804 - RalfJung:ptr-invalid, r=nagisa
bors [Sun, 16 Sep 2018 18:03:39 +0000 (18:03 +0000)]
Auto merge of #53804 - RalfJung:ptr-invalid, r=nagisa

fix some uses of pointer intrinsics with invalid pointers

[Found by miri](https://github.com/solson/miri/pull/446):

* `Vec::into_iter` calls `ptr::read` (and the underlying `copy_nonoverlapping`) with an unaligned pointer to a ZST. [According to LLVM devs](https://bugs.llvm.org/show_bug.cgi?id=38583), this is UB because it contradicts the metadata we are attaching to that pointer.
* `HashMap` creation calls `ptr:.write_bytes` on a NULL pointer with a count of 0. This is likely not currently UB *currently*, but it violates the rules we are setting in https://github.com/rust-lang/rust/pull/53783, and we might want to exploit those rules later (e.g. with more `nonnull` attributes for LLVM).

    Probably what `HashMap` really should do is use `NonNull::dangling()` instead of 0 for the empty case, but that would require a more careful analysis of the code.

It seems like ideally, we should do a review of usage of such intrinsics all over libstd to ensure that they use valid pointers even when the size is 0. Is it worth opening an issue for that?

5 years agoTemporarily prohibit proc macro attributes placed after derives
Vadim Petrochenkov [Sun, 16 Sep 2018 14:15:07 +0000 (17:15 +0300)]
Temporarily prohibit proc macro attributes placed after derives

... and also proc macro attributes used together with test/bench.