Dylan DPC
f35eb5cced
Rollup merge of #75881 - pickfire:patch-5, r=GuillaumeGomez
...
Expand rustdoc theme chooser x padding


But I still think there is room for improvement considering mdbook.

CC @GuillaumeGomez @jyn514
2020-08-30 01:43:42 +02:00
Pietro Albini
efd81b435b
Rollup merge of #75989 - matklad:renamerustdoctest, r=GuillaumeGomez
...
Rename rustdoc/test -> rustdoc/doctest
This modules contains the implementation of doctests, and not the
tests of rustdoc itself. This name is confusing, so let's rename it to
doctest for clarity.
2020-08-28 10:24:07 +02:00
Pietro Albini
8730c2beb7
Rollup merge of #75330 - Nemo157:improve-doc-cfg-features, r=GuillaumeGomez
...
Improve rendering of crate features via doc(cfg)
The current rendering of crate features with `doc(cfg(feature = ".."))` is verbose and unwieldy for users, `doc(cfg(target_feature = ".."))` is special-cased to make it render nicely, and a similar rendering can be applied to `doc(cfg(feature))` to make it easier for users to read.
I also added special casing of `all`/`any` cfgs consisting of just `feature`/`target-feature` to remove the repetitive "target/crate feature" prefix.
The downside of this current rendering is that there is no distinction between `feature` and `target_feature` in the shorthand display. IMO this is ok, or if anything `target_feature` should have a more verbose shorthand, because `doc(cfg(feature = ".."))` usage is going to vastly outstrip `doc(cfg(target_feature = ".."))` usage in non-stdlib crates when it eventually stabilizes (or even before that given the number of crates using `cfg_attr(docsrs)` like constructs).
## Previously
<img width="259" alt="Screenshot 2020-08-09 at 13 32 42" src="https://user-images.githubusercontent.com/81079/89731110-d090c000-da44-11ea-96fa-56adc6339123.png ">
<img width="438" alt="image" src="https://user-images.githubusercontent.com/81079/89731116-d7b7ce00-da44-11ea-87c6-022d192d6eca.png ">
<img width="765" alt="image" src="https://user-images.githubusercontent.com/81079/89731152-24030e00-da45-11ea-9552-1c270bff2729.png ">
<img width="671" alt="image" src="https://user-images.githubusercontent.com/81079/89731158-28c7c200-da45-11ea-8acb-97d8a4ce00eb.png ">
## Now
<img width="216" alt="image" src="https://user-images.githubusercontent.com/81079/89731123-e1d9cc80-da44-11ea-82a8-5900bd9448a5.png ">
<img width="433" alt="image" src="https://user-images.githubusercontent.com/81079/89731127-e8684400-da44-11ea-9d18-572fd810f19f.png ">
<img width="606" alt="image" src="https://user-images.githubusercontent.com/81079/89731162-2feed000-da45-11ea-98d2-8a88c364d903.png ">
<img width="669" alt="image" src="https://user-images.githubusercontent.com/81079/89731991-ccb46c00-da4b-11ea-9416-cd20a3193826.png ">
cc #43781
2020-08-28 10:23:53 +02:00
bors
397b390cc7
Auto merge of #75976 - GuillaumeGomez:help-popup, r=jyn514
...
Improve help popup
Fixes #75623 .
The second commit is just a slight improvement: the help popup won't be created until someone presses "?" or ESC. Not a big improvement in itself but considering the low amount of code required, I think it was worth the shot.
r? @jyn514
2020-08-27 21:30:32 +00:00
Aleksey Kladov
df975cf9c2
Rename rustdoc/test -> rustdoc/doctest
...
This modules contains the implementation of doctests, and not the
tests of rustdoc itself. This name is confusing, so let's rename it to
doctest for clarity.
2020-08-27 18:21:25 +02:00
Guillaume Gomez
86e42c2742
Delay help popup creation to when it's needed
2020-08-27 14:22:54 +02:00
Guillaume Gomez
1727c7a194
Improve helper wording
2020-08-27 14:22:54 +02:00
bors
18b0585b52
Auto merge of #75842 - camelid:highlight-crate-links, r=jyn514
...
Highlight crate links like normal links
Fixes #75823 .
Cc @jyn514
2020-08-27 02:51:01 +00:00
Dylan DPC
c1cb46e906
Rollup merge of #75870 - GuillaumeGomez:unify-border-color-theme-ayu, r=pickfire
...
Unify theme choices border color in ayu theme
There was a slight color difference in the theme choice menu borders:


r? @Cldfire
2020-08-27 01:14:15 +02:00
Dylan DPC
88c68cae4f
Rollup merge of #75837 - GuillaumeGomez:fix-font-color-help-button, r=Cldfire
...
Fix font color for help button in ayu and dark themes
A nice before/after:


For the ayu theme, the change is very "light", the font color was already close to white, so I unified the color with the pictures of the other buttons:


2020-08-27 01:14:13 +02:00
Dylan DPC
463fdf3e04
Rollup merge of #75806 - GuillaumeGomez:prevent-automatic-page-change-history, r=pickfire
...
Prevent automatic page change when using history
Fixes #75774 .
2020-08-27 01:14:08 +02:00
Ivan Tham
8e0e179776
Expand rustdoc theme chooser x padding
2020-08-24 22:32:59 +08:00
Guillaume Gomez
76bd5b3852
Add explanations on the results search element check
2020-08-24 12:59:16 +02:00
Guillaume Gomez
efef159c55
Unify theme choices border color in ayu theme
2020-08-24 10:38:28 +02:00
Camelid
4419e04f16
Highlight crate links like normal links
2020-08-23 10:24:19 -07:00
Guillaume Gomez
5041aeef3d
Fix font color for help button in ayu and dark themes
2020-08-23 15:17:50 +02:00
Guillaume Gomez
6cb364cda4
Prevent automatic page change when using history
2020-08-23 14:39:43 +02:00
Joshua Nelson
a97d65d6e4
rustdoc: Rename misleading function
...
- `is_associated` -> `is_type_alias`
`is_associated` is not a good name for what this is doing. If you look at
https://github.com/rust-lang/rust/pull/74489/files#diff-6a301d597807ee441a41e7237800563dR296 ,
is_associated() and as_assoc_kind() do completely different things, but
from the name it sounds like they're similar.
2020-08-22 00:22:43 -04:00
Yuki Okushi
98f7d882c8
Rollup merge of #75665 - GuillaumeGomez:doc-examples-coverage, r=jyn514
...
Add doc examples coverage
r? @jyn514
2020-08-19 15:54:37 +09:00
Wim Looman
3328bd9a0f
Add long cfg description to tooltip on short description
2020-08-18 22:35:50 +02:00
Guillaume Gomez
d9d84dca8e
Add doc examples count for --show-coverage
2020-08-18 13:31:23 +02:00
Bastian Kauschke
cd53760cc7
merge as_local_hir_id with local_def_id_to_hir_id
2020-08-13 16:55:16 +02:00
Tyler Mandry
a4211977d7
Rollup merge of #75393 - GuillaumeGomez:fix-help-shortcut, r=pickfire
...
Fully handle "?" shortcut
Fixes #75386 .
cc @runiq
2020-08-11 12:28:34 -07:00
Tyler Mandry
c18b64c866
Rollup merge of #75378 - petrochenkov:isident, r=Mark-Simulacrum
...
Introduce `rustc_lexer::is_ident` and use it in couple of places
Implements the suggestion from https://github.com/rust-lang/rust/pull/74537#issuecomment-662261979 .
2020-08-11 12:28:32 -07:00
Guillaume Gomez
fdf2fe18a1
Fully handle "?" shortcut
2020-08-11 18:28:01 +02:00
Yuki Okushi
a75bdfa230
Rollup merge of #75347 - fusion-engineering-forks:rustdoc-nat-sort, r=GuillaumeGomez
...
Rustdoc: Fix natural ordering to look at all numbers.
The old implementation only looks at numbers at the end, but not in other places in a name: `u8` and `u16` got sorted properly, but `u8_bla` and `u16_bla` did not.

2020-08-11 16:23:52 +09:00
Dylan DPC
51ed33d8c2
Rollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514
...
Add help button
Part of #75197 .
Here is a screenshot of the result:

r? @jyn514
2020-08-11 01:56:43 +02:00
Dylan DPC
2ad7c1687f
Rollup merge of #75249 - GuillaumeGomez:rust-logo-border, r=Manishearth
...
Only add a border for the rust logo



I didn't add a border for the light theme though, as I felt it as unnecessary.
r? @Manishearth
2020-08-11 01:56:32 +02:00
Mark Rousskov
6bbf4558ac
Feature gate is always present
2020-08-11 00:08:04 +03:00
Guillaume Gomez
a34bc7961a
Add help button
2020-08-10 16:52:19 +02:00
Mara Bos
8c705f83db
Rustdoc: Fix natural ordering to look at all numbers.
...
The old implementation only looks at numbers at the end, but not in
other places in a name: "u8" and "u16" got sorted properly, but "u8_bla"
and "u16_bla" did not.
2020-08-09 23:05:35 +02:00
Camelid
f3cc957f2e
Rename "Important traits" to "Notable traits"
...
* Rename it in the UI
* Rename the CSS classes
2020-08-09 12:09:05 -07:00
Nicholas Nethercote
e539dd65f8
Eliminate the SessionGlobals from librustc_ast.
...
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.
All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.
`contains_feature_attr()` was dead, and is removed.
Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`
2020-08-08 12:03:42 +10:00
Guillaume Gomez
48a6c2125b
Only add a border for the rust logo
2020-08-07 11:19:07 +02:00
Vadim Petrochenkov
0a88346be6
rustc_ast: (Nested)MetaItem::check_name -> has_name
...
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.
Replace all uses of `check_name` with `has_name` outside of rustc
2020-08-04 00:34:11 +03:00
bors
6b269e4432
Auto merge of #73767 - P1n3appl3:rustdoc-formats, r=tmandry
...
Refactor librustdoc html backend
This PR moves several types out of the librustdoc::html module so that they can be used by a future json backend. These changes are a re-implementation of [some work done 6 months ago](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:multiple-output-formats ) by @GuillaumeGomez. I'm currently working on said json backend and will put up an RFC soon with the proposed implementation.
There are a couple of changes that are more substantial than relocating structs to a different module:
1. The `Cache` is no longer part of the `html::render::Context` type and therefor it needs to be explicitly passed to any functions that access it.
2. The driving function `html::render::run` has been rewritten to use the `FormatRenderer` trait which should allow different backends to re-use the driving code.
r? @GuillaumeGomez
cc @tmandry @betamos
2020-07-29 22:24:46 +00:00
Joseph Ryan
29df0508f3
Pass by value
2020-07-29 16:48:22 -05:00
Joseph Ryan
7621a5b635
Refactor DocFS to fix error handling bugs
2020-07-29 16:15:31 -05:00
Lzu Tao
5faef5e00c
ayu theme: Change doccomment color to #a1ac88
...
Co-authored-by: Cldfire <cldfire@3grid.net>
2020-07-28 05:12:12 +00:00
Joseph Ryan
cee8023c69
More requested changes
2020-07-27 17:34:17 -05:00
Joseph Ryan
3d707a008e
Make requested changes
2020-07-27 16:00:39 -05:00
Joseph Ryan
a790952254
Pull out more types from html
2020-07-27 16:00:38 -05:00
Joseph Ryan
6a4396b98c
Extract Cache and other types from html module
2020-07-27 16:00:38 -05:00
Joseph Ryan
5bc97946ca
Refactor html backend to use generic interface
2020-07-27 16:00:38 -05:00
Joseph Ryan
c692ed468c
Move Error and RenderInfo out of html module
2020-07-27 16:00:38 -05:00
Jarek Samic
51b99d48fa
Don't italicize comments in ayu theme
2020-07-26 14:11:10 -04:00
Yuki Okushi
0651dd4aab
Rollup merge of #74572 - Mark-Simulacrum:unify-rustc-depr, r=petrochenkov
...
Internally unify rustc_deprecated and deprecated
This PR intentionally tries to be "featureless" in that the behavior is not altered for either attribute, though it more clearly exposes cases where that is the case in the code.
2020-07-24 18:56:27 +09:00
Yuki Okushi
52476f53dd
Rollup merge of #74504 - lzutao:ayu-border-selected-fn, r=GuillaumeGomez
...
Add right border bar to Dark and Light theme
Demo:
Light theme: https://github.com/rust-lang/rust/pull/74504#issuecomment-662491120
Dark theme: https://github.com/rust-lang/rust/pull/74504#issuecomment-662522446
Ayu theme: https://github.com/rust-lang/rust/pull/74504#issuecomment-662625685
2020-07-24 18:56:25 +09:00
Yuki Okushi
38b295699f
Rollup merge of #74361 - GuillaumeGomez:theme-logo, r=Manishearth
...
Improve doc theme logo display
Fixes #74350 .
The first commit cleans up the whitespaces and converts them to tabs. We should definitely write a tidy check for this (will do it in another PR).
Screenshots:



r? @lzutao
cc @Cldfire
2020-07-24 18:56:22 +09:00
Lzu Tao
7005ddb50d
Add right border bar to Dark and Light theme
...
Ayu has it. Adding similar rule to other themes makes users less
surprised and makes GUI more consistent.
2020-07-24 02:09:14 +00:00