rust/test/sums.rs

50 lines
682 B
Rust
Raw Normal View History

2016-03-12 21:32:24 -06:00
#![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
2016-03-13 07:05:48 -05:00
enum Unit { Unit }
#[miri_run]
fn return_unit() -> Unit {
Unit::Unit
}
enum MyBool { False, True }
#[miri_run]
fn return_true() -> MyBool {
MyBool::True
}
#[miri_run]
fn return_false() -> MyBool {
MyBool::False
}
#[miri_run]
fn return_none() -> Option<i64> {
None
}
2016-03-12 21:32:24 -06:00
#[miri_run]
fn return_some() -> Option<i64> {
Some(42)
}
2016-03-13 07:30:28 -05:00
#[miri_run]
fn match_opt_none() -> i8 {
let x = None;
2016-03-13 07:30:28 -05:00
match x {
Some(data) => data,
None => 42,
2016-03-13 07:30:28 -05:00
}
}
#[miri_run]
fn match_opt_some() -> i8 {
let x = Some(13);
match x {
Some(data) => data,
2016-03-13 07:30:28 -05:00
None => 20,
}
}