mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
3fbfe2bca5
Helps with #90929 This changes the search results, specifically, when there's more than one impl with an associated item with the same name. For example, the search queries `simd<i8> -> simd<i8>` and `simd<i64> -> simd<i64>` don't link to the same function, but most of the functions have the same names. This change should probably be FCP-ed, especially since it adds a new anchor link format for `main.js` to handle, so that URLs like `struct.Vec.html#impl-AsMut<[T]>-for-Vec<T,+A>/method.as_mut` redirect to `struct.Vec.html#method.as_mut-2`. It's a strange design, but there are a few reasons for it: * I'd like to avoid making the HTML bigger. Obviously, fixing this bug is going to add at least a little more data to the search index, but adding more HTML penalises viewers for the benefit of searchers. * Breaking `struct.Vec.html#method.len` would also be a disappointment. On the other hand: * The path-style anchors might be less prone to link rot than the numbered anchors. It's definitely less likely to have URLs that appear to "work", but silently point at the wrong thing. * This commit arranges the path-style anchor to redirect to the numbered anchor. Nothing stops rustdoc from doing the opposite, making path-style anchors the default and redirecting the "legacy" numbered ones.
23 lines
330 B
Rust
23 lines
330 B
Rust
pub trait X {
|
|
type InnerType;
|
|
fn my_method(&self) -> Self::InnerType;
|
|
}
|
|
|
|
pub struct MyTy<T> {
|
|
pub t: T,
|
|
}
|
|
|
|
impl X for MyTy<bool> {
|
|
type InnerType = bool;
|
|
fn my_method(&self) -> bool {
|
|
self.t
|
|
}
|
|
}
|
|
|
|
impl X for MyTy<u8> {
|
|
type InnerType = u8;
|
|
fn my_method(&self) -> u8 {
|
|
self.t
|
|
}
|
|
}
|