From ce1d5ed31aff33bbbb116fffabd6107491c464bc Mon Sep 17 00:00:00 2001 From: Christiaan Dirkx Date: Fri, 4 Sep 2020 01:04:34 +0200 Subject: [PATCH] Move const tests for `Poll` to `library\core` Part of #76268 --- library/core/tests/lib.rs | 1 + library/core/tests/task.rs | 14 ++++++++++++++ src/test/ui/consts/std/poll.rs | 13 ------------- 3 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 library/core/tests/task.rs delete mode 100644 src/test/ui/consts/std/poll.rs diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 81e621318e1..2c20259fc58 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -76,5 +76,6 @@ mod result; mod slice; mod str; mod str_lossy; +mod task; mod time; mod tuple; diff --git a/library/core/tests/task.rs b/library/core/tests/task.rs new file mode 100644 index 00000000000..d71fef9e5c8 --- /dev/null +++ b/library/core/tests/task.rs @@ -0,0 +1,14 @@ +use core::task::Poll; + +#[test] +fn poll_const() { + // test that the methods of `Poll` are usable in a const context + + const POLL: Poll = Poll::Pending; + + const IS_READY: bool = POLL.is_ready(); + assert!(!IS_READY); + + const IS_PENDING: bool = POLL.is_pending(); + assert!(IS_PENDING); +} diff --git a/src/test/ui/consts/std/poll.rs b/src/test/ui/consts/std/poll.rs deleted file mode 100644 index 28f2ace6715..00000000000 --- a/src/test/ui/consts/std/poll.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass - -use std::task::Poll; - -fn main() { - const POLL : Poll = Poll::Pending; - - const IS_READY : bool = POLL.is_ready(); - assert!(!IS_READY); - - const IS_PENDING : bool = POLL.is_pending(); - assert!(IS_PENDING); -}