Add feature const_option
This commit is contained in:
parent
d462551a86
commit
e7d9944e20
3 changed files with 23 additions and 4 deletions
14
src/test/ui/consts/const-option.rs
Normal file
14
src/test/ui/consts/const-option.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(const_option)]
|
||||
|
||||
const X: Option<i32> = Some(32);
|
||||
const Y: Option<&i32> = X.as_ref();
|
||||
|
||||
const IS_SOME: bool = X.is_some();
|
||||
const IS_NONE: bool = Y.is_none();
|
||||
|
||||
fn main() {
|
||||
assert!(IS_SOME);
|
||||
assert!(!IS_NONE)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue