blob: 2dc91ec84f556977f41c56a36007911961117675 [file] [log] [blame]
// run-pass
fn get<T>(opt: &Option<T>) -> &T {
match *opt {
Some(ref v) => v,
None => panic!("none")
}
}
pub fn main() {
let mut x = Some(23);
{
let y = get(&x);
assert_eq!(*y, 23);
}
x = Some(24);
{
let y = get(&x);
assert_eq!(*y, 24);
}
}