summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2020-11-17Add test to ensure that no DOS backline (\r\n) doesn't create extra backline ↵Guillaume Gomez-14/+27
in source rendering
2020-11-17Ensure that the source code display is working with DOS backlineGuillaume Gomez-0/+2
2020-11-13Auto merge of #78826 - petrochenkov:mrscopes2, r=eddybbors-1/+1
resolve: Collapse `macro_rules` scope chains on the fly Otherwise they grow too long and you have to endlessly walk through them when resolving macros or imports. Addresses https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Slow.20Builtin.20Derives/near/215750815
2020-11-12Auto merge of #78976 - GuillaumeGomez:rollup-endkih3, r=GuillaumeGomezbors-2/+5
Rollup of 5 pull requests Successful merges: - #78916 (extend const generics test suite) - #78921 (Improve the page title switch handling between search and doc) - #78933 (Don't print thread ids and names in `tracing` logs) - #78960 (Test default values for const parameters.) - #78971 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-12Rollup merge of #78921 - GuillaumeGomez:search-result-title, r=jyn514Guillaume Gomez-2/+5
Improve the page title switch handling between search and doc The current behavior often "forgets" to update the page title when discarding/putting back the search results. This isn't optimal which is why I wrote this fix. r? ``@jyn514``
2020-11-12Auto merge of #78773 - GuillaumeGomez:theme-picker-shortcut, r=jyn514bors-0/+10
Add shortcut for theme picker menu Follow-up of #78584 Just like you can focus the search input by pressing "S", you can now access the theme picker menu by pressing "T" and navigate through the options only using the keyboard. cc `@notriddle` r? `@jyn514`
2020-11-11Rollup merge of #78923 - jyn514:intra-doc-comments, r=ManishearthJonas Schievink-167/+247
Cleanup and comment intra-doc link pass r? ```@Manishearth``` cc ```@seeplusplus```
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-3/+2
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
2020-11-10Cleanup and comment intra-doc link passJoshua Nelson-167/+247
2020-11-10Improve the page title switch handling between search and docGuillaume Gomez-2/+5
2020-11-10(rustdoc) [src] link for types defined by macros shows invocationFlorian Warzecha-4/+9
Previously the [src] link on types defined by a macro pointed to the macro definition. This commit makes the Clean-Implementation for Spans aware of macro defined types, so that the link points to the invocation instead.
2020-11-09Rollup merge of #78868 - notriddle:master, r=GuillaumeGomezDylan DPC-2/+3
Fix tab focus on restyled switches Setting a checkbox to `display:none` makes it impossible to tab onto it, which makes the rustdoc settings page completely keyboard inaccessible.
2020-11-09Rollup merge of #78114 - jyn514:private, r=oli-obkDylan DPC-5/+6
Recognize `private_intra_doc_links` as a lint Previously, trying to allow this would give another error! ``` warning: unknown lint: `private_intra_doc_links` --> private.rs:1:10 | 1 | #![allow(private_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links` | = note: `#[warn(unknown_lints)]` on by default warning: public documentation for `DocMe` links to private item `DontDocMe` --> private.rs:2:11 | 2 | /// docs [DontDocMe] | ^^^^^^^^^ this item is private | = note: `#[warn(private_intra_doc_links)]` on by default = note: this link will resolve properly if you pass `--document-private-items` ``` Fixes the issue found in https://github.com/rust-lang/rust/pull/77249#issuecomment-712339227. r? ````````@Manishearth```````` Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
2020-11-07Fix tab focus on restyled switchesMichael Howell-2/+3
Setting a checkbox to `display:none` makes it impossible to tab onto it, which makes the rustdoc settings page completely keyboard inaccessible.
2020-11-07resolve: Collapse `macro_rules` scope chains on the flyVadim Petrochenkov-1/+1
2020-11-06Auto merge of #75778 - AndyGauge:75521-rustdoc-book-improvements, r=jyn514bors-0/+1
75521 rustdoc book improvements Added some guidelines about documenting with rustdoc Fixes #75521
2020-11-06Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27bors-1/+148
Add non_autolinks lint Part of #77501. r? `@jyn514`
2020-11-05Fix even more URLsGuillaume Gomez-1/+1
2020-11-05Add PRIVATE_INTRA_DOC_LINKS to rustdoc special-casingJoshua Nelson-5/+6
This is really starting to get out of hand. Rustdoc should instead allow all lints in the rustdoc lint group.
2020-11-05Add shortcut for theme picker menuGuillaume Gomez-0/+10
2020-11-05Rollup merge of #78584 - notriddle:master, r=GuillaumeGomezMara Bos-12/+64
Add keyboard handling to the theme picker menu This PR is mostly designed to bring the theme picker closer to feature parity with the menu bar from docs.rs. Though the rustdoc theme picker is technically already usable from the keyboard, it's really weird that arrow keys work on some of the menus, but not all of them, in the exact same page.
2020-11-05Rename lint to non_autolinksGuillaume Gomez-17/+18
2020-11-05Improve lint even moreGuillaume Gomez-4/+5
2020-11-05Don't check for URLs inside codeblocksGuillaume Gomez-20/+30
2020-11-05Rename automatic_links to url_improvementsGuillaume Gomez-16/+16
2020-11-05Improve automatic_links globallyGuillaume Gomez-19/+18
2020-11-05Extend automatic_links lint to take into account URLs without link syntaxGuillaume Gomez-27/+63
2020-11-05Add new lint for automatic_links improvementsGuillaume Gomez-0/+100
2020-11-04Added Rustdoc book sections for linting and embedding more examplesAndrew Gauger-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-11-04`u128` truncation and sign extension are not just interpreter relatedoli-2/+2
2020-11-04Split the "raw integer bytes" part out of `Scalar`Oliver Scherer-4/+5
2020-11-03Rollup merge of #78400 - GuillaumeGomez:fix-unindent, r=jyn514Yuki Okushi-92/+98
Fix unindent in doc comments Fixes #70732 r? ``@jyn514``
2020-11-01Improve code in unindent_comment a bit moreGuillaume Gomez-21/+22
2020-10-30Pull theme picker keyboard code into main.jsMichael Howell-51/+59
Most of the code in mod.rs should be code that really needs to have the list of available themes inlined into it.
2020-10-30Add comment describing the Escape key weirdnessMichael Howell-2/+8
2020-10-30Add aria roles for theme picker menuMichael Howell-2/+2
2020-10-30Allow the theme picker to work with arrow keysMichael Howell-2/+46
This is mostly motivated by docs.rs. It's really weird when arrow keys work in the top dropdown menu, but don't work in other dropdown menus on the same page.
2020-10-30Close the theme picker when Escape is pressedMichael Howell-8/+2
2020-10-29Update testsGuillaume Gomez-6/+1
2020-10-29Change a bit how the first doc comment lines are handledGuillaume Gomez-38/+33
2020-10-28rustdoc: Use Vec::into_iter() rather than drain()Ian Jackson-2/+2
This allows removing a `mut` which is nicer. Suggested-by: @jyn514 Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28Add a comment about non-panicking of splitn().next().unwrap()Ian Jackson-0/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-28rustdoc: Fix some nitsIan Jackson-4/+4
* Remove a needless comma in the Rust code * Replace double spaces after full stops with single spaces Requested-by: @GuillaumeGomez Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28rustdoc: Provide a --default-theme THEME optionIan Jackson-0/+21
This is a fairly simple special case of --default-eetting. We must set both "theme" and "use-system-theme". Providing it separately enables us to document a way to set the theme without expoosing the individual settings keywords, which are quite complex. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28rustdoc: Provide a general --default-setting SETTING[=VALUE] optionIan Jackson-2/+26
We just plumb through what the user tells us. This is flagged as unstable, mostly because I don't understand the compatibility rules that rustdoc obeys for local storage data, and how error handling of invalid data works. We collect() the needed HashMap from Vec of Vecs of (key, value) pairs, so that there is a nice place to add new more-specific options. It would have been possible to use Extend::extend but doing it this way ensures that all the used inputs are (and will stay) right next to each other. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28rustdoc: Provide a way to set the default settings from Rust codeIan Jackson-2/+39
rustdoc has various user-configurable preferences. These are recorded in web Local Storage (where available). But we want to provide a way to configure the default default, including for when web storage is not available. getSettingValue is the function responsible for looking up these settings. Here we make it fall back some in-DOM data, which ultimately comes from RenderOptions.default_settings. Using HTML data atrtributes is fairly convenient here, dsspite the need to transform between snake and kebab case to avoid the DOM converting kebab case to camel case (!) We cache the element and dataset lookup in a global variable, to ensure that getSettingValue remains fast. The DOM representation has to be in an element which precedes the inclusion of storage.js. That means it has to be in the <head> and we should not use an empty <div> as the container (although most browsers will accept that). An empty <script> element provides a convenient and harmless container object. <meta> would be another possibility but runs a greater risk of having unwanted behaviours on weird browsers. We trust the RenderOptions not to contain unhelpful setting names, which don't fit nicely into an HTML attribute. It's awkward to quote dataset keys. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28rustdoc: js: Use getSettingValue for all rustdoc-* valuesIan Jackson-24/+25
Currently, storage.js and main.js have many open-coded calls to getCurrentValue for "rustdoc-" values, but these are settings and should be handled by getSettingValue. So make getSettingValue part of storage.js (where everyone can call it) and use it everywhere. No functional change yet. We are going to make getSettingValue do something more sophisticated in a moment. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-27Rollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomezYuki Okushi-10/+10
Make some functions private that don't have to be public r? @GuillaumeGomez
2020-10-26Add test for doc comments unindent fixGuillaume Gomez-32/+28
2020-10-26Fix unindent behavior between different doc commentsGuillaume Gomez-56/+75