rust/tests/ui/traits/trait-upcasting/migrate-lint-deny.rs

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

26 lines
453 B
Rust
Raw Normal View History

#![deny(deref_into_dyn_supertrait)]
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 {
//~^ ERROR this `Deref` implementation is covered by an implicit supertrait coercion
//~| WARN this will change its meaning in a future release!
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() {}