about summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
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
2021-04-17rustdoc: move the cx argument to the end of the listMichael Howell-13/+13
This should help make things consistent.
2021-04-17rustdoc: change 'cx to 'tcx, to match the struct itselfMichael Howell-60/+60
2021-04-17rustdoc: use more precise relative URLSMichael Howell-264/+253
Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter. Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping). $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html 2387389 struct.Wrapping.old.html 2298538 struct.Wrapping.new.html Most if it can be efficiently gzipped away. $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz 70679 struct.Wrapping.old.html.gz 70050 struct.Wrapping.new.html.gz But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
2021-04-17Auto merge of #84246 - notriddle:rustdoc-path-printing-cleanup, r=jyn514bors-42/+0
rustdoc: get rid of unused path printing code The code for printing a raw path is only used in utils.rs, which only prints the alternative (non-HTML) format. Path has a function that does the same thing without HTML support, so use that instead.
2021-04-16rustdoc: get rid of unused path printing codeMichael Howell-42/+0
The code for printing a raw path is only used in utils.rs, which only prints the alternative (non-HTML) format. Path has a function that does the same thing without HTML support, so use that instead.
2021-04-10rustdoc: clean up and test macro visibility printMichael Howell-10/+38
This fixes the overly-complex invariant mentioned in <https://github.com/rust-lang/rust/pull/83237#issuecomment-815346570>, where the macro source can't have any links in it only because the cache hasn't been populated yet.
2021-03-24Rework rustdoc const typeGuillaume Gomez-313/+404
2021-03-07Avoid temporary allocations in `render_assoc_item`Joshua Nelson-0/+4
`render_assoc_item` came up as very hot in a profile of rustdoc on `bevy`. This avoids some temporary allocations just to calculate the length of the header. This should be a strict improvement, since all string formatting was done twice before.
2021-02-06Restore linking to itself in implementors section of trait pageLeSeulArtichaut-43/+2