| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
[rustdoc] Make aliases search support partial matching
Fixes rust-lang/rust#140782.
To make this work, I moved aliases into the `searchIndex` like any other item. It links to the "original" item with a new `original` field. No so great part is that we need to have some fields like `bitIndex` to be set on the alias to make the description load to work but I consider it minor enough to be ok.
This PR voluntarily doesn't handle de-prioritization of aliases as ```@lolbinarycat``` wished to work on this so I'll leave them this part. :wink:
cc ```@lolbinarycat```
|
|
|
|
|
|
There are many places that join path segments with `::` to produce a
string. A lot of these use `join("::")`. Many in rustdoc use
`join_with_double_colon`, and a few use `.joined("..")`. One in Clippy
uses `itertools::join`. A couple of them look for `kw::PathRoot` in the
first segment, which can be important.
This commit introduces `rustc_ast::join_path_{syms,ident}` to do the
joining for everyone. `rustc_ast` is as good a location for these as
any, being the earliest-running of the several crates with a `Path`
type. Two functions are needed because `Ident` printing is more complex
than simple `Symbol` printing.
The commit also removes `join_with_double_colon`, and
`estimate_item_path_byte_length` with it.
There are still a handful of places that join strings with "::" that are
unchanged. They are not that important: some of them are in tests, and
some of them first split a path around "::" and then rejoin with "::".
This fixes one test case where `{{root}}` shows up in an error message.
|
|
|
|
Implements https://www.github.com/rust-lang/rust/issues/141358.
This has 2 primary benefits:
1. For rustdoc-json consumers, they no longer need to parse strings of
attributes, but it's there in a structured and normalized way.
2. For rustc contributors, the output of HIR pretty printing is no
longer a versioned thing in the output. People can work on
https://github.com/rust-lang/rust/issues/131229 without needing to
bump `FORMAT_VERSION`.
(Over time, as the attribute refractor continues, I expect we'll add new
things to `rustdoc_json_types::Attribute`. But this can be done
separately to the rustc changes).
|
|
|
|
Use `join_with_double_colon` in `write_shared.rs`.
For consistency. Also, it's faster because `join_with_double_colon` does a better job estimating the allocation size than `join` from `itertools`.
r? `@camelid`
|
|
Rollup of 6 pull requests
Successful merges:
- rust-lang/rust#134006 (setup typos check in CI)
- rust-lang/rust#142876 (Port `#[target_feature]` to new attribute parsing infrastructure)
- rust-lang/rust#143038 (avoid suggesting traits from private dependencies)
- rust-lang/rust#143083 (Fix rustdoc not correctly showing attributes on re-exports)
- rust-lang/rust#143283 (document optional jobs)
- rust-lang/rust#143329 (minicore: use core's `diagnostic::on_unimplemented` messages)
Failed merges:
- rust-lang/rust#143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
|
|
r=GuillaumeGomez
rustdoc: show attributes on enum variants
mostly for #[non_exhaustive]
unsure if there's any attributes we should take care to *not* include, it could use `render_code_attribute` and `is_non_exhaustive` instead, if that is a concern.
fixes rust-lang/rust#142599
|
|
mostly for #[non_exhaustive]
|
|
Closes https://www.github.com/rust-lang/rust/issues/142952
|
|
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
|
|
For consistency. Also, it's faster because `join_with_double_colon` does
a better job estimating the allocation size than `join` from
`itertools`.
|
|
r=nnethercote
Avoid a few more allocations in `write_shared.rs`
Inspired by rust-lang/rust#141421 , avoids a few `Vec`, `PathBuf` and `String` allocations in `write_shared.rs`. I don't think these will show up on benchmarks, but are still worthwhile IMHO.
Also includes a few small cleanups.
r? nnethercote - if you'd like :)
|
|
We only called it it one place, which isn't generic and can be replaced
with a field access.
|
|
|
|
|
|
|
|
|
|
this is one-time initialization data, it can just
be a function parameter.
we also move the json parsing into createSrcSidebar
to save a few bytes.
|
|
By making `JsonRenderer::item` take `&clean::Item` instead of a
`clean::Item`. This required also changing `FromClean` and `IntoJson`
methods to take references, which required a lot of follow-on sigil
wrangling that is mostly tedious.
|
|
- It doesn't need to be cloneable.
- Some of the `Rc`s and `RefCell`s aren't doing anything.
- `after_krate` can consume `self`.
|
|
rustdoc: cleanups relating to allocations
These commits generally clean up the code a bit and also reduce allocation rates a bit.
r? `@camelid`
|
|
|
|
- `ret` only ever gets at most one entry, so it can be an `Option`
instead of a `Vec`.
- Which means we can use `filter_map` instead of `flat_map`.
- Move `trait_` next to the `ret` assignment, which can only happen
once.
- No need for `impls` to be a `Vec`, it can remain an iterator.
- Avoid `Result` when collecting `impls`.
|
|
|
|
Most of the methods returning `impl Display` have `print` in their name.
This commit renames a few that didn't follow that convention.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update askama to `0.14.0`
[Askama 0.14.0 release notes](https://github.com/askama-rs/askama/releases/tag/v0.14.0)
Just one change needed for a filter in rustdoc.
r? ```@notriddle```
|
|
|
|
|
|
This is a huge perf win for rustdoc on the `typenum` and `nalgebra`
benchmarks, because the `else` branch doesn't get hit much.
|
|
The comparison against `text` seems to be unnecessary.
|
|
|
|
|
|
|
|
|
|
|
|
rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)
**(0)** PR #136411 aimed to stop rendering unnamed params of fn ptr types as underscores in the common case (e.g., `fn(_: i32)` → `fn(i32)`) to make the rendered output stylistically more conventional.
**(0.a)** However, since the cleaning fn that the PR modified is also used for lowering the HIR params of foreign fns and required assoc fns in traits, it accidentally butchered the rendering of the latter two:
```rs
pub trait Trait { fn assoc_fn(_: i32); } // as well as (Rust 2015 only): fn assoc_fn(i32);
unsafe extern "C" { pub fn foreign_fn(_: i32); }
// Since 1.86 the fns above gets mis-rendered as:
pub fn assoc_fn(: i32) // <-- BUTCHERED
pub unsafe extern "C" fn foreign_fn(: i32) // <-- BUTCHERED
```
**(0.b)** Furthermore, it broke parity with middle cleaning (which includes inlined cross-crate re-exports) re-regressing parts of #44306 I once fixed in PR #103885.
**(1)** Lastly, PR #139035 introduced an ICE triggered by the following input file:
```rs
trait Trait { fn anon(()) {} } // internal error: entered unreachable code
```
---
This PR fixes all of these regressions and in the first commit renames several types and fns to be more ~~correct~~ descriptive and legible.
~~It also refactors `Param.name` to be of type `Option<Symbol>` instead `Symbol` (where `None` ~ `kw::Empty`), so rendering mistakes like that can no longer creep in like that (ignoring tests). CC #137978.~~ Independently done in PR #139846 a day prior.
|