3 // Use of global static variables in literal values should be allowed for
5 // This test is to demonstrate the issue raised in
6 // https://github.com/rust-lang/rust/issues/70584
8 // Literal values were previously promoted into local static values when
9 // other global static variables are used.
11 struct A<T: 'static>(&'static T);
12 struct B<T: 'static + ?Sized> {
15 static STR: &'static [u8] = b"hi";
16 static C: A<B<B<[u8]>>> = {
22 pub struct Slice(&'static [i32]);
24 static CONTENT: i32 = 42;
25 pub static CONTENT_MAP: Slice = Slice(&[CONTENT]);
27 pub static FOO: (i32, i32) = (42, 43);
28 pub static CONTENT_MAP2: Slice = Slice(&[FOO.0]);
31 assert_eq!(b"hi", C.0.x.x);
32 assert_eq!(&[42], CONTENT_MAP.0);
33 assert_eq!(&[42], CONTENT_MAP2.0);