Create fewer basic blocks in match MIR lowering
This commit is contained in:
parent
32c337724d
commit
da22793a35
30 changed files with 700 additions and 668 deletions
|
|
@ -2,22 +2,22 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
|
|||
--> $DIR/borrowck-mut-borrow-linear-errors.rs:10:30
|
||||
|
|
||||
LL | 1 => { addr.push(&mut x); }
|
||||
| ---- ^^^^^^ second mutable borrow occurs here
|
||||
| |
|
||||
| first borrow later used here
|
||||
| ^^^^^^ second mutable borrow occurs here
|
||||
LL | 2 => { addr.push(&mut x); }
|
||||
LL | _ => { addr.push(&mut x); }
|
||||
| ------ first mutable borrow occurs here
|
||||
| ---- ------ first mutable borrow occurs here
|
||||
| |
|
||||
| first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-mut-borrow-linear-errors.rs:11:30
|
||||
|
|
||||
LL | 1 => { addr.push(&mut x); }
|
||||
| ---- first borrow later used here
|
||||
LL | 2 => { addr.push(&mut x); }
|
||||
| ^^^^^^ second mutable borrow occurs here
|
||||
LL | _ => { addr.push(&mut x); }
|
||||
| ------ first mutable borrow occurs here
|
||||
| ---- ------ first mutable borrow occurs here
|
||||
| |
|
||||
| first borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time
|
||||
--> $DIR/borrowck-mut-borrow-linear-errors.rs:12:30
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ fn main() {
|
|||
match &1 as *const i32 as usize {
|
||||
//~^ ERROR casting pointers to integers in constants
|
||||
//~| NOTE for more information, see
|
||||
//~| ERROR constant contains unimplemented expression type
|
||||
0 => 42, //~ ERROR constant contains unimplemented expression type
|
||||
//~^ NOTE "pointer arithmetic or comparison" needs an rfc before being allowed
|
||||
//~| ERROR evaluation of constant value failed
|
||||
|
|
|
|||
|
|
@ -8,18 +8,24 @@ LL | match &1 as *const i32 as usize {
|
|||
= help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/match-test-ptr-null.rs:9:13
|
||||
--> $DIR/match-test-ptr-null.rs:6:15
|
||||
|
|
||||
LL | match &1 as *const i32 as usize {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/match-test-ptr-null.rs:10:13
|
||||
|
|
||||
LL | 0 => 42,
|
||||
| ^
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/match-test-ptr-null.rs:9:13
|
||||
--> $DIR/match-test-ptr-null.rs:10:13
|
||||
|
|
||||
LL | 0 => 42,
|
||||
| ^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0019, E0080, E0658.
|
||||
For more information about an error, try `rustc --explain E0019`.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#![allow(warnings)]
|
||||
|
||||
const x: bool = match Some(true) {
|
||||
//~^ ERROR: constant contains unimplemented expression type [E0019]
|
||||
Some(value) => true,
|
||||
//~^ ERROR: constant contains unimplemented expression type [E0019]
|
||||
_ => false
|
||||
|
|
@ -8,6 +9,7 @@ const x: bool = match Some(true) {
|
|||
|
||||
const y: bool = {
|
||||
match Some(true) {
|
||||
//~^ ERROR: constant contains unimplemented expression type [E0019]
|
||||
Some(value) => true,
|
||||
//~^ ERROR: constant contains unimplemented expression type [E0019]
|
||||
_ => false
|
||||
|
|
|
|||
|
|
@ -1,15 +1,27 @@
|
|||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/const-match-pattern-arm.rs:4:5
|
||||
--> $DIR/const-match-pattern-arm.rs:3:23
|
||||
|
|
||||
LL | const x: bool = match Some(true) {
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/const-match-pattern-arm.rs:5:5
|
||||
|
|
||||
LL | Some(value) => true,
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/const-match-pattern-arm.rs:11:9
|
||||
--> $DIR/const-match-pattern-arm.rs:11:11
|
||||
|
|
||||
LL | match Some(true) {
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/const-match-pattern-arm.rs:13:9
|
||||
|
|
||||
LL | Some(value) => true,
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0019`.
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ enum Foo {
|
|||
Prob,
|
||||
}
|
||||
|
||||
const FOO: u32 = match Foo::Prob {
|
||||
Foo::Prob => 42, //~ ERROR unimplemented expression type
|
||||
const FOO: u32 = match Foo::Prob { //~ ERROR unimplemented expression type
|
||||
Foo::Prob => 42,
|
||||
};
|
||||
|
||||
const BAR: u32 = match Foo::Prob {
|
||||
x => 42, //~ ERROR unimplemented expression type
|
||||
const BAR: u32 = match Foo::Prob { //~ ERROR unimplemented expression type
|
||||
x => 42,
|
||||
};
|
||||
|
||||
impl Foo {
|
||||
|
|
@ -15,7 +15,8 @@ impl Foo {
|
|||
use self::Foo::*;
|
||||
|
||||
match *self {
|
||||
Prob => 0x1, //~ ERROR loops and conditional expressions are not stable in const fn
|
||||
//~^ ERROR loops and conditional expressions are not stable in const fn
|
||||
Prob => 0x1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/single_variant_match_ice.rs:6:5
|
||||
--> $DIR/single_variant_match_ice.rs:5:24
|
||||
|
|
||||
LL | Foo::Prob => 42,
|
||||
| ^^^^^^^^^
|
||||
LL | const FOO: u32 = match Foo::Prob {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/single_variant_match_ice.rs:10:5
|
||||
--> $DIR/single_variant_match_ice.rs:9:24
|
||||
|
|
||||
LL | x => 42,
|
||||
| ^
|
||||
LL | const BAR: u32 = match Foo::Prob {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0723]: loops and conditional expressions are not stable in const fn
|
||||
--> $DIR/single_variant_match_ice.rs:18:13
|
||||
--> $DIR/single_variant_match_ice.rs:17:15
|
||||
|
|
||||
LL | Prob => 0x1,
|
||||
| ^^^^
|
||||
LL | match *self {
|
||||
| ^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add #![feature(const_fn)] to the crate attributes to enable
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ fn non_const() -> Thing {
|
|||
Thing::This
|
||||
}
|
||||
|
||||
pub const Q: i32 = match non_const() { //~ ERROR E0015
|
||||
pub const Q: i32 = match non_const() {
|
||||
//~^ ERROR E0015
|
||||
//~^^ ERROR unimplemented expression type
|
||||
Thing::This => 1, //~ ERROR unimplemented expression type
|
||||
Thing::That => 0
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,12 +5,18 @@ LL | pub const Q: i32 = match non_const() {
|
|||
| ^^^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/issue-46843.rs:8:5
|
||||
--> $DIR/issue-46843.rs:7:26
|
||||
|
|
||||
LL | pub const Q: i32 = match non_const() {
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/issue-46843.rs:10:5
|
||||
|
|
||||
LL | Thing::This => 1,
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0019.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ LL | let x;
|
|||
...
|
||||
LL | x = 1;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
LL | } else {
|
||||
LL | x = 2;
|
||||
| ----- first assignment to `x`
|
||||
|
||||
error[E0384]: cannot assign twice to immutable variable `x`
|
||||
--> $DIR/liveness-assign-imm-local-notes.rs:32:13
|
||||
|
|
@ -35,9 +38,6 @@ error[E0384]: cannot assign twice to immutable variable `x`
|
|||
LL | let x;
|
||||
| - help: make this binding mutable: `mut x`
|
||||
...
|
||||
LL | x = 1;
|
||||
| ----- first assignment to `x`
|
||||
LL | } else {
|
||||
LL | x = 2;
|
||||
| ^^^^^ cannot assign twice to immutable variable
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue