2024-01-22 06:23:50 -06:00
|
|
|
#![deny(deref_into_dyn_supertrait)]
|
2021-10-02 06:00:36 -05:00
|
|
|
|
2023-11-17 16:05:42 -06:00
|
|
|
use std::ops::Deref;
|
2021-10-02 06:00:36 -05:00
|
|
|
|
|
|
|
// issue 89190
|
|
|
|
trait A {}
|
|
|
|
trait B: A {}
|
2022-11-22 15:33:19 -06:00
|
|
|
|
2021-10-02 06:00:36 -05:00
|
|
|
impl<'a> Deref for dyn 'a + B {
|
2024-01-22 06:23:50 -06:00
|
|
|
//~^ 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() {}
|