1
Fork 0

Move /src/test to /tests

This commit is contained in:
Albert Larsan 2023-01-05 09:13:28 +01:00
parent ca855e6e42
commit cf2dff2b1e
No known key found for this signature in database
GPG key ID: 92709B88BB8F13EA
27592 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,48 @@
// check-pass
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
trait Foo {
fn foo(&self) -> impl Debug;
}
impl Foo for () {
fn foo(&self) -> impl Debug {
"Hello, world"
}
}
impl<T: Default + Debug> Foo for std::marker::PhantomData<T> {
fn foo(&self) -> impl Debug {
T::default()
}
}
trait Bar {
fn bar<T>(&self) -> impl Debug;
}
impl Bar for () {
fn bar<T>(&self) -> impl Debug {
format!("Hello with generic {}", std::any::type_name::<T>())
}
}
trait Baz {
fn baz(&self) -> impl Debug + '_;
}
impl Baz for String {
fn baz(&self) -> impl Debug + '_ {
(self,)
}
}
fn main() {
println!("{:?}", ().foo());
println!("{:?}", ().bar::<u64>());
println!("{:?}", "hi".to_string().baz());
}