2 #![allow(unused_assignments)]
3 #![allow(unused_variables)]
4 #![feature(existential_type)]
7 assert_eq!(foo().to_string(), "foo");
8 assert_eq!(bar1().to_string(), "bar1");
9 assert_eq!(bar2().to_string(), "bar2");
12 assert_eq!(boo::boo().to_string(), "boo");
13 assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
17 existential type Foo: std::fmt::Display;
24 existential type Bar: std::fmt::Display;
34 // definition in submodule
35 existential type Boo: std::fmt::Display;
38 pub fn boo() -> super::Boo {
43 existential type MyIter<T>: Iterator<Item = T>;
45 fn my_iter<T>(t: T) -> MyIter<T> {
49 fn my_iter2<T>(t: T) -> MyIter<T> {
53 // param names should not have an effect!
54 fn my_iter3<U>(u: U) -> MyIter<U> {
58 // param position should not have an effect!
59 fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
63 // param names should not have an effect!
64 existential type MyOtherIter<T>: Iterator<Item = T>;
66 fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
71 existential type GenericBound<'a, T: Trait>: Sized + 'a;
73 fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
78 pub existential type Passthrough<T>: Sized + 'static;
80 fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
85 fn use_passthrough(x: pass_through::Passthrough<u32>) -> pass_through::Passthrough<u32> {