rust/tests/ui/traits/trait-upcasting/deref-lint.rs
2023-11-22 21:51:39 +00:00

25 lines
366 B
Rust

// check-pass
use std::ops::Deref;
// issue 89190
trait A {}
trait B: A {}
impl<'a> Deref for dyn 'a + B {
//~^ WARN this `Deref` implementation is covered by an implicit supertrait coercion
type Target = dyn A;
fn deref(&self) -> &Self::Target {
todo!()
}
}
fn take_a(_: &dyn A) {}
fn whoops(b: &dyn B) {
take_a(b)
}
fn main() {}