summary refs log tree commit diff
path: root/src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs
blob: 83fa32bf092bb9140c8404d06cf893e5f0e75bd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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() {}