about summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2022-07-17rustdoc: extend `#[doc(tuple_variadic)]` to fn pointersMichael Howell-7/+7
The attribute is also renamed `fake_variadic`.
2022-07-16rustdoc: avoid inlining items with duplicate `(type, name)`Michael Howell-5/+37
Fixes #99221
2022-07-16Fix rustdoc JSON inlineGuillaume Gomez-2/+3
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-1/+1
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13Auto merge of #99066 - est31:remove_box_librustdoc, r=jshabors-25/+31
Remove most box syntax from librustdoc This is the second attempt after the librustdoc specific changes have been reverted from #87781 in #89134, due to a minor, but exant regression caused by the changes. ~~There have been some changes to librustdoc in the past and maybe thanks to them there is no regression any more. If there is still a regression, one can investigate further and maybe find ways to fix the regressions. Thus, i request a perf run.~~ Edit: turns out there is still a regression, but it's caused only by a subset of the changes. So I've changed this PR to only contains the changes that don't cause any performance regressions, keeping the regression causing changes for a later PR.
2022-07-11Remove box syntax from Box<BareFunctionDecl> constructionest31-3/+3
The type has 144 bytes according to compiler internal rustdoc.
2022-07-11Remove box syntax for Box<rustdoc::clean::types::Type> constructionest31-11/+11
The type has 80 bytes according to compiler internal rustdoc.
2022-07-11Remove box syntax for Box<ImplItem> constructionest31-5/+5
ImplItem only has 80 bytes according to compiler internal rustdoc.
2022-07-11Remove box syntax for Box<Attributes> constructionest31-6/+12
Attributes only has 48 bytes according to compiler internal rustdoc.
2022-07-07Rollup merge of #98692 - camelid:more-fixmes, r=GuillaumeGomezDylan DPC-3/+2
rustdoc: Cleanup more FIXMEs r? `@GuillaumeGomez`
2022-07-06Rollup merge of #98911 - notriddle:notriddle/rustdoc-string-impl, ↵Guillaume Gomez-0/+1
r=GuillaumeGomez rustdoc: filter '_ lifetimes from ty::Generics Fixes a weirdly-rendered section of the std::string::String docs. Before: ![image](https://user-images.githubusercontent.com/1593513/177256873-20b9cf6e-2429-4865-853b-b269d74672f4.png) After: ![image](https://user-images.githubusercontent.com/1593513/177256900-ef3efd17-f624-40c5-af90-fe709ec034f2.png)
2022-07-04rustdoc: filter '_ lifetimes from ty::GenericsMichael Howell-0/+1
Fixes a weirdly-rendered section of the std::string::String docs.
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-30rustdoc: filter '_ lifetimes from ty::PolyTraitRefMichael Howell-1/+1
Fixes #98697
2022-06-29Remove FIXME that hasn't been an issue in practiceNoah Lev-1/+0
2022-06-29Replace weird handling of edge case with panicNoah Lev-2/+2
2022-06-29Auto merge of #98542 - jackh726:coinductive-wf, r=oli-obkbors-1/+1
Make empty bounds lower to `WellFormed` and make `WellFormed` coinductive r? rust-lang/types
2022-06-28Auto merge of #98475 - notriddle:notriddle/index-fn-signatures, r=GuillaumeGomezbors-4/+0
rustdoc: reference function signature types from the `p` array This reduces the size of the function signature index, because it's common to have many functions that operate on the same types. $ wc -c search-index-old.js search-index-new.js 5224374 search-index-old.js 3932314 search-index-new.js By my math, this reduces the uncompressed size of the search index by 32%. On compressed signatures, the wins are less drastic, a mere 8%: $ wc -c search-index-old.js.gz search-index-new.js.gz 404532 search-index-old.js.gz 371635 search-index-new.js.gz
2022-06-28Fix glob import ICE in rustdoc JSON formatGuillaume Gomez-1/+5
2022-06-28Make empty bounds lower to WellFormed and make WellFormed coinductiveJack Huey-1/+1
2022-06-24rustdoc: reference function signature types from the `p` arrayMichael Howell-4/+0
This reduces the size of the function signature index, because it's common to have many functions that operate on the same types. $ wc -c search-index-old.js search-index-new.js 5224374 search-index-old.js 3932314 search-index-new.js By my math, this reduces the uncompressed size of the search index by 32%. On compressed signatures, the wins are less drastic, a mere 8%: $ wc -c search-index-old.js.gz search-index-new.js.gz 404532 search-index-old.js.gz 371635 search-index-new.js.gz
2022-06-22Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkovbors-32/+35
Create elided lifetime parameters for function-like types Split from https://github.com/rust-lang/rust/pull/97720 This PR refactor lifetime generic parameters in bare function types and parenthesized traits to introduce the additional required lifetimes as fresh parameters in a `for<>` bound. This PR does the same to lifetimes appearing in closure signatures, and as-if introducing `for<>` bounds on closures (without the associated change in semantics). r? `@petrochenkov`
2022-06-21Rustdoc fallout.Camille GILLOT-32/+35
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-1/+1
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-1/+1
2022-06-16Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomezbors-6/+19
Improve the tuple and unit trait docs * Reduce duplicate impls; show only the `(T,)` and include a sentence saying that there exists ones up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`. Here's the new version: * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html> * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.unit.html>
2022-06-16Auto merge of #98108 - SpriteOvO:doc_auto_cfg-feature-rmv-fix, ↵bors-6/+10
r=notriddle,GuillaumeGomez Rustdoc: Fix stab disappearing and exclude cfg "doc" and "doctest" Fixes #98065 Context: https://github.com/rust-lang/rust/issues/43781#issuecomment-1154226733 r? `@GuillaumeGomez`
2022-06-16Fix `cfg(not)` and `cfg(all)` causing Rustdoc stab to disappearSprite-6/+10
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.
2022-06-11Fix incorrectly spelled "variadic"Michael Howell-3/+3
2022-06-08rustdoc: fixed messed-up rustdoc auto trait implsMichael Howell-4/+4
Before: impl<T, U> UnwindSafe for (T, ...) where T: UnwindSafe, U: UnwindSafe, After: impl<T> UnwindSafe for (T, ...) where T: UnwindSafe,
2022-06-08rustdoc: show tuple impls as `impl Trait for (T, ...)`Michael Howell-2/+15
This commit adds a new unstable attribute, `#[doc(tuple_varadic)]`, that shows a 1-tuple as `(T, ...)` instead of just `(T,)`, and links to a section in the tuple primitive docs that talks about these.
2022-06-08Folding revamp.Nicholas Nethercote-1/+1
This commit makes type folding more like the way chalk does it. Currently, `TypeFoldable` has `fold_with` and `super_fold_with` methods. - `fold_with` is the standard entry point, and defaults to calling `super_fold_with`. - `super_fold_with` does the actual work of traversing a type. - For a few types of interest (`Ty`, `Region`, etc.) `fold_with` instead calls into a `TypeFolder`, which can then call back into `super_fold_with`. With the new approach, `TypeFoldable` has `fold_with` and `TypeSuperFoldable` has `super_fold_with`. - `fold_with` is still the standard entry point, *and* it does the actual work of traversing a type, for all types except types of interest. - `super_fold_with` is only implemented for the types of interest. Benefits of the new model. - I find it easier to understand. The distinction between types of interest and other types is clearer, and `super_fold_with` doesn't exist for most types. - With the current model is easy to get confused and implement a `super_fold_with` method that should be left defaulted. (Some of the precursor commits fixed such cases.) - With the current model it's easy to call `super_fold_with` within `TypeFolder` impls where `fold_with` should be called. The new approach makes this mistake impossible, and this commit fixes a number of such cases. - It's potentially faster, because it avoids the `fold_with` -> `super_fold_with` call in all cases except types of interest. A lot of the time the compile would inline those away, but not necessarily always.
2022-06-03Manipulate lifetimes by LocalDefId for region resolution.Camille GILLOT-17/+6
2022-05-31rustdoc: also index impl traitMichael Howell-0/+4
2022-05-29Auto merge of #96652 - notriddle:notriddle/self, r=GuillaumeGomezbors-0/+6
rustdoc: include impl generics / self in search index Fixes #92205
2022-05-26Rollup merge of #97066 - petrochenkov:nofragkind, r=camelidMichael Goulet-1/+1
rustdoc: Remove `ItemFragment(Kind)` And stop using `write!` when rendering URL fragments to avoid impossible errors.
2022-05-25rustdoc: include impl generics / self in search indexMichael Howell-0/+6
2022-05-25Auto merge of #97365 - klensy:rustdoc-vs-clippy, r=notriddlebors-41/+41
rustdoc: fix few clippy lints Fix few clippy lints: second commit - perf ones, first - other ones.
2022-05-24fix simple clippy lintsklensy-41/+41
2022-05-24Rollup merge of #97288 - compiler-errors:tcxify-rustdoc, r=Dylan-DPCDylan DPC-150/+162
Lifetime variance fixes for rustdoc #97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime. This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`. Split out from #97287 so the rustdoc team can review independently.
2022-05-23Auto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddlebors-16/+43
rustdoc: Remove fields_stripped fields (and equivalents) Fixes #90588. r? `@camelid`
2022-05-23Auto merge of #97195 - notriddle:notriddle/cleanup, r=GuillaumeGomezbors-31/+32
rustdoc: shrink GenericArgs/PathSegment with boxed slices This PR also contains a few cleanup bits and pieces, but one of them is a broken intra-doc link, and the other is removing an unused Hash impl. The last commit is the one that matters.
2022-05-22Clean up `&args[..]`, use more readable `args.iter()` insteadMichael Howell-1/+1
2022-05-22Lifetime variance fixes for rustdocMichael Goulet-150/+162
2022-05-22Auto merge of #97177 - oli-obk:const-stability, r=davidtwcobors-3/+3
Implement proper stability check for const impl Trait, fall back to unstable const when undeclared Continuation of #93960 `@jhpratt` it looks to me like the test was simply not testing for the failure you were looking for? Your checks actually do the right thing for const traits?
2022-05-21Extend `substs_to_args` into a perfectly-sized Vec almost every timeMichael Howell-16/+16