diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-21384.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-21384.rs b/src/test/ui/issues/issue-21384.rs new file mode 100644 index 000000000..caa99a159 --- /dev/null +++ b/src/test/ui/issues/issue-21384.rs @@ -0,0 +1,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))); +} |