rust/src/test/run-pass/borrowed-ptr-pattern.rs

12 lines
207 B
Rust
Raw Normal View History

2012-09-23 07:39:39 -05:00
fn foo<T: Copy>(x: &T) -> T{
2012-09-07 19:07:32 -05:00
match x {
2012-09-23 07:39:39 -05:00
&a => a
2012-09-07 19:07:32 -05:00
}
}
fn main() {
2012-09-23 07:39:39 -05:00
assert foo(&3) == 3;
assert foo(&'a') == 'a';
assert foo(&@"Dogs rule, cats drool") == @"Dogs rule, cats drool";
}