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.

27 lines
468 B
Rust
Raw Normal View History

2023-07-27 10:51:02 -05:00
// known-bug: #110395
// FIXME check-pass
2021-09-29 07:15:17 -05:00
#![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() {}