Move /src/test to /tests
This commit is contained in:
parent
ca855e6e42
commit
cf2dff2b1e
27592 changed files with 0 additions and 0 deletions
32
tests/ui/impl-trait/in-trait/nested-rpitit.rs
Normal file
32
tests/ui/impl-trait/in-trait/nested-rpitit.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(return_position_impl_trait_in_trait)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
use std::fmt::Display;
|
||||
use std::ops::Deref;
|
||||
|
||||
trait Foo {
|
||||
fn bar(self) -> impl Deref<Target = impl Display + ?Sized>;
|
||||
}
|
||||
|
||||
struct A;
|
||||
|
||||
impl Foo for A {
|
||||
fn bar(self) -> &'static str {
|
||||
"Hello, world"
|
||||
}
|
||||
}
|
||||
|
||||
struct B;
|
||||
|
||||
impl Foo for B {
|
||||
fn bar(self) -> Box<i32> {
|
||||
Box::new(42)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Message for you: {:?}", &*A.bar());
|
||||
println!("Another for you: {:?}", &*B.bar());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue