2021-09-29 07:15:17 -05:00
|
|
|
// check-pass
|
|
|
|
|
|
|
|
#![feature(const_trait_impl)]
|
|
|
|
#![feature(const_precise_live_drops)]
|
|
|
|
|
2022-03-21 00:52:41 -05:00
|
|
|
use std::marker::Destruct;
|
|
|
|
|
|
|
|
const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
|
2021-09-29 07:15:17 -05:00
|
|
|
match res {
|
|
|
|
Ok(t) => Some(t),
|
|
|
|
Err(_e) => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Foo<T>(T);
|
|
|
|
|
2022-03-21 01:07:09 -05:00
|
|
|
const fn baz<T, E>(res: Result<Foo<T>, Foo<E>>) -> Option<Foo<T>>
|
|
|
|
where
|
|
|
|
T: ~const Destruct,
|
|
|
|
E: ~const Destruct,
|
|
|
|
{
|
2021-09-29 07:15:17 -05:00
|
|
|
foo(res)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|