Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"
This reverts commita8387aef8c, reversing changes made to6e12110812.
This commit is contained in:
parent
84b1d859c8
commit
e22fe4008c
8 changed files with 54 additions and 15 deletions
|
|
@ -1,9 +0,0 @@
|
|||
// run-pass
|
||||
|
||||
const _FOO: fn() -> String = || "foo".into();
|
||||
|
||||
pub fn bar() -> fn() -> String {
|
||||
|| "bar".into()
|
||||
}
|
||||
|
||||
fn main(){}
|
||||
23
src/test/ui/consts/try-operator.rs
Normal file
23
src/test/ui/consts/try-operator.rs
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue