1
Fork 0

Only show notable traits if both types are the same

Checking only their DefId doesn't work because all slices have the same
fake DefId.

Fixes #91347
This commit is contained in:
Michael Howell 2021-11-29 12:18:57 -07:00
parent 6db0a0e9a4
commit 85ba6c7b34
3 changed files with 67 additions and 1 deletions

View file

@ -0,0 +1,20 @@
#![feature(doc_notable_trait)]
#[doc(notable_trait)]
pub trait SomeTrait {}
pub struct SomeStruct;
pub struct OtherStruct;
impl SomeTrait for &[SomeStruct] {}
// @has doc_notable_trait_slice/fn.bare_fn_matches.html
// @has - '//code[@class="content"]' 'impl SomeTrait for &[SomeStruct]'
pub fn bare_fn_matches() -> &'static [SomeStruct] {
&[]
}
// @has doc_notable_trait_slice/fn.bare_fn_no_matches.html
// @!has - '//code[@class="content"]' 'impl SomeTrait for &[SomeStruct]'
pub fn bare_fn_no_matches() -> &'static [OtherStruct] {
&[]
}