Commit Graph

5315 Commits

Author SHA1 Message Date
Tomasz Miąsko 5db17335a1 rustdoc: forward -Z options to rustc
Currently rustdoc does not forward `-Z` options to rustc when building
test executables. This makes impossible to use rustdoc to run test
samples when crate under test is instrumented with one of sanitizers
`-Zsanitizer=...`, since the final linking step will not include
sanitizer runtime library.

Forward `-Z` options to rustc to solve the issue.

Helps with #43031.
2019-10-11 22:29:11 +02:00
Guillaume Gomez 169a1cac8d Don't pass doctest feature by default 2019-10-10 11:37:13 +02:00
Jon Gjengset 45aca119a6
Stabilize mem::take (mem_take)
Tracking issue: https://github.com/rust-lang/rust/issues/61129
2019-10-08 18:04:18 -04:00
Josh Stone 33c4125fbe Rebase rustc-rayon on rayon-1.2
See also https://github.com/rust-lang/rustc-rayon/pull/3
2019-10-07 13:20:17 -07:00
Tyler Mandry c071083732
Rollup merge of #65155 - Avi-D-coder:fix-lints, r=Mark-Simulacrum
Use shorthand initialization in rustdoc

This just fixes a few lints I rust-analyzer was showing. Is this sort of PR useful? Should the lints be fixed as apart of the otherwise unrelated PR I was working on?
2019-10-06 11:41:59 -07:00
Stefan Lankes c1e440a90f redesign of the interface to the unikernel HermitCore
- the old interface between HermitCore and the Rust Standard Library
  based on a small C library (newlib)
- remove this interface and call directly the unikernel
- remove the dependency to the HermitCore linker
- use rust-lld as linker
2019-10-06 15:26:14 +00:00
Avi Dessauer c087111345 Use shorthand initialization in rustdoc 2019-10-06 03:42:53 -04:00
Tyler Mandry 69598dc3cf
Rollup merge of #65151 - tmandry:revert-emscripten-upgrade, r=tmandry
Revert #63649 - "Upgrade Emscripten targets to use upstream LLVM backend"

This change caused the runtime of the linux-asmjs builder to nearly double from 2+ hours to about 4 hours, which happens to be the bors timeout. (It made it in barely under 4 hours when it was merged.) This is causing timeouts on all new changes.

This reverts commit 7870050796, reversing
changes made to 2e7244807a.
2019-10-05 21:55:13 -07:00
Tyler Mandry 008526340a
Rollup merge of #64708 - SimonSapin:option-deref, r=Centril
Stabilize `Option::as_deref` and `Option::as_deref_mut`

The tracking issue https://github.com/rust-lang/rust/issues/50264 still has unresolved question for the corresponding `Result` methods.
2019-10-05 21:54:47 -07:00
Tyler Mandry d16b7f705b Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton"
This reverts commit 7870050796, reversing
changes made to 2e7244807a.
2019-10-05 21:38:45 -07:00
bors 7870050796 Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton
Upgrade Emscripten targets to use upstream LLVM backend

 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the incorrect wasm32 C call ABI with the old asmjs
   version, which is correct for both wasm32 and JS.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Temporarily makes Emscripten targets use panic=abort by default
   because supporting unwinding will require an LLVM patch.
2019-10-04 20:33:02 +00:00
bors 2e7244807a Auto merge of #64994 - GuillaumeGomez:fix-rustdoc-display-js-disabled, r=Mark-Simulacrum
Fix rustdoc display with js disabled

Fixes #64988.

Currently, all sections are collapsed when the page is loading, and then is displayed once done. However, if js is disabled, they never get expanded. Therefore, they need to be shown by default.

r? @Mark-Simulacrum
2019-10-04 12:17:13 +00:00
Thomas Lively 9a55103b98 Upgrade Emscripten targets to use upstream LLVM backend
- Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the incorrect wasm32 C call ABI with the old asmjs
   version, which is correct for both wasm32 and JS.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Temporarily makes Emscripten targets use panic=abort by default
   because supporting unwinding will require an LLVM patch.
2019-10-04 00:47:21 -07:00
Tyler Mandry 69837b14d6
Rollup merge of #64741 - GuillaumeGomez:prevent-rustdoc-feature-doctests, r=QuietMisdreavus
Prevent rustdoc feature doctests

Part of https://github.com/rust-lang/rust/pull/61351

cc @ollie27
2019-10-03 16:25:41 -07:00
Mazdak Farrokhzad 1c8ef985f2
Rollup merge of #64948 - GuillaumeGomez:improve-sidebar-styling, r=Mark-Simulacrum
Improve sidebar styling to make its integration easier

Part of https://github.com/rust-lang/docs.rs/issues/417

Setting the height was an error: forcing the element bottom to be at the bottom allows to change to top of the sidebar.

r? @Mark-Simulacrum
2019-10-02 18:24:35 +02:00
Guillaume Gomez de961a7e12 Fix rustdoc display with js disabled 2019-10-02 14:21:25 +02:00
Guillaume Gomez 445e7350f2 Prevent rustdoc feature to be passed down to doctests 2019-10-01 14:38:36 +02:00
Guillaume Gomez 4aa526f809 Improve sidebar styling to make its integration easier 2019-10-01 10:32:45 +02:00
bors 22bc9e1d9c Auto merge of #64778 - csmoe:index, r=eddyb
Introduce librustc_index crate

Closes #50592
2019-09-30 13:33:15 +00:00
Oliver Middleton dc295318fc rustdoc: Fix default logo filename 2019-09-29 22:17:03 +01:00
Igor Aleksanov 75a297573f Enhance report-time option 2019-09-29 21:22:30 +03:00
csmoe 64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
Eduard-Mihai Burtescu a88d181a02 rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures. 2019-09-28 17:39:00 +03:00
Eduard-Mihai Burtescu 7683d1c3aa rustc: don't store a lifetime in hir::TyKind::CVarArgs. 2019-09-28 17:39:00 +03:00
bors a37fe2de69 Auto merge of #63937 - Nashenas88:rustdoc_57180, r=GuillaumeGomez
Fix ICE in rustdoc when merging generic and where bounds of an Fn with an output

Fixes #57180
2019-09-27 13:51:25 +00:00
varkor 80b63ddca5 Fix librustcdoc test 2019-09-27 01:37:14 +01:00
varkor 38121173e2 Rename `MetaItem.node` to `MetaItem.kind` 2019-09-26 18:21:48 +01:00
varkor b474867961 Rename `ForeignItem.node` to `ForeignItem.kind` 2019-09-26 18:21:48 +01:00
varkor 7bc94cc3c2 Rename `Item.node` to `Item.kind` 2019-09-26 18:21:48 +01:00
varkor c3d8791373 Rename `Ty.node` to `Ty.kind` 2019-09-26 18:21:10 +01:00
varkor d4573c9c1e Rename `TraitItem.node` to `TraitItem.kind` 2019-09-26 18:21:09 +01:00
varkor 17726f6b52 Rename `Lit.node` to `Lit.kind` 2019-09-26 18:21:09 +01:00
varkor ce6aabbaa1 Rename `ImplItem.node` to `ImplItem.kind` 2019-09-26 18:21:09 +01:00
varkor 8bd0382134 Rename `Pat.node` to `Pat.kind` 2019-09-26 18:21:09 +01:00
bors ddf43867a9 Auto merge of #64515 - varkor:kindedterm, r=oli-obk
Rename `subst::Kind` to `subst::GenericArg`

And `subst::UnpackedKind` to `subst::GenericArgKind`. Individual variable names (e.g. `kind`) are not renamed, which would be an infeasible mission.

Fixes https://github.com/rust-lang/rust/issues/64352.

r? @eddyb
2019-09-26 12:34:54 +00:00
varkor e3fb05dc3c Rename some `_sty` variables to `_kind` 2019-09-26 12:10:43 +01:00
varkor bea3d67c77 Rename `subst::Kind` to `subst::GenericArg` 2019-09-26 11:48:05 +01:00
bors 134004f74d Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakis
reserve `impl<T> From<!> for T`

this is necessary for never-type stabilization.

cc #57012 #35121

I think we wanted a crater run for this @nikomatsakis?

r? @nikomatsakis
2019-09-26 08:42:34 +00:00
bors dc45735f29 Auto merge of #64513 - varkor:sty-begone, r=eddyb
Rename `TyS.sty` to `TyS.kind`

Fixes https://github.com/rust-lang/rust/issues/64353.

r? @eddyb
2019-09-26 04:29:18 +00:00
varkor e2e0f9af85 Rename `sty` to `kind` 2019-09-25 15:50:04 +01:00
Mark Rousskov f359a94849 Snap cfgs to new beta 2019-09-25 08:42:46 -04:00
Mazdak Farrokhzad 34067ee961
Rollup merge of #64599 - csmoe:doc_async_reexport, r=nikomatsakis
Rustdoc render async function re-export

Closes #63710
r? @nikomatsakis
2019-09-25 03:48:27 +02:00
Mazdak Farrokhzad 4a58b14db5
Rollup merge of #64443 - Mark-Simulacrum:rustdoc-clean-1, r=GuillaumeGomez
rustdoc: general cleanup

Review should be conducted commit-by-commit.

There are some general cleanup commits in the end, which are somewhat related but can be easily split into another PR, so just let me know.
2019-09-24 23:45:20 +02:00
Ariel Ben-Yehuda 1ec7ae14fa resolve the rustc_reservation_impl attribute in 1 place 2019-09-24 21:11:50 +03:00
Simon Sapin 0797712e29 Stabilize Option::deref and Option::deref_mut
The tracking issue https://github.com/rust-lang/rust/issues/50264
still has unresolved question for the corresponding `Result` methods.
2019-09-23 17:14:26 +02:00
Mark Rousskov 059163fad7 Remove needless `mut` in paths 2019-09-23 07:48:24 -04:00
Mark Rousskov cac7e5faed Remove unused arguments 2019-09-23 07:48:24 -04:00
Mark Rousskov 53acfc3f8a Utilize shared error codes rather than re-querying env 2019-09-23 07:48:24 -04:00
Mark Rousskov 583a81dc5e Remove pointless or 2019-09-23 07:48:24 -04:00
Mark Rousskov 61f16920b3 Remove needless Rc<RefCell<...>> 2019-09-23 07:48:24 -04:00
Mark Rousskov 5f58834fb8 Provide helper for synthesizing paths with resource suffix 2019-09-23 07:48:24 -04:00
csmoe a813cc1bf1 rename is_async_fn to asyncness 2019-09-21 03:17:57 +00:00
csmoe 9ffb1ce28c append asyncness info to functions 2019-09-19 18:38:55 +00:00
Mark Rousskov cdd805506e Replace DiagnosticBuilder with Diagnostic when emitting error 2019-09-17 09:29:46 -04:00
bors 572d3d9634 Auto merge of #60584 - jonas-schievink:ice-panic-hook, r=oli-obk
Use `panic::set_hook` to print the ICE message

This allows custom frontends and backends to override the hook with their own, for example to point people to a different issue tracker.

ICE messages are printed in a slightly different order now. Nightly prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-nightly (08bfe1612 2019-05-02) running on x86_64-unknown-linux-gnu
```

After this PR, rustc prints:

```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.36.0-dev running on x86_64-unknown-linux-gnu

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
```
2019-09-15 00:10:08 +00:00
Mark Rousskov 0ad789aa5b Stylistic fix -- remove double impl 2019-09-13 19:44:45 -04:00
Mark Rousskov 6e0b0d4d70 Move cache into Context, avoid TLS
This doesn't move everything over as cache() is pretty annoying to
remove fully, but it gets the ball rolling.
2019-09-13 19:44:45 -04:00
Mark Rousskov f5ed0fd1c0 Move `Cache` generation to separate module 2019-09-13 19:44:45 -04:00
Mark Rousskov f4bb5a7c1a Move playground to shared context 2019-09-13 19:44:45 -04:00
Mark Rousskov c26518086e Move error codes to shared context 2019-09-13 19:44:45 -04:00
Mark Rousskov 98c94f6f77 Move edition field out of Context 2019-09-13 19:44:44 -04:00
Mark Rousskov e0e0c3787c Replace SlashChecker with ensure_trailing_slash 2019-09-13 19:44:44 -04:00
Mark Rousskov aa4055cd6c Simplify render_spotlight_traits 2019-09-13 19:44:44 -04:00
Mark Rousskov 3f144e119e Move Toc printing from fmt::Display 2019-09-13 19:44:44 -04:00
Mark Rousskov 8a9dab3a20 Remove *Space wrappers in favor of direct impls or functions 2019-09-13 19:44:44 -04:00
Mark Rousskov ec349bef24 Unwrap Visibility fields
There's not really any reason to not have the visibility default to
inherited, and this saves us the trouble of checking everywhere for
whether we have a visibility or not.
2019-09-13 19:44:44 -04:00
Mark Rousskov 04b27efa00 Move to print functions on types instead of impl fmt::Display
This will eventually allow us to easily pass in more parameters to the
functions without TLS or other such hacks
2019-09-13 19:44:44 -04:00
bors 28e85d7ae7 Auto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=GuillaumeGomez
rustdoc: change doctests locating rustc binary

We previously used the "naive" approach of replacing the `current_exe()`'s file name with rustc, but now load from the sysroot by default (`$sysroot/bin/rustc`). The functionality of locating the sysroot overlaps/is the same as the functionality used by codegen backend loading; this ensures that any failure cases we've introduced are not exceeding those, and that improvements to finding the sysroot for loading codegen backends likewise enhance rustdoc.

The second commit adds an unstable `--test-builder` flag to rustdoc, and is largely separate (I can split into separate PR, but it's a simple and related change). This is largely intended for "advanced" users at this point (I'm not sure if we'll ever stabilize it); it permits use of a different rustc binary for rustdoc compilation of doctests than the rustdoc binary used when loading. Note, that this may not be what you want as the parsers and such differ (and rustdoc uses its own libsyntax, etc.). However, I've been told that running doctests in miri may be assisted by this change, so I've implemented it; I'll file a tracking issue for it if there's interest in it (and we land this PR).
2019-09-12 08:29:55 +00:00
bors f71826e8f2 Auto merge of #64303 - nnethercote:avoid-more-Symbol-to-string-operations, r=petrochenkov
Avoid more `Symbol`-to-string operations

These commits avoid various `Symbol`-to-string conversions, by doing more operations directly on `Symbol`s. This requires adding a few more static `Symbol`s to the binary.

r? @petrochenkov
2019-09-12 04:15:27 +00:00
Nicholas Nethercote 4fd18c9c06 Use `Symbol` in `external_path()`. 2019-09-11 11:31:38 +10:00
Mazdak Farrokhzad ec06633e19
Rollup merge of #64072 - limira:patch-1, r=ollie27
Replace file_stem by file_name in rustdoc markdown

Before this PR, a file name like `some.file.md` will be output to a file named `some.html` with is not correct because the expected output file must be `some.file.html`
2019-09-11 02:38:04 +02:00
Mark Rousskov 093cbd60fc Add unstable --test-builder to rustdoc
This allows overriding the rustc binary used to build tests; it should
not generally be necessary as we fallback to the sysroot.
2019-09-10 16:59:31 -04:00
Mark Rousskov 2fc32b9e72 Locate rustc binary similarly to codegen backend loading
This ensures that the failure cases for finding the codegen backend and
for finding the rustc binary are essentially the same, and since we
almost always will load the codegen backend, this is essentially meaning
that the rustc change is not a regression.
2019-09-10 16:57:14 -04:00
bors 87b0c9036f Auto merge of #60387 - Goirad:test-expansion, r=ollie27
Allow cross-compiling doctests

This PR allows doctest to receive a --runtool argument, as well as possibly many --runtool-arg arguments, which are then used to run cross compiled doctests.
Also, functionality has been added to rustdoc to allow it to skip testing doctests on a per-target basis, in the same way that compiletest does it. For example, tagging the doctest with "ignore-sgx" disables testing on any targets that contain "sgx". A plain "ignore" still skips testing on all targets.

See [here](https://github.com/rust-lang/cargo/pull/6892) for the companion PR in the cargo project that extends functionality in Cargo so that it passes the appropriate parameters to rustdoc when cross compiling and testing doctests.

Part of [#6460](https://github.com/rust-lang/cargo/issues/6460)
2019-09-10 12:19:41 +00:00
Mark Rousskov 007a58d4ce Switch rustdoc logging to RUSTDOC_LOG
This better aligns with Cargo (CARGO_LOG) and rustc (RUSTC_LOG).
2019-09-09 21:25:49 -04:00
bors 0b36e9dea3 Auto merge of #64313 - Centril:rollup-7w8b67g, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63468 (Resolve attributes in several places)
 - #64121 (Override `StepBy::{try_fold, try_rfold}`)
 - #64278 (check git in bootstrap.py)
 - #64306 (Fix typo in config.toml.example)
 - #64312 (Unify escape usage)

Failed merges:

r? @ghost
2019-09-09 16:33:43 +00:00
Mazdak Farrokhzad f7ee13040b
Rollup merge of #64312 - GuillaumeGomez:rustdoc-better-esc-handling, r=Mark-Simulacrum
Unify escape usage

Fixes #63443.

I chose to keep the search text when pressing escape so when we focus on the search bar, we got the results again without needing to load them again. I also unified a bit a few things (maybe I should have done it in another commit, sorry...).

r? @Mark-Simulacrum
2019-09-09 17:42:29 +02:00
Guillaume Gomez 0d34fe42f7 Unify escape usage 2019-09-09 17:04:28 +02:00
bors 45859b7ca7 Auto merge of #63118 - Centril:stabilize-bind-by-move, r=matthewjasper
Stabilize `bind_by_move_pattern_guards` in Rust 1.39.0

Closes https://github.com/rust-lang/rust/issues/15287.

After stabilizing `#![feature(bind_by_move_pattern_guards)]`, you can now use bind-by-move bindings in patterns and take references to those bindings in `if` guards of `match` expressions. For example, the following now becomes legal:

```rust
fn main() {
    let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]);

    match array {
        nums
//      ---- `nums` is bound by move.
            if nums.iter().sum::<u8>() == 10
//                 ^------ `.iter()` implicitly takes a reference to `nums`.
        => {
            drop(nums);
//          --------- Legal as `nums` was bound by move and so we have ownership.
        }
        _ => unreachable!(),
    }
}
```

r? @matthewjasper
2019-09-09 12:46:59 +00:00
Nicholas Nethercote c36d7d4834 Use `sym::{all,any,main,not}` more. 2019-09-09 08:27:40 +10:00
Mazdak Farrokhzad 832b47aee6
Rollup merge of #64267 - ehuss:rustdoc-fix-mixed-code-block, r=GuillaumeGomez
rustdoc: fix diagnostic with mixed code block styles

This fixes a relatively obscure issue where the diagnostic (emitted [here](ef54f57c5b/src/librustdoc/passes/check_code_block_syntax.rs (L69))) would get confused since the "is_fenced" flag wasn't reset properly.
2019-09-08 12:11:59 +02:00
bors 50362372d6 Auto merge of #64096 - GuillaumeGomez:theme-regex-fix, r=Mark-Simulacrum
Fix regex replacement in theme detection

Fixes #64061.

This is sadly a lot of bad luck: after making the changes and re-build the docs, I just forgot to force reload the page. Hence having the old (working) version with two replacements instead of the failing regex. Sorry again about that...

cc @fenhl
r? @Mark-Simulacrum
2019-09-08 06:06:39 +00:00
bors 4a8ccdbeeb Auto merge of #64044 - Mark-Simulacrum:rustdoc-clean-2, r=GuillaumeGomez
Rustdoc: formatting to buffers

This should be reviewed commit-by-commit.

I've not attempted to fully flesh out what the end state of this PR could look like yet as I wanted to get it up for some early feedback (I already think this has some wins, too, so we could land it as-is).

The primary idea with `Buffer` is that it internally tracks whether we're printing to HTML or text, and the goal is that eventually instead of branch on `fmt.alternate()` anywhere, we'd call a helper like `buf.nbsp()` which would either return `&nbsp;` or ` ` depending on the target we're printing to. Obviously, that's not included in this PR, in part because it was already getting quite big.
2019-09-08 02:12:24 +00:00
Mark Rousskov 02c5c5cb59 Move to buffers throughout print_item 2019-09-07 19:33:43 -04:00
Mark Rousskov c1c1e86d5a Item to function 2019-09-07 19:31:59 -04:00
Mark Rousskov a502e85603 AllTypes to function 2019-09-07 19:31:59 -04:00
Mark Rousskov 17bef30d0b Settings to function 2019-09-07 19:31:59 -04:00
Mark Rousskov bb40d5fa49 Move Source to Buffer 2019-09-07 19:31:58 -04:00
Mark Rousskov 3f0e77f19c layout::render takes Print instead of fmt::Display 2019-09-07 19:31:58 -04:00
Mark Rousskov d5f147086b De-indent all fmt::Display impls for later replacement to functions 2019-09-07 19:31:58 -04:00
Mark Rousskov eefaee1af4 Delete Sidebar struct in favor of FnOnce impl 2019-09-07 19:31:58 -04:00
Mark Rousskov f4a15ae3b2 Implement Print for FnOnce(&mut Buffer)
This means that callers can pass in a closure like
`|buf| some_function(..., &mut buf)` and pass in arbitrary arguments to
that function without complicating the trait definition. We also keep
the impl for str and String, since it's useful to be able to just pass
in "" or format!("{}"...) results in some cases.

This changes Print's definition to take self, instead of &self, because
otherwise FnOnce cannot be called directly. We could instead take FnMut
or even Fn, but that seems like it'd merely complicate matters -- most
of the time, the FnOnce does not constrain us at all anyway. If it does,
a custom Print impl for &'_ SomeStruct is not all that painful.
2019-09-07 19:31:58 -04:00
Mark Rousskov f8bccb1658 Move sidebar to Buffer-printing 2019-09-07 19:31:58 -04:00
Mark Rousskov 04dc72eeef Remove unnecessary Buffer in layout::render 2019-09-07 19:31:58 -04:00
Mark Rousskov 75528f266f Replace writeln!/write! with push_str 2019-09-07 19:31:58 -04:00
Mark Rousskov 57243b74b1 Move constant parameters to render to Layout struct 2019-09-07 19:31:58 -04:00
Mark Rousskov 3657bfc040 Remove needless clone of layout 2019-09-07 19:31:58 -04:00
Mark Rousskov 9e52ba94fa Create buffers in top-level rendering
This avoids needlessly creating and threading the buffers through when
we only use them once.
2019-09-07 19:31:58 -04:00
Mark Rousskov eebd0265c3 Migrate top-level rendering to Buffer 2019-09-07 19:31:58 -04:00
Mark Rousskov f35eae9934 Add buffer abstraction 2019-09-07 19:31:58 -04:00
Mazdak Farrokhzad 0356813b27 Dont use gate bind_by_move_pattern_guards internally. 2019-09-08 01:27:10 +02:00
Eric Huss fb387088e2 rustdoc: fix diagnostic with mixed code block styles 2019-09-07 12:21:32 -07:00
varkor f0386a10e0 Add "bool" lang item 2019-09-07 13:16:18 +01:00
Mazdak Farrokhzad 2cb02adbf9
Rollup merge of #64175 - GuillaumeGomez:replace-span-when-it-should-be-div, r=Mark-Simulacrum
Fix invalid span generation when it should be div

Fixes #64146.

It changes basically nothing in the display... Can be checked with:

```rust
pub enum X {
    /// Some doc?
    ///
    /// with lines!
    Foo {
        /// a
        ///
        /// b
        x: u32,
        /// Doc!
        ///
        /// ```
        /// yolo
        /// ```
        y: String,
    },
    /// Doc!
    ///
    /// ```
    /// yolo
    /// ```
    Bar(String),
}
```

r? @Mark-Simulacrum
2019-09-06 09:36:45 +02:00
Mazdak Farrokhzad ab75a1713a
Rollup merge of #64094 - kawa-yoiko:rustdoc-search, r=GuillaumeGomez
Improve searching in rustdoc and add tests

👋 I have made searching in rustdoc more intuitive, added a couple more tests and made a little shell script to aid testing. Closes #63005.

It took me quite a while to figure out how to run the tests for rustdoc (instead of running tests for other crates with rustdoc); the only pointer I found was [hidden in the rustc book](https://rust-lang.github.io/rustc-guide/rustdoc.html#cheat-sheet). Maybe this could be better documented? I shall be delighted to help if it is desirable.
2019-09-06 09:36:38 +02:00
Guillaume Gomez d4d5aa436d Fix invalid span generation when it should be div 2019-09-05 14:15:58 +02:00
Mazdak Farrokhzad d855bde457
Rollup merge of #63930 - estebank:rustdoc-ice, r=GuillaumeGomez
Account for doc comments coming from proc macros without spans

Fix https://github.com/rust-lang/rust/issues/63821.
2019-09-05 12:11:07 +02:00
Mazdak Farrokhzad 6da74a2605
Rollup merge of #63774 - chocol4te:fix_63707, r=GuillaumeGomez
Fix `window.hashchange is not a function`

Closes #63707.
2019-09-05 12:11:05 +02:00
Dario Gonzalez 4a2094c9f6 address rebase changes 2019-09-04 09:24:33 -07:00
Shiqing cb84aa4744 Improve searching in rustdoc and add tests 2019-09-04 21:27:13 +08:00
Aleksey Kladov 206fe8e1c3 flatten rustc_lexer::character_properties module
On the call site, `rustc_lexer::is_whitespace` reads much better than
`character_properties::is_whitespace`.
2019-09-04 15:13:29 +03:00
Aleksey Kladov a0c186c34f remove XID and Pattern_White_Space unicode tables from libcore
They are only used by rustc_lexer, and are not needed elsewhere.

So we move the relevant definitions into rustc_lexer (while the actual
unicode data comes from the unicode-xid crate) and make the rest of
the compiler use it.
2019-09-04 13:11:11 +03:00
Dario Gonzalez 14110ebd93 added rustdoc book documentation, improved behavior when unstable flag not present 2019-09-03 13:53:00 -07:00
Dario Gonzalez 657e24c56b changed target from option to plain target, populated with host triple at argument parsing time if no --target arguments 2019-09-03 13:52:58 -07:00
Dario Gonzalez 3f76408841 added feature gate enable-per-target-ignores
updated and augmented tests in html/markdown.rs
2019-09-03 13:50:36 -07:00
Dario Gonzalez 98bd8fd88c Added ability to crosscompile doctests 2019-09-03 13:48:18 -07:00
Guillaume Gomez 991f436633 Fix regex replacement in theme detection 2019-09-02 15:58:05 +02:00
bors fdaf594bab Auto merge of #63834 - andjo403:rustdoc-linker-remove, r=Mark-Simulacrum
remove the unstable rustdoc parameter --linker

use the code generation parameter -Clinker (same parameter as rustc)
to control what linker to use for building the rustdoc test executables.

closes: #63816
2019-09-02 02:11:07 +00:00
limira 7fdcbce499
Replace file_stem by file_name in rustdoc markdown 2019-09-02 00:14:58 +07:00
Mazdak Farrokhzad 6eadfc3459
Rollup merge of #64032 - andjo403:codegen-units, r=Mark-Simulacrum
rustdoc use -Ccodegen-units=1 by default for test compile

as the test is small we do not want split up in multiple codegen units
and also as there is multiple test running at the same time this
will reduce the number of concurrent threads

tested the test time with `./x.py test src/libcore --doc`
for my 16 core 32 thread cpu i get about 6% faster execution
and my 2 core 4 thread cpu I get about 10% faster execution

cc #63638
 r? @Mark-Simulacrum
2019-09-01 11:39:28 +02:00
Andreas Jonson f0b30c7ded remove the unstable rustdoc parameter --linker
use the code generation parameter -Clinker (same parameter as rustc)
to control what linker to use for building the rustdoc test executables.

closes: #63816
2019-09-01 08:50:23 +02:00
bors 59cc53e6e7 Auto merge of #63703 - tommilligan:warn-empty-doctest, r=ollie27
rustdoc: warn on empty doc test

Closes #60319.

A doc test that only contains whitespace should result in a warning.

This PR adds detection of empty doc tests to `check-code-block-syntax`, as having an invalid doc test is mutually exclusive with an empty doc test.
2019-08-31 20:10:20 +00:00
Mazdak Farrokhzad 5f07ff7087
Rollup merge of #63847 - GuillaumeGomez:system-theme-detection, r=kinnison
[rustdoc] Fix system theme detection

Fixes #63830

The problem is that it returns the property "entirely" (so with the quotes in our case). Removing them fixes the issue.

cc @fenhl

r? @kinnison
2019-08-30 23:08:03 +02:00
Andreas Jonson 0b478e6d46 rustdoc use -Ccodegen-units=1 by default for test compile
as the test is small we do not want split up in multiple codegen units
and also as there is multiple test running at the same time this
will reduce the number of concurrent threads
2019-08-30 21:26:04 +02:00
Jonas Schievink a8926a5e9c Use `panic::set_hook` to print the ICE message 2019-08-30 12:34:20 +02:00
bors 0f41401691 Auto merge of #63827 - andjo403:out-of-process-rustc-in-rustdoc, r=Mark-Simulacrum
Run doctests via out-of-process rustc

closes #63638
2019-08-30 10:25:26 +00:00
bors 19a38de68a Auto merge of #63402 - estebank:strip-margin, r=oli-obk
Strip code to the left and right in diagnostics for long lines

Fix #62999.
2019-08-30 06:49:15 +00:00
Andreas Jonson b304cd02c0 Run doctests via out-of-process rustc 2019-08-29 23:15:31 +02:00
Mazdak Farrokhzad 1ea8fc587c
Rollup merge of #62734 - GuillaumeGomez:hide-default-methods, r=Mark-Simulacrum
Hide trait default methods

Fixes #62499.

However, the question remains: do we want to extend it to this point or not?

r? @QuietMisdreavus
2019-08-29 17:13:57 +02:00
bors 85ed538d69 Auto merge of #63990 - Centril:rollup-q1nt0b0, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #63811 (Correctly suggest adding bounds to `impl Trait` argument)
 - #63933 (Resolve some small issues related to #63580)
 - #63938 (or-pattern: fix typo in error message)
 - #63945 (Recover `mut $pat` and other improvements)
 - #63958 (const_prop: only call error_to_const_error if we are actually showing something)
 - #63961 (Add Option<Span> to `require_lang_item`)
 - #63963 (remove the reference to __cxa_thread_atexit_impl)
 - #63965 (Prevent syntax error in LD linker version script)
 - #63968 (rustc_apfloat: make the crate #![no_std] explicitly.)
 - #63970 (Notify me (flip1995) when Clippy toolstate changes)
 - #63980 (add missing `#[repr(C)]` on the Slices union)

Failed merges:

 - #63989 (Add Yaah to clippy toolstain notification list)

r? @ghost
2019-08-29 05:05:17 +00:00
Mazdak Farrokhzad d4757d5bbf
Rollup merge of #63961 - JohnTitor:improve-require-lang-item, r=estebank
Add Option<Span> to `require_lang_item`

Fixes #63954

I'm not sure where to take `Some(span)` or something so I use `None` in many places.
r? @estebank
2019-08-29 05:32:51 +02:00
bors 347654324d Auto merge of #62855 - Aaron1011:feature/rustdoc-reexport-final, r=petrochenkov
Improve Rustdoc's handling of procedural macros

Fixes #58700
Fixes #58696
Fixes #49553
Fixes #52210

This commit removes the special rustdoc handling for proc macros, as we can now
retrieve their span and attributes just like any other item.

A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate.

In compiletest, a new 'rustdoc-flags' option is added. This allows us to
pass in the '--proc-macro-crate' flag in the absence of Cargo.

I've opened [an additional PR to Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing in this flag.
These two PRS can be merged in any order - the Cargo changes will not
take effect until the 'cargo' submodule is updated in this repository.
2019-08-29 01:22:11 +00:00
bors 0414dfa0aa Auto merge of #62941 - GuillaumeGomez:save-crate-filter, r=Mark-Simulacrum
Save crate filtering on rustdoc

Fixes #62929.

I added a hashmap and a hash encoding for the current crate list in case you have multiple crates handling on a same website (who talked about docs.rs?!). Like that, for each context, you have the filter crate selected.

r? @QuietMisdreavus
2019-08-28 21:42:52 +00:00
Guillaume Gomez 06228d33ca Save crate filtering on rustdoc 2019-08-28 11:56:21 +02:00
Paul Daniel Faria 143b83a3c1 Add regression test for issue, apply suggestion to convert to assert_eq 2019-08-28 00:21:30 -04:00
bors bbd48e6f16 Auto merge of #63127 - kper:pr, r=nikomatsakis
Cleanup: Consistently use `Param` instead of `Arg` #62426

Fixes #62426
2019-08-28 03:42:00 +00:00
Yuki Okushi 82f2b37635 Add Option<Span> to `require_lang_item` 2019-08-28 07:11:12 +09:00
bors 0396aace27 Auto merge of #63639 - Mark-Simulacrum:rustdoc-clean-3, r=GuillaumeGomez
rustdoc: general cleanup
2019-08-27 12:45:16 +00:00
Kevin Per e0ce9f8c0a Cleanup: Consistently use `Param` instead of `Arg` #62426 2019-08-27 14:07:41 +02:00
Mazdak Farrokhzad 6d20265a9e
Rollup merge of #62600 - emmericp:libtest-add-show-output, r=gnzlbg
libtest: add --show-output flag to print stdout of successful tests

This pull request adds a new flag `--show-output` for tests to show the output of successful tests. For most formatters this was already supported just not exposed via the CLI (apparently only used by `librustdoc`). I've also added support for this option in the JSON formatter.

This kind of fixes https://github.com/rust-lang/rust/issues/54669 which wants `--format json` to work with `--nocapture`, which is... well, impossible. What this issue really calls for is `--show-output` as implemented here.
2019-08-27 08:17:48 +02:00
Paul Daniel Faria 09f6b44790 Simplify some code in rustdoc's simplify 2019-08-27 00:22:31 -04:00
Paul Daniel Faria c015927af3 Fix ICE in rustdoc when merging generic and where bounds in the case of an Fn with an output
Fixes #57180
2019-08-27 00:20:21 -04:00
Esteban Küber b2b9b81c9a Account for doc comments coming from proc macros without spans 2019-08-26 17:46:14 -07:00
Mark Rousskov b0fab966fa Shorten line during rendering instead of in markdown 2019-08-26 20:30:10 -04:00
Mark Rousskov b3f01753b0 Inline recurse into only callsite 2019-08-26 20:30:10 -04:00
Mark Rousskov edfd5556f1 Transition a few fmt::Display impls to functions
This introduces a WithFormatter abstraction that permits one-time
fmt::Display on an arbitrary closure, created via `display_fn`. This
allows us to prevent allocation while still using functions instead of
structs, which are a bit unwieldy to thread arguments through as they
can't easily call each other (and are generally a bit opaque).

The eventual goal here is likely to move us off of the formatting
infrastructure entirely in favor of something more structured, but this
is a good step to move us in that direction as it makes, for example,
passing a context describing current state to the formatting impl much
easier.
2019-08-26 20:30:10 -04:00
Mark Rousskov dafdfee33e Inline RawMutableSpace 2019-08-26 19:15:19 -04:00
Mark Rousskov 3307929a84 Store only the current depth
Previously we stored the entire current path which is a bit expensive
and only ever accessed its length. This stores the length directly.
2019-08-26 19:15:19 -04:00
Mark Rousskov 0e079c2c68 Remove support for printing HRef in alternate mode
The alternate mode merely prints out the passed in text which is largely
useless (as the text can simply be directly printed).
2019-08-26 18:52:36 -04:00
Mark Rousskov 95f5698c10 Remove dead tracking of external param names 2019-08-26 18:52:27 -04:00
Mark Rousskov 57d57c6784 Mutate DocContext from LibEmbargoVisitor and RustdocVisitor
We have &mut access, so remove the RefCell borrowing
2019-08-26 18:51:34 -04:00
Mark Rousskov e2b6f4c662 Move top-level Clean impl to function
This allows us to pass it a `&mut DocContext` which will allow removal
of RefCells, etc. in the following commits. It's also somewhat a unique
Clean impl in that it previously ignored `self` (re-retriveing
hir::Crate), which it no longer needs to do.
2019-08-26 18:51:34 -04:00
Mark Rousskov a77247acb1 Move source HTML generation to own module 2019-08-26 18:51:34 -04:00
bors 521d784074 Auto merge of #61613 - sinkuu:impl_trait_inline, r=ollie27
Support `impl Trait` in inlined documentation

`impl Trait` in argument position was not properly rendered when inlined from other crates. ([a live example on docs.rs](https://docs.rs/libp2p/0.8.1/libp2p/floodsub/struct.Floodsub.html#method.unsubscribe))

![old](https://user-images.githubusercontent.com/7091080/59089838-14ba9900-8946-11e9-830b-53b317bdecb4.png)
↓
![new](https://user-images.githubusercontent.com/7091080/59089844-16845c80-8946-11e9-9fe3-8998af9d73ce.png)
2019-08-25 19:20:20 +00:00
Guillaume Gomez fcbbf8d312 Fix system theme detection 2019-08-25 12:37:24 +02:00
Aaron Hill 1498608135
Improve Rustdoc's handling of procedural macros
Fixes #58700
Fixes #58696
Fixes #49553
Fixes #52210

This commit removes the special rustdoc handling for proc macros, as we
can now
retrieve their span and attributes just like any other item.

A new command-line option is added to rustdoc: `--crate-type`. This
takes the same options as rustc's `--crate-type` option. However, all
values other than `proc-macro` are treated the same. This allows Rustdoc
to enable 'proc macro mode' when handling a proc macro crate.

In compiletest, a new 'rustdoc-flags' option is added. This allows us to
pass in the '--proc-macro-crate' flag in the absence of Cargo.

I've opened [an additional PR to
Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing
in this flag.
These two PRS can be merged in any order - the Cargo changes will not
take effect until the 'cargo' submodule is updated in this repository.
2019-08-24 13:11:57 -04:00
Mazdak Farrokhzad 1f56441a00
Rollup merge of #63782 - GuillaumeGomez:theme-switch-fix, r=kinnison
Fix confusion in theme picker functions

To reproduce the bug currently: click on the theme picker button twice (to show it then hide it). Then click anywhere else: the dropdown menu appears again.

The problem was coming from a confusion of what the `hideThemeButtonState` and `showThemeButtonState` were supposed to do. I switched their codes and updated the `switchThemeButtonState` function. It now works as expected.

r? @kinnison
2019-08-22 15:15:40 +02:00
Esteban Küber 21f2e93345 Add terminal_width debugging flag 2019-08-21 11:58:24 -07:00
Guillaume Gomez 3375b05cd0 Fix confusion in theme picker functions 2019-08-21 13:10:06 +02:00
Guillaume Gomez 1bd94241b7 Replaced skipStorage with saveTheme variable 2019-08-21 12:49:01 +02:00
Ferdia McKeogh 5a446c1ea9
Fix `window.hashchange is not a function` 2019-08-21 09:13:51 +01:00
Guillaume Gomez c076d30ce4 take into account the system theme 2019-08-21 10:08:29 +02:00
Tom Milligan 0ec2e9fceb
librustdoc: warn on empty doc test 2019-08-19 16:02:57 +01:00
Shotaro Yamada 1fe6160c7e Fix ICE with `impl Trait` in type bounds 2019-08-19 17:49:54 +09:00
Shotaro Yamada 3620456faf Use BTreeMap for deterministic iter order 2019-08-19 17:49:54 +09:00
Shotaro Yamada 5f9e26382f Support nested `impl Trait` 2019-08-19 17:49:54 +09:00
Shotaro Yamada 9beff38382 Associated type bound for inlined impl Trait doc 2019-08-19 17:49:54 +09:00
Shotaro Yamada b78367d8e8 Support `impl Trait` in inlined documentation 2019-08-19 17:49:54 +09:00
bors a807902dd6 Auto merge of #63463 - matthewjasper:ty_param_cleanup, r=petrochenkov
Don't special case the `Self` parameter by name

This results in a couple of small diagnostic regressions. They could be avoided by keeping the special case just for diagnostics, but that seems worse.

closes #50125
cc #60869
2019-08-19 01:31:35 +00:00
Matthew Jasper 24587d20df Pre intern the `Self` parameter type
Use this to simplify the object safety code a bit.
2019-08-18 19:25:12 +01:00
varkor 1713ac4bf5
Initial implementation of or patterns 2019-08-17 15:05:36 +00:00
Vadim Petrochenkov c76277340e resolve: `ParentScope::default` -> `ParentScope::module` 2019-08-15 20:47:15 +03:00
Vadim Petrochenkov 1a1557c285 resolve: Add `ParentScope::default`, eliminate `dummy_parent_scope`
Remove some unnecessary parameters from functions
2019-08-15 20:40:18 +03:00
Vadim Petrochenkov 6cb28b6617 `Ident::with_empty_ctxt` -> `Ident::with_dummy_span`
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-15 20:39:26 +03:00
Vadim Petrochenkov a6182711ef Remove `Spanned` from `{ast,hir}::FieldPat` 2019-08-15 12:31:50 +03:00
Vadim Petrochenkov 73d2da0894 Remove `Spanned` from `mk_name_value_item_str` and `expr_to_spanned_string` 2019-08-15 11:44:22 +03:00
Caio 6a42b0b28d Merge Variant and Variant_ 2019-08-14 14:47:01 -03:00
Mark Rousskov 3b8a24d193 Reduce nesting in externalfiles implementation
Utilize `?` instead of and_then/map operators
2019-08-11 10:47:58 -04:00
Mark Rousskov 1aa0964b54 Drop RefCell from IdMap in markdown rendering 2019-08-11 10:47:58 -04:00
Mark Rousskov c250b5fd03 Remove fmt::Display impls on Markdown structs
These impls prevent ergonomic use of the config (e.g., forcing us to use
RefCell) despite all usecases for these structs only using their Display
impls once.
2019-08-11 10:36:46 -04:00
Mark Rousskov dbad77ffdd Remove thread-local for playground config 2019-08-11 10:36:46 -04:00
Mark Rousskov ade8b02828 Remove unnecessary channel 2019-08-11 10:36:46 -04:00
Mark Rousskov eea2f879af Use a HashSet instead of Vec 2019-08-11 10:36:46 -04:00
Mark Rousskov 0347480151 Don't store all traits in DocContext
This is already a query so we're just needlessly copying the data
around.
2019-08-11 10:36:46 -04:00
Mark Rousskov 00319519bb Store typed Passes 2019-08-11 10:36:46 -04:00
Mark Rousskov 6be2857a6c Replace Arc with Rc around external_traits 2019-08-11 10:36:46 -04:00
Mark Rousskov c57481001e Remove ReentrantMutex
This drops the parking_lot dependency; the ReentrantMutex type appeared
to be unused (at least, no compilation failures occurred).

This is technically a possible change in behavior of its users, as
lock() would wait on other threads releasing their guards, but since we
didn't actually remove any threading or such in this code, it appears
that we never used that behavior (the behavior change is only noticeable
if the type previously was used in two threads, in a single thread
ReentrantMutex is useless).
2019-08-11 10:36:46 -04:00
Mark Rousskov 8f80a8d7d5 Use entry API in store_path 2019-08-11 10:36:46 -04:00
Mark Rousskov 00d7bc7688 Remove crate_name from DocContext
tcx.crate_name is the appropriate way to retrieve the crate name.
2019-08-11 10:36:46 -04:00
Mark Rousskov 19c85a8f8a Move def_id_to_path to use site in visit_ast 2019-08-11 10:36:46 -04:00
Mark Rousskov 65ea7b7947 rustdoc: Replace HirVec with slices in doctree 2019-08-11 10:36:46 -04:00
Matthew Jasper 2f6babbc6d Remove `is_self` and `has_self_ty` methods 2019-08-11 15:00:42 +01:00
bors 9703ef6661 Auto merge of #62955 - Mark-Simulacrum:rustdoc-clean-1, r=eddyb
rustdoc: general cleanups

This is purely a refactoring, mostly just simplifying some of the code. Commits are best reviewed individually.
2019-08-10 17:19:55 +00:00
Mark Rousskov 32f144a527 Implement Clean<Crate> on hir::Crate directly 2019-08-10 07:52:07 -04:00
Mark Rousskov 78d9088e77 Replace is_doc_reachable with is_public 2019-08-10 07:52:07 -04:00
Mark Rousskov c36e0c0424 Remove NodeId from doctree::Module 2019-08-10 07:52:07 -04:00
Mark Rousskov 4beb751575 Gather deprecation information during cleaning 2019-08-10 07:52:07 -04:00
Mark Rousskov 11735b6235 Gather stability information during cleaning 2019-08-10 07:52:07 -04:00
Mark Rousskov 6c5d212f5f Make exact_paths a non-optional field on RustdocVisitor
Also privatizes needlessly public methods to enforce which methods
callers are intended to call, i.e., only `new` and `visit`.
2019-08-10 07:52:07 -04:00
Mark Rousskov 2fadc4524d Represent ownership transfer in RustdocVisitor::visit
Previously visit could be called multiple times, but this is inaccurate,
as it deconstructs Visitor state.
2019-08-10 07:52:07 -04:00
Mark Rousskov 2d18504c27 Remove Option from resolver 2019-08-10 07:52:07 -04:00
Mark Rousskov 37100024de Make fields of RustdocVisitor private 2019-08-10 06:48:59 -04:00
Vadim Petrochenkov 8cc8133973 Fix calls to resolver from rustdoc and HIR lowering
Cleanup some surrounding code.
Support resolution of intra doc links in unnamed block scopes.
(Paths from rustdoc now use early resolution and no longer need results of late resolution like all the built ribs.)

Fix one test hitting file path limits on Windows.
2019-08-10 13:16:06 +03:00
Mazdak Farrokhzad 949b49a53d
Rollup merge of #63286 - Mark-Simulacrum:resolve-no-cb, r=petrochenkov
Replace error callback with Result

r? @petrochenkov
2019-08-06 15:36:32 +02:00
Mazdak Farrokhzad a389521c90
Rollup merge of #62837 - Kinrany:patch-1, r=GuillaumeGomez
Fix theme picker blur handler: always hide instead of switching

Fixes a minor bug in UI generated by rustdoc.

For example, this page: https://doc.rust-lang.org/std/

Reproduction steps:
1. Click the theme picker twice
   * The list of themes will be shown and then hidden
2. Click anywhere else
   * The list of themes will be show again, which is unexpected

The bug was caused by blur event handler toggling the state of the element instead of always hiding it regardless of the current state.
2019-08-06 15:36:30 +02:00
Mazdak Farrokhzad e6994714d9
Rollup merge of #62821 - GuillaumeGomez:not-listed-methods, r=Mark-Simulacrum
Not listed methods

Fixes #60326.

cc @rust-lang/rustdoc
r? @QuietMisdreavus
2019-08-06 15:36:28 +02:00
Mazdak Farrokhzad b2603d6386
Rollup merge of #63272 - Mark-Simulacrum:clean-attr, r=petrochenkov
Some more libsyntax::attr cleanup

Much smaller patch than the last one, mostly just finishing up by removing some Span arguments.

r? @petrochenkov
2019-08-06 08:17:42 +02:00
Guillaume Gomez d89bf91b2d Display methods from DerefMut in the sidebar as well 2019-08-05 23:14:22 +02:00
Mark Rousskov 3cd7f08ed1 Force callers of resolve_ast_path to deal with Res::Err correctly 2019-08-05 12:31:00 -04:00
Mark Rousskov 24a491f40c Drop explicit span argument from mk_name_value_item 2019-08-05 08:48:22 -04:00
Aleksey Kladov b3e8c8bbe2 adapt rustdoc to infailable lexer 2019-08-05 13:15:12 +03:00
Aleksey Kladov 58ac81a60f add unknown token 2019-08-05 13:15:11 +03:00
varkor 63659ca9f6 Rename `ItemImplKind::Type` to `ItemImplKind::TyAlias` 2019-08-04 20:16:41 +01:00
varkor 8aa45c65d8 Rename `ItemKind::Ty` to `ItemKind::TyAlias` 2019-08-04 20:13:37 +01:00
bors 460072ebee Auto merge of #63048 - Aaron1011:feature/rustdoc-reexport-doc, r=GuillaumeGomez
Use doc comments from 'pub use' statements

Split off from #62855

Currently, rustdoc ignores any doc comments found on 'pub use'
statements. As described in issue #58700, this makes it impossible to
properly document procedural macros. Any doc comments must be written on
the procedural macro definition, which must occur in a dedicated
proc-macro crate. This means that any doc comments or doc tests cannot
reference items defined in re-exporting crate, despite the fact that
such items may be required to use the procedural macro.

To solve this issue, this commit allows doc comments to be written on
'pub use' statements. For consistency, this applies to *all* 'pub use'
statements, not just those importing procedural macros.

When inlining documentation, documentation on 'pub use' statements will
be prepended to the documentation of the inlined item. For example,
the following items:

```rust

mod other_mod {
    /// Doc comment from definition
    pub struct MyStruct;
}

/// Doc comment from 'pub use'
///
pub use other_mod::MyStruct;
```

will caues the documentation for the re-export of 'MyStruct' to be
rendered as:

```
Doc comment from 'pub use'
Doc comment from definition
```

Note the empty line in the 'pub use' doc comments - because doc comments
are concatenated as-is, this ensure that the doc comments on the
definition start on a new line.
2019-08-04 11:30:12 +00:00
bors d7270712cb Auto merge of #63180 - varkor:trait-alias-impl-trait, r=Centril
Change opaque type syntax from `existential type` to type alias `impl Trait`

This implements a new feature gate `type_alias_impl_trait` (this is slightly different from the originally proposed feature name, but matches what has been used in discussion since), deprecating the old `existential_types` feature.

The syntax for opaque types has been changed. In addition, the "existential" terminology has been replaced with "opaque", as per previous discussion and the RFC.

This makes partial progress towards implementing https://github.com/rust-lang/rust/issues/63063.

r? @Centril
2019-08-03 02:21:23 +00:00
varkor b4fe555796 Replace `exist_ty` and `ExistTy` with `opaque_ty` and `OpaqueTy` 2019-08-02 02:44:36 +01:00
varkor 70c8839f7c Fix fallout after rebase 2019-08-02 02:44:36 +01:00
varkor c28ce3e4ca Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
Vadim Petrochenkov a332e224a3 librustdoc: Unconfigure tests during normal build 2019-08-02 01:59:01 +03:00
Pietro Albini e2934bab3e
Rollup merge of #62971 - GuillaumeGomez:keyword-sidebar, r=nobody
Add keywords item into the sidebar

Fixes #62939.

cc @pravic

screenshot of the result:

![Screenshot from 2019-07-25 14-29-48](https://user-images.githubusercontent.com/3050060/61874545-f9512080-aee8-11e9-8e8b-aa50216aec94.png)

r? @QuietMisdreavus
2019-08-01 16:00:25 +02:00
bors f690098e6d Auto merge of #62766 - alexcrichton:stabilize-pipelined-compilation, r=oli-obk
rustc: Stabilize options for pipelined compilation

This commit stabilizes options in the compiler necessary for Cargo to
enable "pipelined compilation" by default. The concept of pipelined
compilation, how it's implemented, and what it means for rustc are
documented in #60988. This PR is coupled with a PR against Cargo
(rust-lang/cargo#7143) which updates Cargo's support for pipelined
compliation to rustc, and also enables support by default in Cargo.
(note that the Cargo PR cannot land until this one against rustc lands).

The technical changes performed here were to stabilize the functionality
proposed in #60419 and #60987, the underlying pieces to enable pipelined
compilation support in Cargo. The issues have had some discussion during
stabilization, but the newly stabilized surface area here is:

* A new `--json` flag was added to the compiler.
* The `--json` flag can be passed multiple times.
* The value of the `--json` flag is a comma-separated list of
  directives.
* The `--json` flag cannot be combined with `--color`
* The `--json` flag must be combined with `--error-format=json`
* The acceptable list of directives to `--json` are:
  * `diagnostic-short` - the `rendered` field of diagnostics will have a
    "short" rendering matching `--error-format=short`
  * `diagnostic-rendered-ansi` - the `rendered` field of diagnostics
    will be colorized with ansi color codes embedded in the string field
  * `artifacts` - JSON blobs will be emitted for artifacts being emitted
    by the compiler

The unstable `-Z emit-artifact-notifications` and `--json-rendered`
flags have also been removed during this commit as well.

Closes #60419
Closes #60987
Closes #60988
2019-07-30 08:39:29 +00:00
bors c7312fe4ff Auto merge of #63090 - Centril:rollup-xnjwm2h, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #61856 (Lint attributes on function arguments)
 - #62360 (Document that ManuallyDrop::drop should not called more than once)
 - #62392 (Update minifier-rs version)
 - #62871 (Explicit error message for async recursion.)
 - #62995 (Avoid ICE when suggestion span is at Eof)
 - #63053 (SystemTime docs: recommend Instant for elapsed time)
 - #63081 (tidy: Cleanup the directory whitelist)
 - #63088 (Remove anonymous_parameters from unrelated test)

Failed merges:

r? @ghost
2019-07-28 20:22:42 +00:00
Guillaume Gomez 3f4dbd390c Update minifier-rs version 2019-07-28 20:26:07 +02:00
Vadim Petrochenkov 676d282dd3 Deny `unused_lifetimes` through rustbuild 2019-07-28 18:47:02 +03:00
Vadim Petrochenkov 434152157f Remove lint annotations in specific crates that are already enforced by rustbuild
Remove some random unnecessary lint `allow`s
2019-07-28 18:46:24 +03:00
Aaron Hill 7ee9b7a410
Use doc comments from 'pub use' statements
Split off from #62855

Currently, rustdoc ignores any doc comments found on 'pub use'
statements. As described in issue #58700, this makes it impossible to
properly document procedural macros. Any doc comments must be written on
the procedural macro definition, which must occur in a dedicated
proc-macro crate. This means that any doc comments or doc tests cannot
reference items defined in re-exporting crate, despite the fact that
such items may be required to use the procedural macro.

To solve this issue, this commit allows doc comments to be written on
'pub use' statements. For consistency, this applies to *all* 'pub use'
statements, not just those importing procedural macros.

When inlining documentation, documentation on 'pub use' statements will
be prepended to the documentation of the inlined item. For example,
the following items:

```rust

mod other_mod {
    /// Doc comment from definition
    pub struct MyStruct;
}

/// Doc comment from 'pub use'
///
pub use other_mod::MyStruct;
```

will caues the documentation for the re-export of 'MyStruct' to be
rendered as:

```
Doc comment from 'pub use'
Doc comment from definition
```

Note the empty line in the 'pub use' doc comments - because doc comments
are concatenated as-is, this ensure that the doc comments on the
definition start on a new line.
2019-07-27 14:35:14 -04:00
Mazdak Farrokhzad 625aa60b3a
Rollup merge of #62421 - JohnTitor:U007D-master, r=alexcrichton
Introduce `as_deref` to Option

This is re-submission for #59628.
Renames `deref()` to `as_deref()` and adds `deref_mut()` impls and tests.

CC #50264

r? @Kimundi
(I picked you as you're the previous reviewer.)
2019-07-26 18:56:38 +02:00
Alex Crichton 17312337a9 rustc: Stabilize options for pipelined compilation
This commit stabilizes options in the compiler necessary for Cargo to
enable "pipelined compilation" by default. The concept of pipelined
compilation, how it's implemented, and what it means for rustc are
documented in #60988. This PR is coupled with a PR against Cargo
(rust-lang/cargo#7143) which updates Cargo's support for pipelined
compliation to rustc, and also enables support by default in Cargo.
(note that the Cargo PR cannot land until this one against rustc lands).

The technical changes performed here were to stabilize the functionality
proposed in #60419 and #60987, the underlying pieces to enable pipelined
compilation support in Cargo. The issues have had some discussion during
stabilization, but the newly stabilized surface area here is:

* A new `--json` flag was added to the compiler.
* The `--json` flag can be passed multiple times.
* The value of the `--json` flag is a comma-separated list of
  directives.
* The `--json` flag cannot be combined with `--color`
* The `--json` flag must be combined with `--error-format=json`
* The acceptable list of directives to `--json` are:
  * `diagnostic-short` - the `rendered` field of diagnostics will have a
    "short" rendering matching `--error-format=short`
  * `diagnostic-rendered-ansi` - the `rendered` field of diagnostics
    will be colorized with ansi color codes embedded in the string field
  * `artifacts` - JSON blobs will be emitted for artifacts being emitted
    by the compiler

The unstable `-Z emit-artifact-notifications` and `--json-rendered`
flags have also been removed during this commit as well.

Closes #60419
Closes #60987
Closes #60988
2019-07-26 07:46:35 -07:00
Guillaume Gomez 08a8de8181 Add keywords item into the sidebar 2019-07-25 14:29:05 +02:00
Mazdak Farrokhzad 52247b2383
Rollup merge of #62905 - fakenine:normalize_use_of_backticks_compiler_messages_p16, r=Centril
Normalize use of backticks in compiler messages for doc

https://github.com/rust-lang/rust/issues/60532
2019-07-24 16:13:17 +02:00
Samy Kacimi ca8420c61f
Normalize use of backticks in compiler messages for doc
https://github.com/rust-lang/rust/issues/60532
2019-07-23 20:06:00 +02:00
Aleksey Kladov 27b703dd40 add rustc_private as a proper language feature gate
At the moment, `rustc_private` as a (library) feature exists by
accident: `char::is_xid_start`, `char::is_xid_continue` methods in
libcore define it.
2019-07-22 16:32:13 +03:00
Kinrany 3e39ac7188
Update render.rs 2019-07-20 23:40:30 +03:00
Kinrany 112a3473d0
Fix theme picker blur handler: always hide instead of switching 2019-07-20 23:12:57 +03:00
Guillaume Gomez 9d6b29af5a Update pulldown-cmark version 2019-07-20 11:01:04 +02:00
Vadim Petrochenkov 1b4fbfca41 resolve: Support resolving macro paths without macro kind restrictions 2019-07-18 13:42:45 +03:00
Yuki Okushi 59634bc1d4 Replace deref with as_deref 2019-07-18 15:18:41 +09:00
Brad Gibson 6a9d749b92 fixed breaking changes 2019-07-18 15:17:30 +09:00
Guillaume Gomez 145ae1b263 hide default trait methods by default 2019-07-16 23:24:26 +02:00
Guillaume Gomez cb873c5a87 code formatting 2019-07-16 18:32:40 +02:00
Mazdak Farrokhzad d70ea7ce48
Rollup merge of #62568 - lzutao:replace_may_dangle, r=matthewjasper
Replace unsafe_destructor_blind_to_params with may_dangle

This PR will completely remove support for `#[unsafe_destructor_blind_to_params]` attribute,
which is deprecated in #38970 by `[may_dangle]` unsafe  attribute.

Closes #34761
2019-07-12 22:46:44 +02:00
bors 71f9384e3b Auto merge of #61462 - GuillaumeGomez:fix-local-storage, r=Manishearth
[rustdoc] Fix storage usage when disabled

Fixes #61239.

@starblue: Can you give a try to this change please? I tried on chrome and firefox and both worked so if you're using another web browser, that might be useful. :)

r? @Manishearth
2019-07-12 12:04:25 +00:00
Paul Emmerich 1add949ef0 libtest: add --show-output option
this new flag enables printing the captured stdout of successful tests
utilizing the already existing display_output test runner option
2019-07-11 22:23:00 +02:00
Lzu Tao 8347917dd9 Remove feature gate `dropck_parametricity` completely
Therefore we also remove `#[unsafe_destructor_blind_to_params]`
attribute completly.
2019-07-11 18:44:56 +00:00
Vadim Petrochenkov f923942094 resolve: Divide macro path resolution into speculative and error reporting parts
Also move macro stability checking closer to other checks performed on obtained resolutions.
Tighten the stability spans as well, it is an error to *refer* to and unstable entity in any way, not only "call" it.
2019-07-11 00:12:08 +03:00
Vadim Petrochenkov 48635226d8 Remove `MacroKind::ProcMacroStub`
It's internal to resolve and always results in `Res::Err` outside of resolve.
Instead put `DefKind::Fn`s themselves into the macro namespace, it's ok.

Proc macro stubs are items placed into macro namespase for functions that define proc macros.
https://github.com/rust-lang/rust/pull/52383

The rustdoc test is changed because the old test didn't actually reproduce the ICE it was supposed to reproduce.
2019-07-11 00:12:07 +03:00
Mazdak Farrokhzad 5915517c6b
Rollup merge of #62470 - dima74:patch-1, r=GuillaumeGomez
Prevent shrinking of "crate select" element on Firefox

This fixes #60368
2019-07-09 21:01:51 +02:00
Dmitry Murzin 11a4d6ed9c
Prevent shrinking of "crate select" element on Firefox 2019-07-07 18:46:24 +03:00
QuietMisdreavus bed54cf854 rustdoc: set cfg(doctest) when collecting doctests 2019-07-06 21:37:17 -05:00