]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-21384.rs
Merge commit 'b71f3405606d49b9735606b479c3415a0ca9810f' into clippyup
[rust.git] / src / test / ui / issues / issue-21384.rs
1 // run-pass
2
3 use ::std::ops::RangeFull;
4
5 fn test<T : Clone>(arg: T) -> T {
6     arg.clone()
7 }
8
9 #[derive(PartialEq, Debug)]
10 struct Test(isize);
11
12 fn main() {
13     // Check that ranges implement clone
14     assert_eq!(test(1..5), (1..5));
15     assert_eq!(test(..5), (..5));
16     assert_eq!(test(1..), (1..));
17     assert_eq!(test(RangeFull), (RangeFull));
18
19     // Check that ranges can still be used with non-clone limits
20     assert_eq!((Test(1)..Test(5)), (Test(1)..Test(5)));
21 }