]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/trait-upcasting/migrate-lint-deny.rs
Rollup merge of #103702 - WaffleLapkin:lift-sized-bounds-from-pointer-methods-where...
[rust.git] / tests / ui / traits / trait-upcasting / migrate-lint-deny.rs
1 #![deny(deref_into_dyn_supertrait)]
2
3 extern crate core;
4
5 use core::ops::Deref;
6
7 // issue 89190
8 trait A {}
9 trait B: A {}
10
11 impl<'a> Deref for dyn 'a + B {
12     //~^ ERROR `(dyn B + 'a)` implements `Deref` with supertrait `A` as target
13     //~| WARN this was previously accepted by the compiler but is being phased out;
14
15     type Target = dyn A;
16     fn deref(&self) -> &Self::Target {
17         todo!()
18     }
19 }
20
21 fn take_a(_: &dyn A) {}
22
23 fn whoops(b: &dyn B) {
24     take_a(b)
25 }
26
27 fn main() {}