summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
2021-11-26Rename `Type::ResolvedPath` to `Type::Path`Noah Lev-3/+2
At last! The new name is shorter, simpler, and consistent with `hir::Ty`.
2021-11-25Stop re-exporting `Type::ResolvedPath`Noah Lev-1/+1
I would like to rename it to `Type::Path`, but then it can't be re-exported since the name would conflict with the `Path` struct. Usually enum variants are referred to using their qualified names in Rust (and parts of rustdoc already do that with `clean::Type`), so this is also more consistent with the language.
2021-11-24Remove `ResolvedPath.did`Noah Lev-1/+2
2021-11-24Return the actual `DefId` for assoc. items in `register_res`Noah Lev-1/+12
Before, if `register_res` were called on an associated item or enum variant, it would return the parent's `DefId`. Now, it returns the actual `DefId`. This change is a step toward removing `Type::ResolvedPath.did` and potentially removing `kind_side_channel` in rustdoc. It also just simplifies rustdoc's behavior.
2021-11-07rustdoc: Remove top-level wrappers for `ImplKind` methodsNoah Lev-1/+1
The `ImplKind` methods can just be used directly instead.
2021-11-07rustdoc: Use `ty::ImplPolarity` instead of custom enumNoah Lev-2/+3
2021-11-07Use an enum to record polarity in `clean::Impl`Noah Lev-2/+3
2021-11-07rustdoc: Refactor `Impl.{synthetic,blanket_impl}` into enumNoah Lev-1/+1
This change has two advantages: 1. It makes the possible states clearer, and it makes it impossible to construct invalid states, such as a blanket impl that is also an auto trait impl. 2. It shrinks the size of `Impl` a bit, since now there is only one field, rather than two.
2021-10-25Fix clippy lints in librustdocGuillaume Gomez-5/+5
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-39/+36
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-09Fix invalid HTML generation for higher boundsGuillaume Gomez-2/+6
2021-10-02Replace all uses of `path.res.def_id()` with `path.def_id()`Noah Lev-3/+3
2021-09-30Use `Path` instead of `Type` in `PolyTrait`Noah Lev-39/+27
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-0/+9
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-29Remove Never variant from clean::Type enumGuillaume Gomez-1/+3
2021-09-12Rename `is_generic()` to `is_assoc_ty()`Noah Lev-2/+2
The new name is more accurate than the previous one.
2021-09-12Remove `Type::ResolvedPath.is_generic`Noah Lev-24/+13
It can be computed on-demand.
2021-09-12Fix broken handling of primitive itemsJoshua Nelson-1/+7
- Fix broken handling of primitive associated items - Remove fragment hack Fixes 83083 - more logging - Update CrateNum hacks The CrateNum has no relation to where in the dependency tree the crate is, only when it's loaded. Explicitly special-case core instead of assuming it will be the first DefId. - Update and add tests - Cache calculation of primitive locations This could possibly be avoided by passing a Cache into collect_intra_doc_links; but that's a much larger change, and doesn't seem valuable other than for this.
2021-09-12downgrade some loggingJoshua Nelson-1/+1
2021-09-02rustdoc: Clean up handling of lifetime boundsNoah Lev-4/+18
Previously, rustdoc recorded lifetime bounds by rendering them into the name of the lifetime parameter. Now, it leaves the name as the actual name and instead records lifetime bounds in an `outlives` list, similar to how type parameter bounds are recorded.
2021-08-27Introduce `~const`Deadbeef-1/+1
- [x] Removed `?const` and change uses of `?const` - [x] Added `~const` to the AST. It is gated behind const_trait_impl. - [x] Validate `~const` in ast_validation. - [ ] Add enum `BoundConstness` to the HIR. (With variants `NotConst` and `ConstIfConst` allowing future extensions) - [ ] Adjust trait selection and pre-existing code to use `BoundConstness`. - [ ] Optional steps (*for this PR, obviously*) - [ ] Fix #88155 - [ ] Do something with constness bounds in chalk
2021-08-05Add missing root_path when generating links using hrefGuillaume Gomez-1/+17
2021-08-05* Rename 'move_span' into 'local_span_to_global_span'Guillaume Gomez-4/+1
* Add documentation on new arguments/functions
2021-08-05Add links on source types to go to definitionGuillaume Gomez-1/+4
2021-08-03don't use .into() to convert types to identical types ↵Matthias Krüger-2/+2
(clippy::useless_conversion) Example: let _x: String = String::from("hello world").into();
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-2/+2
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-25don't slice slices (clippy::redundant_slicing)Matthias Krüger-2/+2
2021-07-25Add generic arg inferkadmin-0/+1
2021-07-06review - better error names/docFrançois Mockers-7/+8
2021-07-06fix dead link for method in trait of blanket impl from third party crateFrançois Mockers-22/+36
2021-07-05rustdoc: Rename `expect_real` to `expect_def_id`, remove `Item::is_fake`Justus K-1/+1
2021-07-05rustdoc: Replace `FakeDefId` with new `ItemId` typeJustus K-2/+2
2021-06-26Auto merge of #84814 - Stupremee:properly-render-hrtbs, r=GuillaumeGomezbors-21/+42
Properly render HRTBs ```rust pub fn test<T>() where for<'a> &'a T: Iterator, {} ``` This will now render properly including the `for<'a>` ![image](https://user-images.githubusercontent.com/39732259/116808426-fe6ce600-ab38-11eb-9452-f33f554fbb8e.png) I do not know if this covers all cases, it only covers everything that I could think of that includes `for` and lifetimes in where bounds. Also someone need to mentor me on how to add a proper rustdoc test for this. Resolves #78482
2021-06-21Update comment regarding staged_apiDeadbeef-1/+1
2021-06-21Removed/Updated some cases and simplified `match`Deadbeef-1/+1
2021-06-21Check for const_unstable before printing `const`Deadbeef-9/+17
2021-06-19rustdoc: Introduce new `DynTrait` type for better representation of trait ↵Justus K-37/+23
objects
2021-06-18rustdoc: Render `for<'_>` lifetimes in trait objectsJustus K-5/+24
2021-06-18rustdoc: Render `for<'_>` lifetimes in front of where boundJustus K-3/+19
2021-06-09Rollup merge of #85957 - BoxyUwU:rustdoc-const-generic-defaults, r=oli-obkYuki Okushi-3/+13
Display defaults on const params- rustdoc previously rustdoc would render this struct declaration: `pub struct Foo<const N: usize = 10>;` as: `pub struct Foo<const N: usize>;` this PR changes it to render correctly
2021-06-05Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomezYuki Okushi-3/+3
rustdoc: Remove `PrimitiveType::{to_url_str, as_str}` These can easily be rewritten in terms of `as_sym`, and this avoids bugs where the two get out of sync. I don't expect this to have a perf impact, but I'll start a perf run just in case.
2021-06-03rustdoc- Show defaults on const generics Ellen-3/+13
2021-05-20Remove `PrimitiveType::as_str`Joshua Nelson-3/+3
2021-05-20Remove `to_url_str`Joshua Nelson-2/+2
2021-05-19rustdoc: render `<Self as X>::Y` type casts properlyJustus K-3/+6
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-6/+9
2021-05-01Rollup merge of #84601 - tdelabro:rustdoc-get-rid-of-cache-extern_locations, ↵Yuki Okushi-9/+11
r=jyn514 rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand help #84588
2021-04-29only store locations in extern_locationsTimothée Delabrouille-9/+11
2021-04-27Don't put empty implementations into details/summary blocksGuillaume Gomez-0/+4
2021-04-17rustdoc: get rid of CURRENT_DEPTHMichael Howell-40/+43