Skip to content

Commit 7fe6993

Browse files
committed
Add test for try operator on Result
1 parent 8281f64 commit 7fe6993

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// run-pass
2+
3+
#![feature(try_trait_v2)]
4+
#![feature(const_trait_impl)]
5+
#![feature(const_try)]
6+
#![feature(const_identity_convert)]
7+
8+
fn main() {
9+
const fn foo() -> Result<bool, ()> {
10+
Err(())?;
11+
Ok(true)
12+
}
13+
14+
const FOO: Result<bool, ()> = foo();
15+
assert_eq!(Err(()), FOO);
16+
}

0 commit comments

Comments
 (0)