2015-11-12 16:13:05 -06:00
|
|
|
#![feature(custom_attribute)]
|
2015-11-12 15:50:58 -06:00
|
|
|
#![allow(dead_code, unused_attributes)]
|
|
|
|
|
2015-11-12 16:13:05 -06:00
|
|
|
#[miri_run(expected = "Int(1)")]
|
|
|
|
fn ret() -> i32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
2015-11-12 17:24:43 -06:00
|
|
|
#[miri_run(expected = "Int(-1)")]
|
|
|
|
fn neg() -> i32 {
|
|
|
|
-1
|
|
|
|
}
|
|
|
|
|
2015-11-12 16:13:05 -06:00
|
|
|
#[miri_run(expected = "Int(3)")]
|
|
|
|
fn add() -> i32 {
|
|
|
|
1 + 2
|
|
|
|
}
|
|
|
|
|
|
|
|
#[miri_run(expected = "Int(3)")]
|
|
|
|
fn indirect_add() -> i32 {
|
2015-11-12 15:50:58 -06:00
|
|
|
let x = 1;
|
|
|
|
let y = 2;
|
|
|
|
x + y
|
|
|
|
}
|
|
|
|
|
2015-11-12 18:00:22 -06:00
|
|
|
#[miri_run(expected = "Int(25)")]
|
|
|
|
fn arith() -> i32 {
|
|
|
|
3*3 + 4*4
|
|
|
|
}
|
|
|
|
|
2015-11-19 03:23:50 -06:00
|
|
|
#[miri_run(expected = "Int(0)")]
|
|
|
|
fn if_false() -> i32 {
|
|
|
|
if false { 1 } else { 0 }
|
|
|
|
}
|
|
|
|
|
|
|
|
#[miri_run(expected = "Int(1)")]
|
|
|
|
fn if_true() -> i32 {
|
|
|
|
if true { 1 } else { 0 }
|
|
|
|
}
|
|
|
|
|
2015-11-19 07:07:47 -06:00
|
|
|
#[miri_run(expected = "Int(2)")]
|
|
|
|
fn call() -> i32 {
|
|
|
|
fn increment(x: i32) -> i32 {
|
|
|
|
x + 1
|
|
|
|
}
|
|
|
|
|
|
|
|
increment(1)
|
|
|
|
}
|
|
|
|
|
2015-11-12 15:50:58 -06:00
|
|
|
fn main() {}
|