diff options
Diffstat (limited to 'tests/ui/coercion/coerce-reborrow-mut-vec-arg.rs')
-rw-r--r-- | tests/ui/coercion/coerce-reborrow-mut-vec-arg.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/coercion/coerce-reborrow-mut-vec-arg.rs b/tests/ui/coercion/coerce-reborrow-mut-vec-arg.rs new file mode 100644 index 000000000..2635754f1 --- /dev/null +++ b/tests/ui/coercion/coerce-reborrow-mut-vec-arg.rs @@ -0,0 +1,18 @@ +// run-pass + + +fn reverse(v: &mut [usize]) { + v.reverse(); +} + +fn bar(v: &mut [usize]) { + reverse(v); + reverse(v); + reverse(v); +} + +pub fn main() { + let mut the_vec = vec![1, 2, 3, 100]; + bar(&mut the_vec); + assert_eq!(the_vec, [100, 3, 2, 1]); +} |