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!(boo::boo().to_string(), "boo");
15 assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
19 type Foo = impl std::fmt::Display;
26 type Bar = impl std::fmt::Display;
36 // definition in submodule
37 type Boo = impl std::fmt::Display;
40 pub fn boo() -> super::Boo {
45 type MyIter<T> = impl Iterator<Item = T>;
47 fn my_iter<T>(t: T) -> MyIter<T> {
51 fn my_iter2<T>(t: T) -> MyIter<T> {
55 // param names should not have an effect!
56 fn my_iter3<U>(u: U) -> MyIter<U> {
60 // param position should not have an effect!
61 fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
65 // param names should not have an effect!
66 type MyOtherIter<T> = impl Iterator<Item = T>;
68 fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
73 type GenericBound<'a, T: Trait + 'a> = impl Sized + 'a;
75 fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
80 pub type Passthrough<T: 'static> = impl Sized + 'static;
82 fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
87 fn use_passthrough(x: pass_through::Passthrough<u32>) -> pass_through::Passthrough<u32> {