Loosened rules involving statics mentioning other statics.
Updated tests accordingly.
This commit is contained in:
parent
74c89b0230
commit
13931762e9
8 changed files with 27 additions and 215 deletions
|
|
@ -22,7 +22,6 @@ mod Y {
|
|||
|
||||
static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
//~^ ERROR `*const usize` cannot be shared between threads safely [E0277]
|
||||
//~| ERROR cannot refer to other statics by value, use the address-of operator or a constant instead
|
||||
//~| ERROR E0015
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -9,17 +9,13 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct S { a: usize }
|
||||
|
||||
static A: S = S { a: 3 };
|
||||
static B: &'static usize = &A.a;
|
||||
//~^ ERROR: cannot refer to the interior of another static
|
||||
static C: &'static usize = &(A.a);
|
||||
//~^ ERROR: cannot refer to the interior of another static
|
||||
|
||||
static D: [usize; 1] = [1];
|
||||
static E: usize = D[0];
|
||||
//~^ ERROR: cannot refer to the interior of another static
|
||||
//~^^ ERROR: cannot refer to other statics by value
|
||||
static F: &'static usize = &D[0];
|
||||
//~^ ERROR: cannot refer to the interior of another static
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
static A: u32 = 0;
|
||||
static B: u32 = A;
|
||||
//~^ ERROR E0394
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
error[E0394]: cannot refer to other statics by value, use the address-of operator or a constant instead
|
||||
--> $DIR/E0394.rs:14:17
|
||||
|
|
||||
LL | static B: u32 = A;
|
||||
| ^ referring to another static by value
|
||||
|
|
||||
= note: use the address-of operator or a constant instead
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0394`.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Foo {
|
||||
a: u32
|
||||
}
|
||||
|
||||
static S : Foo = Foo { a : 0 };
|
||||
static A : &'static u32 = &S.a; //~ ERROR E0494
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
error[E0494]: cannot refer to the interior of another static, use a constant instead
|
||||
--> $DIR/E0494.rs:16:27
|
||||
|
|
||||
LL | static A : &'static u32 = &S.a; //~ ERROR E0494
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0494`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue