diff options
| author | Michael Howell <michael@notriddle.com> | 2023-03-09 13:41:13 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-03-09 14:18:12 -0700 |
| commit | ee6b228b6a8b874ca8b6e88cd58d4618cf20fb20 (patch) | |
| tree | 320ff17ba2e730dbd3e387502ea3cbc72d5b1762 /src/librustdoc/html/render | |
| parent | c6015851f7e54d1e1e267afb315a2b4b23096d0d (diff) | |
| download | rust-ee6b228b6a8b874ca8b6e88cd58d4618cf20fb20.tar.gz rust-ee6b228b6a8b874ca8b6e88cd58d4618cf20fb20.zip | |
rustdoc: handle generics better when matching notable traits
This commit makes the `clean::Type::is_same` non-commutative, so that a generic `impl` matches a concrete return, but a generic return does not match a concrete `impl`. It makes slice and vector Write for `u8` not match on every generic return value.
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index e6a040d02e5..f8c26dc4706 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1291,7 +1291,7 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &mut Context<'_>) -> O if let Some(impls) = cx.cache().impls.get(&did) { for i in impls { let impl_ = i.inner_impl(); - if !impl_.for_.without_borrowed_ref().is_same(ty.without_borrowed_ref(), cx.cache()) { + if !ty.is_same(&impl_.for_, cx.cache()) { // Two different types might have the same did, // without actually being the same. continue; @@ -1327,7 +1327,7 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) { for i in impls { let impl_ = i.inner_impl(); - if !impl_.for_.without_borrowed_ref().is_same(ty.without_borrowed_ref(), cx.cache()) { + if !ty.is_same(&impl_.for_, cx.cache()) { // Two different types might have the same did, // without actually being the same. continue; |
