about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2020-08-28Rollup merge of #75330 - Nemo157:improve-doc-cfg-features, r=GuillaumeGomezPietro Albini-5/+21
Improve rendering of crate features via doc(cfg) The current rendering of crate features with `doc(cfg(feature = ".."))` is verbose and unwieldy for users, `doc(cfg(target_feature = ".."))` is special-cased to make it render nicely, and a similar rendering can be applied to `doc(cfg(feature))` to make it easier for users to read. I also added special casing of `all`/`any` cfgs consisting of just `feature`/`target-feature` to remove the repetitive "target/crate feature" prefix. The downside of this current rendering is that there is no distinction between `feature` and `target_feature` in the shorthand display. IMO this is ok, or if anything `target_feature` should have a more verbose shorthand, because `doc(cfg(feature = ".."))` usage is going to vastly outstrip `doc(cfg(target_feature = ".."))` usage in non-stdlib crates when it eventually stabilizes (or even before that given the number of crates using `cfg_attr(docsrs)` like constructs). ## Previously <img width="259" alt="Screenshot 2020-08-09 at 13 32 42" src="https://user-images.githubusercontent.com/81079/89731110-d090c000-da44-11ea-96fa-56adc6339123.png"> <img width="438" alt="image" src="https://user-images.githubusercontent.com/81079/89731116-d7b7ce00-da44-11ea-87c6-022d192d6eca.png"> <img width="765" alt="image" src="https://user-images.githubusercontent.com/81079/89731152-24030e00-da45-11ea-9552-1c270bff2729.png"> <img width="671" alt="image" src="https://user-images.githubusercontent.com/81079/89731158-28c7c200-da45-11ea-8acb-97d8a4ce00eb.png"> ## Now <img width="216" alt="image" src="https://user-images.githubusercontent.com/81079/89731123-e1d9cc80-da44-11ea-82a8-5900bd9448a5.png"> <img width="433" alt="image" src="https://user-images.githubusercontent.com/81079/89731127-e8684400-da44-11ea-9d18-572fd810f19f.png"> <img width="606" alt="image" src="https://user-images.githubusercontent.com/81079/89731162-2feed000-da45-11ea-98d2-8a88c364d903.png"> <img width="669" alt="image" src="https://user-images.githubusercontent.com/81079/89731991-ccb46c00-da4b-11ea-9416-cd20a3193826.png"> cc #43781
2020-08-23Update primitive test to match the new behaviorJoshua Nelson-8/+8
2020-08-22rustdoc: Add support for associated items even outside the impl itselfJoshua Nelson-0/+86
Previously, associated items would only be available for linking directly on the `impl Trait for Type`. Now they can be used anywhere. - Make `item` for resolve mandatory - Refactor resolving associated items into a separate function - Remove broken trait_item logic - Don't skip the type namespace for associated items - Only call `variant_field` for `TypeNS` - Add test for associated items - Use exhaustive matches instead of wildcards Wildcards caused several bugs while implementing this.
2020-08-19Add test for f32 and f64 methodsJoshua Nelson-2/+20
2020-08-19Add a testJoshua Nelson-0/+14
2020-08-18Add long cfg description to tooltip on short descriptionWim Looman-1/+17
2020-08-17Resolve true and false as booleansJoshua Nelson-0/+10
2020-08-12Auto merge of #75205 - Aaron1011:fix/auto-trait-proj-ice, r=nikomatsakisbors-0/+25
Handle projection predicates in the param env for auto-trait docs Fixes #72213 Any predicates in the param env are guaranteed to hold, so we don't need to do any additional processing of them if we come across them as sub-obligations of a different predicate. This allows us to avoid adding the same predicate to the computed ParamEnv multiple times (but with different regions each time), which causes an ambiguity error during fulfillment.
2020-08-10Auto merge of #74936 - GuillaumeGomez:const-rustc_const_unstable, r=jyn514bors-0/+9
Don't print "const" keyword on non-nightly build if rustc_const_unstable is used on the item Fixes #74579.
2020-08-10Add test for rustc_const_unstable on methodsGuillaume Gomez-0/+9
2020-08-09Give precedence to primitives over modulesJoshua Nelson-1/+6
This has less surprising behavior when there is a module with the same name as a primitive in scope.
2020-08-09Render longhand multiple crate/target features nicerWim Looman-2/+2
2020-08-09Improve rendering of crate features via doc(cfg)Wim Looman-5/+5
2020-08-08Rollup merge of #75237 - nbdd0121:rustdoc, r=jyn514Yuki Okushi-0/+54
Display elided lifetime for non-reference type in doc In edition 2018 we encourage writing `<'_>` explicitly, so rustdoc should display like such as well. Fixes #75225 ~~Somehow when I run the compiled rustdoc using `cargo +stage2 doc` on other crates, it correctly produces `<'_>`, but I couldn't get the std doc to do the same with `./x.py doc --stage 2`. Might this be related to the recent change to x.py about how the doc is built?~~
2020-08-08Cross-crate doc inlining test case for elided lifetimeGary Guo-14/+22
2020-08-07Display elided lifetime for external pathsGary Guo-0/+13
2020-08-07Display elided lifetime for non-reference type in docGary Guo-0/+33
2020-08-06Fix outdated codeJoshua Nelson-3/+3
2020-08-06Improve testsJoshua Nelson-2/+11
2020-08-05Handle projection predicates in the param env for auto-trait docsAaron Hill-0/+25
Fixes #72213 Any predicates in the param env are guaranteed to hold, so we don't need to do any additional processing of them if we come across them as sub-obligations of a different predicate. This allows us to avoid adding the same predicate to the computed ParamEnv multiple times (but with different regions each time), which causes an ambiguity error during fulfillment.
2020-08-02Don't mark associated items as traitsJoshua Nelson-0/+3
This caused the following false positive: ``` warning: unresolved link to `Default::default` --> /home/joshua/rustc2/default.rs:1:14 | 1 | /// Link to [Default::default()] | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(broken_intra_doc_links)]` on by default note: this item resolved to a trait, which did not match the disambiguator 'fn' --> /home/joshua/rustc2/default.rs:1:14 | 1 | /// Link to [Default::default()] | ^^^^^^^^^^^^^^^^^^ ```
2020-08-01Rollup merge of #74992 - lcnr:fix-generic-param-order, r=GuillaumeGomezManish Goregaokar-2/+2
fix rustdoc generic param order fixes #61292 r? @varkor cc @GuillaumeGomez
2020-07-31fix rustdoc generic param orderBastian Kauschke-2/+2
2020-07-30intra_doc_resolution_failures -> broken_intra_doc_linksManish Goregaokar-27/+27
2020-07-30Rename to intra_doc_resolution_failuresManish Goregaokar-27/+27
2020-07-29Rename usage of intra_doc_link_resolution_failureManish Goregaokar-27/+27
2020-07-29handle ConstEquate in rustdocBastian Kauschke-0/+18
2020-07-19Only skip impls of foreign unstable traitsMark Rousskov-0/+37
Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.
2020-07-17Add test for module ambiguityManish Goregaokar-0/+18
2020-07-16Update src/test/rustdoc/intra-doc-crate/auxiliary/hidden.rsManish Goregaokar-2/+2
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-07-16Add test for doc(hidden) intra-doc cross-crate reexportsManish Goregaokar-0/+29
2020-07-16Rollup merge of #74351 - lzutao:remove-rustc-internal-compiler-warns, ↵Manish Goregaokar-4/+6
r=Mark-Simulacrum Do not render unstable items for rustc doc See the zulip conversion: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rustc.20doc.3A.20.22internal.20compiler.20API.22.20warns.20are.20everywhere!/near/203850782 Before: ![image](https://user-images.githubusercontent.com/15225902/87501971-9cff8780-c68a-11ea-93b4-ea53ce18a77b.png) After: ![image](https://user-images.githubusercontent.com/15225902/87501985-a7218600-c68a-11ea-81c0-a6b5b120832c.png) Nothing changes in unstable items of std: Before: ![image](https://user-images.githubusercontent.com/15225902/87502004-b7d1fc00-c68a-11ea-9224-a27a1d2a81d6.png) After: ![image](https://user-images.githubusercontent.com/15225902/87502018-c0c2cd80-c68a-11ea-9773-4c63158025cb.png) Closes #54682
2020-07-16Fix invalid lintJoshua Nelson-11/+11
intra_doc_resolution_failure is not a lint.
2020-07-16Add (broken and ignored) test for #73829Joshua Nelson-2/+4
2020-07-16Support intra-doc links on trait and module re-exportsJoshua Nelson-0/+46
Trait implementations are treated the same as modules for the purposes of intra-doc links.
2020-07-16Support intra-doc links on macro re-exportsJoshua Nelson-0/+42
This includes both `macro_rules!` and proc-macros.
2020-07-16rand -> my_randJoshua Nelson-4/+4
This fixes a failure in stage2 rustdoc tests.
2020-07-16 #![deny(intra_doc_resolution_failure)]Joshua Nelson-0/+12
2020-07-16Add test for submodules in inner crateJoshua Nelson-3/+20
2020-07-16Add test for documenting the re-exportJoshua Nelson-0/+13
2020-07-16Add test for re-exportsJoshua Nelson-0/+28
I had a hard time getting this to work without the `extern crate`, suggestions are welcome.
2020-07-16Add tests for basic intra-doc linksJoshua Nelson-0/+11
2020-07-16Rollup merge of #74370 - Manishearth:re-spotlight, r=GuillaumeGomezManish Goregaokar-0/+36
Reintroduce spotlight / "important traits" feature (Reopened version of https://github.com/rust-lang/rust/pull/74111 because Github is broken, see discussion there) Fixes https://github.com/rust-lang/rust/issues/73785 This PR reintroduces the "spotlight" ("important traits") feature. A couple changes have been made: As there were concerns about its visibility, it has been moved to be next to the return type, as opposed to being on the side. It also no longer produces a modal, it shows the traits on hover, and it can be clicked on to pin the hover bubble. ![image](https://user-images.githubusercontent.com/1617736/86674555-a82d2600-bfad-11ea-9a4a-a1a9ffd66ae5.png) ![image](https://user-images.githubusercontent.com/1617736/86674533-a1061800-bfad-11ea-9e8a-c62ad86ed0d7.png) It also works fine on mobile: ![image](https://user-images.githubusercontent.com/1617736/86674638-bda25000-bfad-11ea-8d8d-1798b608923e.png)
2020-07-16Revert "Remove "important traits" feature"Manish Goregaokar-0/+36
This reverts commit 1244ced9580b942926afc06815e0691cf3f4a846.
2020-07-15Add test case for #65863Joshua Nelson-0/+15
2020-07-15Don't ICE on errors in function returning impl traitJoshua Nelson-0/+14
Instead, report the error. This emits the errors on-demand, without special-casing `impl Trait`, so it should catch all ICEs of this kind, including ones that haven't been found yet. Since the error is emitted during type-checking there is less info about the error; see comments in the code for details. - Add test case for -> impl Trait - Add test for impl trait with alias - Move EmitIgnoredResolutionErrors to rustdoc This makes `fn typeck_item_bodies` public, which is not desired behavior. That change should be removed once https://github.com/rust-lang/rust/pull/74070 is merged. - Don't visit nested closures twice
2020-07-15Add `rustdoc` tests from #72088Dylan MacKenzie-0/+16
2020-07-15Add an option not to report resolution errors for rustdocJoshua Nelson-3/+1
- Remove unnecessary `should_loop` variable - Report errors for trait implementations These should give resolution errors because they are visible outside the current scope. Without these errors, rustdoc will give ICEs: ``` thread 'rustc' panicked at 'attempted .def_id() on invalid res: Err', /home/joshua/src/rust/src/libstd/macros.rs:16:9 15: rustc_hir::def::Res<Id>::def_id at /home/joshua/src/rust/src/librustc_hir/def.rs:382 16: rustdoc::clean::utils::register_res at src/librustdoc/clean/utils.rs:627 17: rustdoc::clean::utils::resolve_type at src/librustdoc/clean/utils.rs:587 ``` - Add much more extensive tests + fn -> impl -> fn + fn -> impl -> fn -> macro + errors in function parameters + errors in trait bounds + errors in the type implementing the trait + unknown bounds for the type + unknown types in function bodies + errors generated by macros - Use explicit state instead of trying to reconstruct it from random info - Use an enum instead of a boolean - Add example of ignored error
2020-07-15Don't run everybody_loops for rustdocJoshua Nelson-1/+3
Instead, ignore resolution errors that occur in item bodies. The reason this can't ignore item bodies altogether is because `const fn` could be used in generic types, for example `[T; f()]`
2020-07-15Don't render unstable for rustc docsLzu Tao-4/+6
As rustc is permanently unstable. So marking every items with unstable is essential useless.