summary refs log tree commit diff
path: root/src/librustdoc/clean/utils.rs
AgeCommit message (Collapse)AuthorLines
2023-06-23Link to the corresponding channel in the help popoverGuillaume Gomez-0/+3
2023-06-07rustdoc: re-elide cross-crate default trait object lifetime boundsLeón Orell Valerian Liehr-16/+27
2023-05-27Clean up usage of `cx.tcx` when `tcx` is already set into a variableGuillaume Gomez-1/+1
2023-05-13refactor: add chunks method to TokenStream to obviate rustdoc clonesCaleb Cartwright-2/+1
2023-04-20Remove WithOptconstParam.Camille GILLOT-2/+2
2023-03-21rustdoc: Cleanup parent module tracking for doc linksVadim Petrochenkov-2/+2
Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary.
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-21Allow disabling of auto and blanket trait impls retrieval in rustdoc when in ↵Guillaume Gomez-0/+6
parallel_compiler mode.
2023-02-17Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwUbors-1/+1
Switch to `EarlyBinder` for `type_of` query Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+1
2023-02-16don't into selfMatthias Krüger-1/+1
don't into()-convert types to themselves
2023-02-15Use more let chainGuillaume Gomez-4/+4
2023-01-25rustdoc: Collect rustdoc-reachable items during early doc link resolutionVadim Petrochenkov-5/+0
2022-12-12Round 3: require binders for substsOli Scherer-10/+19
2022-12-12Round 2: make clean_middle_ty take a binderOli Scherer-3/+7
2022-11-28Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errorsDylan DPC-1/+1
Refactor `ty::ClosureKind` related stuff I've tried to fix all duplication and weirdness, but if I missed something do tell :p r? `@compiler-errors`
2022-11-27Remove Crate::primitives fieldGuillaume Gomez-1/+1
2022-11-27Rename `fn_trait_kind_from_{from_lang=>def_id}` to better convey meaningMaybe Waffle-1/+1
2022-11-22Split `MacArgs` in two.Nicholas Nethercote-1/+1
`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's used in two ways: - For representing attribute macro arguments (e.g. in `AttrItem`), where all three variants are used. - For representing function-like macros (e.g. in `MacCall` and `MacroDef`), where only the `Delimited` variant is used. In other words, `MacArgs` is used in two quite different places due to them having partial overlap. I find this makes the code hard to read. It also leads to various unreachable code paths, and allows invalid values (such as accidentally using `MacArgs::Empty` in a `MacCall`). This commit splits `MacArgs` in two: - `DelimArgs` is a new struct just for the "delimited arguments" case. It is now used in `MacCall` and `MacroDef`. - `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro case. Its `Delimited` variant now contains a `DelimArgs`. Various other related things are renamed as well. These changes make the code clearer, avoids several unreachable paths, and disallows the invalid values.
2022-11-08Auto merge of #104013 - notriddle:notriddle/rustdoc-sizeof, r=GuillaumeGomezbors-14/+8
rustdoc: use `ThinVec` and `Box<str>` to shrink `clean::ItemKind`
2022-11-05rustdoc: print usize with less string manipulationMichael Howell-12/+6
2022-11-05rustdoc: use `ThinVec` and `Box<str>` to shrink `clean::ItemKind`Michael Howell-2/+2
2022-11-04rustdoc: render the return type of cross-crate `Fn`-family trait bounds in ↵León Orell Valerian Liehr-7/+7
trait-object types
2022-11-03Remove rustdoc clean::Visibility typeGuillaume Gomez-4/+5
2022-10-30rustdoc: Do not add external traits to the crate in `register_res`Vadim Petrochenkov-4/+0
It's not clear why it was done, and apparently it's no longer necessary now. Such additions are unpredictable for early doc link resolution and would force us to collect all doc links from all external traits.
2022-10-29rustdoc: Simplify modifications of effective visibility tableVadim Petrochenkov-2/+1
2022-10-09Remove unnecessary lift calls from rustdocMichael Goulet-4/+4
2022-09-29Shrink `hir::def::Res`.Nicholas Nethercote-1/+3
`Res::SelfTy` currently has two `Option`s. When the second one is `Some` the first one is never consulted. So we can split it into two variants, `Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res` from 24 bytes to 12. This then shrinks `hir::Path` and `hir::PathSegment`, which are the HIR types that take up the most space.
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-1/+1
2022-09-22introduce mir::Unevaluatedb-naber-2/+1
2022-09-17Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnrbors-4/+3
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
2022-09-15Streamline `register_res`.Nicholas Nethercote-21/+5
Turns out it's only ever passed a `Res::Def`.
2022-09-13rebaseb-naber-1/+1
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-3/+2
2022-09-09RPITIT placeholder itemsMichael Goulet-2/+2
2022-09-03Rustdoc-Json: Add enum discriminantNixon Enraght-Moony-9/+25
2022-08-29Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`.Nicholas Nethercote-4/+4
`rustc_data_structures::thin_vec::ThinVec` looks like this: ``` pub struct ThinVec<T>(Option<Box<Vec<T>>>); ``` It's just a zero word if the vector is empty, but requires two allocations if it is non-empty. So it's only usable in cases where the vector is empty most of the time. This commit removes it in favour of `thin_vec::ThinVec`, which is also word-sized, but stores the length and capacity in the same allocation as the elements. It's good in a wider variety of situation, e.g. in enum variants where the vector is usually/always non-empty. The commit also: - Sorts some `Cargo.toml` dependency lists, to make additions easier. - Sorts some `use` item lists, to make additions easier. - Changes `clean_trait_ref_with_bindings` to take a `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this avoid some unnecessary allocations.
2022-08-09remove Clean trait implementation for ast::ModuleGuillaume Gomez-4/+4
2022-08-03remove Clean trait implementation for ty::RegionGuillaume Gomez-4/+4
2022-07-29Change maybe_body_owned_by to take local def idMiguel Guarniz-2/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-24Remove Clean trait implementation for ConstantGuillaume Gomez-4/+4
2022-07-23Remove Clean trait implementation for hir::Ty and middle::TyGuillaume Gomez-4/+5
2022-07-21Remove unused field in ItemKind::KeywordItemGuillaume Gomez-1/+1
2022-07-04Rollup merge of #98814 - fmease:minimal-fix-for-issue-97933, r=GuillaumeGomezMatthias Krüger-6/+87
rustdoc: Censor certain complex unevaluated const exprs Fixes #97933. This is more of a hotfix for the aforementioned issue. By that, I mean that my proposed patch is not the best solution but one that does not change as much existing code. It treats symptoms rather than the root cause. This PR “censors” certain complex unevaluated constant expressions like `match`es, blocks, function calls, struct literals etc. by pretty-printing them as `_` / `{ _ }` (number and string literals, paths and `()` are still printed as one would expect). Resorting to this placeholder is preferable to printing the full expression verbatim since they can be quite large and verbose resulting in an unreadable mess in the generated documentation. Further, mindlessly printing the const would leak private and `doc(hidden)` struct fields (#97933), at least in the current stable & nightly implementations which rely on `span_to_snippet` (!) and `rustc_hir_pretty::id_to_string`. The censoring of _verbose_ expressions is probably going to stay longer term. However, in regards to private and `doc(hidden)` struct fields, I have a more proper fix in mind which I have already partially implemented locally and for which I am going to open a separate PR sometime soon. For that, I was already in contact with `@GuillaumeGomez.` The proper fix involves rustdoc not falling back on pretty-printing unevaluated consts so easily (what this PR is concerned about) and instead preferring to print evaluated consts which contain more information allowing it to selectively hide private and `doc(hidden)` fields, create hyperlinks etc. generally making the output more granular and precise (compared to the brutal `_` placeholder). Unfortunately, I was a bit too late and the issue just hit stable (1.62). Should this be backported to beta or even a potential 1.62.1? r? `@GuillaumeGomez`
2022-07-04rustdoc: censor certain complex unevaluated const exprsLeón Orell Valerian Liehr-6/+87
2022-06-21Rustdoc fallout.Camille GILLOT-6/+3
2022-06-14address reviewb-naber-9/+10
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-7/+6
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-2/+2
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.