]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/object/with-self-in-projection-output-good.rs
Merge commit 'c4416f20dcaec5d93077f72470e83e150fb923b1' into sync-rustfmt
[rust.git] / src / test / ui / traits / object / with-self-in-projection-output-good.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2
3 // Regression test related to #56288. Check that a supertrait projection (of
4 // `Output`) that references `Self` can be ok if it is referencing a projection (of
5 // `Self::Target`, in this case). Note that we still require the user to manually
6 // specify both `Target` and `Output` for now.
7
8 trait Base {
9     type Output;
10 }
11
12 trait Helper: Base<Output=<Self as Helper>::Target> {
13     type Target;
14 }
15
16 impl Base for u32
17 {
18     type Output = i32;
19 }
20
21 impl Helper for u32
22 {
23     type Target = i32;
24 }
25
26 fn main() {
27     let _x: Box<dyn Helper<Target=i32, Output=i32>> = Box::new(2u32);
28 }