Commit Graph

5315 Commits

Author SHA1 Message Date
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
Mazdak Farrokhzad
952ee77871
Rollup merge of #62329 - matklad:no-peeking, r=petrochenkov
Remove support for 1-token lookahead from the lexer

`StringReader` maintained `peek_token` and `peek_span_src_raw` for look ahead.

`peek_token` was used only by rustdoc syntax coloring. After moving peeking logic into highlighter, I was able to remove `peek_token` from the lexer. I tried to use `iter::Peekable`, but that wasn't as pretty as I hoped, due to buffered fatal errors. So I went with hand-rolled peeking.

After that I've noticed that the only peeking behavior left was for raw tokens to test tt jointness. I've rewritten it in terms of trivia tokens, and not just spans.

After that it became possible to simplify the awkward constructor of the lexer, which could return `Err` if the first peeked token contained error.
2019-07-06 02:38:01 +02:00
Mazdak Farrokhzad
2e86c006f7
Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=Zoxc
The (almost) culmination of HirIdification

It's finally over.

This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name.
All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.
2019-07-05 20:26:56 +02:00
Mazdak Farrokhzad
485a084b45
Rollup merge of #61545 - flip1995:internal_lints, r=oli-obk
Implement another internal lints

cc #49509

This adds ~~two~~ one internal lint~~s~~:
1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669
2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~

~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~

TODO (not directly relevant for review):
- [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) 🤔 cc @eddyb)
- [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870
- [x] Check explicitly for the `{declare,impl}_lint_pass!` macros

r? @oli-obk
2019-07-05 20:26:51 +02:00
Mazdak Farrokhzad
61256a8164
Rollup merge of #62238 - GuillaumeGomez:fix-code-block-information-icon-pos, r=QuietMisdreavus
Fix code block information icon position

Fixes #62118.

A screenshot of the fix:

<img width="720" alt="Screenshot 2019-06-29 at 18 28 59" src="https://user-images.githubusercontent.com/3050060/60386900-edb23b80-9a9b-11e9-9f4f-0f343674348c.png">

r? @rust-lang/rustdoc
2019-07-05 13:53:04 +02:00
Mazdak Farrokhzad
0f92eb8a4a
Rollup merge of #62123 - jeremystucki:needless_lifetimes_std, r=alexcrichton
Remove needless lifetimes (std)

Split from #62039
2019-07-05 13:52:58 +02:00
ljedrz
c6131b23ae rename hir::map::opt_local_def_id* 2019-07-04 12:53:12 +02:00
ljedrz
37d7e1f22a rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
ljedrz
4f7ba515c2 rename hir::map::local_def_id to local_def_id_from_node_id 2019-07-04 12:29:26 +02:00
Aleksey Kladov
601bad86b2 cleanup lexer constructors 2019-07-04 09:08:45 +03:00
Aleksey Kladov
830ff4a592 remove StringReader::peek
The reader itself doesn't need ability to peek tokens, so it's better
if clients implement this functionality.

This hopefully becomes especially easy once we use iterator interface
for lexer, but this is not too easy at the moment, because of buffered
errors.
2019-07-04 09:01:37 +03:00
Mazdak Farrokhzad
88c007cd04
Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
2019-07-04 01:38:46 +02:00
bors
8c6fb028ca Auto merge of #61995 - eddyb:hir-sep-ptr, r=petrochenkov
rustc: use a separate copy of P for HIR than for AST.

Note: this currently includes/is based on top of #61987.

Like #61968, but goes one step further and uses a separate `P<...>` for the HIR, with no `Clone`, or the ability to mutate after allocation.
There is still `into_inner`/`into_iter`, but they're only exposed for `hir::lowering`, and they would take more work to untangle.

r? @petrochenkov cc @rust-lang/compiler
2019-07-03 10:57:39 +00:00
Chris Gregory
eddfad3140 Fix import of take in collapse_docs.rs 2019-07-01 20:21:53 -07:00
Chris Gregory
b0c199a969 Enable mem_take feature in relevant crates 2019-07-01 20:21:53 -07:00
Chris Gregory
636f5e6d11 Convert more usages over 2019-07-01 20:21:12 -07:00
Guillaume Gomez
a683bb1754 Revert "implicit Option-returning doctests"
This reverts commit 6bb6c001be.
2019-07-01 16:41:37 +02:00
Eduard-Mihai Burtescu
c6374cfbe2 rustc: use a separate copy of P for HIR than for AST. 2019-07-01 14:34:34 +03:00
Jeremy Stucki
47ea8ae022
Remove needless lifetimes 2019-07-01 12:15:27 +02:00
Mazdak Farrokhzad
1683bb7771
Rollup merge of #62224 - euclio:remove-derives, r=GuillaumeGomez
rustdoc: remove unused derives and variants

Though many structs in rustdoc derive `RustcEncodable` and `RustcDecodable`, the impls do not appear to be used by the crate or its dependents. Removing them revealed some enum variants that are never constructed, too.

r? @GuillaumeGomez
2019-06-30 21:57:25 +02:00
bors
fd7f48b3ef Auto merge of #61459 - GuillaumeGomez:fix-rustdoc-sysroot-panic, r=ollie27,bjorn3,QuietMisdreavus
Prevent panic when sysroot cannot be computed

Fixes #61377.

cc @rotty @rust-lang/rustdoc

r? @Manishearth
2019-06-30 01:44:44 +00:00
Guillaume Gomez
e861efd9f9 Fix code block information icon position 2019-06-29 18:28:39 +02:00
Mazdak Farrokhzad
6c0ab739fb
Rollup merge of #61199 - ollie27:rustdoc_cfg_test, r=QuietMisdreavus
Revert "Set test flag when rustdoc is running with --test option"

Reverts https://github.com/rust-lang/rust/pull/59940.

It caused doctests in this repository to no longer be tested including all of the core crate.
2019-06-29 11:18:06 +02:00
Andy Russell
e991abd004
remove unused derives and variants 2019-06-26 21:15:13 -04:00
Mazdak Farrokhzad
c5e6069194
Rollup merge of #62055 - matthewjasper:fix-error-counting, r=pnkfelix
Fix error counting

Count duplicate errors for `track_errors` and other error counting checks.
Add FIXMEs to make it clear that we should be moving away from this kind of logic.

Closes #61663
2019-06-25 17:15:31 +02:00
Eduard-Mihai Burtescu
e6ee8a0d44 rustc: produce AST instead of HIR from hir::lowering::Resolver methods. 2019-06-25 15:34:57 +03:00
flip1995
084c829fb8
Enable internal lints in bootstrap 2019-06-24 10:45:20 +02:00
Matthew Jasper
30b6c59f24 Prefer to use has_errors to err_count 2019-06-22 15:36:24 +01:00
Mazdak Farrokhzad
dc0ef823be
Rollup merge of #61984 - ljedrz:more_node_id_pruning, r=Zoxc
More NodeId pruning

Just another round of the `HirId`ification initiative.

r? @Zoxc
2019-06-22 01:42:38 +02:00
Mazdak Farrokhzad
18bb75477a
Rollup merge of #61181 - GuillaumeGomez:fix-theme-checker, r=kinnison
Fix theme-checker failure

Fixes #61145.

I didn't find a way to check it without strongly depending on the output... Is there a way to check if a program fails without checking its output?

r? @QuietMisdreavus
2019-06-22 01:42:31 +02:00
Guillaume Gomez
65f12950b6 Better handling of the sender channel part in rustdoc file writing 2019-06-21 12:00:49 +02:00
Guillaume Gomez
3eeb543504 Handle fs errors through errors::Handler instead of eprintln and panic 2019-06-21 12:00:49 +02:00
Robert Collins
6392bc9fcd Add DocFS layer to rustdoc
* Move fs::create_dir_all calls into DocFS to provide a clean
  extension point if async extension there is needed.
* Convert callsites of create_dir_all to ensure_dir to reduce syscalls.
* Convert fs::write usage to DocFS.write
  (which also removes a lot of try_err! usage for easier reading)
* Convert File::create calls to use Vec buffers and then DocFS.write
  in order to consistently reduce syscalls as well, make
  deferring to threads cleaner and avoid leaving dangling content if
  writing to existing files....
* Convert OpenOptions usage similarly - I could find no discussion on
  the use of create_new for that one output file vs all the other
  files render creates, if link redirection attacks are a concern
  DocFS will provide a good central point to introduce systematic
  create_new usage. (fs::write/File::create is vulnerable to link
  redirection attacks).
* DocFS::write defers to rayon for IO on Windows producing a modest
  speedup: before this patch on my development workstation:

$ time cargo +mystg1 doc -p winapi:0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 6m 11s

real    6m11.734s

Afterwards:
$ time cargo +mystg1 doc -p winapi:0.3.7
   Compiling winapi v0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 49.53s

real    0m49.643s

I haven't measured how much time is in the compilation logic vs in the
IO and outputting etc, but this takes it from frustating to tolerable
for me, at least for now.
2019-06-21 12:00:49 +02:00
Guillaume Gomez
640bdbdb1d Improve theme checker by removing unneeded conditions 2019-06-20 22:59:56 +02:00
Guillaume Gomez
165a95b371 Add test for empty css file check 2019-06-20 22:59:56 +02:00
Guillaume Gomez
cfd754d892 Fix theme-checker failure 2019-06-20 22:59:56 +02:00
Simonas Kazlauskas
4c8d00a3ec rustdoc: generate implementors for all auto traits
Previously we would only generate a list of synthetic implementations
for two well known traits – Send and Sync. With this patch all the auto
traits known to rustc are considered. This includes such traits like
Unpin and user’s own traits.

Sadly the implementation still iterates through the list of crate items
and checks them against the traits, which for non-std crates containing
their own auto-traits will still not include types defined in std/core.

It is an improvement nontheless.
2019-06-20 17:36:43 +03:00
ljedrz
73cb9ab526 rename hir::map::get_by_hir_id to get 2019-06-20 12:50:06 +02:00
ljedrz
98cc18a5db rename hir::map::name_by_hir_id to ::name 2019-06-20 12:47:26 +02:00
Eduard-Mihai Burtescu
673c3fc23a rustc: disallow cloning HIR nodes. 2019-06-19 21:16:08 +03:00
Eduard-Mihai Burtescu
887feeeaf7 rustc: replace GenericArgs::with_generic_args hack with a plain getter. 2019-06-19 21:16:04 +03:00
Mazdak Farrokhzad
d51002ce07
Rollup merge of #61898 - petrochenkov:sekind, r=eddyb
syntax: Factor out common fields from `SyntaxExtension` variants

And some other related cleanups.

Continuation of https://github.com/rust-lang/rust/pull/61606.
This will also help to unblock https://github.com/rust-lang/rust/pull/61877.
2019-06-19 01:52:10 +02:00
Mazdak Farrokhzad
9a7016d67d
Rollup merge of #61505 - ebarnard:doc-shrink, r=GuillaumeGomez
Only show methods that appear in `impl` blocks in the Implementors sections of trait doc pages

In the "Implementors" and "Implementations on Foreign Types" sections, only show methods that appear in the `impl` block for that type. This has the benefit of
- Reducing the size of the Iterator page, and other large trait documentation pages.
- Retaining documentation on the `impl` blocks and functions in the `impl` blocks.
- Indicating which provided methods are overridden.
- Making the documentation match the structure of the code being documented.
- Being a small change that can be easily backed out if issues arise.

A set of Rust stdlib docs build with this change are [available here](https://ebarnard.github.io/2019-06-03-rust-smaller-trait-implementers-docs/).

The size of the [`Iterator` doc page](https://ebarnard.github.io/2019-06-03-rust-smaller-trait-implementers-docs/std/iter/trait.Iterator.html) is reduced from 14.4MB (latest nightly) to 724kB.

Before:
<img width="1411" alt="Screenshot 2019-06-03 at 23 12 17" src="https://user-images.githubusercontent.com/1059683/58837971-1722a780-8655-11e9-8d81-51e48130951d.png">

After:
<img width="1428" alt="Screenshot 2019-06-03 at 16 41 27" src="https://user-images.githubusercontent.com/1059683/58814907-84ffac80-861e-11e9-8692-79be473a5299.png">

cc #55900
2019-06-19 01:51:58 +02:00
Eduard-Mihai Burtescu
b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
Vadim Petrochenkov
961ba8f9ef syntax: Factor out common fields from SyntaxExtension variants 2019-06-18 10:48:56 +03:00
ljedrz
d996c4d5a3 remove _by_hir_id if there is no NodeId counterpart 2019-06-17 18:57:21 +02:00
Vadim Petrochenkov
5a9643c95b Fix tidy 2019-06-16 14:17:21 +03:00
chansuke
46e622beb9 Separate librustcdoc module 2019-06-16 14:17:01 +03:00
Shotaro Yamada
6a0abd6048 Remove unnecessary .clone() 2019-06-15 20:46:00 +09:00
Eduard-Mihai Burtescu
f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
17cdd356da rustc: replace TyCtxt<'tcx, 'gcx, 'tcx> with TyCtxt<'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
2441253508 Fix fallout from deny(unused_lifetimes). 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
37799a5552 rustc: replace TyCtxt<'a, 'gcx, 'tcx> with TyCtxt<'tcx, 'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Mazdak Farrokhzad
d78260d781
Rollup merge of #61568 - Mark-Simulacrum:symbol-fmt-macros, r=estebank
Use Symbol, Span in libfmt_macros

I'm not super happy with this, personally, but I think it might be a decent start -- happy to take suggestions as to how to expand this or change things further.

r? @estebank

Fixes #60795
2019-06-12 04:22:47 +02:00
bors
961a9d6e97 Auto merge of #61741 - Centril:rollup-fgro5kz, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #61518 (Add loops to doc list of things not stable in const fn)
 - #61526 (move some tests into subfolders)
 - #61550 (Windows 10 SDK is also required now.)
 - #61606 (Remove some legacy proc macro flavors)
 - #61652 (Mention slice patterns in array)
 - #61686 (librustc_errors: Add some more documentation)
 - #61698 (typeck: Fix const generic in repeat param ICE.)
 - #61707 (Azure: retry failed awscli installs)
 - #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone)
 - #61724 (core: use memcmp optimization for 128 bit integer slices)
 - #61726 (Use `for_each` in `Iterator::partition`)

Failed merges:

r? @ghost
2019-06-11 23:29:20 +00:00
Guillaume Gomez
4eb19d19a5 Fix storage usage when disabled 2019-06-11 20:59:59 +02:00
Eduard-Mihai Burtescu
4a219685ff rustdoc: deny(unused_lifetimes). 2019-06-11 14:11:59 +03:00
Vadim Petrochenkov
93eb63c9a5 syntax: Rename variants of SyntaxExtension for consistency 2019-06-10 21:34:26 +03:00
Vadim Petrochenkov
8edbbacbca syntax: Remove SyntaxExtension::DeclMacro
It's a less powerful duplicate of `SyntaxExtension::NormalTT`
2019-06-10 21:33:31 +03:00
Guillaume Gomez
ab277a439b Prevent panic when sysroot cannot be computed 2019-06-10 11:04:12 +02:00
Mark Rousskov
b1c357e0c3 Introduce InnerSpan abstraction
This should be used when trying to get at subsets of a larger span,
especially when the larger span is not available in the code attempting
to work with those subsets (especially common in the fmt_macros crate).

This is usually a good replacement for (BytePos, BytePos) and (usize,
usize) tuples.

This commit also removes from_inner_byte_pos, since it took usize
arguments, which is error prone.
2019-06-09 14:09:36 -06:00
Vadim Petrochenkov
0ca3c2f881 syntax: Move most of the TokenKind methods to Token 2019-06-08 22:38:12 +03:00
Oliver Middleton
6cc42ce286 Revert "Set test flag when rustdoc is running with --test option"
This reverts commit 8ed2292dbe.

It caused doctests in this repository to no longer be tested including all of the core crate.
2019-06-08 18:25:29 +01:00
Mazdak Farrokhzad
9bbdc40334
Rollup merge of #61605 - GuillaumeGomez:const-generic-display, r=varkor
Fix slice const generic length display

Fixes #61487.

r? @varkor
2019-06-07 16:48:09 +02:00
Guillaume Gomez
8f3753703c Fix slice const generic length display 2019-06-07 15:54:16 +02:00
Vadim Petrochenkov
f745e5f9b6 syntax: Remove duplicate span from token::Ident 2019-06-06 14:04:02 +03:00
Vadim Petrochenkov
c0c57acd7b syntax: Use Token in StringReader and TokenTreesReader 2019-06-06 14:03:15 +03:00
Vadim Petrochenkov
e0127dbf81 syntax: Use Token in TokenTree::Token 2019-06-06 14:03:15 +03:00
Vadim Petrochenkov
a3425edb46 syntax: Rename TokenAndSpan into Token 2019-06-06 14:03:15 +03:00
Niko Matsakis
f472cd9c02 Addressed points raised in review. 2019-06-05 21:09:27 +01:00
Alexander Regueiro
a71d55701e Addressed points raised in review. 2019-06-05 21:09:27 +01:00
Alexander Regueiro
aaa53ec853 Implemented for traits (associated type definitions). 2019-06-05 21:09:26 +01:00
Alexander Regueiro
35585c499f Aggregation of drive-by cosmetic changes. 2019-06-05 21:09:26 +01:00
Mazdak Farrokhzad
3a06a93f59
Rollup merge of #61413 - davidtwco:async-argument-order-in-a-sane-way, r=eddyb
Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from #61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes #61187 (cc #61192).

r? @eddyb
cc @cramertj
2019-06-04 04:48:11 +02:00
Edward Barnard
45bb4097b4 Only show methods that appear in the impl block for types in the Implementors and Implementations on Foreign Types sections of trait documentation pages. 2019-06-03 22:11:57 +01:00
bors
61d286e9d0 Auto merge of #59033 - GuillaumeGomez:duplicated-bounds, r=Dylan-DPC
Fix duplicated bounds printing in rustdoc

Fixes #56331.

Once again, I couldn't find out how to reproduce it with a small code so no test... :-/

r? @QuietMisdreavus
2019-06-03 14:02:15 +00:00
David Wood
5e3b41e0cb
rustc: remove HirId from ArgSource::AsyncFn
This commit removes the `HirId` from `ArgSource::AsyncFn`, relying on
the fact that only `simple_ident` is used in each of the locations that
previously took the original pattern from the `ArgSource::AsyncFn`.
2019-06-03 14:02:21 +01:00
David Wood
1e5f496143
rustc: async fn drop order lowering in HIR
This commit re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
`@eddyb` to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.
2019-06-03 10:20:35 +01:00
bors
3a6bef0cbd Auto merge of #61008 - GuillaumeGomez:fix-rustdoc-code-highlighting, r=Manishearth
Fix lines highlighting in rustdoc source view

Fixes #60948.

This PR fixes how we handle the lines highlighting from the URL (so in "/doc/src/alloc/string.rs.html#285-283", the "285-283" part). We got a hard limit on 50000, for some unknown and lost reasons which was used in case only one line is selected.

r? @Manishearth
2019-06-03 00:02:34 +00:00
Mazdak Farrokhzad
525d7deb6d
Rollup merge of #61263 - GuillaumeGomez:valid-html, r=Manishearth
Don't generate div inside header (h4/h3/h...) elements

Fixes #60865.

According to the HTML spec, we're not supposed to put `div` elements inside heading elements (h4/h3/h...). It doesn't change the display as far as I could tell.

r? @QuietMisdreavus
2019-06-01 06:50:02 +02:00
Mazdak Farrokhzad
07d0b578c1
Rollup merge of #61279 - llogiq:implicit-option-main-doctests, r=GuillaumeGomez
implicit `Option`-returning doctests

This distinguishes `Option` and `Result`-returning doctests with implicit `main` method, where the former tests must end with `Some(())`.

Open question: Does this need a feature gate?

r? @GuillaumeGomez
2019-05-30 10:52:56 +02:00
Mazdak Farrokhzad
040af62a5a
Rollup merge of #60802 - euclio:pulldown-cmark-panic, r=GuillaumeGomez
upgrade rustdoc's `pulldown-cmark` to 0.5.2

Fixes #60482.
2019-05-30 10:52:48 +02:00
Andy Russell
ed8a4d5bc1
upgrade rustdoc's pulldown-cmark to 0.5.2
Fixes #60482.
2019-05-29 10:59:59 -04:00
Guillaume Gomez
35091620e6 Don't generate div inside header (h4/h3/h...) elements 2019-05-29 16:51:48 +02:00
Oliver Scherer
9cc289e7b4
Rollup merge of #61293 - varkor:rustdoc-print-const-generic, r=GuillaumeGomez
Print const generics properly in rustdoc

Now that https://github.com/rust-lang/rust/pull/59276 is merged, we can print consts properly in rustdoc.

Fixes https://github.com/rust-lang/rust/issues/60737.
Fixes https://github.com/rust-lang/rust/issues/61257.

r? @GuillaumeGomez
2019-05-29 14:41:08 +02:00
Oliver Scherer
8186994446
Rollup merge of #60549 - euclio:doctest-panic-messages, r=GuillaumeGomez
do not print panic message on doctest failures

This PR cleans up rustdoc test output by silently unwinding on failure instead of using `panic!`. It also improves the clarity and consistency of the output on test failure, and adds test cases for failure modes that were previously untested.
2019-05-29 14:41:01 +02:00
varkor
35ce2abf21 Use proper const printing in rustdoc 2019-05-28 22:53:16 +01:00
Andre Bogus
6bb6c001be implicit Option-returning doctests
This distinguishes `Option` and `Result`-returning doctests with
implicit `main` method, where the former tests must end with
`Some(())`.
2019-05-28 19:10:39 +02:00
Andrew Xu
46b9ed4fa1 Rename "Associated*" to "Assoc*"
We are going to uniform the terminology of all associated items.
Methods that may or may not have `self` are called "associated
functions". Because `AssociatedFn` is a bit long, we rename `Associated`
to `Assoc`.
2019-05-26 17:49:02 +08:00
Oliver Scherer
e694b63cd1 Don't use ty::Const without immediately interning 2019-05-25 10:07:01 +02:00
Oliver Scherer
8d4f4cdada Reuse the pretty printing architecture for printing of constants 2019-05-25 10:07:01 +02:00
John Kåre Alsaker
ae8975c812 Update GenericPredicates queries 2019-05-23 18:51:46 +02:00
John Kåre Alsaker
b1398a0de6 Update item_children 2019-05-23 18:51:45 +02:00
Vadim Petrochenkov
ca2a50fad7 syntax: Turn token::Lit into a struct 2019-05-23 12:46:24 +03:00
Andy Russell
89d437ec76
do not print panic message on doctest failures 2019-05-22 13:27:53 -04:00
Vadim Petrochenkov
a1885cdba3 Restore the old behavior of the rustdoc keyword check + Fix rebase 2019-05-22 20:20:12 +03:00
Vadim Petrochenkov
59a382122f Simplify use of keyword symbols 2019-05-22 19:48:56 +03:00
Mazdak Farrokhzad
44cb86bdc8
Rollup merge of #61003 - nnethercote:rm-InternedString-PartialEq-impls, r=petrochenkov
Remove impls for `InternedString`/string equality.

`Symbol` received the same treatment in #60630.

Also, we can derive `PartialEq` for `InternedString`.

r? @petrochenkov
2019-05-22 03:47:41 +02:00
John Kåre Alsaker
0b37900b40 Specify the edition for the rustdoc thread-pool 2019-05-21 18:17:06 +02:00
John Kåre Alsaker
a1f2dceaeb Move edition outside the hygiene lock and avoid accessing it 2019-05-21 18:17:05 +02:00
Guillaume Gomez
8ca3887439 Fix lines highlighting in rustdoc source view 2019-05-21 14:49:53 +02:00