Guillaume Gomez
c9a48d1d73
Fix strings indent
2020-08-31 13:16:50 +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
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
Camelid
4419e04f16
Highlight crate links like normal links
2020-08-23 10:24:19 -07: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
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
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
Mark Rousskov
6bbf4558ac
Feature gate is always present
2020-08-11 00:08:04 +03: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
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
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
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
c692ed468c
Move Error and RenderInfo out of html module
2020-07-27 16:00:38 -05:00
Joshua Nelson
20552c811a
Generate docs for links to private items when passed --document-private
...
- Pass around document_private a lot more
- Add tests
+ Add tests for intra-doc links to private items
+ Add ignored tests for warnings in reference links
2020-06-26 07:23:39 -04:00
Felix S. Klock II
da09fd3db0
Split payload of FileName::Real to track both real and virutalized paths.
...
Such splits arise from metadata refs into libstd.
This way, we can (in a follow on commit) continue to emit the virtual name into
things like the like the StableSourceFileId that ends up in incremetnal build
artifacts, while still using the devirtualized file path when we want to access
the file.
Note that this commit is intended to be a refactoring; the actual fix to the bug
in question is in a follow-on commit.
2020-05-29 23:41:45 -04:00
Guillaume Gomez
e17ac66899
* Update aliases data struct from HashMap to BTreeMap to have more deterministic results
...
* Update Javascript to take this change into account
* Update CrateData::aliases field to take a reference instead (it allowed to remove a conversion loop)
2020-05-14 11:36:02 +02:00
Guillaume Gomez
883c177abb
Move doc alias discovery into the Attributes struct and some code improvements
2020-05-14 11:35:44 +02:00
Guillaume Gomez
f581cf7544
Merge aliases and search-index
2020-05-07 20:08:08 +02:00
Guillaume Gomez
cf41b1d3a5
Improve doc alias discovery
2020-05-07 20:08:08 +02:00
Dylan DPC
2f06ac08e9
Rollup merge of #71250 - GuillaumeGomez:use-json-instead-of-js, r=kinnison
...
Replace big JS dict with JSON parsing
Part of #56545 .
@ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had...
I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally:
```bash
$ cargo doc --features doc --open
```
But I strongly recommend to do it with this PR. Some numbers:
* Loading a page with the JSON search-index: less than 1 second
* Loading a page with the JS search-index: crashed after 30 seconds
I think the results are clear enough...
r? @ollie27
cc @rust-lang/rustdoc
2020-04-20 18:07:05 +02:00
Guillaume Gomez
b4fb3069ce
Replace big JS dict with JSON parsing
2020-04-17 18:09:04 +02:00
Josh Stone
554847c513
Dogfood or_patterns in rustdoc
2020-04-16 13:58:47 -07:00
Guillaume Gomez
12a95482c1
Improve rustdoc source code a bit
2020-04-10 16:43:00 +02:00
Matthias Krüger
08f2904dfa
more clippy fixes
...
use is_empty() instead of len comparison (clippy::len_zero)
use if let instead of while let loop that never loops (clippy::never_loop)
remove redundant returns (clippy::needless_return)
remove redundant closures (clippy::redundant_closure)
use if let instead of match and wildcard pattern (clippy::single_match)
don't repeat field names redundantly (clippy::redundant_field_names)
2020-03-31 15:20:05 +02:00
Mazdak Farrokhzad
1ccb0b4a02
rustc -> rustc_middle part 3 (rustfmt)
2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
0cb9e36090
rustc -> rustc_middle part 2
2020-03-30 07:16:56 +02:00
Matthias Krüger
74d68ea7eb
don't create variable bindings just to return the bound value immediately (clippy::let_and_return)
2020-03-22 00:35:25 +01:00
Guillaume Gomez
d964e60e4f
Rename render::Type to improve naming
2020-03-16 18:30:26 +01:00
Guillaume Gomez
5654cde729
formatting
2020-03-16 18:30:26 +01:00
Guillaume Gomez
b9167e6c7d
Support type search for arguments and returned types
2020-03-16 18:29:19 +01:00
Guillaume Gomez
8858d71d28
Put back output-format option for show-coverage
2020-03-02 13:15:51 +01:00
Matthias Krüger
de7c40c168
use .iter() instead of .into_iter() on references.
2020-02-29 03:14:01 +01:00
Matthias Krüger
7c84ba1124
use char instead of &str for single char patterns
2020-02-27 14:57:22 +01:00
Tom Jakubowski
b60f08bd6d
rustdoc: NodeId is now DefId
2020-01-30 13:38:25 +01:00
Guillaume Gomez
6e791464bc
remove unneeded code from cache.rs
2020-01-15 15:07:35 +01:00
Guillaume Gomez
81a5b94ac6
formatting
2020-01-15 13:43:09 +01:00
Guillaume Gomez
12f029b7ee
Fix deref impl on type alias
2020-01-15 13:43:09 +01:00
Mazdak Farrokhzad
ebfd8673a7
Remove rustc_hir reexports in rustc::hir.
2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad
4ff12ce4c1
Normalize syntax::symbol imports.
2020-01-02 13:57:04 +01:00
Mazdak Farrokhzad
75e4783f63
Normalize syntax::source_map imports.
2020-01-02 13:57:04 +01:00
Mark Rousskov
a06baa56b9
Format the world
2019-12-22 17:42:47 -05:00
Andy Russell
94630d4c8b
replace serialize with serde in rustdoc
2019-12-12 16:33:25 -05:00