4 #![allow(unused_assignments)]
5 #![allow(unused_variables)]
6 #![feature(type_alias_impl_trait)]
9 assert_eq!(foo().to_string(), "foo");
10 assert_eq!(bar1().to_string(), "bar1");
11 assert_eq!(bar2().to_string(), "bar2");
14 assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
18 type Foo = impl std::fmt::Display;
25 type Bar = impl std::fmt::Display;
35 type MyIter<T> = impl Iterator<Item = T>;
37 fn my_iter<T>(t: T) -> MyIter<T> {
41 fn my_iter2<T>(t: T) -> MyIter<T> {
45 // param names should not have an effect!
46 fn my_iter3<U>(u: U) -> MyIter<U> {
50 // param position should not have an effect!
51 fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
55 // param names should not have an effect!
56 type MyOtherIter<T> = impl Iterator<Item = T>;
58 fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
63 type GenericBound<'a, T: Trait + 'a> = impl Sized + 'a;
65 fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
70 pub type Passthrough<T: 'static> = impl Sized + 'static;
72 fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
77 fn use_passthrough(x: pass_through::Passthrough<u32>) -> pass_through::Passthrough<u32> {