]> git.lizzy.rs Git - rust.git/blob - tests/ui/self/arbitrary_self_types_nested.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / ui / self / arbitrary_self_types_nested.rs
1 // run-pass
2
3 use {
4     std::{
5         rc::Rc,
6         sync::Arc,
7     },
8 };
9
10 #[derive(Default)]
11 struct Ty;
12
13 trait Trait {
14     fn receive_trait(self: &Arc<Rc<Box<Self>>>) -> u32;
15 }
16
17 const TRAIT_MAGIC: u32 = 42;
18 const INHERENT_MAGIC: u32 = 1995;
19
20 impl Trait for Ty {
21     fn receive_trait(self: &Arc<Rc<Box<Self>>>) -> u32 {
22         TRAIT_MAGIC
23     }
24 }
25
26 impl Ty {
27     fn receive_inherent(self: &Arc<Rc<Box<Self>>>) -> u32 {
28         INHERENT_MAGIC
29     }
30 }
31
32 fn main() {
33     let ty = <Arc<Rc<Box<Ty>>>>::default();
34     assert_eq!(TRAIT_MAGIC, ty.receive_trait());
35     assert_eq!(INHERENT_MAGIC, ty.receive_inherent());
36 }