Allow more cases to match ~const Drop.
This commit is contained in:
parent
3b25e92a8f
commit
e0c2ff7ccc
2 changed files with 68 additions and 32 deletions
20
src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs
Normal file
20
src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs
Normal 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() {}
|
Loading…
Add table
Add a link
Reference in a new issue