]> git.lizzy.rs Git - rust.git/blob - tests/run-pass/sums.rs
209629eabbf8274ce0bbcf16e6a997e3ece97cb7
[rust.git] / tests / run-pass / sums.rs
1 #![crate_type = "lib"]
2 #![feature(custom_attribute)]
3 #![allow(dead_code, unused_attributes)]
4
5 enum Unit { Unit }
6
7 #[miri_run]
8 fn return_unit() -> Unit {
9     Unit::Unit
10 }
11
12 enum MyBool { False, True }
13
14 #[miri_run]
15 fn return_true() -> MyBool {
16     MyBool::True
17 }
18
19 #[miri_run]
20 fn return_false() -> MyBool {
21     MyBool::False
22 }
23
24 #[miri_run]
25 fn return_none() -> Option<i64> {
26     None
27 }
28
29 #[miri_run]
30 fn return_some() -> Option<i64> {
31     Some(42)
32 }
33
34 #[miri_run]
35 fn match_opt_none() -> i8 {
36     let x = None;
37     match x {
38         Some(data) => data,
39         None => 42,
40     }
41 }
42
43 #[miri_run]
44 fn match_opt_some() -> i8 {
45     let x = Some(13);
46     match x {
47         Some(data) => data,
48         None => 20,
49     }
50 }
51
52 #[miri_run]
53 fn two_nones() -> (Option<i16>, Option<i16>) {
54     (None, None)
55 }