We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4631579 commit c511454Copy full SHA for c511454
src/test/ui/statics/static-promotion.rs
@@ -12,12 +12,23 @@ struct A<T: 'static>(&'static T);
12
struct B<T: 'static + ?Sized> {
13
x: &'static T,
14
}
15
+static STR: &'static [u8] = b"hi";
16
static C: A<B<B<[u8]>>> = {
17
A(&B {
- x: &B { x: b"hi" as &[u8] },
18
+ x: &B { x: STR },
19
})
20
};
21
22
+pub struct Slice(&'static [i32]);
23
+
24
+static CONTENT: i32 = 42;
25
+pub static CONTENT_MAP: Slice = Slice(&[CONTENT]);
26
27
+pub static FOO: (i32, i32) = (42, 43);
28
+pub static CONTENT_MAP2: Slice = Slice(&[FOO.0]);
29
30
fn main() {
31
assert_eq!(b"hi", C.0.x.x);
32
+ assert_eq!(&[42], CONTENT_MAP.0);
33
+ assert_eq!(&[42], CONTENT_MAP2.0);
34
0 commit comments