aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-855.rs
blob: 9e450ddda3aea908e31c88fc91fc0f08cbe0551e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
pub use result::Result::{self, Err, Ok};

#[lang = "sized"]
pub trait Sized {}

extern "C" {
    fn printf(s: *const i8, ...);
}

mod result {
    pub enum Result<T, E> {
        #[lang = "Ok"]
        Ok(T),

        #[lang = "Err"]
        Err(E),
    }
}

pub fn test(a: i32) -> Result<i32, bool> {
    if a > 5 {
        Ok(123)
    } else {
        Err(false)
    }
}