about summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
2019-09-28rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures.Eduard-Mihai Burtescu-4/+11
2019-09-13Remove *Space wrappers in favor of direct impls or functionsMark Rousskov-68/+43
2019-09-13Unwrap Visibility fieldsMark Rousskov-6/+2
There's not really any reason to not have the visibility default to inherited, and this saves us the trouble of checking everywhere for whether we have a visibility or not.
2019-09-13Move to print functions on types instead of impl fmt::DisplayMark Rousskov-413/+468
This will eventually allow us to easily pass in more parameters to the functions without TLS or other such hacks
2019-09-07Move to buffers throughout print_itemMark Rousskov-3/+3
2019-09-07layout::render takes Print instead of fmt::DisplayMark Rousskov-1/+5
2019-09-07De-indent all fmt::Display impls for later replacement to functionsMark Rousskov-5/+5
2019-09-07Implement Print for FnOnce(&mut Buffer)Mark Rousskov-9/+11
This means that callers can pass in a closure like `|buf| some_function(..., &mut buf)` and pass in arbitrary arguments to that function without complicating the trait definition. We also keep the impl for str and String, since it's useful to be able to just pass in "" or format!("{}"...) results in some cases. This changes Print's definition to take self, instead of &self, because otherwise FnOnce cannot be called directly. We could instead take FnMut or even Fn, but that seems like it'd merely complicate matters -- most of the time, the FnOnce does not constrain us at all anyway. If it does, a custom Print impl for &'_ SomeStruct is not all that painful.
2019-09-07Move sidebar to Buffer-printingMark Rousskov-0/+23
2019-09-07Add buffer abstractionMark Rousskov-0/+65
2019-08-26Transition a few fmt::Display impls to functionsMark Rousskov-49/+53
This introduces a WithFormatter abstraction that permits one-time fmt::Display on an arbitrary closure, created via `display_fn`. This allows us to prevent allocation while still using functions instead of structs, which are a bit unwieldy to thread arguments through as they can't easily call each other (and are generally a bit opaque). The eventual goal here is likely to move us off of the formatting infrastructure entirely in favor of something more structured, but this is a good step to move us in that direction as it makes, for example, passing a context describing current state to the formatting impl much easier.
2019-08-26Inline RawMutableSpaceMark Rousskov-16/+7
2019-08-26Store only the current depthMark Rousskov-6/+6
Previously we stored the entire current path which is a bit expensive and only ever accessed its length. This stores the length directly.
2019-08-26Remove support for printing HRef in alternate modeMark Rousskov-11/+8
The alternate mode merely prints out the passed in text which is largely useless (as the text can simply be directly printed).
2019-08-10Replace is_doc_reachable with is_publicMark Rousskov-2/+1
2019-06-26remove unused derives and variantsAndy Russell-3/+0
2019-06-05Addressed points raised in review.Niko Matsakis-4/+19
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-4/+3
2019-06-03Auto merge of #59033 - GuillaumeGomez:duplicated-bounds, r=Dylan-DPCbors-11/+11
Fix duplicated bounds printing in rustdoc Fixes #56331. Once again, I couldn't find out how to reproduce it with a small code so no test... :-/ r? @QuietMisdreavus
2019-05-26Rename "Associated*" to "Assoc*"Andrew Xu-1/+1
We are going to uniform the terminology of all associated items. Methods that may or may not have `self` are called "associated functions". Because `AssociatedFn` is a bit long, we rename `Associated` to `Assoc`.
2019-05-18Fix display of const generics in rustdocGuillaume Gomez-3/+1
2019-03-22Rollup merge of #59170 - varkor:const-generics-rustdoc, r=QuietMisdreavus,eddybMazdak Farrokhzad-24/+23
Add const generics to rustdoc Split out from #53645. This work is a collaborative effort with @yodaldevoid. The `FIXME`s are waiting on a refactor to `LazyConst`. I'll address these in a follow up, but I thought it would be better to implement the rest now to avoid bitrot. r? @QuietMisdreavus
2019-03-18Make clean::Constant display respect f.alternate()varkor-1/+3
2019-03-18Fix indentation issuevarkor-1/+1
2019-03-18Refactor `GenericArgs` to include const genericsvarkor-14/+5
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18Implement `Clean` for const genericsvarkor-0/+6
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-18Rename typarams to param_namesvarkor-10/+10
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-14Add default keyword handling in rustdocGuillaume Gomez-0/+11
2019-03-09Fix duplicated bounds printing in rustdocGuillaume Gomez-11/+11
2019-02-27Support defining C compatible variadic functionsDan Robertson-17/+5
Add support for defining C compatible variadic functions in unsafe rust with extern "C".
2019-02-23Transition librustdoc to 2018 editionHirokazu Hata-39/+40
2019-02-20Rollup merge of #58409 - euclio:impl-trait-wrapping, r=QuietMisdreavuskennytm-11/+15
rustdoc: respect alternate flag when formatting impl trait Fixes #58226. Before: <img width="963" alt="screen shot 2019-02-12 at 3 23 30 pm" src="https://user-images.githubusercontent.com/1372438/52665732-4496ea00-2eda-11e9-9e29-efffe43b2abf.png"> After: <img width="964" alt="screen shot 2019-02-12 at 3 23 51 pm" src="https://user-images.githubusercontent.com/1372438/52665733-452f8080-2eda-11e9-999a-dd1fb28dee16.png">
2019-02-15Add Const kind to rustdocvarkor-0/+10
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-3/+3
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12respect alternate flag when formatting impl traitAndy Russell-11/+15
2019-02-10rustc: doc commentsAlexander Regueiro-3/+3
2019-02-06display sugared return types for async functionsAndy Russell-7/+16
2018-12-25Remove licensesMark Rousskov-10/+0
2018-10-15rustdoc: Use dyn keyword when rendering dynamic traitsOliver Middleton-0/+3
The dyn keyword has been stable for a while now so rustdoc should start using it.
2018-08-23use String::new() instead of String::from(""), "".to_string(), "".to_owned() ↵Matthias Krüger-1/+1
or "".into()
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-5/+5
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-29Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakisbors-11/+9
Misc cleanups
2018-07-28Don't display full blanket implementation and put it into its own sectionGuillaume Gomez-1/+5
2018-07-27Use str::repeatShotaro Yamada-11/+9
2018-07-27Prefer to_string() to format!()ljedrz-5/+5
2018-06-21Display async fn in rustdoc.Without Boats-0/+13
2018-06-20Make GenericBound explicitvarkor-2/+2
2018-06-20Rename ParamBound(s) to GenericBound(s)varkor-10/+10
2018-06-20Use ParamBounds in WhereRegionPredicatevarkor-1/+1
2018-06-20Lift bounds into GenericParamvarkor-10/+10