Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"

This reverts commit a8387aef8c, reversing
changes made to 6e12110812.
This commit is contained in:
Deadbeef 2021-12-05 18:46:29 +08:00
parent 84b1d859c8
commit e22fe4008c
No known key found for this signature in database
GPG key ID: 6D017A96D8E6C2F9
8 changed files with 54 additions and 15 deletions

View file

@ -1,9 +0,0 @@
// run-pass
const _FOO: fn() -> String = || "foo".into();
pub fn bar() -> fn() -> String {
|| "bar".into()
}
fn main(){}

View file

@ -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);
}