diff options
Diffstat (limited to 'src/test/ui/borrowck/borrowck-freeze-frozen-mut.rs')
-rw-r--r-- | src/test/ui/borrowck/borrowck-freeze-frozen-mut.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/test/ui/borrowck/borrowck-freeze-frozen-mut.rs b/src/test/ui/borrowck/borrowck-freeze-frozen-mut.rs deleted file mode 100644 index 199931d6d..000000000 --- a/src/test/ui/borrowck/borrowck-freeze-frozen-mut.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass -// Test that a `&mut` inside of an `&` is freezable. - - -struct MutSlice<'a, T:'a> { - data: &'a mut [T] -} - -fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: usize) -> &'a T { - &ms.data[index] -} - -pub fn main() { - let mut data = [1, 2, 3]; - { - let slice = MutSlice { data: &mut data }; - slice.data[0] += 4; - let index0 = get(&slice, 0); - let index1 = get(&slice, 1); - let index2 = get(&slice, 2); - assert_eq!(*index0, 5); - assert_eq!(*index1, 2); - assert_eq!(*index2, 3); - } - assert_eq!(data[0], 5); - assert_eq!(data[1], 2); - assert_eq!(data[2], 3); -} |