about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
AgeCommit message (Collapse)AuthorLines
2019-08-31Auto merge of #63703 - tommilligan:warn-empty-doctest, r=ollie27bors-0/+32
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-24Improve Rustdoc's handling of procedural macrosAaron Hill-7/+8
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-19librustdoc: warn on empty doc testTom Milligan-0/+32
2019-08-05adapt rustdoc to infailable lexerAleksey Kladov-14/+154
2019-08-02Replace `abstract type` with type alias `impl Trait`varkor-1/+1
2019-08-02Replace "existential" by "opaque"varkor-3/+4
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-5/+5
https://github.com/rust-lang/rust/issues/60532
2019-07-06force single-threaded text executionQuietMisdreavus-2/+2
2019-07-06rustdoc: set cfg(doctest) when collecting doctestsQuietMisdreavus-3/+14
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-15/+15
2019-06-08Fix tests after revert of rustdoc cfg(test) featureOliver Middleton-3/+6
2019-06-05Reblessed tests.Alexander Regueiro-1/+1
2019-05-22do not print panic message on doctest failuresAndy Russell-18/+110
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-3/+3
2019-05-18Update rustdoc-ui testsGuillaume Gomez-8/+38
2019-05-18Fix lints handling in rustdocGuillaume Gomez-0/+39
2019-05-03Rollup merge of #60220 - euclio:rustdoc-test-fatal-parsing-errors, ↵Mazdak Farrokhzad-2/+36
r=QuietMisdreavus report fatal errors during doctest parsing Fixes #59557.
2019-04-26Rollup merge of #59940 - GuillaumeGomez:rustdoc-test, r=ollie27Mazdak Farrokhzad-0/+25
Set cfg(test) when rustdoc is running with --test option Following a [discussion on twitter](https://twitter.com/burntsushi5/status/1117091914199785473), I proposed this change. What do you think about it? r? @QuietMisdreavus cc @BurntSushi
2019-04-24Add test for rustdoc cfg(test) featureGuillaume Gomez-0/+25
2019-04-24report fatal errors during doctest parsingAndy Russell-2/+36
2019-04-23Remove unnecessary tidy ignore directivesvarkor-4/+2
2019-03-25compiletest: make path normalization smarterAndy Russell-41/+41
2019-03-15use `!` in macro disambiguation suggestionAndy Russell-3/+3
2019-03-15replace ad-hoc namespace enumsAndy Russell-5/+5
2019-03-15overhaul intra-doc-link ambiguity warningAndy Russell-0/+118
- Makes the warning part of the `intra_doc_link_resolution_failure` lint. - Tightens the span to just the ambiguous link. - Reports ambiguities across all three namespaces. - Uses structured suggestions for disambiguation. - Adds a test for the warnings.
2019-03-11Update testsVadim Petrochenkov-7/+7
2019-03-10Make the rustc driver and interface demand drivenJohn Kåre Alsaker-4/+19
2019-03-09Rollup merge of #58626 - QuietMisdreavus:doc-coverage, r=GuillaumeGomezMazdak Farrokhzad-0/+222
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-28update rustdoc coverage tests with new table layoutQuietMisdreavus-80/+51
2019-02-28add tests for doc coverageQuietMisdreavus-0/+251
2019-02-28Introduce rustc_interface and move some methods thereJohn Kåre Alsaker-2/+2
2019-02-23move collapse and unindent docs passes earlierAndy Russell-2/+24
2019-02-19Auto merge of #56514 - ollie27:rustdoc_test_libdir, r=QuietMisdreavusbors-2/+2
rustdoc: Don't modify library path for doctests It shouldn't be needed anymore because doctests are no longer compiled with `prefer-dynamic` (since #54939). r? @QuietMisdreavus
2019-01-20Auto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavusbors-10/+156
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-20rustdoc: Don't modify library path for doctestsOliver Middleton-2/+2
It shouldn't be needed anymore because doctests are no longer compiled with `prefer-dynamic`.
2019-01-17Bless test.Wesley Norris-2/+2
Bless test, remove submodule, and fix book entry. bless test again? maybe it'll work this time...
2019-01-17Minor changes to wording and formatting.Wesley Norris-3/+2
2019-01-17Bless test.Wesley Norris-2/+3
2019-01-17Auto merge of #57520 - alexreg:tidy-copyright-lint, r=Mark-Simulacrumbors-25/+5
Add lint for copyright headers to 'tidy' tool r? @Mark-Simulacrum CC @centril
2019-01-14rustdoc: check code block syntax in early passAndy Russell-10/+156
2019-01-13Removed more copyright notices.Alexander Regueiro-25/+5
2019-01-13Account for 2 removed lines in src/librustdoc/test.rsIgor Matuszewski-2/+2
2019-01-06check missing docs for reexported macros as wellGuillaume Gomez-0/+67
2019-01-02make `panictry!` private to libsyntaxAndy Russell-2/+2
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-25Remove licensesMark Rousskov-156/+47
2018-12-19Rollup merge of #56689 - QuietMisdreavus:rustdoc-lint-group, r=pnkfelixPietro Albini-0/+78
add a lint group for lints emitted by rustdoc As rustdoc adds more lints that it specifically manages, it would be nice to be able to lump them all together. This gives us a new group just for that. I deliberately didn't include `missing_docs` because this is kind of a stepping stone for moving our lints into tool lints (i.e. `#![warn(rustdoc::private_doc_tests)]`), since all of these are specifically emitted by rustdoc. If we want to move `missing_docs` out of the compiler, that's also an option, but it would create a surprising change of behavior. I also took the chance to rewrite the lint descriptions of these lints to better match the style of the other lints. `>_>`
2018-12-14Rollup merge of #56748 - kinnison:kinnison/fix-56734, r=dtolnaykennytm-2/+2
Update panic message to be clearer about env-vars Esteban Kuber requested that the panic message make it clear that `RUST_BACKTRACE=1` is an environment variable. This change makes that clear. I understand that this may simply be closed if the concept isn't accepted, and I'd be fine with that :-) Fixes #56734
2018-12-13Update panic message to be clearer about env-varsDaniel Silverstone-2/+2
Esteban Kuber requested that the panic message make it clear that `RUST_BACKTRACE=1` is an environment variable. This change makes that clear. Wording provided in part by David Tolnay.
2018-12-10fix intra-link resolution spans in block commentsAndy Russell-24/+163
This commit improves the calculation of code spans for intra-doc resolution failures. All sugared doc comments should now have the correct spans, including those where the comment is longer than the docs. It also fixes an issue where the spans were calculated incorrectly for certain unsugared doc comments. The diagnostic will now always use the span of the attributes, as originally intended. Fixes #55964.
2018-12-10add a lint group for lints emitted by rustdocQuietMisdreavus-0/+78