1
Fork 0

Allow more cases to match ~const Drop.

This commit is contained in:
Deadbeef 2021-09-29 12:15:17 +00:00
parent 3b25e92a8f
commit e0c2ff7ccc
No known key found for this signature in database
GPG key ID: 027DF9338862ADDD
2 changed files with 68 additions and 32 deletions

View file

@ -0,0 +1,20 @@
// check-pass
#![feature(const_trait_impl)]
#![feature(const_fn_trait_bound)]
#![feature(const_precise_live_drops)]
const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Drop {
match res {
Ok(t) => Some(t),
Err(_e) => None,
}
}
pub struct Foo<T>(T);
const fn baz<T: ~const Drop, E: ~const Drop>(res: Result<Foo<T>, Foo<E>>) -> Option<Foo<T>> {
foo(res)
}
fn main() {}