From b2a5d99705e2b93462669791f9a2bf0bd0055384 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 29 Jul 2019 03:38:49 +0200 Subject: Move ui/existential_type.rs -> ui/existential_type/existential_type-pass. --- src/test/ui/existential_type.rs | 89 ---------------------- .../ui/existential_types/existential_type-pass.rs | 89 ++++++++++++++++++++++ 2 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 src/test/ui/existential_type.rs create mode 100644 src/test/ui/existential_types/existential_type-pass.rs diff --git a/src/test/ui/existential_type.rs b/src/test/ui/existential_type.rs deleted file mode 100644 index c2cf0eeed3d..00000000000 --- a/src/test/ui/existential_type.rs +++ /dev/null @@ -1,89 +0,0 @@ -// run-pass - -#![allow(dead_code)] -#![allow(unused_assignments)] -#![allow(unused_variables)] -#![feature(existential_type)] - -fn main() { - assert_eq!(foo().to_string(), "foo"); - assert_eq!(bar1().to_string(), "bar1"); - assert_eq!(bar2().to_string(), "bar2"); - let mut x = bar1(); - x = bar2(); - assert_eq!(boo::boo().to_string(), "boo"); - assert_eq!(my_iter(42u8).collect::>(), vec![42u8]); -} - -// single definition -existential type Foo: std::fmt::Display; - -fn foo() -> Foo { - "foo" -} - -// two definitions -existential type Bar: std::fmt::Display; - -fn bar1() -> Bar { - "bar1" -} - -fn bar2() -> Bar { - "bar2" -} - -// definition in submodule -existential type Boo: std::fmt::Display; - -mod boo { - pub fn boo() -> super::Boo { - "boo" - } -} - -existential type MyIter: Iterator; - -fn my_iter(t: T) -> MyIter { - std::iter::once(t) -} - -fn my_iter2(t: T) -> MyIter { - std::iter::once(t) -} - -// param names should not have an effect! -fn my_iter3(u: U) -> MyIter { - std::iter::once(u) -} - -// param position should not have an effect! -fn my_iter4(_: U, v: V) -> MyIter { - std::iter::once(v) -} - -// param names should not have an effect! -existential type MyOtherIter: Iterator; - -fn my_other_iter(u: U) -> MyOtherIter { - std::iter::once(u) -} - -trait Trait {} -existential type GenericBound<'a, T: Trait>: Sized + 'a; - -fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> { - t -} - -mod pass_through { - pub existential type Passthrough: Sized + 'static; - - fn define_passthrough(t: T) -> Passthrough { - t - } -} - -fn use_passthrough(x: pass_through::Passthrough) -> pass_through::Passthrough { - x -} diff --git a/src/test/ui/existential_types/existential_type-pass.rs b/src/test/ui/existential_types/existential_type-pass.rs new file mode 100644 index 00000000000..c2cf0eeed3d --- /dev/null +++ b/src/test/ui/existential_types/existential_type-pass.rs @@ -0,0 +1,89 @@ +// run-pass + +#![allow(dead_code)] +#![allow(unused_assignments)] +#![allow(unused_variables)] +#![feature(existential_type)] + +fn main() { + assert_eq!(foo().to_string(), "foo"); + assert_eq!(bar1().to_string(), "bar1"); + assert_eq!(bar2().to_string(), "bar2"); + let mut x = bar1(); + x = bar2(); + assert_eq!(boo::boo().to_string(), "boo"); + assert_eq!(my_iter(42u8).collect::>(), vec![42u8]); +} + +// single definition +existential type Foo: std::fmt::Display; + +fn foo() -> Foo { + "foo" +} + +// two definitions +existential type Bar: std::fmt::Display; + +fn bar1() -> Bar { + "bar1" +} + +fn bar2() -> Bar { + "bar2" +} + +// definition in submodule +existential type Boo: std::fmt::Display; + +mod boo { + pub fn boo() -> super::Boo { + "boo" + } +} + +existential type MyIter: Iterator; + +fn my_iter(t: T) -> MyIter { + std::iter::once(t) +} + +fn my_iter2(t: T) -> MyIter { + std::iter::once(t) +} + +// param names should not have an effect! +fn my_iter3(u: U) -> MyIter { + std::iter::once(u) +} + +// param position should not have an effect! +fn my_iter4(_: U, v: V) -> MyIter { + std::iter::once(v) +} + +// param names should not have an effect! +existential type MyOtherIter: Iterator; + +fn my_other_iter(u: U) -> MyOtherIter { + std::iter::once(u) +} + +trait Trait {} +existential type GenericBound<'a, T: Trait>: Sized + 'a; + +fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> { + t +} + +mod pass_through { + pub existential type Passthrough: Sized + 'static; + + fn define_passthrough(t: T) -> Passthrough { + t + } +} + +fn use_passthrough(x: pass_through::Passthrough) -> pass_through::Passthrough { + x +} -- cgit 1.4.1-3-g733a5