Skip to content

Commit d711f47

Browse files
committed
Move const tests for Poll to library\core
Part of rust-lang#76268
1 parent 407add0 commit d711f47

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

core/tests/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@ mod result;
7676
mod slice;
7777
mod str;
7878
mod str_lossy;
79+
mod task;
7980
mod time;
8081
mod tuple;

core/tests/task.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use core::task::Poll;
2+
3+
#[test]
4+
fn poll_const() {
5+
// test that the methods of `Poll` are usable in a const context
6+
7+
const POLL: Poll<usize> = Poll::Pending;
8+
9+
const IS_READY: bool = POLL.is_ready();
10+
assert!(!IS_READY);
11+
12+
const IS_PENDING: bool = POLL.is_pending();
13+
assert!(IS_PENDING);
14+
}

0 commit comments

Comments
 (0)