diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2021-12-05 18:46:29 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2021-12-12 12:34:59 +0800 |
| commit | e22fe4008ca9db3d2b183d8df95a800d830d1edb (patch) | |
| tree | fb6704f490a55bd0d53aee5fa98c7da94ae9dccc /src | |
| parent | 84b1d859c8caa6049bfe728b219f679286151bb2 (diff) | |
| download | rust-e22fe4008ca9db3d2b183d8df95a800d830d1edb.tar.gz rust-e22fe4008ca9db3d2b183d8df95a800d830d1edb.zip | |
Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"
This reverts commit a8387aef8c378a771686878062e544af4d5e2245, reversing changes made to 6e1211081239be62a5d0bb3bbcb29a9f14621c81.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/consts/not_const_clusure_in_const.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/consts/try-operator.rs | 23 |
2 files changed, 23 insertions, 9 deletions
diff --git a/src/test/ui/consts/not_const_clusure_in_const.rs b/src/test/ui/consts/not_const_clusure_in_const.rs deleted file mode 100644 index fd2cfa442d3..00000000000 --- a/src/test/ui/consts/not_const_clusure_in_const.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - -const _FOO: fn() -> String = || "foo".into(); - -pub fn bar() -> fn() -> String { - || "bar".into() -} - -fn main(){} diff --git a/src/test/ui/consts/try-operator.rs b/src/test/ui/consts/try-operator.rs new file mode 100644 index 00000000000..fe43b132cbd --- /dev/null +++ b/src/test/ui/consts/try-operator.rs @@ -0,0 +1,23 @@ +// run-pass + +#![feature(try_trait_v2)] +#![feature(const_trait_impl)] +#![feature(const_try)] +#![feature(const_convert)] + +fn main() { + const fn result() -> Result<bool, ()> { + Err(())?; + Ok(true) + } + + const FOO: Result<bool, ()> = result(); + assert_eq!(Err(()), FOO); + + const fn option() -> Option<()> { + None?; + Some(()) + } + const BAR: Option<()> = option(); + assert_eq!(None, BAR); +} |
