]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/try-operator.rs
Rollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwU
[rust.git] / tests / ui / consts / try-operator.rs
1 // run-pass
2
3 #![feature(try_trait_v2)]
4 #![feature(const_trait_impl)]
5 #![feature(const_try)]
6 #![feature(const_convert)]
7
8 fn main() {
9     const fn result() -> Result<bool, ()> {
10         Err(())?;
11         Ok(true)
12     }
13
14     const FOO: Result<bool, ()> = result();
15     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);
23 }