Open
Description
In #80653 methods from Deref
targets were added to rustdoc
output. However, it seems that trait bounds on these methods are not rendered.
I tried this code:
use std::ops::Deref;
pub trait Foo {}
pub struct Bar<T>(T);
impl<T> Bar<T> {
pub fn generic(&self) {}
}
impl<T> Bar<T>
where
T: Foo,
{
pub fn with_foo(&self) {}
}
pub struct Baz(Bar<()>);
impl Deref for Baz {
type Target = Bar<()>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
pub struct Qux<T>(Bar<T>);
impl<T> Deref for Qux<T> {
type Target = Bar<T>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
I expected to see this happen:
The relevant methods added by the Deref
impls on Baz
and Qux
are added to the output of rustdoc
. For Baz
this is generic
, and for Qux
this is generic
and with_foo
(including the trait bound).
Instead, this happened:
Both methods are visible in the documentation of Baz
and Qux
without a trait bound T: Foo
on the with_foo
method.
Meta
Tested with stable and nightly.
cargo rustc -- --version --verbose
:
rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-apple-darwin
release: 1.51.0
LLVM version: 11.0.1
cargo +nightly rustc -- --version --verbose
:
rustc 1.53.0-nightly (42816d61e 2021-04-24)
binary: rustc
commit-hash: 42816d61ead7e46d462df997958ccfd514f8c21c
commit-date: 2021-04-24
host: x86_64-apple-darwin
release: 1.53.0-nightly
LLVM version: 12.0.0