]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | // check-pass |
2 | ||
3 | #![feature(return_position_impl_trait_in_trait)] | |
4 | #![allow(incomplete_features)] | |
5 | ||
6 | use std::fmt::Display; | |
7 | use std::ops::Deref; | |
8 | ||
9 | trait Foo { | |
10 | fn bar(self) -> impl Deref<Target = impl Display + ?Sized>; | |
11 | } | |
12 | ||
13 | struct A; | |
14 | ||
15 | impl Foo for A { | |
16 | fn bar(self) -> &'static str { | |
17 | "Hello, world" | |
18 | } | |
19 | } | |
20 | ||
21 | struct B; | |
22 | ||
23 | impl Foo for B { | |
24 | fn bar(self) -> Box<i32> { | |
25 | Box::new(42) | |
26 | } | |
27 | } | |
28 | ||
29 | fn main() { | |
30 | println!("Message for you: {:?}", &*A.bar()); | |
31 | println!("Another for you: {:?}", &*B.bar()); | |
32 | } |