diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-27 02:07:23 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-27 18:56:17 +0300 |
| commit | 5486cc69bdcc1c0027d7d06cd7630a2c48e3b063 (patch) | |
| tree | cc51bb82d6b0e4456f49f008f551c87573eeec53 /src/test/run-pass/impl-trait | |
| parent | 9be35f82c1abf2ecbab489bca9eca138ea648312 (diff) | |
| download | rust-5486cc69bdcc1c0027d7d06cd7630a2c48e3b063.tar.gz rust-5486cc69bdcc1c0027d7d06cd7630a2c48e3b063.zip | |
tests: Move run-pass tests with naming conflicts to ui
Diffstat (limited to 'src/test/run-pass/impl-trait')
| -rw-r--r-- | src/test/run-pass/impl-trait/auto-trait-leak.rs | 21 | ||||
| -rw-r--r-- | src/test/run-pass/impl-trait/equality.rs | 48 |
2 files changed, 0 insertions, 69 deletions
diff --git a/src/test/run-pass/impl-trait/auto-trait-leak.rs b/src/test/run-pass/impl-trait/auto-trait-leak.rs deleted file mode 100644 index 9976a018b46..00000000000 --- a/src/test/run-pass/impl-trait/auto-trait-leak.rs +++ /dev/null @@ -1,21 +0,0 @@ -// run-pass - -// Fast path, main can see the concrete type returned. -fn before() -> impl FnMut(i32) { - let mut p = Box::new(0); - move |x| *p = x -} - -fn send<T: Send>(_: T) {} - -fn main() { - send(before()); - send(after()); -} - -// Deferred path, main has to wait until typeck finishes, -// to check if the return type of after is Send. -fn after() -> impl FnMut(i32) { - let mut p = Box::new(0); - move |x| *p = x -} diff --git a/src/test/run-pass/impl-trait/equality.rs b/src/test/run-pass/impl-trait/equality.rs deleted file mode 100644 index 05c9e4173b0..00000000000 --- a/src/test/run-pass/impl-trait/equality.rs +++ /dev/null @@ -1,48 +0,0 @@ -// run-pass - -#![feature(specialization)] - -trait Foo: std::fmt::Debug + Eq {} - -impl<T: std::fmt::Debug + Eq> Foo for T {} - -fn hide<T: Foo>(x: T) -> impl Foo { - x -} - -trait Leak<T>: Sized { - fn leak(self) -> T; -} -impl<T, U> Leak<T> for U { - default fn leak(self) -> T { panic!("type mismatch") } -} -impl<T> Leak<T> for T { - fn leak(self) -> T { self } -} - -trait CheckIfSend: Sized { - type T: Default; - fn check(self) -> Self::T { Default::default() } -} -impl<T> CheckIfSend for T { - default type T = (); -} -impl<T: Send> CheckIfSend for T { - type T = bool; -} - -fn lucky_seven() -> impl Fn(usize) -> u8 { - let a = [1, 2, 3, 4, 5, 6, 7]; - move |i| a[i] -} - -fn main() { - assert_eq!(hide(42), hide(42)); - - assert_eq!(std::mem::size_of_val(&hide([0_u8; 5])), 5); - assert_eq!(std::mem::size_of_val(&lucky_seven()), 7); - - assert_eq!(Leak::<i32>::leak(hide(5_i32)), 5_i32); - - assert_eq!(CheckIfSend::check(hide(0_i32)), false); -} |
