2 #![allow(non_upper_case_globals)]
4 // Constants (static variables) can be used to match in patterns, but mutable
5 // statics cannot. This ensures that there's some form of error if this is
8 // aux-build:static_mut_xc.rs
11 extern crate static_mut_xc;
13 unsafe fn static_bound(_: &'static isize) {}
15 fn static_bound_set(a: &'static mut isize) {
20 assert_eq!(static_mut_xc::a, 3);
22 assert_eq!(static_mut_xc::a, 4);
23 static_mut_xc::a += 1;
24 assert_eq!(static_mut_xc::a, 5);
25 static_mut_xc::a *= 3;
26 assert_eq!(static_mut_xc::a, 15);
27 static_mut_xc::a = -3;
28 assert_eq!(static_mut_xc::a, -3);
29 static_bound(&static_mut_xc::a);
30 static_bound_set(&mut static_mut_xc::a);
38 pub static mut a: isize = 4;