diff options
| author | Albin Hedman <albin9604@gmail.com> | 2021-07-04 14:22:48 +0200 |
|---|---|---|
| committer | Albin Hedman <albin9604@gmail.com> | 2021-09-15 16:58:00 +0200 |
| commit | 991b375d87c1d171f3d36dd92d9543950eefcf47 (patch) | |
| tree | cfc72fb198d92598636001f03c0877592038130a | |
| parent | 88258c02a9c70fb562e4c646386411f4e0a4a80a (diff) | |
| download | rust-991b375d87c1d171f3d36dd92d9543950eefcf47.tar.gz rust-991b375d87c1d171f3d36dd92d9543950eefcf47.zip | |
Add test for try operator on Result
| -rw-r--r-- | src/test/ui/consts/try-operator.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/consts/try-operator.rs b/src/test/ui/consts/try-operator.rs new file mode 100644 index 00000000000..4767e68d41e --- /dev/null +++ b/src/test/ui/consts/try-operator.rs @@ -0,0 +1,16 @@ +// run-pass + +#![feature(try_trait_v2)] +#![feature(const_trait_impl)] +#![feature(const_try)] +#![feature(const_convert)] + +fn main() { + const fn foo() -> Result<bool, ()> { + Err(())?; + Ok(true) + } + + const FOO: Result<bool, ()> = foo(); + assert_eq!(Err(()), FOO); +} |
