summary refs log tree commit diff
path: root/src/test/rustdoc-ui
AgeCommit message (Collapse)AuthorLines
2021-11-26Rollup merge of #91259 - jyn514:doctest-warnings, r=GuillaumeGomezMatthias Krüger-7/+47
Remove `--display-doctest-warnings` `--display-doctest-warnings` can be replicated in full with other existing features, there's no need to have a separate option for it. This removes the option and documents the combination of other features to replicate it. This also fixes a bug where `--test-args=--show-output` had no effect. cc `@ollie27,` https://github.com/rust-lang/rust/pull/73314#issuecomment-668317262 Fixes https://github.com/rust-lang/rust/issues/41574 r? `@GuillaumeGomez`
2021-11-26Remove `--display-doctest-warnings`Joshua Nelson-7/+47
This can be replicated in full with other existing features, there's no need to have a separate option for it. This also fixes a bug where `--test-args=--show-output` had no effect, and updates the documentation.
2021-11-27Reduce the ICEDeadbeef-469/+1
2021-11-27Add ICE testDeadbeef-0/+472
2021-11-24Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelidGuillaume Gomez-3/+2
Create rustdoc_internals feature gate As suggested by ``@camelid`` [here](https://github.com/rust-lang/rust/pull/90398#issuecomment-955093851), since `doc_keyword` and `doc_primitive` aren't meant to be stabilized, we could put them behind a same feature flag. This is pretty much what it would look like (needs to update the tests too). The tracking issue is https://github.com/rust-lang/rust/issues/90418. What do you think ``@rust-lang/rustdoc`` ?
2021-11-24Create rustdoc_internals feature gateGuillaume Gomez-3/+2
2021-11-22Update issue-91134.stdoutMichael Howell-1/+1
2021-11-22fix(doctest): detect extern crate items in statement doctestsMichael Howell-0/+23
This partially reverts #91026, because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly. Fixes #91134
2021-11-18rustdoc doctest: detect `fn main` after an unexpected semicolonMichael Howell-0/+42
The basic problem with this is that rustdoc, when hunting for `fn main`, will stop parsing after it reaches a fatal error. This unexpected semicolon was a fatal error, so in `src/test/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs`, it would wrap the doctest in an implied main function, turning it into this: fn main() { struct S {}; fn main() { assert_eq!(0, 1); } } This, as it turns out, is totally valid, and it executes no assertions, so *it passes,* even though the user wanted it to execute the assertion. The Rust parser already has the ability to recover from these unexpected semicolons, but to do so, it needs to use the `parse_mod` function, so this commit changes it to do that.
2021-11-08Add more missing methods to `IntraLinkCrateLoader`Joshua Nelson-0/+30
This helps with (but does not fix) https://github.com/rust-lang/rust/issues/84738. I tested on https://github.com/jyn514/objr/commit/edcee7b8124abf0e4c63873e8422ff81beb11ebb and still hit ICEs.
2021-10-30Rollup merge of #90183 - GuillaumeGomez:recurse-deref, r=jyn514Guillaume Gomez-0/+19
Show all Deref implementations recursively Fixes #87783. This is a re-implementation of #80653, so taking the original PR comment: This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level. ![image](https://user-images.githubusercontent.com/279572/103482863-46723b00-4ddb-11eb-972b-c463351a425c.png) cc `@camelid` r? `@jyn514`
2021-10-29Unify titles in rustdoc book doc attributes chapterGuillaume Gomez-2/+2
2021-10-29Add tests for recursive derefGuillaume Gomez-0/+19
2021-10-23Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-0/+6
Scrape code examples from examples/ directory for Rustdoc Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123 Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525 Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-22Revert def_id addition from clean::Function, add test forWill Crichton-3/+6
scrape-examples options
2021-10-20Add test to ensure that the missing_doc_code_examples is not triggered on ↵Guillaume Gomez-1/+10
foreign trait implementations
2021-10-17Rollup merge of #89907 - GuillaumeGomez:correctly-emit-errors, r=camelidYuki Okushi-1/+0
Remove FIXME since there is nothing to be fixed Resolves #88593. The errors are deduplicated when displayed to users. They only appear multiple times in UI tests. cc ``@jyn514`` r? ``@camelid``
2021-10-16Remove FIXME since there is nothing to be fixed.Guillaume Gomez-1/+0
The errors are deduplicated when displayed to users. They only appear multiple times in UI tests.
2021-10-15Bless testsCameron Steffen-1/+1
2021-10-06Change serialized format to use DefPathHash instead of custom StringWill Crichton-0/+3
Move test to rustdoc-ui Fix test writing to wrong directory Formatting Fix test Add FIXME Remove raw multiline strings
2021-10-06Simplify AttributesExt::cfg function and remove error emissions since they ↵Guillaume Gomez-0/+35
are not useful
2021-10-05Add test case for `doc_cfg_hide` feature gateJoshua Nelson-0/+21
2021-09-26Use the correct edition when syntax highlighting doctestsJoshua Nelson-0/+38
Previously it would unconditionally use edition 2015, which was incorrect.
2021-09-17Don't lint about missing code examples in derived traitsHans-0/+9
Fixes #81775
2021-09-14Auto merge of #73314 - GuillaumeGomez:display-warnings, r=jyn514bors-0/+33
Rename "--display-warnings" to "--display-doctest-warnings" Fixes #41574. cc `@ollie27` r? `@kinnison`
2021-09-14Add test for --display-doctest-warnings optionGuillaume Gomez-0/+33
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-5/+5
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
2021-09-13Auto merge of #88745 - hnj2:allow-trait-impl-missing-code, r=GuillaumeGomezbors-0/+7
Allow missing code examples in trait impls. Excludes Trait implementations from the items that need to have doc code examples when using the `rustdoc::missing_doc_code_examples` lint. For details see #88741 fixes #88741 r? `@jyn514`
2021-09-12Fix broken handling of primitive itemsJoshua Nelson-38/+7
- Fix broken handling of primitive associated items - Remove fragment hack Fixes 83083 - more logging - Update CrateNum hacks The CrateNum has no relation to where in the dependency tree the crate is, only when it's loaded. Explicitly special-case core instead of assuming it will be the first DefId. - Update and add tests - Cache calculation of primitive locations This could possibly be avoided by passing a Cache into collect_intra_doc_links; but that's a much larger change, and doesn't seem valuable other than for this.
2021-09-10Add test for enum tuple variants and tuple struct doc countGuillaume Gomez-2/+71
2021-09-09Allow missing code examples in trait impls.Hans Niklas Jacob-0/+7
2021-09-05Auto merge of #88604 - camelid:rustdoc-lifetime-bounds, r=GuillaumeGomezbors-0/+19
rustdoc: Clean up handling of lifetime bounds Previously, rustdoc recorded lifetime bounds by rendering them into the name of the lifetime parameter. Now, it leaves the name as the actual name and instead records lifetime bounds in an `outlives` list, similar to how type parameter bounds are recorded. Also, higher-ranked lifetimes cannot currently have bounds, so I simplified the code to reflect that. r? `@GuillaumeGomez`
2021-09-02rustdoc: Higher-ranked lifetimes can't have boundsNoah Lev-0/+19
This cleans up the other spot I found where rustdoc was rendering bounds into the lifetime name itself. However, in this case, I don't think it could have actually happened because higher-ranked lifetime definitions aren't currently allowed to have bounds.
2021-09-01rustdoc: Don't panic on ambiguous inherent associated typesNoah Lev-0/+32
Instead, return `Type::Infer` since compilation should fail anyway. That's how rustdoc handles `hir::TyKind::Err`s, so this just extends that behavior to `ty::Err`s when analyzing associated types. For some reason, the error is printed twice with rustdoc (though only once with rustc). I'm not sure why that is, but it's better than panicking. This commit also makes rustdoc fail early in the non-projection, non-error case, instead of returning a `Res::Err` that would likely cause rustdoc to panic later on. This change is originally from #88379.
2021-08-28Update testsinquisitivecrystal-1/+1
2021-08-26Rollup merge of #88215 - jyn514:lazy-loading, r=petrochenkovManish Goregaokar-0/+20
Reland #83738: "rustdoc: Don't load all extern crates unconditionally" I hopefully found all the bugs :crossed_fingers: time for a take two. See the last commit for details on what went wrong before. r? `@petrochenkov` (but feel free to reassign to Guillaume if you don't have time.) Closes https://github.com/rust-lang/rust/issues/68427. Includes a fix for https://github.com/rust-lang/rust/issues/84738.
2021-08-22Revert "Revert "Don't load all extern crates unconditionally""Joshua Nelson-0/+20
This reverts commit 5f0c54db4e595a6a77048f2b0605138ffa49a326.
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-16Move working checks into separate test filesGuillaume Gomez-2/+8
2021-08-16Add UI tests for doc(test(...)) attribute checksGuillaume Gomez-0/+50
2021-08-16feature gate doc(primitive)Joshua Nelson-0/+1
2021-08-12Use smaller spans for some structured suggestionsEsteban Kuber-5/+5
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
2021-08-11Modify structured suggestion outputEsteban Küber-55/+62
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-05Ensure that --generate-link-to-definition is only used with HTML output and ↵Guillaume Gomez-0/+24
is unstable
2021-07-29Auto merge of #87285 - GuillaumeGomez:intra-doc-span, r=estebankbors-92/+166
Improve intra doc errors display #87169 `@jyn514` This is what I had in mind to avoid having duplicated backticks. I also gave a try to simply updating the span for the suggestion/help messages but I think this current one is better because less "noisy". Anyway, that allows you to see the result. ;)
2021-07-29Update rustdoc-ui tests for intra-doc links errorsGuillaume Gomez-92/+166
2021-07-29Rollup merge of #87451 - GuillaumeGomez:tuple-struct-field-doc, r=jyn514Yuki Okushi-2/+2
Add support for tuple struct field documentation Fixes #42615. This is #80320 updated to new codebase and with added tests. Part of https://github.com/rust-lang/rust/issues/83255. cc ```@camelid``` (since you were involved on the original PR). r? ```@jyn514```
2021-07-27Make all tests use type_alias_impl_trait feature instead of minSantiago Pastorino-3/+3
2021-07-26Add test for enum item tuple fields documentationGuillaume Gomez-2/+2
2021-07-20Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebankbors-1/+1
Suggest lint groups Fixes rust-lang/rust-clippy#6986