summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-21384.rs
blob: caa99a159826703f4e6fc2b45cd940328c199f12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// run-pass

use ::std::ops::RangeFull;

fn test<T : Clone>(arg: T) -> T {
    arg.clone()
}

#[derive(PartialEq, Debug)]
struct Test(isize);

fn main() {
    // Check that ranges implement clone
    assert_eq!(test(1..5), (1..5));
    assert_eq!(test(..5), (..5));
    assert_eq!(test(1..), (1..));
    assert_eq!(test(RangeFull), (RangeFull));

    // Check that ranges can still be used with non-clone limits
    assert_eq!((Test(1)..Test(5)), (Test(1)..Test(5)));
}