Commit Graph

83689 Commits

Author SHA1 Message Date
bors
3bc2ca7e4f Auto merge of #53162 - QuietMisdreavus:crouching-impl-hidden-trait, r=GuillaumeGomez
rustdoc: collect trait impls as an early pass

Fixes https://github.com/rust-lang/rust/issues/52545, fixes https://github.com/rust-lang/rust/issues/41480, fixes https://github.com/rust-lang/rust/issues/36922

Right now, rustdoc pulls all its impl information by scanning a crate's HIR for any items it finds. However, it doesn't recurse into anything other than modules, preventing it from seeing trait impls that may be inside things like functions or consts. Thanks to https://github.com/rust-lang/rust/pull/53002, now these items actually *exist* for rustdoc to see, but they still weren't getting collected for display.

But there was a secret. Whenever we pull in an item from another crate, we don't have any of its impls in the local HIR, so instead we ask the compiler for *everything* and filter out after the fact. This process is only triggered if there's a cross-crate re-export in the crate being documented, which can sometimes leave this info out of the docs. This PR instead moves this collection into an early pass, which occurs immediately after crate cleaning, so that that collection occurs regardless. In addition, by including the HIR's own `trait_impls` in addition to the existing `all_trait_implementations` calls, we can collect all these tricky trait impls without having to scan for them!
2018-09-20 14:32:26 +00:00
QuietMisdreavus
1106577116 fix intra-links for trait impls 2018-09-20 05:54:31 -05:00
QuietMisdreavus
755c02dbd4 filter collected trait impls against items in the crate 2018-09-20 05:54:30 -05:00
QuietMisdreavus
354507e61f shuffle ownership of external_traits
constraints:

- clean/inline.rs needs this map to fill in traits when inlining
- fold.rs needs this map to allow passes to fold trait items
- html/render.rs needs this map to seed the Cache.traits map of all
  known traits

The first two are the real problem, since `DocFolder` only operates on
`clean::Crate` but `clean/inline.rs` only sees the `DocContext`. The
introduction of early passes means that these two now exist at the same
time, so they need to share ownership of the map. Even better, the use
of `Crate` in a rustc thread pool means that it needs to be Sync, so it
can't use `Lrc<Lock>` to manually activate thread-safety.

`parking_lot` is reused from elsewhere in the tree to allow use of its
`ReentrantMutex`, as the relevant parts of rustdoc are still
single-threaded and this allows for easier use in that context.
2018-09-20 05:54:26 -05:00
QuietMisdreavus
c754e8240c refactor: move access_levels into RenderInfo 2018-09-20 05:42:38 -05:00
QuietMisdreavus
87760e5f5e collect auto-/blanket-impls during collect-trait-impls 2018-09-20 05:42:37 -05:00
QuietMisdreavus
e854d39929 don't index trait impls if the trait isn't also documented 2018-09-20 05:42:36 -05:00
QuietMisdreavus
7e70fee0c7 add more tests for traits-in-non-module-scope 2018-09-20 05:42:35 -05:00
QuietMisdreavus
e79780f18f don't check visibility when inlining local impls
those get handled properly in strip-hidden anyway
2018-09-20 05:42:33 -05:00
QuietMisdreavus
a45d38744c swap external_traits into the crate before running strip_hidden 2018-09-20 05:42:32 -05:00
QuietMisdreavus
de6a89783c pull impl generics from HIR if available 2018-09-20 05:42:31 -05:00
QuietMisdreavus
fe26efe748 collect impl items from the HIR if available 2018-09-20 05:42:30 -05:00
QuietMisdreavus
978c13aa02 pull local types from the HIR instead of tcx 2018-09-20 05:42:29 -05:00
QuietMisdreavus
bfd2b34454 handle local names when registering FQNs 2018-09-20 05:42:28 -05:00
QuietMisdreavus
a893117f38 add a bunch of debug prints 2018-09-20 05:42:27 -05:00
QuietMisdreavus
50fa16f5b5 undo some tweaks to build_impl 2018-09-20 05:42:26 -05:00
QuietMisdreavus
804a1a6fa9 don't record an external trait if it's not external 2018-09-20 05:42:25 -05:00
QuietMisdreavus
6aa74939bf only move access_levels/external_traits after early passes 2018-09-20 05:42:24 -05:00
QuietMisdreavus
457efc111a ignore rustdoc/doc-proc-macro on stage1 2018-09-20 05:42:22 -05:00
QuietMisdreavus
5e0f9be670 print local inlined consts via the HIR map 2018-09-20 05:42:21 -05:00
QuietMisdreavus
02bea3c581 rustdoc: collect trait impls as an early pass 2018-09-20 05:42:20 -05:00
bors
f7f4c500b4 Auto merge of #54255 - spastorino:use-of-moved-value-error, r=nikomatsakis
Inspect parents paths when checking for moves

Closes #52669
2018-09-20 09:02:46 +00:00
bors
992d1e4d3d 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
2018-09-20 06:34:22 +00:00
bors
d16f27f89a 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.
2018-09-20 02:51:56 +00:00
Alex Crichton
b1305c22e3 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.
2018-09-19 18:17:58 -07:00
bors
1d33aedaa9 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.
2018-09-20 00:16:46 +00: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
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
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
Taylor Cramer
574bca7262 Cleanup Deref impls and add ?Sized bound to &mut T impls 2018-09-18 15:42:51 -07:00
James Duley
a3b87058e7 Expand synchronization comments in park/unpark 2018-09-18 18:06:16 +01: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
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