about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2023-08-08Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, ↵Matthias Krüger-9/+28
r=oli-obk Store the laziness of type aliases in their `DefKind` Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not. With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*: Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates. As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions. --- This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold. `@rustbot` label F-lazy_type_alias r? `@oli-obk`
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-9/+28
2023-08-05Auto merge of #113734 - cjgillot:no-crate-lint, r=petrochenkovbors-4/+4
Convert builtin "global" late lints to run per module The compiler currently has 4 non-incremental lints: 1. `clashing_extern_declarations`; 2. `missing_debug_implementations`; 3. ~`unnameable_test_items`;~ changed by https://github.com/rust-lang/rust/pull/114414 4. `missing_docs`. Non-incremental lints get reexecuted for each compilation, which is slow. Moreover, those lints are allow-by-default, so run for nothing most of the time. This PR attempts to make them more incremental-friendly. `clashing_extern_declarations` is moved to a standalone query. `missing_debug_implementation` can use `non_blanket_impls_for_ty` instead of recomputing it. `missing_docs` is harder as it needs to track if there is a `doc(hidden)` module surrounding. I hack around this using the lint level engine. That's easy to implement and allows to re-enable the lint for a re-exported module, while a more proper solution would reuse the same device as `unnameable_test_items`.
2023-08-04Rollup merge of #114475 - GuillaumeGomez:migrate-gui-test-color-27, r=notriddleMichael Goulet-2/+2
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-08-04Auto merge of #114104 - oli-obk:syn2, r=compiler-errorsbors-53/+13
Lots of tiny incremental simplifications of `EmitterWriter` internals ignore the first commit, it's https://github.com/rust-lang/rust/pull/114088 squashed and rebased, but it's needed to use to use `derive_setters`, as they need a newer `syn` version. Then this PR starts out with removing many arguments that are almost always defaulted to `None` or `false` and replace them with builder methods that can set these fields in the few cases that want to set them. After that it's one commit after the other that removes or merges things until everything becomes some very simple trait objects
2023-08-04Use similar color scheme to make it obvious they are linkedGuillaume Gomez-2/+2
2023-08-04Add comment for rustdoc overrides.Camille GILLOT-0/+1
2023-08-04Make MissingDoc a module lint.Camille GILLOT-4/+3
2023-08-03Auto merge of #114353 - nnethercote:parser-ast-cleanups, r=petrochenkovbors-9/+5
Some parser and AST cleanups Things I found while looking closely at this code. r? `@petrochenkov`
2023-08-02Remove constness from `TraitPredicate`Deadbeef-3/+2
2023-08-02Rollup merge of #114321 - SparrowLii:parallel_test, r=oli-obkNilstrieb-6/+0
get auto traits for parallel rustc test for #106930 #[Edit] Since this doesn't block try build now, we can close https://github.com/rust-lang/rust/issues/106930 fixes #106930
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-31Remove a `bool` for color in favor of the `WriteColor` trait wrapping ↵Oli Scherer-2/+2
colored and uncolored printing
2023-07-31Use builder pattern instead of lots of arguments for `EmitterWriter::new`Oli Scherer-27/+3
2023-07-31Replace the many arguments of `EmitterWriter::stderr` with builder methodsOli Scherer-26/+10
2023-07-30Remove some unneeded `clone()` callsGuillaume Gomez-16/+11
2023-07-29Group `write` calls when possible and use new format argsGuillaume Gomez-76/+84
2023-07-29Move `inherits_doc_hidden` and `should_ignore_res` into `clean/utils.rs`Guillaume Gomez-37/+38
2023-07-29Move Res check into `should_ignore_res`Guillaume Gomez-3/+8
2023-07-29Rollup merge of #113773 - compiler-errors:err-layout-bail, r=cjgillotMatthias Krüger-0/+5
Don't attempt to compute layout of type referencing error Leads to more ICEs and strange diagnostics than are worth it. Fixes #113760
2023-07-28Render generic const items in rustdocLeón Orell Valerian Liehr-69/+116
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-27Fix aksama templateMichael Goulet-0/+5
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-46/+86
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-34/+25
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-18/+39
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-25/+71
2023-07-26rustdoc: stylistic changesLeón Orell Valerian Liehr-21/+15
2023-07-25Use a builder instead of boolean/option argumentsOli Scherer-8/+5
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-16/+31
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-27/+50
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-18/+39
2023-07-22fix doc links on `extern crate` itemsLukas Markeffsky-14/+23