]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-17718-references.rs
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-17718-references.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![allow(warnings)]
12
13 struct Struct { a: usize }
14
15 const C: usize = 1;
16 static S: usize = 1;
17
18 const T1: &'static usize = &C;
19 const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics
20 static T3: &'static usize = &C;
21 static T4: &'static usize = &S;
22
23 const T5: usize = C;
24 const T6: usize = S; //~ ERROR: constants cannot refer to statics
25 static T7: usize = C;
26 static T8: usize = S;
27
28 const T9: Struct = Struct { a: C };
29 const T10: Struct = Struct { a: S };
30 //~^ ERROR: constants cannot refer to statics
31 static T11: Struct = Struct { a: C };
32 static T12: Struct = Struct { a: S };
33
34 fn main() {}