2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2015-01-28 05:16:00 +00:00
|
|
|
use ::std::ops::RangeFull;
|
2015-01-28 04:06:46 +00:00
|
|
|
|
2015-01-19 05:43:15 +00:00
|
|
|
fn test<T : Clone>(arg: T) -> T {
|
|
|
|
arg.clone()
|
|
|
|
}
|
|
|
|
|
2015-06-07 18:00:38 +00:00
|
|
|
#[derive(PartialEq, Debug)]
|
2015-03-26 00:06:52 +00:00
|
|
|
struct Test(isize);
|
2015-01-19 05:43:15 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Check that ranges implement clone
|
2015-06-07 18:00:38 +00:00
|
|
|
assert_eq!(test(1..5), (1..5));
|
|
|
|
assert_eq!(test(..5), (..5));
|
|
|
|
assert_eq!(test(1..), (1..));
|
|
|
|
assert_eq!(test(RangeFull), (RangeFull));
|
2015-01-19 05:43:15 +00:00
|
|
|
|
|
|
|
// Check that ranges can still be used with non-clone limits
|
2015-06-07 18:00:38 +00:00
|
|
|
assert_eq!((Test(1)..Test(5)), (Test(1)..Test(5)));
|
2015-01-19 05:43:15 +00:00
|
|
|
}
|