diff options
| author | Albin Hedman <albin9604@gmail.com> | 2021-07-04 19:11:54 +0200 |
|---|---|---|
| committer | Albin Hedman <albin9604@gmail.com> | 2021-09-15 16:58:01 +0200 |
| commit | aaf902bf8ff406f1dd300ad86b4fb5eeccb4fbe9 (patch) | |
| tree | 6fd5091182e96afc55eb0938f107c1937e902132 | |
| parent | a042705a7dd3733428528ad7d31310763552e33b (diff) | |
| download | rust-aaf902bf8ff406f1dd300ad86b4fb5eeccb4fbe9.tar.gz rust-aaf902bf8ff406f1dd300ad86b4fb5eeccb4fbe9.zip | |
Add test for try operator with Option
| -rw-r--r-- | src/test/ui/consts/try-operator.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/test/ui/consts/try-operator.rs b/src/test/ui/consts/try-operator.rs index 4767e68d41e..fe43b132cbd 100644 --- a/src/test/ui/consts/try-operator.rs +++ b/src/test/ui/consts/try-operator.rs @@ -6,11 +6,18 @@ #![feature(const_convert)] fn main() { - const fn foo() -> Result<bool, ()> { + const fn result() -> Result<bool, ()> { Err(())?; Ok(true) } - const FOO: Result<bool, ()> = foo(); + const FOO: Result<bool, ()> = result(); assert_eq!(Err(()), FOO); + + const fn option() -> Option<()> { + None?; + Some(()) + } + const BAR: Option<()> = option(); + assert_eq!(None, BAR); } |
