Auto merge of #58403 - eddyb:requalify, r=oli-obk

rustc_mir: split qualify_consts' "value qualification" bitflags into separate computations.

Prerequisite for computing those bits through a dataflow algorithm ~~(which I might do in this PR later)~~.

This PR should not change behavior overall, other than treating `simd_shuffle*` identically to `#[rustc_args_required_const]` (maybe we should just have `#[rustc_args_required_const]` on the intrinsic imports of `simd_shuffle*`? cc @gnzlbg)

cc @oli-obk @alexreg
This commit is contained in:
bors 2019-02-15 12:15:17 +00:00
commit f058741a67
8 changed files with 869 additions and 597 deletions

View file

@ -2822,7 +2822,6 @@ name = "rustc_mir"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"arena 0.0.0", "arena 0.0.0",
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"graphviz 0.0.0", "graphviz 0.0.0",

View file

@ -11,7 +11,6 @@ crate-type = ["dylib"]
[dependencies] [dependencies]
arena = { path = "../libarena" } arena = { path = "../libarena" }
bitflags = "1.0"
either = "1.5.0" either = "1.5.0"
dot = { path = "../libgraphviz", package = "graphviz" } dot = { path = "../libgraphviz", package = "graphviz" }
log = "0.4" log = "0.4"

File diff suppressed because it is too large Load diff

View file

@ -4,18 +4,18 @@ error[E0017]: references in constants may only refer to immutable values
LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
| ^^^^^^ constants require immutable values | ^^^^^^ constants require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0017.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0017]: references in statics may only refer to immutable values error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0017.rs:5:39 --> $DIR/E0017.rs:5:39
| |
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0017.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0596]: cannot borrow immutable static item `X` as mutable error[E0596]: cannot borrow immutable static item `X` as mutable
--> $DIR/E0017.rs:5:39 --> $DIR/E0017.rs:5:39
| |

View file

@ -4,18 +4,18 @@ error[E0017]: references in constants may only refer to immutable values
LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
| ^^^^^^ constants require immutable values | ^^^^^^ constants require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0017.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0017]: references in statics may only refer to immutable values error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0017.rs:5:39 --> $DIR/E0017.rs:5:39
| |
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0017.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0596]: cannot borrow immutable static item as mutable error[E0596]: cannot borrow immutable static item as mutable
--> $DIR/E0017.rs:5:44 --> $DIR/E0017.rs:5:44
| |

View file

@ -4,18 +4,18 @@ error[E0017]: references in constants may only refer to immutable values
LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
| ^^^^^^ constants require immutable values | ^^^^^^ constants require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0388.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0017]: references in statics may only refer to immutable values error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0388.rs:5:39 --> $DIR/E0388.rs:5:39
| |
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0388.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0596]: cannot borrow immutable static item `X` as mutable error[E0596]: cannot borrow immutable static item `X` as mutable
--> $DIR/E0388.rs:5:39 --> $DIR/E0388.rs:5:39
| |

View file

@ -4,18 +4,18 @@ error[E0017]: references in constants may only refer to immutable values
LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017
| ^^^^^^ constants require immutable values | ^^^^^^ constants require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0388.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0017]: references in statics may only refer to immutable values error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0388.rs:5:39 --> $DIR/E0388.rs:5:39
| |
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0388.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
| ^^^^^^
error[E0596]: cannot borrow immutable static item as mutable error[E0596]: cannot borrow immutable static item as mutable
--> $DIR/E0388.rs:5:44 --> $DIR/E0388.rs:5:44
| |

View file

@ -4,18 +4,18 @@ error[E0017]: references in constants may only refer to immutable values
LL | const C1: &'static mut [usize] = &mut []; LL | const C1: &'static mut [usize] = &mut [];
| ^^^^^^^ constants require immutable values | ^^^^^^^ constants require immutable values
error[E0013]: constants cannot refer to statics, use a constant instead
--> $DIR/issue-17718-const-bad-values.rs:5:41
|
LL | const C2: &'static mut usize = unsafe { &mut S };
| ^^^^^^
error[E0017]: references in constants may only refer to immutable values error[E0017]: references in constants may only refer to immutable values
--> $DIR/issue-17718-const-bad-values.rs:5:41 --> $DIR/issue-17718-const-bad-values.rs:5:41
| |
LL | const C2: &'static mut usize = unsafe { &mut S }; LL | const C2: &'static mut usize = unsafe { &mut S };
| ^^^^^^ constants require immutable values | ^^^^^^ constants require immutable values
error[E0013]: constants cannot refer to statics, use a constant instead
--> $DIR/issue-17718-const-bad-values.rs:5:41
|
LL | const C2: &'static mut usize = unsafe { &mut S };
| ^^^^^^
error: aborting due to 3 previous errors error: aborting due to 3 previous errors
Some errors occurred: E0013, E0017. Some errors occurred: E0013, E0017.