2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2015-01-08 22:02:42 +11:00
|
|
|
struct S { a: usize }
|
2018-05-27 17:07:23 +01:00
|
|
|
|
2018-05-29 01:38:18 +01:00
|
|
|
static A: S = S { a: 3 };
|
2015-01-08 22:02:42 +11:00
|
|
|
static B: &'static usize = &A.a;
|
|
|
|
static C: &'static usize = &(A.a);
|
2014-10-06 21:16:35 -07:00
|
|
|
|
2015-01-08 22:02:42 +11:00
|
|
|
static D: [usize; 1] = [1];
|
|
|
|
static E: usize = D[0];
|
|
|
|
static F: &'static usize = &D[0];
|
2014-10-06 21:16:35 -07:00
|
|
|
|
2018-05-29 01:38:18 +01:00
|
|
|
fn main() {
|
|
|
|
assert_eq!(*B, A.a);
|
|
|
|
assert_eq!(*B, A.a);
|
|
|
|
|
|
|
|
assert_eq!(E, D[0]);
|
|
|
|
assert_eq!(*F, D[0]);
|
|
|
|
}
|