about summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2023-08-02get auto traits for parallel rustcSparrowLii-6/+0
Signed-off-by: SparrowLii <liyuan179@huawei.com>
2023-08-02Only call `parse_token_tree` once.Nicholas Nethercote-5/+4
This code currently uses a `while` loop and gathers token trees into a vector, but it only succeeds in the case where there is a single token tree. We can instead just call `parse_token_tree` once and then look for `Eof` to detect the success case.
2023-08-02Inline and remove `parse_all_token_trees`.Nicholas Nethercote-1/+4
It has a single call site.
2023-08-02`parse_all_token_trees` cannot fail.Nicholas Nethercote-7/+1
2023-07-29Move `inherits_doc_hidden` and `should_ignore_res` into `clean/utils.rs`Guillaume Gomez-2/+34
2023-07-29Move Res check into `should_ignore_res`Guillaume Gomez-2/+2
2023-07-28Render generic const items in rustdocLeón Orell Valerian Liehr-45/+77
2023-07-28Lower generic const items to HIRLeón Orell Valerian Liehr-1/+2
2023-07-28Auto merge of #114115 - nnethercote:less-token-tree-cloning, r=petrochenkovbors-5/+5
Less `TokenTree` cloning `TokenTreeCursor` has this comment on it: ``` // FIXME: Many uses of this can be replaced with by-reference iterator to avoid clones. ``` This PR completes that FIXME. It doesn't have much perf effect, but at least we now know that. r? `@petrochenkov`
2023-07-27Auto merge of #113374 - GuillaumeGomez:private-to-public-path, ↵bors-3/+132
r=notriddle,fmease [rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly Fixes #81141. If we have: ```rust use Private as Something; pub fn foo() -> Something {} ``` Then `Something` will be replaced by `Private`. r? `@notriddle`
2023-07-27Rollup merge of #114059 - fmease:rustdoc-fix-x-crate-impl-sized, ↵Guillaume Gomez-35/+62
r=GuillaumeGomez rustdoc: fix cross-crate `impl Sized` & `impl ?Sized` Previously, cross-crate impl-Trait (APIT, RPIT, etc.) that only consists of a single `Sized` bound (modulo outlives-bounds) and ones that are `?Sized` were incorrectly rendered. To give you a taste (before vs. after): ```diff - fn sized(x: impl ) -> impl + fn sized(x: impl Sized) -> impl Sized - fn sized_outlives<'a>(x: impl 'a) -> impl 'a + fn sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a - fn maybe_sized(x: &impl ) -> &impl + fn maybe_sized(x: &impl ?Sized) -> &impl ?Sized - fn debug_maybe_sized(x: &impl Debug) -> &impl ?Sized + Debug + fn debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized) ``` Moreover, we now surround impl-Trait that has multiple bounds with parentheses if they're the pointee of a reference or raw pointer type. This affects both local and cross-crate docs. The current output isn't correct (rustc would emit the error *ambiguous `+` in a type* if we fed the rendered code back to it). --- Best reviewed commit by commit :) `@rustbot` label A-cross-crate-reexports
2023-07-27Remove transmute calls and caching for use pathsGuillaume Gomez-30/+24
2023-07-27Avoid some token cloning in `filter_tokens_from_list`.Nicholas Nethercote-5/+5
Now the cloning only happens on some paths, instead of all paths.
2023-07-26Auto merge of #114012 - GuillaumeGomez:fix-113982, r=notriddlebors-16/+37
Fix missing attribute merge on glob foreign re-exports Fixes https://github.com/rust-lang/rust/issues/113982. The attributes were not merged with the import's in case of glob re-export of foreign items. r? `@notriddle`
2023-07-26Fix regression for private in publicGuillaume Gomez-0/+1
2023-07-26rustdoc: fix cross-crate impl-SizedLeón Orell Valerian Liehr-14/+47
2023-07-26rustdoc: stylistic changesLeón Orell Valerian Liehr-21/+15
2023-07-25Improve performance of `first_non_private`Guillaume Gomez-22/+18
2023-07-25Auto merge of #113958 - lukas-code:doc-links, r=GuillaumeGomez,petrochenkovbors-13/+14
fix intra-doc links on nested `use` and `extern crate` items This PR fixes two rustdoc ICEs that happen if there are any intra-doc links on nested `use` or `extern crate` items, for example: ```rust /// Re-export [`fmt`] and [`io`]. pub use std::{fmt, io}; // "nested" use = use with braces /// Re-export [`std`]. pub extern crate std; ``` Nested use items were incorrectly considered private and therefore didn't have their intra-doc links resolved. I fixed this by always resolving intra-doc links for nested `use` items that are declared `pub`. <details> During AST->HIR lowering, nested `use` items are desugared like this: ```rust pub use std::{}; // "list stem" pub use std::fmt; pub use std::io; ``` Each of these HIR nodes has it's own effective visibility and the list stem is always considered private. To check the effective visibility of an AST node, the AST node is mapped to a HIR node with `Resolver::local_def_id`, which returns the (private) list stem for nested use items. </details> For `extern crate`, there was a hack in rustdoc that stored the `DefId` of the crate itself in the cleaned item, instead of the `DefId` of the `extern crate` item. This made rustdoc look at the resolved links of the extern crate's crate root instead of the `extern crate` item. I've removed this hack and instead translate the `DefId` in the appropriate places. As as side effect of fixing `extern crate`, i've turned ```rust #[doc(masked)] extern crate self as _; ``` into a no-op instead of hiding all trait impls. Proper verification for `doc(masked)` is included as a bonus. fixes https://github.com/rust-lang/rust/issues/113896
2023-07-24Cache qpath first public resultGuillaume Gomez-26/+46
2023-07-24Revert "Remove needs for transmute"Guillaume Gomez-28/+20
This reverts commit ea9a17b9995b7a076283777b7d462a360fece2d6.
2023-07-24Remove needs for transmuteGuillaume Gomez-20/+28
2023-07-24Re-add missing generics in `first_non_private`Guillaume Gomez-3/+23
2023-07-24Add support for `--document-hidden-items` in `first_non_private`Guillaume Gomez-1/+2
2023-07-24Add test for private itemsGuillaume Gomez-0/+3
2023-07-24Correctly handle `super` and `::`Guillaume Gomez-1/+10
2023-07-24Rename `first_not_private` into `first_non_private`Guillaume Gomez-2/+2
2023-07-24Improve code readabilityGuillaume Gomez-32/+27
2023-07-24If re-export is private, get the next item until a public one is found or ↵Guillaume Gomez-3/+93
expose the private item directly
2023-07-24Fix missing attribute merge on glob foreign re-exportsGuillaume Gomez-16/+37
2023-07-22fix doc links on `extern crate` itemsLukas Markeffsky-13/+14
2023-07-22rustdoc: handle cross-crate RPITITs correctlyLeón Orell Valerian Liehr-1/+4
2023-07-20XSimplifiedType to SimplifiedType::Xlcnr-28/+27
2023-07-19Rollup merge of #113785 - GuillaumeGomez:tests/rustdoc/issue-105735-fix, ↵Dylan DPC-3/+16
r=notriddle,aDotInTheVoid Fix invalid display of inlined re-export when both local and foreign items are inlined Fixes #105735. The bug is actually quite interesting: at the `clean` pass, local inlined items have their `use` item removed, however foreign items don't have their `use` item removed because it's in the `clean` pass that we handle them. So when a `use` inlines both a local and a foreign item, it will work as expected for the foreign one, but not for the local as its `use` should not be around anymore. To prevent this, I created a new `inlined_foreigns` field into the `Module` struct to allow to remove the `use` item early on for foreign items as well. Then we iterate it in the `clean` pass directly. r? ``@notriddle``
2023-07-18support for mips32r6 as a target_arch valuechenx97-0/+1
2023-07-18support for mips64r6 as a target_arch valuechenx97-0/+1
2023-07-18Remove unneeded `Option<Symbol>` in `foreign_items`Guillaume Gomez-1/+1
2023-07-18Fix invalid display of inlined re-exportGuillaume Gomez-3/+16
2023-07-18Auto merge of #113801 - compiler-errors:iter-instantiated, r=oli-obkbors-2/+2
Rename `arg_iter` to `iter_instantiated` `arg_iter` doesn't make sense, and doesn't really indicate what it's doing (returning an iterator that ~~substitutes~~ instantiates its elements). `iter_instantiated_copied` is kinda awkward but i don't really wanna bikeshed it. r? `@oli-obk`
2023-07-18Auto merge of #113574 - GuillaumeGomez:rustdoc-json-strip-hidden-impl, ↵bors-8/+8
r=aDotInTheVoid,notriddle Strip impl if not re-exported and is doc(hidden) Part of #112852. r? `@aDotInTheVoid`
2023-07-17Rename arg_iter to iter_instantiatedMichael Goulet-2/+2
2023-07-14Correctly handle `--document-hidden-items`Guillaume Gomez-8/+8
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-80/+78
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-18/+16
2023-07-03remove TypeWellFormedFromEnvMichael Goulet-2/+1
2023-06-27Auto merge of #113083 - matthiaskrgr:rollup-anbqpij, r=matthiaskrgrbors-1/+4
Rollup of 3 pull requests Successful merges: - #113039 (make custom mir ICE a bit nicer) - #113058 (Add/improve code comments) - #113063 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-27Rollup merge of #113058 - GuillaumeGomez:improve-code-comments, r=notriddleMatthias Krüger-1/+4
Add/improve code comments Working on something else and did some small comments updates/adds. r? `@notriddle`
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-39/+19
2023-06-26Add/improve code commentsGuillaume Gomez-1/+4
2023-06-26Rollup merge of #112920 - fmease:rustdoc-fix-112904, r=GuillaumeGomezTakayuki Maeda-43/+45
rustdoc: render generic params & where-clauses of cross-crate assoc tys in impls We used to only ever render generic parameters & where-clauses of cross-crate associated types when the item was located inside of a trait and we used to just drop them when it was inside of an impl block (trait or inherent). Fixes #112904. `@rustbot` label A-cross-crate-reexports