]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfc-2027-object-safe-for-dispatch/downcast-unsafe-trait-objects.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / rfc-2027-object-safe-for-dispatch / downcast-unsafe-trait-objects.rs
1 // Check that we if we get ahold of an object unsafe trait
2 // object with auto traits and lifetimes, we can downcast it
3 //
4 // check-pass
5
6 #![feature(object_safe_for_dispatch)]
7
8 trait Trait: Sized {}
9
10 fn downcast_auto(t: &(dyn Trait + Send)) -> &dyn Trait {
11     t
12 }
13
14 fn downcast_lifetime<'a, 'b, 't>(t: &'a (dyn Trait + 't))
15                                  -> &'b (dyn Trait + 't)
16 where
17     'a: 'b,
18     't: 'a + 'b,
19 {
20     t
21 }
22
23 fn main() {}