diff --git a/src/test/ui/statics/static-promotion.rs b/src/test/ui/statics/static-promotion.rs index 500af1e15e12..bd8910bdb3f3 100644 --- a/src/test/ui/statics/static-promotion.rs +++ b/src/test/ui/statics/static-promotion.rs @@ -12,12 +12,23 @@ struct A(&'static T); struct B { x: &'static T, } +static STR: &'static [u8] = b"hi"; static C: A>> = { A(&B { - x: &B { x: b"hi" as &[u8] }, + x: &B { x: STR }, }) }; +pub struct Slice(&'static [i32]); + +static CONTENT: i32 = 42; +pub static CONTENT_MAP: Slice = Slice(&[CONTENT]); + +pub static FOO: (i32, i32) = (42, 43); +pub static CONTENT_MAP2: Slice = Slice(&[FOO.0]); + fn main() { assert_eq!(b"hi", C.0.x.x); + assert_eq!(&[42], CONTENT_MAP.0); + assert_eq!(&[42], CONTENT_MAP2.0); }