Skip to content

Commit b7f572b

Browse files
committed
Add test for try operator with Option
1 parent 7c8c209 commit b7f572b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/test/ui/consts/try-operator.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@
66
#![feature(const_identity_convert)]
77

88
fn main() {
9-
const fn foo() -> Result<bool, ()> {
9+
const fn result() -> Result<bool, ()> {
1010
Err(())?;
1111
Ok(true)
1212
}
1313

14-
const FOO: Result<bool, ()> = foo();
14+
const FOO: Result<bool, ()> = result();
1515
assert_eq!(Err(()), FOO);
16+
17+
const fn option() -> Option<()> {
18+
None?;
19+
Some(())
20+
}
21+
const BAR: Option<()> = option();
22+
assert_eq!(None, BAR);
1623
}

0 commit comments

Comments
 (0)