summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
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
2021-02-05Rollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514Mara Bos-11/+11
rustdoc: Move `display_fn` struct inside `display_fn` This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it. r? ````@GuillaumeGomez````
2021-01-29rustdoc: Move `display_fn` struct inside `display_fn`Camelid-11/+11
This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it.
2021-01-27rustdoc: Render HRTB correctly for bare functionsCamelid-6/+15
The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR.
2021-01-27Remove CACHE_KEY globalGuillaume Gomez-228/+279
2021-01-09Replace under-used ImplPolarity enum with a booleanGuillaume Gomez-1/+1
2021-01-01clippy fixes for librustdocMatthias Krüger-9/+9
fixes clippy warnings of type: match_like_matches_macro or_fun_call op_ref needless_return let_and_return single_char_add_str useless_format unnecessary_sort_by match_ref_pats redundant_field_names
2020-12-31Add FIXME for visibility of a moduleCamelid-0/+3
2020-12-30Update `find_nearest_parent_module`Camelid-3/+3
2020-12-25Prefer `pub(crate)` over no modifierCamelid-3/+3
2020-12-25Handle `pub(super)`Camelid-1/+9
2020-12-25Fix bugs; fix and add testsCamelid-27/+29