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.
hack: is_doc_subtype_of always returns true for TyAlias
it's worth noting that this function is only used in
the handling of "Methods from Deref", and we were previously
assuming all generic parameters were meaningless,
so this is still an improvment from the status quo.
this change means that we will have strictly less false positives
without adding any new false negitives.
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
Rollup of 6 pull requests
Successful merges:
- #134807 (fix(rustdoc): always use a channel when linking to doc.rust-lang.org)
- #134814 (Add `kl` and `widekl` target features, and the feature gate)
- #135836 (bootstrap: only build `crt{begin,end}.o` when compiling to MUSL)
- #136022 (Port ui/simd tests to use the intrinsic macro)
- #136309 (set rustc dylib on manually constructed rustc command)
- #136462 (mir_build: Simplify `lower_pattern_range_endpoint`)
r? `@ghost`
`@rustbot` modify labels: rollup
fix(rustdoc): always use a channel when linking to doc.rust-lang.org
Closes#131971
I manually checked the resulting links
One issue is that this will create `nightly/...` links in places that formerly linked to stable, is that ok ? (the `slice` and `array` links in the search help notably)
- `check-pass` test for a MRE of #135020
- fail test for #135138
- switch to `TooGeneric` for checking CMSE fn signatures
- switch to `TooGeneric` for compute `SizeSkeleton` (for transmute)
- fix broken tests
Enable "jump to def" feature on patterns
Part of https://github.com/rust-lang/rust/issues/89095.
Pattern (as in "patterns in pattern matching") were not handled by the feature, it's now added.
It all started when I realized that prelude values like `Some` or `Err` were not getting a link generated either (added support for it in the first commit).
r? ``@fmease``
rustdoc: use stable paths as preferred canonical paths
This accomplishes something like 16a4ad7d7b, but with the `rustc_allowed_through_unstable_modules` attribute instead of the path length.
Fixes#131676
rustdoc: Fix mismatched capitalization in sidebar
Previously, the main content used "Aliased Type", while the sidebar said "Aliased type". Now, they both say "Aliased Type", which is the more common capitalization in Rustdoc.
See the following link for an example.
https://doc.rust-lang.org/1.83.0/std/io/type.Result.html
Previously, the main content used "Aliased Type", while the sidebar said
"Aliased type". Now, they both say "Aliased Type", which is the more common
capitalization in Rustdoc.
See the following link for an example.
https://doc.rust-lang.org/1.83.0/std/io/type.Result.html