Add regression test for #115480

This commit is contained in:
Guillaume Gomez 2023-10-11 11:33:51 +02:00
parent a314707867
commit efac0b9c02
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,15 @@
use std::borrow::Borrow;
pub trait Equivalent<K: ?Sized> {
fn equivalent(&self, key: &K) -> bool;
}
impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q
where
Q: Eq,
K: Borrow<Q>,
{
fn equivalent(&self, key: &K) -> bool {
PartialEq::eq(self, key.borrow())
}
}

View File

@ -0,0 +1,9 @@
// exact-check
// This test ensures that methods from blanket impls of not available foreign traits
// don't show up in the search results.
const EXPECTED = {
'query': 'equivalent',
'others': [],
};

View File

@ -0,0 +1,8 @@
// aux-crate:priv:equivalent=equivalent.rs
// compile-flags: -Zunstable-options --extern equivalent
// edition:2018
extern crate equivalent;
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct LayoutError;