Commit Graph

79 Commits

Author SHA1 Message Date
Oli Scherer 62f2d72330 Bump tracing-tree dependency 2021-03-09 16:44:51 +00:00
Guillaume Gomez 6052211982 Update minifier dependency version 2021-03-05 21:17:48 +01:00
Joshua Nelson 65f0b2549c Always compile rustdoc with debug logging enabled when `download-rustc` is set
Previously, logging at DEBUG or below would always be silenced, because
rustc compiles tracing with the `static_max_level_info` feature. That
makes sense for release artifacts, but not for developing rustdoc.

Instead, this compiles two different versions of tracing: one in the
release artifacts, distributed in the sysroot, and a new version
compiled by rustdoc. Since `rustc_driver` is always linked to the
version of sysroot, this copy/pastes `init_env_logging` into rustdoc.

The builds the second version of tracing unconditionally; see the code
for details on why.
2021-02-28 22:01:45 -05:00
klensy 93c8ebe022 bumped smallvec deps 2021-02-14 18:03:11 +03:00
bors 4b80687854 rustdoc tweaking
* Reuse memory
* simplify `next_def_id`, avoid multiple hashing and unnecessary lookups
* remove `all_fake_def_ids`, use the global map instead (probably not a good step toward parallelization, though...)
* convert `add_deref_target` to iterative implementation
* use `ArrayVec` where we know the max number of elements
* minor touchups here and there
* avoid building temporary vectors that get appended to other vectors

At most places I may or may not be doing the compiler's job is this PR.
2021-01-30 01:02:18 +00:00
Rune Tynan 67b78a0271
Update crate name and add README 2021-01-27 18:58:44 -05:00
Rune Tynan 3076e255fe
`src/etc/json-types` -> `src/rustdoc-json-types` 2021-01-27 18:58:43 -05:00
Rune Tynan 3c2806957e
Move into src/etc 2021-01-27 18:57:14 -05:00
Rune Tynan c689b97fba
Split JSON into separately versioned crate 2021-01-27 18:56:57 -05:00
Guillaume Gomez f467b8d77c Extend automatic_links lint to take into account URLs without link syntax 2020-11-05 10:22:08 +01:00
Joshua Nelson e4c28bf61a Upgrade to pulldown-cmark 0.8.0
Thanks to marcusklaas' hard work in https://github.com/raphlinus/pulldown-cmark/pull/469, this fixes a lot of rustdoc bugs!

- Get rid of unnecessary `RefCell`
- Fix duplicate warnings for broken implicit reference link
- Remove unnecessary copy of links
2020-09-13 20:15:01 -04:00
Andreas Jonson b8752fff19 update the version of itertools and parking_lot
this is to avoid compiling multiple version of the crates in rustc
2020-09-12 08:26:53 +02:00
Aleksey Kladov 5716c3e18d Update expect-test to 1.0
The only change is that `expect_file` now uses path relative to the
current file (same as `include!`). Before, it used paths relative to
the workspace root, which makes no sense.
2020-08-31 21:04:09 +02:00
Vadim Petrochenkov 7dfbf59f10 cleanup: Remove duplicate library names from `Cargo.toml`s 2020-08-30 22:57:54 +03:00
Aleksey Kladov b4f4db946e Add expect test for rustdoc html highlighting
It's a unit-test in a sense that it only checks syntax highlighting.
However, the resulting HTML is written to disk and can be easily
inspected in the browser.

To update the test, run with `--bless` argument or set
`UPDATE_EXPEC=1` env var
2020-08-27 18:48:06 +02:00
Joshua Nelson 3ddd8b233c Return all impls, not just the primary one 2020-08-19 08:18:24 -04:00
Guillaume Gomez d8589de1f0 Update pulldown-cmark dependency 2020-02-14 22:39:45 +01:00
Ohad Ravid 811bdeee00 Show value for consts in the documentation 2019-12-24 10:10:36 +01:00
Andy Russell 94630d4c8b
replace serialize with serde in rustdoc 2019-12-12 16:33:25 -05: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
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
Guillaume Gomez 3f4dbd390c Update minifier-rs version 2019-07-28 20:26:07 +02:00
Guillaume Gomez 9d6b29af5a Update pulldown-cmark version 2019-07-20 11:01:04 +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
Andy Russell ed8a4d5bc1
upgrade rustdoc's `pulldown-cmark` to 0.5.2
Fixes #60482.
2019-05-29 10:59:59 -04:00
Guillaume Gomez d676386b1e Fix index-page generation 2019-04-23 22:44:27 +02:00
Andy Russell 303016485b
upgrade rustdoc's pulldown-cmark to 0.4.1 2019-04-22 09:11:26 -04:00
Guillaume Gomez 7f2c726d6c Speed up rustdoc run a bit 2019-03-27 19:07:48 +01:00
bors aadbc459bd Auto merge of #57051 - Eijebong:parking_lot, r=nikomatsakis
Update parking_lot to 0.7

Unfortunately this'll dupe parking_lot until the data_structures crate
is published and be updated in rls in conjunction with crossbeam-channel
2019-02-23 19:46:10 +00:00
Hirokazu Hata 1932d7a52d Transition librustdoc to 2018 edition 2019-02-23 16:40:07 +09:00
Bastien Orivel a82f0ce54b Update parking_lot to 0.7
Unfortunately this'll dupe parking_lot until the data_structures crate
is published and be updated in rls in conjunction with crossbeam-channel
2019-02-22 13:49:19 +01:00
Guillaume Gomez f97856350c Update minifier version 2019-01-25 00:07:08 +01:00
Guillaume Gomez d405606c3b End fixing search index minification 2019-01-17 01:41:01 +01:00
Guillaume Gomez f42407f114 Reduce search-index.js size 2019-01-17 01:41:01 +01:00
Guillaume Gomez ca517a6ee9 Update minifier version 2018-10-11 21:37:04 +02:00
QuietMisdreavus 354507e61f shuffle ownership of `external_traits`
constraints:

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

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

`parking_lot` is reused from elsewhere in the tree to allow use of its
`ReentrantMutex`, as the relevant parts of rustdoc are still
single-threaded and this allows for easier use in that context.
2018-09-20 05:54:26 -05:00
Guillaume Gomez cf5ee8f59b Fix links' color 2018-08-15 15:07:07 +02:00
Guillaume Gomez f7485df05b Minify css 2018-06-25 23:28:20 +02:00
Bastien Orivel ae9a27185e Replace tempdir by tempfile in librustdoc 2018-06-20 19:28:27 +02:00
Guillaume Gomez 4b14573d50 Add minification process 2018-05-12 19:15:06 +02:00
bors 5de90898de Auto merge of #48343 - Mark-Simulacrum:release-step, r=kennytm
Update nightly to 1.26.0 and bootstrap from beta.
2018-02-22 23:25:39 +00:00
Mark Simulacrum 33f5ceee1f stage0 cfg cleanup 2018-02-20 08:52:33 -07:00
Manish Goregaokar 6818551c6f bump pulldown 2018-02-18 17:57:06 -08:00
Guillaume Gomez 5bd5bc3f21 Remove hoedown from rustdoc
Is it really time? Have our months, no, *years* of suffering come to an end? Are we finally able to cast off the pall of Hoedown? The weight which has dragged us down for so long?

-----

So, timeline for those who need to catch up:

* Way back in December 2016, [we decided we wanted to switch out the markdown renderer](https://github.com/rust-lang/rust/issues/38400). However, this was put on hold because the build system at the time made it difficult to pull in dependencies from crates.io.
* A few months later, in March 2017, [the first PR was done, to switch out the renderers entirely](https://github.com/rust-lang/rust/pull/40338). The PR itself was fraught with CI and build system issues, but eventually landed.
* However, not all was well in the Rustdoc world. During the PR and shortly after, we noticed [some differences in the way the two parsers handled some things](https://github.com/rust-lang/rust/issues/40912), and some of these differences were major enough to break the docs for some crates.
* A couple weeks afterward, [Hoedown was put back in](https://github.com/rust-lang/rust/pull/41290), at this point just to catch tests that Pulldown was "spuriously" running. This would at least provide some warning about spurious tests, rather than just breaking spontaneously.
* However, the problems had created enough noise by this point that just a few days after that, [Hoedown was switched back to the default](https://github.com/rust-lang/rust/pull/41431) while we came up with a solution for properly warning about the differences.
* That solution came a few weeks later, [as a series of warnings when the HTML emitted by the two parsers was semantically different](https://github.com/rust-lang/rust/pull/41991). But that came at a cost, as now rustdoc needed proc-macro support (the new crate needed some custom derives farther down its dependency tree), and the build system was not equipped to handle it at the time. It was worked on for three months as the issue stumped more and more people.
  * In that time, [bootstrap was completely reworked](https://github.com/rust-lang/rust/pull/43059) to change how it ordered compilation, and [the method by which it built rustdoc would change](https://github.com/rust-lang/rust/pull/43482), as well. This allowed it to only be built after stage1, when proc-macros would be available, allowing the "rendering differences" PR to finally land.
  * The warnings were not perfect, and revealed a few [spurious](https://github.com/rust-lang/rust/pull/44368) [differences](https://github.com/rust-lang/rust/pull/45421) between how we handled the renderers.
  * Once these were handled, [we flipped the switch to turn on the "rendering difference" warnings all the time](https://github.com/rust-lang/rust/pull/45324), in October 2017. This began the "warning cycle" for this change, and landed in stable in 1.23, on 2018-01-04.
  * Once those warnings hit stable, and after a couple weeks of seeing whether we would get any more reports than what we got from sitting on nightly/beta, [we switched the renderers](https://github.com/rust-lang/rust/pull/47398), making Pulldown the default but still offering the option to use Hoedown.

And that brings us to the present. We haven't received more new issues from this in the meantime, and the "switch by default" is now on beta. Our reasoning is that, at this point, anyone who would have been affected by this has run into it already.
2018-02-16 23:17:15 +01:00
Guillaume Gomez e2bd0e15dc Update html-diff crate => fix unicode parsing and invalid paths 2018-01-15 00:40:49 +01:00
bors a2899408dd Auto merge of #46503 - Aaron1011:librustdoc_log, r=Mark-Simulacrum
Remove librustdoc dependency on log

This change should have been included in PR #46386.

Since librustdoc doesn't explicitly depend on internal crates
(such as librustc_driver) through its Cargo.toml, it ends up using the
sysroot to resolve them. By removing the dependency on 'log',
we ensure that the syroot is used to resolve `log` as well. This ensures
that only one version of log is in use, so that `env_logger::init()`
enables all uses of `log!` macros.
2017-12-05 09:00:35 +00:00
Aaron Hill f6d3900642
Remove librustdoc dependency on log
This change should have been included in PR #46386.

Since librustdoc doesn't explicitly depend on internal crates
(such as librustc_driver) through its Cargo.toml, it ends up using the
sysroot to resolve them. By removing the dependency on 'log',
we ensure that the syroot is used to resolve `log` as well. This ensures
that only one version of log is in use, so that `env_logger::init()`
enables all uses of `log!` macros.
2017-12-04 17:16:19 -05:00
Irina-Gabriela Popa 2c175df013 rustc_back: replace tempdir with crates.io version. 2017-12-04 18:25:31 +02:00
Aaron Hill 21228a82b0
Remove librustdoc dependency on env_logger
We want librustdoc to pickup the env_logger dependency from
the sysroot. This ensures that the same copy of env_logger is used
for both internal crates (e.g. librustc_driver, libsyntax) and
librustdoc

Closes #46383
2017-11-29 18:10:42 -05:00
Ariel Ben-Yehuda 3801c0594c update Cargo.lock & rustdoc
This is required because the old version depended on tendril 0.3.1,
which used `repr(packed)` incorrectly - see
https://github.com/kuchiki-rs/kuchiki/pull/38
2017-11-26 16:12:42 +02:00