about summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
AgeCommit message (Collapse)AuthorLines
2018-02-18Cleanup formattingAaron Hill-18/+0
2018-02-18Generate documentation for auto-trait implsAaron Hill-60/+235
A new section is added to both both struct and trait doc pages. On struct/enum pages, a new 'Auto Trait Implementations' section displays any synthetic implementations for auto traits. Currently, this is only done for Send and Sync. On trait pages, a new 'Auto Implementors' section displays all types which automatically implement the trait. Effectively, this is a list of all public types in the standard library. Synthesized impls for a particular auto trait ('synthetic impls') take into account generic bounds. For example, a type 'struct Foo<T>(T)' will have 'impl<T> Send for Foo<T> where T: Send' generated for it. Manual implementations of auto traits are also taken into account. If we have the following types: 'struct Foo<T>(T)' 'struct Wrapper<T>(Foo<T>)' 'unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes this sound somehow Then Wrapper will have the following impl generated: 'impl<T> Send for Wrapper<T>' reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send' to hold Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are taken into account by synthetic impls However, if a type can *never* implement a particular auto trait (e.g. 'struct MyStruct<T>(*const T)'), then a negative impl will be generated (in this case, 'impl<T> !Send for MyStruct<T>') All of this means that a user should be able to copy-paste a synthetic impl into their code, without any observable changes in behavior (assuming the rest of the program remains unchanged).
2018-02-16Remove hoedown from rustdocGuillaume Gomez-218/+18
Is it really time? Have our months, no, *years* of suffering come to an end? Are we finally able to cast off the pall of Hoedown? The weight which has dragged us down for so long? ----- So, timeline for those who need to catch up: * Way back in December 2016, [we decided we wanted to switch out the markdown renderer](https://github.com/rust-lang/rust/issues/38400). However, this was put on hold because the build system at the time made it difficult to pull in dependencies from crates.io. * A few months later, in March 2017, [the first PR was done, to switch out the renderers entirely](https://github.com/rust-lang/rust/pull/40338). The PR itself was fraught with CI and build system issues, but eventually landed. * However, not all was well in the Rustdoc world. During the PR and shortly after, we noticed [some differences in the way the two parsers handled some things](https://github.com/rust-lang/rust/issues/40912), and some of these differences were major enough to break the docs for some crates. * A couple weeks afterward, [Hoedown was put back in](https://github.com/rust-lang/rust/pull/41290), at this point just to catch tests that Pulldown was "spuriously" running. This would at least provide some warning about spurious tests, rather than just breaking spontaneously. * However, the problems had created enough noise by this point that just a few days after that, [Hoedown was switched back to the default](https://github.com/rust-lang/rust/pull/41431) while we came up with a solution for properly warning about the differences. * That solution came a few weeks later, [as a series of warnings when the HTML emitted by the two parsers was semantically different](https://github.com/rust-lang/rust/pull/41991). But that came at a cost, as now rustdoc needed proc-macro support (the new crate needed some custom derives farther down its dependency tree), and the build system was not equipped to handle it at the time. It was worked on for three months as the issue stumped more and more people. * In that time, [bootstrap was completely reworked](https://github.com/rust-lang/rust/pull/43059) to change how it ordered compilation, and [the method by which it built rustdoc would change](https://github.com/rust-lang/rust/pull/43482), as well. This allowed it to only be built after stage1, when proc-macros would be available, allowing the "rendering differences" PR to finally land. * The warnings were not perfect, and revealed a few [spurious](https://github.com/rust-lang/rust/pull/44368) [differences](https://github.com/rust-lang/rust/pull/45421) between how we handled the renderers. * Once these were handled, [we flipped the switch to turn on the "rendering difference" warnings all the time](https://github.com/rust-lang/rust/pull/45324), in October 2017. This began the "warning cycle" for this change, and landed in stable in 1.23, on 2018-01-04. * Once those warnings hit stable, and after a couple weeks of seeing whether we would get any more reports than what we got from sitting on nightly/beta, [we switched the renderers](https://github.com/rust-lang/rust/pull/47398), making Pulldown the default but still offering the option to use Hoedown. And that brings us to the present. We haven't received more new issues from this in the meantime, and the "switch by default" is now on beta. Our reasoning is that, at this point, anyone who would have been affected by this has run into it already.
2018-01-26Merge branch 'rustdoc_masked' of https://github.com/ollie27/rust into rollupAlex Crichton-25/+27
2018-01-25Auto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavusbors-4/+4
Few fixes for multiple themes support feature r? @QuietMisdreavus Fixes #47695.
2018-01-24Few fixes for multiple themes support featureGuillaume Gomez-4/+4
2018-01-23Auto merge of #47678 - kennytm:rollup, r=kennytmbors-1/+2
Rollup of 14 pull requests - Successful merges: #47423, #47425, #47440, #47541, #47549, #47554, #47558, #47610, #47635, #47655, #47661, #47662, #47667, #47672 - Failed merges:
2018-01-23Auto merge of #47620 - GuillaumeGomez:multiple-themes, r=QuietMisdreavusbors-6/+76
Multiple themes for rustdoc r? @QuietMisdreavus
2018-01-23rustdoc: Hide methods from #[doc(masked)] crates from the search indexOliver Middleton-25/+27
2018-01-23rustdoc: Show when traits are auto traitsOliver Middleton-1/+2
2018-01-23Fasten even more theme switchGuillaume Gomez-2/+4
2018-01-22Fasten up theme loadingGuillaume Gomez-22/+1
2018-01-22Change theme iconGuillaume Gomez-0/+2
2018-01-22Resolve foreign macrosManish Goregaokar-1/+1
2018-01-22Use correct item for links in modulesManish Goregaokar-2/+2
2018-01-22cleanupQuietMisdreavus-4/+18
2018-01-22Add LinkReplacer pass for pulldownManish Goregaokar-6/+7
2018-01-22give render_text a generic return typeQuietMisdreavus-1/+1
2018-01-21Add themes optionGuillaume Gomez-11/+24
2018-01-21Add possibility to have multiple themesGuillaume Gomez-4/+78
2018-01-17Rollup merge of #47313 - ollie27:rustdoc_record_extern_trait, r=QuietMisdreavusGuillaume Gomez-3/+2
rustdoc: Populate external_traits with traits only seen in impls This means default methods can always be found and "Important traits" will include all spotlight traits.
2018-01-15Reexport -> re-export in prose and documentation commentsCarol (Nichols || Goulding)-4/+4
2018-01-15Reexport -> re-export in documentation section headingsCarol (Nichols || Goulding)-3/+3
2018-01-13Remove `impl Foo for ..` in favor of `auto trait Foo`leonardo.yvens-13/+3
No longer parse it. Remove AutoTrait variant from AST and HIR. Remove backwards compatibility lint. Remove coherence checks, they make no sense for the new syntax. Remove from rustdoc.
2018-01-10Use the new fs_read_write functions in rustc internalsMatt Brubeck-15/+5
2018-01-10rustdoc: Populate external_traits with traits only seen in implsOliver Middleton-3/+2
This means default methods can always be found and "Important traits" will include all spotlight traits.
2018-01-07Auto merge of #47039 - ollie27:rustdoc_trait_impl_src, r=GuillaumeGomezbors-60/+30
rustdoc: Add missing src links for generic impls on trait pages `implementor2item` would return `None` for generic impls so instead this clones the entire `clean::Item` into the `implementors` map which simplifies some code.
2018-01-06Auto merge of #47083 - CAD97:issue-46976, r=nikomatsakisbors-1/+5
Issue 46976 ICE is due to an empty path segments, so I set the path to be the same as the in band ty params symbol. (I think this is how regular generics end up being handled?) Pinging @cramertj, this is your code I'm editing here.
2017-12-30Hard break for rust-lang/rust#46976Christopher Durham-1/+5
2017-12-29Auto merge of #46883 - QuietMisdreavus:faildown, r=GuillaumeGomezbors-1/+7
rustdoc: add option to abort the process on markdown differences In the efforts of keeping the std docs free of markdown warnings, this PR adds a stopgap measure to make sure the CI fails if it detects a markdown difference. It does this by adding a new unstable flag to rustdoc, `--deny-render-differences`, which bootstrap then passes to rustdoc when documenting std and friends. The implementation is... probably not the cleanest option. It currently adds an extra branch after it prints the markdown warnings, which just prints a final line and calls `::std::process::abort(1)`. I did it like this because if it just panics regularly, it looks like an ICE, an even though `html::render::run` returns a Result, that Result is also just `expect`ed immediately, generating the same problem. This way bypasses the panic handler at the top of the thread and looks like a proper failure. Since i don't have a real error Handler there, this is the best i can do without pulling in a real error system for rustdoc. This PR is blocked on https://github.com/rust-lang/rust/pull/46853, which will fix the rendering differences that were present on master when i started this branch.
2017-12-27rustdoc: Add missing src links for generic impls on trait pagesOliver Middleton-60/+30
`implementor2item` would return `None` for generic impls so instead this clones the entire `clean::Item` into the `implementors` map which simplifies some code.
2017-12-27rustdoc: add option to abort process on markdown differencesQuietMisdreavus-1/+7
2017-12-21Auto merge of #46922 - kennytm:rollup, r=kennytmbors-3/+4
Rollup of 14 pull requests - Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918 - Failed merges:
2017-12-22Rollup merge of #46847 - GuillaumeGomez:more-sidebar-escape, r=QuietMisdreavuskennytm-3/+4
Escape more items in the sidebar when needed Fixes #46724. r? @QuietMisdreavus
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-2/+4
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-21Escape more items in the sidebar when neededGuillaume Gomez-3/+4
2017-12-17Add an option to allow rustdoc to list modules by appearancevarkor-4/+13
The `--sort-modules-by-appearance` option will list modules in the order that they appear in the source, rather than sorting them alphabetically (as is the default). This resolves #8552.
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-27/+34
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-5/+2
2017-12-08Auto merge of #46247 - GuillaumeGomez:md-warnings, r=QuietMisdreqvusbors-8/+16
Md warnings Fixes #45365. r? @QuietMisdreavus
2017-12-07fix markdown file differencesGuillaume Gomez-6/+11
2017-12-07Generate difference warnings for markdown files as wellGuillaume Gomez-2/+5
2017-12-07Greatly improve sidebar when width < 700pxGuillaume Gomez-0/+7
2017-12-03Auto merge of #46384 - ollie27:rustdoc_inline_assoc, r=QuietMisdreavusbors-1/+2
rustdoc: Fix issues with cross-crate inlined associated items * Visibility was missing from impl items. * Attributes and docs were missing from consts and types in impls. * Const default values were missing from traits. This unifies the code that handles associated items from impls and traits.
2017-12-02Auto merge of #46326 - GuillaumeGomez:sidebar-text, r=QuietMisdreavusbors-5/+6
Fix invalid HTML escape Fixes #46289. r? @QuietMisdreavus
2017-12-02Auto merge of #46288 - alexcrichton:bump-bootstrap, r=Mark-Simulacrumbors-2/+0
Bump to 1.24.0 * Update the in-tree version number * Update the bootstrap compiler * Remove `cfg(stage0)` annotations * Update crate dependencies * Update Cargo itself
2017-11-29Update bootstrap compilerAlex Crichton-2/+0
Also remove a number of `stage0` annotations and such
2017-11-30Fix rustoc item summaries that are headersChristian Duerr-1/+3
Rustoc item summaries that are headers were not displayed at all because they started with whitespace. This PR fixes this and now removes the whitespace and then displays the block.
2017-11-29rustdoc: Fix issues with cross-crate inlined associated itemsOliver Middleton-1/+2
* Visibility was missing from impl items. * Attributes and docs were missing from consts and types in impls. * Const default values were missing from traits. This unifies the code that handles associated items from impls and traits.
2017-11-29Fix invalid HTML escapeGuillaume Gomez-5/+6