summary refs log tree commit diff
path: root/src/librustdoc/lib.rs
AgeCommit message (Collapse)AuthorLines
2019-06-26remove unused derives and variantsAndy Russell-2/+0
2019-06-21Add DocFS layer to rustdocRobert Collins-0/+1
* 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-11rustdoc: deny(unused_lifetimes).Eduard-Mihai Burtescu-0/+1
2019-05-21Specify the edition for the rustdoc thread-poolJohn Kåre Alsaker-3/+6
2019-05-06set the default edition when pre-parsing a doctestQuietMisdreavus-3/+8
2019-04-17Deny `internal` in stage0Mateusz Mikuła-1/+1
2019-04-03Deny internal lints on two more cratesflip1995-0/+1
- libfmt_macros - librustdoc
2019-03-28Remove unnecessary with_globals callsJohn Kåre Alsaker-2/+2
2019-03-15rustc: uniformize ty::print's error handling by requiring Result.Eduard-Mihai Burtescu-0/+1
2019-03-15rustc: merge PrintCx::parameterized and def_path printing.Eduard-Mihai Burtescu-0/+1
2019-03-15rustc: move the formatter into ty::print::PrintCx.Eduard-Mihai Burtescu-0/+1
2019-03-10Make the rustc driver and interface demand drivenJohn Kåre Alsaker-6/+5
2019-03-09Rollup merge of #58626 - QuietMisdreavus:doc-coverage, r=GuillaumeGomezMazdak Farrokhzad-0/+12
rustdoc: add option to calculate "documentation coverage" This PR adds a new flag to rustdoc, `--show-coverage`. When passed, this flag will make rustdoc count the number of items in a crate with documentation instead of generating docs. This count will be output as a table of each file in the crate, like this (when run on my crate `egg-mode`): ``` +-------------------------------------+------------+------------+------------+ | File | Documented | Total | Percentage | +-------------------------------------+------------+------------+------------+ | src/auth.rs | 16 | 16 | 100.0% | | src/common/mod.rs | 1 | 1 | 100.0% | | src/common/response.rs | 9 | 9 | 100.0% | | src/cursor.rs | 24 | 24 | 100.0% | | src/direct/fun.rs | 6 | 6 | 100.0% | | src/direct/mod.rs | 41 | 41 | 100.0% | | src/entities.rs | 50 | 50 | 100.0% | | src/error.rs | 27 | 27 | 100.0% | | src/lib.rs | 1 | 1 | 100.0% | | src/list/fun.rs | 19 | 19 | 100.0% | | src/list/mod.rs | 22 | 22 | 100.0% | | src/media/mod.rs | 27 | 27 | 100.0% | | src/place/fun.rs | 8 | 8 | 100.0% | | src/place/mod.rs | 35 | 35 | 100.0% | | src/search.rs | 26 | 26 | 100.0% | | src/service.rs | 74 | 74 | 100.0% | | src/stream/mod.rs | 49 | 49 | 100.0% | | src/tweet/fun.rs | 15 | 15 | 100.0% | | src/tweet/mod.rs | 73 | 73 | 100.0% | | src/user/fun.rs | 24 | 24 | 100.0% | | src/user/mod.rs | 87 | 87 | 100.0% | +-------------------------------------+------------+------------+------------+ | Total | 634 | 634 | 100.0% | +-------------------------------------+------------+------------+------------+ ``` Trait implementations are not counted because by default they "inherit" the docs from the trait, even though an impl can override those docs. Similarly, inherent impl blocks are not counted at all, because for the majority of cases such docs are not useful. (The usual pattern for inherent impl blocks is to throw all the methods on a type into a single impl block. Any docs you would put on that block would be better served on the type itself.) In addition, `--show-coverage` can be combined with `--document-private-items` to get the coverage counts for everything in the crate, not just public items. The coverage calculation is implemented as a late pass and two new sets of passes which strip out most of the work that rustdoc otherwise does when generating docs. The is because after the new pass is executed, rustdoc immediately closes instead of going on to generate documentation. Many examples of coverage calculations have been included as `rustdoc-ui` tests. r? @rust-lang/rustdoc
2019-02-28add option to calculate documentation coverageQuietMisdreavus-0/+12
2019-02-28Introduce rustc_interface and move some methods thereJohn Kåre Alsaker-0/+1
2019-02-23merge early and late passes into single structAndy Russell-22/+0
2019-02-23Transition librustdoc to 2018 editionHirokazu Hata-5/+2
2019-02-17Rollup merge of #57929 - GuillaumeGomez:rustodc-remove-old-style-files, ↵kennytm-0/+5
r=ollie27 Rustdoc remove old style files Reopening of #56577 (which I can't seem to reopen...). I made the flag unstable so with this change, what was blocking the PR is now gone I assume.
2019-02-12Stabilize slice_sort_by_cached_keyScott McMurray-1/+0
2019-02-07Remove images' url to make it work even without internet connectionGuillaume Gomez-3/+1
2019-01-27Make 'generate-redirect-pages' option unstableGuillaume Gomez-1/+1
2019-01-27Add generate-old-style-files option to rustdocGuillaume Gomez-0/+5
2019-01-20Auto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavusbors-0/+1
rustdoc: overhaul code block lexing errors Fixes #53919. This PR moves the reporting of code block lexing errors from rendering time to an early pass, so we can use the compiler's error reporting mechanisms. This dramatically improves the diagnostics in this situation: we now de-emphasize the lexing errors as a note under a warning that has a span and suggestion instead of just emitting errors at the top level. Additionally, this PR generalizes the markdown -> source span calculation function, which should allow other rustdoc warnings to use better spans in the future. Last, the PR makes sure that the code block is always emitted in the docs, even if it fails to highlight correctly. Of note: - The new pass unfortunately adds another pass over the docs to gather the doc blocks for syntax-checking. I wonder if this could be combined with the pass that looks for testable blocks? I'm not familiar with that code, so I don't know how feasible that is. - `pulldown_cmark` doesn't make it easy to find the spans of the code blocks, so the code that calculates the spans is a little nasty. It works for all the test cases I threw at it, but I wouldn't be surprised if an edge case would break it. Should have a thorough review. - This PR worsens the state of #56885, since those certain fatal lexing errors are now emitted before docs get generated at all.
2019-01-17Add book section and fix typo.Wesley Norris-0/+1
2019-01-17Minor changes to wording and formatting.Wesley Norris-1/+1
2019-01-17Persist doc test executables to given path.Wesley Norris-0/+5
2019-01-14rustdoc: check code block syntax in early passAndy Russell-0/+1
2019-01-02make `panictry!` private to libsyntaxAndy Russell-1/+1
This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.
2018-12-29Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavusbors-0/+5
Add no-crate filter option on rustdoc @onur asked me about it so here it is! r? @QuietMisdreavus
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-24Add no-crate filter option on rustdocGuillaume Gomez-0/+5
2018-12-20new --static-root-path flag for controlling static file locationsQuietMisdreavus-0/+8
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-05emit error when doc generation failsAndy Russell-3/+15
Fixes #41813.
2018-11-10move all static-file include!s into a single moduleQuietMisdreavus-0/+1
2018-11-02pass the Options struct instead of individual argsQuietMisdreavus-53/+9
2018-11-02split off a separate RenderOptions structQuietMisdreavus-25/+33
2018-11-02swap uses of Matches with pre-parsed argsQuietMisdreavus-97/+31
2018-11-02parse command-line into a central Options structQuietMisdreavus-298/+38
2018-11-02Auto merge of #54543 - GuillaumeGomez:top-level-index, r=QuietMisdreavusbors-14/+37
Add index page argument @Mark-Simulacrum: I might need some help from you: in bootstrap, I want to add an argument (a new flag added into `rustdoc`) in order to generate the current index directly when `rustdoc` is documenting the `std` lib. However, my change in `bootstrap` didn't do it and I assume it must be moved inside the `Std` struct. But there, I don't see how to pass it to `rustdoc` through `cargo`. Did I miss anything? r? @QuietMisdreavus
2018-10-26Remove redundant cloneShotaro Yamada-1/+1
2018-10-21Use markdown::render instead of using pulldown_cmark directlyGuillaume Gomez-13/+14
2018-10-21Add index pageGuillaume Gomez-1/+23
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-1/+1
2018-09-22Rollup merge of #54371 - QuietMisdreavus:rustdoc-ui-testing, r=GuillaumeGomezPietro Albini-3/+9
add -Zui-testing to rustdoc Before we depend on the `rustdoc-ui` tests some more, let's make rustdoc act the same as the compiler when they're actually being executed.
2018-09-20shuffle ownership of `external_traits`QuietMisdreavus-0/+1
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-20don't index trait impls if the trait isn't also documentedQuietMisdreavus-0/+1
2018-09-19add -Zui-testing to rustdocQuietMisdreavus-3/+9
2018-09-18Rollup merge of #54205 - GuillaumeGomez:treat-err-as-bug, r=QuietMisdreavusGuillaume Gomez-3/+10
Add treat-err-as-bug flag in rustdoc cc @nikomatsakis r? @QuietMisdreavus
2018-09-15rustc: add unstable support for --extern crate_name without a path.Eduard-Mihai Burtescu-4/+7