| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
`count()` iterates over the whole collection. Using `len()` instead, or
`.next().is_none()` when comparing to zero, should be faster.
|
|
|
|
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
|
|
|
|
Continue migrating JS functionality
Cleanup
Fix compile error
Clean up the diff
Set toggle font to sans-serif
|
|
|
|
|
|
|
|
- Avoid multiple <h1>s on a page.
- The <h#> tags should follow a semantic hierarchy.
- Cap at h6 (no h7)
|
|
Previously, only the raw string and the `is_ignore` field were
preserved, which made it hard to recover anything else.
|
|
Fix table in docblocks
"Overwrite" of #88702.
Instead of adding a z-index to the sidebar (which only hides the issue, doesn't fix it), I wrap `<table>` elements inside a `<div>` and limit all chidren of `.docblock` elements' width to prevent having the scrollbar on the whole doc block.

Thanks `@nbdd0121` for `overflow-x: auto;`. ;)
r? `@notriddle`
|
|
Fix issues with Markdown summary options
- Use `summary_opts()` for Markdown summaries
- Enable all main body Markdown options for summaries
|
|
|
|
`rustdoc`: compute correct line number for indented rust code blocks.
This PR fixes a bug in `rustdoc` where it computes the wrong line number for indented rust code blocks (and subsequent blocks) it finds in markdown strings. To fix this issue, we decrement the line number if we find characters between the code block and the preceding line ending. I noticed this issue as I was trying to use `rustdoc` to extract examples from The Rust Reference and run them through the [Rust Model Checker](https://github.com/model-checking/rmc).
|
|
This fixes odd renderings when these features are used in the first
paragraph of documentation for an item. This is an extension of #87270.
|
|
It was accidentally changed to use `opts()` in #86451.
I also renamed `opts()` to `main_body_opts()` to make this kind of
accidental change less likely.
|
|
r=GuillaumeGomez
Refactor Markdown length-limited summary implementation
This PR is a new approach to #79749.
This PR refactors the implementation of `markdown_summary_with_limit()`,
separating the logic of determining when the limit has been reached from
the actual rendering process.
The main advantage of the new approach is that it guarantees that all
HTML tags are closed, whereas the previous implementation could generate
tags that were never closed. It also ensures that no empty tags are
generated (e.g., `<em></em>`).
The new implementation consists of a general-purpose struct
`HtmlWithLimit` that manages the length-limiting logic and a function
`markdown_summary_with_limit()` that renders Markdown to HTML using the
struct.
r? `@GuillaumeGomez`
|
|
The length limit turns out to be a surprisingly good heuristic for
initial allocation size. See here for more details [1].
[1]: https://github.com/rust-lang/rust/pull/88173#discussion_r692531631
|
|
This commit refactors the implementation of
`markdown_summary_with_limit()`, separating the logic of determining
when the limit has been reached from the actual rendering process.
The main advantage of the new approach is that it guarantees that all
HTML tags are closed, whereas the previous implementation could generate
tags that were never closed. It also ensures that no empty tags are
generated (e.g., `<em></em>`).
The new implementation consists of a general-purpose struct
`HtmlWithLimit` that manages the length-limiting logic and a function
`markdown_summary_with_limit()` that renders Markdown to HTML using the
struct.
|
|
|
|
struct for better readability
|
|
|
|
|
|
Flatten nested `format!` calls
|
|
|
|
I noticed that `Pin::new()`'s search summary looked off, and I realized
that the reason is that it has inline code containing `Pin<P>`, which is
not escaped and thus renders as a paragraph tag!
|
|
|
|
|
|
|
|
|
|
Before:

After:

|
|
In rustdoc's main.js, we had an onclick handler for the whole document
that would dispatch to handlers for various elements. This change
attaches the handlers to the elements that trigger them, instead.
This simplfies the code and avoids reimplementing the browser's bubbling
functionality.
As part of this change, change from a class to an id for help button.
Move the handlers and associated code for highlighting source lines into
source-script.js (and factor out a shared regex).
|
|
|
|
This reverts commit af6c3201fc3d5ec2559836454ea4f43eec583fa2.
|
|
Since `#![attr]` and `#[attr]` are the only valid syntax that start with `#`, we can just special case those two tokens.
|
|
|
|
Add a button to copy the "use statement"
Fixes https://github.com/rust-lang/rust/issues/50239
When clicking on the button, it'll add the elements prepended by "use " and will end with a ";". So in the images below, I now have in my clipboard `use std::fs::OpenOptions;`.
A screenshot of the newly added button:

A screenshot after it was clicked:

r? `@Nemo157`
|
|
|
|
And, now that we do that, we can remove the explanatory note since the
error span should make it clear what the disambiguator is.
|
|
They are never both `None` or both `Some`, so it makes more sense to use
an enum so that we "make impossible states impossible".
|
|
"The Rust Standard LibraryThe Rust Standard Library is the …" is an awful description.
|
|
There was no need to clone `id_map` because it was reset before each
item was rendered. `deref_id_map` was not reset, but it was keyed by
`DefId` and thus was unlikely to have collisions (at least for now).
Now we just clone the fields that need to be cloned, and instead create
fresh versions of the others.
|
|
|
|
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links`
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests
Otherwise, all `rustdoc::` lints would be ignored.
- Register all existing lints as removed
This unfortunately doesn't work with `register_renamed` because tool
lints have not yet been registered when rustc is running. For similar
reasons, `check_backwards_compat` doesn't work either. Call
`register_removed` directly instead.
- Fix fallout
+ Rustdoc lints for compiler/
+ Rustdoc lints for library/
Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for
`rustdoc::intra_doc_link_resolution_failure`, since there was no time
when the latter was valid.
|