static mut: allow reference to arbitrary types, not just slices and arrays
This commit is contained in:
parent
7df6f4a15e
commit
9a819ab8f7
9 changed files with 46 additions and 77 deletions
|
@ -1,15 +0,0 @@
|
|||
// run-pass
|
||||
#![allow(dead_code)]
|
||||
|
||||
// Checks that mutable static items can have mutable slices
|
||||
|
||||
|
||||
static mut TEST: &'static mut [isize] = &mut [1];
|
||||
static mut EMPTY: &'static mut [isize] = &mut [];
|
||||
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
TEST[0] += 1;
|
||||
assert_eq!(TEST[0], 2);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue