about summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2021-10-10Fix spelling: Cannonical -> CanonicalJohn Kugelman-1/+1
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-362/+279
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-08Auto merge of #89576 - tom7980:issue-89275-fix, r=estebankbors-1/+2
Prevent error reporting from outputting a recursion error if it finds an ambiguous trait impl during suggestions Closes #89275 This fixes the compiler reporting a recursion error during another already in progress error by trying to make a conversion method suggestion and encounters ambiguous trait implementations that can convert a the original type into a type that can then be recursively converted into itself via another method in the trait. Updated OverflowError struct to be an enum so I could differentiate between passes - it's no longer a ZST but I don't think that should be a problem as they only generate when there's an error in compiling code anyway
2021-10-06Simplify AttributesExt::cfg function and remove error emissions since they ↵Guillaume Gomez-27/+10
are not useful
2021-10-06Clean up code a bit:Guillaume Gomez-5/+10
* Remove "bool_to_options" feature * Update version for compiler feature * rustfmt
2021-10-05Issue 89275 fix and testTom Farmer-1/+2
Issue 89275 fix and test Fix librustdoc OverflowError usage rust tidy run Issue 89275 fix and test
2021-10-05Allow adding a set of cfg's to hide from being implicitly doc(cfg)'dWim Looman-6/+9
By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg #[cfg(foobar)] (and _only_ that _exact_ cfg) will not be implicitly treated as a doc(cfg) to render a message in the documentation.
2021-10-05Make cfg implicitly imply doc(cfg)Wim Looman-7/+51
This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via #[doc(cfg(...))], so e.g. to hide a #[cfg] you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` (since `all()` is always true, it is never shown in the docs)
2021-10-03Fix implementation of `clean::Path::whole_name()`Noah Lev-1/+5
I think that before this commit, the path `::std::vec::Vec` would have rendered as `{{root}}::std::vec::Vec`. Now, it should render correctly as `::std::vec::Vec`.
2021-10-03Fix a place that used the old `Path` representationNoah Lev-2/+1
2021-10-03Rename `strip_path` to `strip_path_generics`Noah Lev-2/+3
The new name is more descriptive of what the function does.
2021-10-02Explain `ResolvedPath` vs `hir::Path`Noah Lev-1/+1
Co-authored-by: Joshua Nelson <github@jyn.dev>
2021-10-02Replace all uses of `path.res.def_id()` with `path.def_id()`Noah Lev-9/+9
2021-10-02Remove outdated commentNoah Lev-2/+1
`CACHE_KEY` no longer exists.
2021-10-02Update `clean::Type` docsNoah Lev-25/+29
They've barely been updated since this version of `rustdoc` (originally called `rustdoc_ng`) was checked into the tree! Note that the formatting of a couple `Type` variants changed; rustfmt seems to change formatting based on whether all variants have docs.
2021-10-02Turn some comments into docsNoah Lev-57/+57
2021-10-01Auto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearthbors-2/+2
Rollup of 7 pull requests Successful merges: - #85223 (rustdoc: Clarified the attribute which prompts the warning) - #88847 (platform-support.md: correct ARMv7+MUSL platform triple notes) - #88963 (Coerce const FnDefs to implement const Fn traits ) - #89376 (Fix use after drop in self-profile with llvm events) - #89422 (Replace whitespaces in doctests' name with dashes) - #89440 (Clarify a sentence in the documentation of Vec (#84488)) - #89441 (Normalize after substituting via `field.ty()`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-01Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obkManish Goregaokar-2/+2
Coerce const FnDefs to implement const Fn traits You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`. r? ``@oli-obk`` ``@rustbot`` label T-compiler F-const_trait_impl
2021-10-01Auto merge of #88880 - cjgillot:no-krate, r=oli-obkbors-6/+3
Rework HIR API to make invocations of the hir_crate query harder. `hir_crate` forces the recomputation of queries that depend on it. This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
2021-09-30Avoid intermediate `collect()`Noah Lev-1/+1
2021-09-30Remove temporary `GetDefId` impl for `Path`Noah Lev-16/+10
2021-09-30Remove unused `Clean` implNoah Lev-7/+0
2021-09-30Remove unnecessary `Box` in `Type::QPath`Noah Lev-12/+11
2021-09-30Avoid unnecessary matches by changing `Clean` implNoah Lev-16/+7
2021-09-30Use `Path` instead of `Type` in `PolyTrait`Noah Lev-235/+145
The change to `impl Clean<Path> for hir::TraitRef<'_>` was necessary to fix a test failure for `src/test/rustdoc/trait-alias-mention.rs`. Here's why: The old code path was through `impl Clean<Type> for hir::TraitRef<'_>`, which called `resolve_type`, which in turn called `register_res`. Now, because `PolyTrait` uses a `Path` instead of a `Type`, the impl of `Clean<Path>` was being run, which did not call `register_res`, causing the trait alias to not be recorded in the `external_paths` cache.
2021-09-30Make `Impl.trait_` a `Path`, not a `Type`Noah Lev-20/+52
It should only ever be a `ResolvedPath`, so this (a) enforces that, and (b) reduces the size of `Impl`. I had to update a test because the order of the rendered auto trait impl bounds changed. I think the order changed because rustdoc sorts auto trait bounds using their `Debug` output.
2021-09-30Remove `Path.global`Noah Lev-12/+3
2021-09-29Rollup merge of #89297 - GuillaumeGomez:remove-never-from-type-enum, r=camelidEric Huss-5/+2
Remove Never variant from clean::Type enum Fixes #89287. r? ``@camelid``
2021-09-29Rollup merge of #89098 - GuillaumeGomez:where-bounds-order, r=camelidEric Huss-4/+6
Fix generics where bounds order Fixes #88809. Like said on the above issue, the issue is that we were expecting `Symbol` comparisons to be string-based but they are integer-based (because `Symbol` is an integer), messing up the bounds order. To fix it, I simply stored into a `FxIndexMap` instead. r? ``@jyn514``
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-6/+3
2021-09-29Remove Never variant from clean::Type enumGuillaume Gomez-5/+2
2021-09-27Auto merge of #89203 - GuillaumeGomez:cleanup-rustdoc-types, r=camelidbors-42/+40
Clean up clean/types.rs file by making the implementations follow the type declaration This PR doesn't change anything, it simply moves things around: when reading the code, I realized a few times that a type declaration and implementations on it might be separated by some other type declarations, which makes the reading much more complicated. I put back impl and declaration together. r? `@camelid`
2021-09-25Rollup merge of #89198 - hkmatsumoto:hide-hidden-methods, r=jyn514Manish Goregaokar-1/+33
rustdoc: Don't show hidden trait methods Fix #89186. By skipping trait items whose attributes include `hidden`, we avoid showing such trait methods.
2021-09-25Rollup merge of #88895 - camelid:cleanup-pt2, r=jyn514Manish Goregaokar-44/+32
rustdoc: Cleanup `clean` part 2 Split out from #88379. This contains the following commits from that PR: - Remove `Type::ResolvedPath.is_generic` - Rename `is_generic()` to `is_assoc_ty()` r? `@jyn514`
2021-09-25rustdoc: Document `is_assoc_ty()`Noah Lev-0/+2
It's adapted from the old documentation for the `is_generic` field.
2021-09-26Elaborate commentHirochika Matsumoto-1/+1
Co-authored-by: Joshua Nelson <github@jyn.dev>
2021-09-25rustdoc: Don't show hidden trait methodsHirochika Matsumoto-1/+33
By skipping trait items whose attributes include `hidden`, we void showing such trait methods.
2021-09-24Rollup merge of #89001 - jackh726:binder-cleanup, r=nikomatsakisJubilee-2/+6
Be explicit about using Binder::dummy This is somewhat of a late followup to the binder refactor PR. It removes `ToPredicate` and `ToPolyTraitImpls` that hide the use of `Binder::dummy`. While this does make code a bit more verbose, it allows us be more careful about where we create binders. Another alternative here might be to add a new trait `ToBinder` or something with a `dummy()` fn. Which could still allow grepping but allows doing something like `trait_ref.dummy()` (but I also wonder if longer-term, it would be better to be even more explicit with a `bind_with_vars(ty::List::empty())` *but* that's not clear yet. r? ``@nikomatsakis``
2021-09-23Clean up clean/types.rs file by making the implementations follow the type ↵Guillaume Gomez-42/+40
declaration
2021-09-22Auto merge of #89134 - est31:revert_rustdoc_box_syntax, r=GuillaumeGomezbors-42/+34
Revert the rustdoc box syntax removal Reverts the rustdoc box syntax removal from #87781. It turned out to cause (minor) perf regressions. Requested in https://github.com/rust-lang/rust/pull/87781#issuecomment-922589168
2021-09-21Revert the rustdoc box syntax removalest31-42/+34
It turned out to cause (minor) perf regressions.
2021-09-19Fix generics where bounds orderGuillaume Gomez-4/+6
2021-09-17rustdoc: Add human-readable cfg string for m68kJohn Paul Adrian Glaubitz-0/+1
2021-09-15Fix rustdocjackh726-2/+6
2021-09-15Move is_const_fn to under TyCtxtDeadbeef-2/+2
2021-09-12Rename `is_generic()` to `is_assoc_ty()`Noah Lev-3/+3
The new name is more accurate than the previous one.
2021-09-12Remove `Type::ResolvedPath.is_generic`Noah Lev-43/+29
It can be computed on-demand.
2021-09-12Rollup merge of #88810 - camelid:cleanup-pt1, r=jyn514Manish Goregaokar-58/+34
rustdoc: Cleanup `clean` part 1 Split out from #88379. These commits are completely independent of each other, and each is a fairly small change (the last few are new commits; they are not from #88379): - Remove unnecessary `Cache.*_did` fields - rustdoc: Get symbol for `TyParam` directly - Create a valid `Res` in `external_path()` - Remove unused `hir_id` parameter from `resolve_type` - Fix redundant arguments in `external_path()` - Remove unnecessary `is_trait` argument - rustdoc: Cleanup a pattern match in `external_generic_args()` r? ``@jyn514``
2021-09-12Rollup merge of #88677 - petrochenkov:exportid, r=davidtwcoManish Goregaokar-10/+10
rustc: Remove local variable IDs from `Export`s Local variables can never be exported.
2021-09-12Fix linkcheck issuesJoshua Nelson-1/+1
Most of these are because alloc uses `#[lang_item]` to define methods, but core documents primitives before those methods are available. - Fix rustdoc-js-std test For some reason this change made CStr not show up in the results for `str,u8`. Since it still shows up for str, and since it wasn't a great match for that query anyway, I think this is ok to let slide. - Add test that all primitives can be linked to - Enable `doc(primitive)` in `core` as well - Add linkcheck exception specifically for Windows Ideally this would be done automatically by the linkchecker by replacing `\\` with forward slashes, but this PR is already a ton of work ... - Don't forcibly fail linkchecking if there's a broken intra-doc link on Windows Previously, it would exit with a hard error if a missing file had `::` in it. This changes it to report a missing file instead, which allows adding an exception.