Noah Lev
a65421651a
rustdoc: Record aliases as Symbols
2021-11-19 21:58:25 -05:00
bors
589ad6a5b7
Auto merge of #90883 - matthiaskrgr:rollup-iu9k5pe, r=matthiaskrgr
...
Rollup of 3 pull requests
Successful merges:
- #90771 (Fix trait object error code)
- #90840 (relate lifetime in `TypeOutlives` bounds on drop impls)
- #90853 (rustdoc: Use an empty Vec instead of Option<Vec>)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-14 01:06:05 +00:00
bors
b416e3892d
Auto merge of #90385 - mfrw:mfrw/librustdoc, r=GuillaumeGomez
...
rustdoc: use Type::def_id() instead of Type::def_id_no_primitives()
For: #90187
r? `@jyn514`
2021-11-13 20:11:58 +00:00
Michael Howell
688ed0a019
Use an empty Vec instead of Option<Vec>
2021-11-12 22:25:31 -07:00
Noah Lev
b5817fada2
rustdoc: Remove top-level wrappers for ImplKind
methods
...
The `ImplKind` methods can just be used directly instead.
2021-11-07 18:26:37 -08:00
Noah Lev
120ef36307
rustdoc: Use ty::ImplPolarity
instead of custom enum
2021-11-07 08:57:33 -08:00
Noah Lev
543aea6c03
Use an enum to record polarity in clean::Impl
2021-11-07 08:52:28 -08:00
Noah Lev
7b7023cb72
rustdoc: Refactor Impl.{synthetic,blanket_impl}
into enum
...
This change has two advantages:
1. It makes the possible states clearer, and it makes it impossible to
construct invalid states, such as a blanket impl that is also an auto
trait impl.
2. It shrinks the size of `Impl` a bit, since now there is only one
field, rather than two.
2021-11-07 08:41:18 -08:00
Muhammad Falak R Wani
d468418209
rustdoc: use Type::def_id() instead of Type::def_id_no_primitives()
...
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2021-11-05 07:44:05 +05:30
Will Crichton
ce943d26f8
Add line number to URLs in "additional examples" section of rustdoc
2021-11-02 19:38:55 -07:00
Guillaume Gomez
73494404e9
Rollup merge of #90183 - GuillaumeGomez:recurse-deref, r=jyn514
...
Show all Deref implementations recursively
Fixes #87783 .
This is a re-implementation of #80653 , so taking the original PR comment:
This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level.

cc `@camelid`
r? `@jyn514`
2021-10-30 20:30:26 +02:00
Matthias Krüger
19b5b0f8fb
Rollup merge of #90412 - jyn514:macro-use, r=camelid
...
Remove unnecessary `macro_use`s in rustdoc
2021-10-30 14:37:04 +02:00
Joshua Nelson
b6851ba3c9
Remove unnecessary macro_use
s in rustdoc
2021-10-30 02:22:38 +00:00
Guillaume Gomez
355e6eddfe
Fix invalid handling of generics
2021-10-29 20:54:15 +02:00
Guillaume Gomez
dd68d207a5
Don't display "Methods from Deref<...>" if no method is display (the ones which don't have self
argument)
2021-10-29 14:37:01 +02:00
Guillaume Gomez
8a473ca346
Recursively document Deref
2021-10-29 14:14:46 +02:00
bors
337e1565d3
Auto merge of #90186 - jsha:fix-header-sizes, r=GuillaumeGomez
...
Fix documentation header sizes
And add a rustdoc-gui test confirming various header sizes.
Split off from #90156 . This fixes a regression in #89506 where the heading level of titles within Markdown was too high (h2) for docblocks under structs, unions, and enum impls.
r? `@camelid`
Demo: https://jacob.hoffman-andrews.com/rust/fix-header-sizes/std/string/struct.String.html#impl-Add%3C%26%27_%20str%3E
Stable: https://doc.rust-lang.org/stable/std/string/struct.String.html#impl-Add%3C%26%27_%20str%3E
Beta: https://doc.rust-lang.org/beta/std/string/struct.String.html#impl-Add%3C%26%27_%20str%3E
2021-10-27 12:27:47 +00:00
Matthias Krüger
e3eebfeea6
Rollup merge of #90154 - camelid:remove-getdefid, r=jyn514
...
rustdoc: Remove `GetDefId`
See the individual commit messages for details.
r? `@jyn514`
2021-10-27 06:11:35 +02:00
Jacob Hoffman-Andrews
89276ff7ed
Fix documentation header sizes
...
And add a rustdoc-gui test confirming various header sizes.
2021-10-25 16:26:17 -07:00
Guillaume Gomez
4614ca4541
Fix clippy lints in librustdoc
2021-10-25 11:30:09 +02:00
Matthias Krüger
dcf9242795
Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514
...
Scrape code examples from examples/ directory for Rustdoc
Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123
Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525
Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-23 14:58:39 +02:00
Will Crichton
fd5d614b77
Move def_id logic into render_call_locations
2021-10-22 13:14:46 -07:00
Noah Lev
f93cf66507
Rename Type::def_id_full()
to Type::def_id()
...
It should be preferred over `def_id_no_primitives()`, so it should have
a shorter name. I also put it before `def_id_no_primitives()` so that it
shows up first in the docs.
2021-10-22 13:07:43 -07:00
Noah Lev
bf0cc90050
Replace GetDefId
with inherent methods
...
Now that it's only implemented for `Type`, using inherent methods
instead means that imports are no longer necessary. Also, `GetDefId` is
only meant to be used with `Type`, so it shouldn't be a trait.
2021-10-22 13:07:43 -07:00
Noah Lev
6d82ee839d
Remove GetDefId
impl for FnRetTy
...
It was only used in one place, so it seems better to use ordinary
functions.
2021-10-22 13:07:42 -07:00
Will Crichton
d1c29c696e
Revert def_id addition from clean::Function, add test for
...
scrape-examples options
2021-10-22 12:46:45 -07:00
Guillaume Gomez
38f6c07b11
Improve code readability for sidebar links
2021-10-13 21:58:55 +02:00
Guillaume Gomez
d6dbff56e4
List associated constants in the sidebar
2021-10-12 15:06:52 +02:00
bors
c1cb97481a
Auto merge of #89695 - jsha:more-templates, r=GuillaumeGomez
...
Move top part of print_item to Tera templates
Part of #84419 .
This moves the first line of each item page (E.g. `Struct foo::Bar .... 1.0.0 [-][src]` into a Tera template.
I also moved template initialization into its own module and added a small macro to reduce duplication and opportunity for errors.
2021-10-10 04:41:03 +00:00
bors
a8f2463c68
Auto merge of #88379 - camelid:cleanup-clean, r=jyn514
...
rustdoc: Cleanup various `clean` types
Cleanup various `clean` types.
2021-10-09 19:05:08 +00:00
Jacob Hoffman-Andrews
586a9cea75
Move template initialization into its own file.
2021-10-08 23:28:42 -07:00
Will Crichton
e22e858687
Move more scrape-examples logic from JS to rust
...
Fix failing test
Add missing backslash
Fix padding issue with horizontal scrollbar
2021-10-08 11:14:01 -07:00
Will Crichton
bb383edb69
Move some expansion logic into generation-time, fix section header links, remove ID from line numbers, fix horizontal scrolling on non-expanded elements
2021-10-07 09:46:23 -07:00
Will Crichton
5584c79597
Update to latest rustc and rustdoc styles
2021-10-06 21:43:40 -07:00
Will Crichton
df5e3a6e40
Change serialized format to use DefPathHash instead of custom String
...
Move test to rustdoc-ui
Fix test writing to wrong directory
Formatting
Fix test
Add FIXME
Remove raw multiline strings
2021-10-06 19:45:25 -07:00
Will Crichton
829b1a9dd9
Incorporate jyn's feedback
...
* Move call location logic from function constructor to rendering
* Fix issue with macro spans in scraping examples
* Clean up example loading logic
Documentation / newtype for DecorationInfo
Fix line number display
Serialize edition of call site, other small cleanup
2021-10-06 19:45:23 -07:00
Will Crichton
a1cb19444f
Add styles for non-white themes
...
Tweak colors
Tabs
New link heading style
2021-10-06 19:44:51 -07:00
Will Crichton
18edcf86d2
Reduce blur size, fix example width bug, add better error handling for I/O issues
...
Remove repository url
Fix formatting
Fix file_span in print_src
Formatting
2021-10-06 19:44:51 -07:00
Will Crichton
55bb51786e
Move highlighting logic from JS to Rust
...
Continue migrating JS functionality
Cleanup
Fix compile error
Clean up the diff
Set toggle font to sans-serif
2021-10-06 19:44:50 -07:00
Will Crichton
eea8f0a39a
Sort examples by size
...
Improve styling
Start to clean up code, add comments
2021-10-06 19:44:50 -07:00
Will Crichton
b6338e7792
Generate example source files with corresponding links
...
Add display name
Fix remaining merge conflicts
Only embed code for items containing examples
2021-10-06 19:44:50 -07:00
Will Crichton
2855bf039a
Factor scraping and rendering into separate calls to rustdoc
...
Simplify toggle UI logic, add workspace root for URLs
2021-10-06 19:44:50 -07:00
Will Crichton
7831fee9f8
Fix check issue
...
Clean up tidy checks
2021-10-06 19:44:50 -07:00
Will Crichton
4b3f82ad03
Add updated support for example-analyzer
...
Move rendering of examples into
Finalize design
Cleanup, rename found -> scraped
Softer yellow
Clean up dead code
Document scrape_examples
More simplification and documentation
Remove extra css
Test
2021-10-06 19:44:47 -07:00
Mukund Lakshman
f1425c7c3e
heading_level: u32 -> heading_offset: HeadingOffset
2021-10-04 22:28:04 -04:00
Mukund Lakshman
13558ee0a0
No need to default offset since we always override it.
2021-10-04 22:28:04 -04:00
Mukund Lakshman
6518a0a8b9
Change Markdown(...)
to Markdown { ... }
2021-10-04 22:28:02 -04:00
Mukund Lakshman
4a6aa6e406
Fix heading for methods on trait impls.
2021-10-04 20:49:21 -04:00
Mukund Lakshman
a8a40ea9a4
librustdoc: Use correct heading levels.
...
- Avoid multiple <h1>s on a page.
- The <h#> tags should follow a semantic hierarchy.
- Cap at h6 (no h7)
2021-10-04 05:01:04 -04:00
Noah Lev
962e451443
Replace all uses of path.res.def_id()
with path.def_id()
2021-10-02 15:57:57 -07:00