]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/issue-17718-references.rs
trans-scheduler: Let main thread take over for other worker.
[rust.git] / src / test / compile-fail / 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 struct Struct { a: usize }
12
13 const C: usize = 1;
14 static S: usize = 1;
15
16 const T1: &'static usize = &C;
17 const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics
18 static T3: &'static usize = &C;
19 static T4: &'static usize = &S;
20
21 const T5: usize = C;
22 const T6: usize = S; //~ ERROR: constants cannot refer to statics
23 //~^ cannot refer to statics
24 static T7: usize = C;
25 static T8: usize = S; //~ ERROR: cannot refer to other statics by value
26
27 const T9: Struct = Struct { a: C };
28 const T10: Struct = Struct { a: S }; //~ ERROR: cannot refer to statics by value
29 //~^ ERROR: constants cannot refer to statics
30 static T11: Struct = Struct { a: C };
31 static T12: Struct = Struct { a: S }; //~ ERROR: cannot refer to other statics by value
32
33 fn main() {}