2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2013-07-02 12:47:32 -07:00
|
|
|
fn foo<T:Clone>(x: &T) -> T{
|
2012-09-07 17:07:32 -07:00
|
|
|
match x {
|
2013-07-02 12:47:32 -07:00
|
|
|
&ref a => (*a).clone()
|
2012-09-07 17:07:32 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2015-01-25 22:05:03 +01:00
|
|
|
assert_eq!(foo(&3), 3);
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(foo(&'a'), 'a');
|
2012-09-23 05:39:39 -07:00
|
|
|
}
|