about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2020-12-20Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`Aaron Hill-0/+37
Fixes #80233 We already have logic in `evaluate_predicates` that tries to add unimplemented predicates to our `ParamEnv`. Trying to add a predicate that already holds can lead to errors later on, since projection will prefer trait candidates from the `ParamEnv` to predicates from an impl.
2020-12-16Allow `since="TBD"` for rustc_deprecatedbstrie-2/+10
2020-12-14Add test case for Self:: linksDániel Buga-0/+14
2020-12-11Auto merge of #79349 - Nemo157:issue-79201, r=jyn514bors-1/+43
Apply `doc(cfg)` from parent items while collecting trait impls Because trait impls bypass the standard `clean` hierarchy they do not participate in the `propagate_doc_cfg` pass, so instead we need to pre-collect all possible `doc(cfg)` attributes that will apply to them when cleaning. fixes #79201
2020-12-09Accept arbitrary expressions in key-value attributes at parse timeVadim Petrochenkov-0/+16
2020-12-06Auto merge of #78609 - lcnr:rustdoc-const-eval, r=matthewjasperbors-0/+0
extend `WithOptConstParam` docs, move rustdoc test This should hopefully make things a bit clearer, feel free to comment on anything which can still be improved. cc `@ecstatic-morse` `@nikomatsakis` `@RalfJung`
2020-12-05Update testsGuillaume Gomez-6/+5
2020-12-04Rollup merge of #79638 - jyn514:intra-link-self-raw, r=ManishearthDylan DPC-0/+13
Use `item_name` instead of pretty printing for resolving `Self` on intra-doc links Pretty printing would add a `r#` prefix to raw identifiers, which was not correct. In general I think this change makes sense - pretty-printing is for showing to the *user*, `item_name` is suitable to pass to resolve. Fixes https://github.com/rust-lang/rust/issues/79633. r? `@Manishearth`
2020-12-03Render Markdown in search resultsCamelid-4/+5
Previously Markdown documentation was not rendered to HTML for search results, which led to the output not being very readable, particularly for inline code. This PR fixes that by rendering Markdown to HTML with the help of pulldown-cmark (the library rustdoc uses to parse Markdown for the main text of documentation). However, the text for the title attribute (the text shown when you hover over an element) still uses the plain-text rendering since it is displayed in browsers as plain-text. Only these styles will be rendered; everything else is stripped away: * *italics* * **bold** * `inline code`
2020-12-02Use `item_name` instead of pretty printingJoshua Nelson-0/+13
Pretty printing would add a `r#` prefix to raw identifiers, which was not correct. In general I think this change makes sense - pretty-printing is for showing to the *user*, `item_name` is suitable to pass to resolve.
2020-12-01rustdoc: move lazy norm tests into const-genericsBastian Kauschke-0/+0
2020-12-01Rollup merge of #79548 - CraftSpider:76998, r=jyn514Mara Bos-0/+10
Show since when a function is const in stdlib Fixes #76998 This makes it so that functions with the `#[rustc_const_stable()]` attribute now show from what version they were stably declared const, alongside what version they were declared stable. Example from `Result`: ![image](https://user-images.githubusercontent.com/13342132/100561194-1be60d00-3286-11eb-99ff-1e81201218a9.png) r? ``@jyn514``
2020-12-01Rollup merge of #79527 - jyn514:intra-doc-tests, r=ManishearthMara Bos-258/+254
Move intra-doc link tests into a subdirectory They were starting to get unwieldy. r? ``@Manishearth``
2020-12-01Rollup merge of #79525 - jyn514:feature-gate-normalize, r=GuillaumeGomezMara Bos-1/+1
Add -Z normalize-docs and enable it for compiler docs Works around https://github.com/rust-lang/rust/issues/79459 by only enabling normalization for the compiler itself (and anyone who opts-in on nightly). Eventually I want to remove this and enable normalization by default, but that's turned out to be [really hard](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218125195). This uses a command line option instead of a feature gate so it's easier to pass it to all crates at once. Theoretically it's better to use a feature gate instead so that it's easier for people to use on docs.rs, but I'm also not terribly concerned with how easy it to use a temporary hack. Addresses https://github.com/rust-lang/rust/issues/77459.
2020-11-30Auto merge of #76467 - jyn514:intra-link-self, r=Manishearthbors-0/+49
Fix intra-doc links for `Self` on cross-crate items and primitives - Remove the difference between `parent_item` and `current_item`; these should never have been different. - Remove `current_item` from `resolve` and `variant_field` so that `Self` is only substituted in one place at the very start. - Resolve the current item as a `DefId`, not a `HirId`. This is what actually fixed the bug. Hacks: - `clean` uses `TypedefItem` when it _really_ should be `AssociatedTypeItem`. I tried fixing this without success and hacked around it instead (see comments) - This second-guesses the `to_string()` impl since it wants fully-qualified paths. Possibly there's a better way to do this.
2020-11-29Add support for stable-const-since in docs on items (standalone or assoc)Rune Tynan-0/+10
2020-11-29Add -Z normalize-docs and enable it for compiler docsJoshua Nelson-1/+1
2020-11-29Add test for cross-crate SelfJoshua Nelson-0/+13
2020-11-29Fix intra-doc links for `Self` on primitivesJoshua Nelson-0/+36
- Remove the difference between `parent_item` and `current_item`; these should never have been different. - Remove `current_item` from `resolve` and `variant_field` so that `Self` is only substituted in one place at the very start. - Resolve the current item as a `DefId`, not a `HirId`. This is what actually fixed the bug. Hacks: - `clean` uses `TypedefItem` when it _really_ should be `AssociatedTypeItem`. I tried fixing this without success and hacked around it instead (see comments) - This stringifies DefIds, then resolves them a second time. This is really silly and rustdoc should just use DefIds throughout. Fixing this is a larger task than I want to take on right now.
2020-11-29Auto merge of #78380 - bstrie:rm-old-num-const-from-tests, r=jyn514bors-0/+2
Update tests to remove old numeric constants Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-11-29Auto merge of #79455 - CraftSpider:master, r=jyn514bors-0/+53
Remove doctree::Macro and distinguish between `macro_rules!` and `pub macro` This is a part of #78082, removing doctree::Macro. Uses the changes in #79372 Fixes #76761
2020-11-29Update tests to remove old numeric constantsbstrie-0/+2
Part of #68490. Care has been taken to leave the old consts where appropriate, for testing backcompat regressions, module shadowing, etc. The intrinsics docs were accidentally referring to some methods on f64 as std::f64, which I changed due to being contrary with how we normally disambiguate the shadow module from the primitive. In one other place I changed std::u8 to std::ops since it was just testing path handling in macros. For places which have legitimate uses of the old consts, deprecated attributes have been optimistically inserted. Although currently unnecessary, they exist to emphasize to any future deprecation effort the necessity of these specific symbols and prevent them from being accidentally removed.
2020-11-28Add test for macro by example syntax in decl macros with only one optionRune Tynan-0/+7
2020-11-29Rollup merge of #79464 - GuillaumeGomez:doc-keyword-ident, r=jyn514Dylan DPC-0/+5
Extend doc keyword feature by allowing any ident Part of #51315. As suggested by ``@danielhenrymantilla`` in [this comment](https://github.com/rust-lang/rust/issues/51315#issuecomment-733879934), this PR extends `#[doc(keyword = "...")]` to allow any ident to be used as keyword. The final goal is to allow (proc-)macro crates' owners to write documentation of the keywords they might introduce. r? ``@jyn514``
2020-11-29Rollup merge of #79340 - GuillaumeGomez:rename-stability, r=jyn514Dylan DPC-7/+7
Rename "stability" CSS class to "item-info" and combine `document_stability` with `document_short` Follow-up of #79300 The point of this PR is to make the CSS class more accurate since it's not only about stability anymore. r? ``@jyn514``
2020-11-28Move `src/test/rustdoc` intra-doc link tests into a subdirectoryJoshua Nelson-258/+254
They were starting to get unwieldy.
2020-11-28Add support for multi-argument decl macrosRune Tynan-0/+17
2020-11-28Update src/test/rustdoc/decl_macro_priv.rsRune Tynan-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-11-27Update decl_macro test, add decl_macro_priv test for --document-private-itemsRune Tynan-3/+15
2020-11-27Add test, fix pub macro impl, compile errorRune Tynan-0/+16
2020-11-27Revert the effect of #77467 by disabling normalization in rustdocoli-0/+1
2020-11-27Add tests for doc_keyword feature extensionGuillaume Gomez-0/+5
2020-11-26Auto merge of #77467 - jyn514:query-docs, r=oli-obkbors-0/+80
Normalize `<X as Y>::T` for rustdoc - Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`) - Fall back to the previous behavior if the path can't be resolved The first commit is a pure refactor and should probably be reviewed by `@GuillaumeGomez.` I recommend reviewing the second commit on its own. Fixes https://github.com/rust-lang/rust/issues/77459. r? `@eddyb` cc `@danielhenrymantilla` , `@lcnr`
2020-11-26Rollup merge of #79412 - GuillaumeGomez:cleanup-rustdoc-tests, r=jyn514Jonas Schievink-6/+0
Clean up rustdoc tests by removing unnecessary features r? ``@jyn514``
2020-11-25Clean up rustdoc tests by removing unnecessary featuresGuillaume Gomez-6/+0
2020-11-25Auto merge of #79336 - camelid:rename-feature-oibit-to-auto, r=oli-obkbors-16/+16
Rename `optin_builtin_traits` to `auto_traits` They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>. r? `@oli-obk` (feel free to re-assign if you're not the right reviewer for this)
2020-11-24Use the name "auto traits" everywhere in the compilerCamelid-9/+9
Goodbye, OIBIT!
2020-11-24Track `ParamEnv`s properlyJoshua Nelson-1/+6
This uses the same `with_param_env` pattern that late lints use. Thanks to all the doctree refactors, this was very easy to add.
2020-11-24Normalize `<X as Y>::T` for rustdocJoshua Nelson-0/+75
- Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`) - Fall back to the previous behavior if the path can't be resolved - Show what the behavior is if the type can't be normalized - Run `resolve_vars_if_possible` It's not clear whether or not this is necessary. See https://github.com/rust-lang/rust/pull/77616 for more context. - Add a test for cross-crate re-exports - Use the same code for both `hir::Ty` and `Ty`
2020-11-24Rename "stability" CSS class to "item-info"Guillaume Gomez-7/+7
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-7/+7
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-11-23Apply `doc(cfg)` from parent items while collecting trait implsWim Looman-1/+43
Because trait impls bypass the standard `clean` hierarchy they do not participate in the `propagate_doc_cfg` pass, so instead we need to pre-collect all possible `doc(cfg)` attributes that will apply to them when cleaning.
2020-11-22Accept '!' in intra-doc linksCamelid-0/+3
This will allow linking to things like `Result<T, !>`.
2020-11-21Auto merge of #78461 - TimDiekmann:vec-alloc, r=Amanieubors-2/+3
Add support for custom allocators in `Vec` This follows the [roadmap](https://github.com/rust-lang/wg-allocators/issues/7) of the allocator WG to add custom allocators to collections. r? `@Amanieu` This pull request requires a crater run. ### Prior work: - #71873: Crater-test to solve rust-lang/wg-allocators#1 - [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate
2020-11-21Rollup merge of #79264 - jyn514:less-doctree, r=GuillaumeGomezDylan DPC-0/+12
Get rid of some doctree items They can be derived directly from the `hir::Item`, there's no special logic. - TypeDef - OpaqueTy - Constant - Static - TraitAlias - Enum - Union - Struct Part of #78082 (the easiest part, I'm still debugging some other changes). r? `@GuillaumeGomez`
2020-11-21Rollup merge of #79182 - lochsh:78777-fix-extern-types-ref, r=jyn514Dylan DPC-0/+18
Fix links to extern types in rustdoc (fixes #78777) r? `@jyn514` Fixes #78777. The initial fix we tried was: ```diff diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 8be9482acff..c4b7086fdb1 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs `@@` -433,8 +433,9 `@@` impl<'a, 'tcx> LinkCollector<'a, 'tcx> { Res::PrimTy(prim) => Some( self.resolve_primitive_associated_item(prim, ns, module_id, item_name, item_str), ), - Res::Def(DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::TyAlias, did) => { + Res::Def(kind, did) if kind.ns() == Some(Namespace::TypeNS) => { debug!("looking for associated item named {} for item {:?}", item_name, did); + // Checks if item_name belongs to `impl SomeItem` let assoc_item = cx .tcx ``` However, this caused traits to be matched, resulting in a panic when `resolve_associated_trait_item` is called further down in this function. This PR also adds an error message for that panic. Currently it will look something like: ```rust thread 'rustc' panicked at 'Not a type: DefIndex(8624)', compiler/rustc_metadata/src/rmeta/decoder.rs:951:32 ``` I wasn't sure how to get a better debug output than `DefIndex(...)`, and am open to suggestions.
2020-11-21Add more tests for renamed itemsJoshua Nelson-0/+12
2020-11-18Add testHannah McLaughlin-0/+18
2020-11-18add [src] links to methods on a trait's pageNixon Enraght-Moony-0/+26
2020-11-18Add support for custom allocators in `Vec`Tim Diekmann-2/+3