rust/tests/ui/issues/issue-21384.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
470 B
Rust
Raw Normal View History

// run-pass
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()
}
#[derive(PartialEq, Debug)]
struct Test(isize);
2015-01-19 05:43:15 +00:00
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));
2015-01-19 05:43:15 +00:00
// Check that ranges can still be used with non-clone limits
assert_eq!((Test(1)..Test(5)), (Test(1)..Test(5)));
2015-01-19 05:43:15 +00:00
}