Fix another return-const ICE

This commit is contained in:
varkor 2018-07-01 17:40:36 +01:00
parent 7ad1c62d38
commit 998141f8ef
3 changed files with 39 additions and 35 deletions

View file

@ -9,16 +9,15 @@
// except according to those terms.
fn main() {
|_: [_; return || {}] | {}
|_: [_; return || {}] | {};
//~^ ERROR return statement outside of function body
}
fn foo() {
[(); return || {}];
//~^ ERROR return statement outside of function body
}
fn bar() {
[(); return |ice| {}];
//~^ ERROR return statement outside of function body
[(); return while let Some(n) = Some(0) {}];
//~^ ERROR return statement outside of function body
}

View file

@ -1,21 +1,27 @@
error[E0572]: return statement outside of function body
--> $DIR/issue-51714.rs:12:14
|
LL | |_: [_; return || {}] | {}
LL | |_: [_; return || {}] | {};
| ^^^^^^^^^^^^
error[E0572]: return statement outside of function body
--> $DIR/issue-51714.rs:17:10
--> $DIR/issue-51714.rs:15:10
|
LL | [(); return || {}];
| ^^^^^^^^^^^^
error[E0572]: return statement outside of function body
--> $DIR/issue-51714.rs:22:10
--> $DIR/issue-51714.rs:18:10
|
LL | [(); return |ice| {}];
| ^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
error[E0572]: return statement outside of function body
--> $DIR/issue-51714.rs:21:10
|
LL | [(); return while let Some(n) = Some(0) {}];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0572`.