]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / src / test / ui / traits / trait-object-with-self-in-projection-output-good.rs
CommitLineData
416331ca 1// build-pass (FIXME(62277): could be check-pass?)
69743fb6
XL
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
8trait Base {
9 type Output;
10}
11
12trait Helper: Base<Output=<Self as Helper>::Target> {
13 type Target;
14}
15
16impl Base for u32
17{
18 type Output = i32;
19}
20
21impl Helper for u32
22{
23 type Target = i32;
24}
25
26fn main() {
27 let _x: Box<dyn Helper<Target=i32, Output=i32>> = Box::new(2u32);
28}