Commit Graph

84000 Commits

Author SHA1 Message Date
Matthew Jasper
b210b3168a Make the span of the MIR return place point to the return type 2018-09-19 19:52:55 +01:00
bors
20dc0c5070 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:🧵:{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.
2018-09-19 17:08:28 +00:00
Tom Tromey
e2ff97a14d 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.
2018-09-19 09:46:22 -06:00
Artyom Pavlov
fd7565b076
Added tracking issue, fixed check, 1.30 -> 1.31 2018-09-19 18:40:33 +03:00
Philip Munksgaard
c996c4d316 Add support for running doc test in specific edition 2018-09-19 14:32:09 +02:00
bors
4f3ff5a97b Auto merge of #54101 - osa1:issue_54099, r=nikomatsakis
Fix camel case type warning for types with trailing underscores

Fixes #54099
2018-09-19 09:20:36 +00:00
Felix S. Klock II
c9cf499330 Address following error from rustdoc tests:
error[E0106]: missing lifetime specifier
 --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:11424:23
  |
9 | fn demo(s: &mut S) -> &mut String { let p = &mut *(*s).data; p }
  |                       ^ expected lifetime parameter
  |
  = help: this function's return type contains a borrowed value, but the signature does not say which one of `s`'s 2 lifetimes it is borrowed from
2018-09-19 10:31:42 +02:00
Eduard-Mihai Burtescu
046482e95e rustc: future-proof error reporting for polymorphic constants in types. 2018-09-19 11:07:43 +03:00
bors
1e21c9a297 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
2018-09-19 06:56:19 +00:00
bors
ff6422d7a3 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
2018-09-19 02:37:37 +00:00
bors
8f376771cf Auto merge of #53995 - davidtwco:issue-53807, r=nikomatsakis
NLL: Deduplicate errors for incorrect move in loop

Fixes #53807.

r? @nikomatsakis
2018-09-19 00:01:51 +00:00
Erich Cordoba
3d662639f6 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.
2018-09-18 18:32:29 -05:00
Taylor Cramer
574bca7262 Cleanup Deref impls and add ?Sized bound to &mut T impls 2018-09-18 15:42:51 -07:00
steveklabnik
e3d0d0f5ed Update The Book to latest
Let's check out https://github.com/rust-lang/book/pull/1505 on nightly
2018-09-18 16:52:47 -04:00
memoryruins
73fdc81b39 Use expr's span 2018-09-18 15:35:04 -04:00
Ralf Jung
adcc0d2168 clarify swap 2018-09-18 21:14:31 +02:00
memoryruins
dff1bc1260 Set diagnostic applicability based on array length 2018-09-18 14:41:34 -04:00
James Duley
a3b87058e7 Expand synchronization comments in park/unpark 2018-09-18 18:06:16 +01:00
Michael Woerister
ca197323b9 incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. 2018-09-18 16:33:24 +02:00
Marc-Antoine Perennou
2a45057e17 rustbuild: drop color handling
Let cargo handle that for us

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2018-09-18 15:02:03 +02:00
Rémy Rakic
e90c942477 Update mir-opt test suite 2018-09-18 14:36:37 +02:00
Remy Rakic
75b94e24bf Create a helper function to retrieve the FakeReadClause at a location 2018-09-18 14:36:37 +02:00
Remy Rakic
ae6479c13b Move comments for fake reads where the causes are defined 2018-09-18 14:36:37 +02:00
Remy Rakic
ab236dfc86 Update NLL 3-point error message for fake reads in optimized let patterns 2018-09-18 14:36:37 +02:00
Remy Rakic
f5e310530a Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake read 2018-09-18 14:36:37 +02:00
Remy Rakic
52b5362990 Explain the fake read injection better 2018-09-18 14:34:51 +02:00
Remy Rakic
c3c7a5bafe inject fake read in binding pattern with ascription 2018-09-18 14:34:51 +02:00
Remy Rakic
7216012878 Inject fake read in binding pattern 2018-09-18 14:34:51 +02:00
David Wood
88ca3412e2
Switched from FxHashMap to BTreeMap to preserve ordering when iterating. 2018-09-18 13:55:27 +02:00
David Wood
783bad4295
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.
2018-09-18 13:51:41 +02:00
David Wood
874e08bdd8
Log when buffering a diagnostic.
This is useful in debugging when and where errors are emitted in
logs.
2018-09-18 13:45:24 +02:00
bors
79fcc58b24 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
2018-09-18 11:39:51 +00:00
bors
f004cae536 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
2018-09-18 09:06:42 +00:00
Taylor Cramer
403d12d696 Remove outdated rustdoc PinBox tests 2018-09-18 01:42:27 -07:00
Guillaume Gomez
85d214e7bd
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.
2018-09-18 10:21:44 +02:00
Guillaume Gomez
6a4e7bb968
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?
2018-09-18 10:21:42 +02:00
Guillaume Gomez
50b9694af9
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.
2018-09-18 10:21:41 +02:00
Guillaume Gomez
5f1a123c20
Rollup merge of #54273 - csmoe:lint_ty_lit, r=estebank
Suggest to change numeric literal instead of casting

Closes #54160
r? @estebank
2018-09-18 10:21:40 +02:00
Guillaume Gomez
22d38123ba
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.
2018-09-18 10:21:39 +02:00
Guillaume Gomez
cdd90343b3
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
2018-09-18 10:21:37 +02:00
Guillaume Gomez
108be3cd6b
Rollup merge of #54205 - GuillaumeGomez:treat-err-as-bug, r=QuietMisdreavus
Add treat-err-as-bug flag in rustdoc

cc @nikomatsakis
r? @QuietMisdreavus
2018-09-18 10:21:36 +02:00
Guillaume Gomez
6aed133ebd
Rollup merge of #54097 - GuillaumeGomez:remove-keyword-namespace, r=QuietMisdreavus
rustdoc: Remove namespace for keywords

Fixes #54084.

r? @QuietMisdreavus
2018-09-18 10:21:35 +02:00
Guillaume Gomez
3cdebfb010
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.
2018-09-18 10:21:33 +02:00
ljedrz
a8ec8e5cb7 A few cleanups and minor improvements to rustc/traits 2018-09-18 08:48:39 +02:00
Nicholas Nethercote
154be2c98c 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.
2018-09-18 16:41:27 +10:00
Nicholas Nethercote
687cc292fd 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.
2018-09-18 16:29:55 +10:00
Nicholas Nethercote
c42765a547 Use elem instead of bit consistently for arguments. 2018-09-18 16:29:55 +10:00
bors
36c0ee97b9 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
2018-09-18 06:24:56 +00:00
bors
b80cb47889 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.
2018-09-18 03:52:39 +00:00
Colin Walters
993d02283e 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.
2018-09-17 21:10:36 -04:00