diff options
| author | Flavio Percoco <flaper87@gmail.com> | 2014-03-06 22:48:52 +0100 |
|---|---|---|
| committer | Flavio Percoco <flaper87@gmail.com> | 2014-03-06 22:50:39 +0100 |
| commit | abfc6db4c2b9c9c686a5c09d59e4c534e5f4f2ec (patch) | |
| tree | ceb4a198fc81b100634848144a4a3e6ee1a096ce /src/test | |
| parent | 8b8d41d28a2a2918dd6f08c16034bc5ae07bee81 (diff) | |
| download | rust-abfc6db4c2b9c9c686a5c09d59e4c534e5f4f2ec.tar.gz rust-abfc6db4c2b9c9c686a5c09d59e4c534e5f4f2ec.zip | |
rustc: Move mut slice check to `check_static`
This is a follow-up patch that moves the mut slice check to the recently added `check_static` Closes #11411
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/check-static-immutable-mut-slices.rs (renamed from src/test/compile-fail/issue-11411.rs) | 7 | ||||
| -rw-r--r-- | src/test/run-pass/check-static-mut-slices.rs (renamed from src/test/run-pass/issue-11411.rs) | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/test/compile-fail/issue-11411.rs b/src/test/compile-fail/check-static-immutable-mut-slices.rs index 4ccee2b40c1..73ce488cbc6 100644 --- a/src/test/compile-fail/issue-11411.rs +++ b/src/test/compile-fail/check-static-immutable-mut-slices.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -static TEST: &'static mut [int] = &mut []; //~ ERROR mutable slice is not allowed +// Checks that immutable static items can't have mutable slices -fn main() { } +static TEST: &'static mut [int] = &mut []; +//~^ ERROR static items are not allowed to have mutable slices + +pub fn main() { } diff --git a/src/test/run-pass/issue-11411.rs b/src/test/run-pass/check-static-mut-slices.rs index e0da80702d7..af25c43005d 100644 --- a/src/test/run-pass/issue-11411.rs +++ b/src/test/run-pass/check-static-mut-slices.rs @@ -8,11 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// Checks that mutable static items can have mutable slices static mut TEST: &'static mut [int] = &mut [1]; pub fn main() { unsafe { TEST[0] += 1; + assert_eq!(TEST[0], 2); } } |
