rust/tests/ui/traits/trait-upcasting/deref-lint.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
366 B
Rust
Raw Normal View History

// check-pass
2021-10-02 06:00:36 -05:00
use std::ops::Deref;
2021-10-02 06:00:36 -05:00
// issue 89190
trait A {}
trait B: A {}
2021-10-02 06:00:36 -05:00
impl<'a> Deref for dyn 'a + B {
//~^ WARN this `Deref` implementation is covered by an implicit supertrait coercion
2023-11-18 13:29:39 -06:00
2021-10-02 06:00:36 -05:00
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() {}