1
Fork 0

static mut: allow reference to arbitrary types, not just slices and arrays

This commit is contained in:
Ralf Jung 2023-11-05 16:58:47 +01:00
parent 7df6f4a15e
commit 9a819ab8f7
9 changed files with 46 additions and 77 deletions

View file

@ -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);
}
}