rust/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-bound.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
440 B
Rust
Raw Normal View History

2021-09-29 07:15:17 -05:00
// check-pass
#![feature(const_trait_impl)]
#![feature(const_precise_live_drops)]
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() {}