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