-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #86690 - JohnTitor:rollup-4ukk4yw, r=JohnTitor
Rollup of 6 pull requests Successful merges: - #86206 (Fix type checking of return expressions outside of function bodies) - #86358 (fix pretty print for `loop`) - #86568 (Don't dist miri or rust-analyzer on stable or beta.) - #86683 (:arrow_up: rust-analyzer) - #86687 (Allow anyone to set `perf-regression` label) - #86688 (Add a regression test for issue-65384) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
19 changed files
with
268 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ fn syntax() { | |
#![attr] | ||
}; | ||
let _ = | ||
#[attr] loop { | ||
#[attr] loop { | ||
#![attr] | ||
}; | ||
let _ = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[prelude_import] | ||
use ::std::prelude::rust_2015::*; | ||
#[macro_use] | ||
extern crate std; | ||
// pretty-compare-only | ||
// pretty-mode:hir | ||
// pp-exact:hir-pretty-loop.pp | ||
|
||
pub fn foo() { loop { break ; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// pretty-compare-only | ||
// pretty-mode:hir | ||
// pp-exact:hir-pretty-loop.pp | ||
|
||
pub fn foo(){ | ||
loop{ | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
fn main() { | ||
//~^ NOTE: not the enclosing function body | ||
//~| NOTE: not the enclosing function body | ||
//~| NOTE: not the enclosing function body | ||
//~| NOTE: not the enclosing function body | ||
|_: [_; return || {}] | {}; | ||
//~^ ERROR return statement outside of function body | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
|
||
[(); return || {}]; | ||
//~^ ERROR return statement outside of function body | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
|
||
[(); return |ice| {}]; | ||
//~^ ERROR return statement outside of function body | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
|
||
[(); return while let Some(n) = Some(0) {}]; | ||
//~^ ERROR return statement outside of function body | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Due to a compiler bug, if a return occurs outside of a function body | ||
// (e.g. in an AnonConst body), the return value expression would not be | ||
// type-checked, leading to an ICE. This test checks that the ICE no | ||
// longer happens, and that an appropriate error message is issued that | ||
// also explains why the return is considered "outside of a function body" | ||
// if it seems to be inside one, as in the main function below. | ||
|
||
const C: [(); 42] = { | ||
[(); return || { | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
let tx; | ||
}] | ||
}; | ||
|
||
fn main() { | ||
//~^ NOTE: ...not the enclosing function body | ||
[(); return || { | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
let tx; | ||
}]; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/ui/return/issue-86188-return-not-in-fn-body.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
error[E0572]: return statement outside of function body | ||
--> $DIR/issue-86188-return-not-in-fn-body.rs:9:10 | ||
| | ||
LL | [(); return || { | ||
| __________^ | ||
LL | | | ||
LL | | let tx; | ||
LL | | }] | ||
| |_____^ | ||
|
||
error[E0572]: return statement outside of function body | ||
--> $DIR/issue-86188-return-not-in-fn-body.rs:17:10 | ||
| | ||
LL | / fn main() { | ||
LL | | | ||
LL | | [(); return || { | ||
| |__________^ | ||
LL | || | ||
LL | || | ||
LL | || let tx; | ||
LL | || }]; | ||
| ||_____^ the return is part of this body... | ||
LL | | } | ||
| |_- ...not the enclosing function body | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0572`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
fn main() { | ||
//~^ NOTE: not the enclosing function body | ||
//~| NOTE: not the enclosing function body | ||
//~| NOTE: not the enclosing function body | ||
[(); return match 0 { n => n }]; | ||
//~^ ERROR: return statement outside of function body | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
|
||
[(); return match 0 { 0 => 0 }]; | ||
//~^ ERROR: return statement outside of function body | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
|
||
[(); return match () { 'a' => 0, _ => 0 }]; | ||
//~^ ERROR: return statement outside of function body | ||
//~^ ERROR: return statement outside of function body [E0572] | ||
//~| NOTE: the return is part of this body... | ||
//~| ERROR: mismatched types [E0308] | ||
//~| NOTE: expected `()`, found `char` | ||
//~| NOTE: this expression has type `()` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,56 @@ | ||
error[E0572]: return statement outside of function body | ||
--> $DIR/return-match-array-const.rs:2:10 | ||
--> $DIR/return-match-array-const.rs:5:10 | ||
| | ||
LL | [(); return match 0 { n => n }]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | / fn main() { | ||
LL | | | ||
LL | | | ||
LL | | | ||
LL | | [(); return match 0 { n => n }]; | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... | ||
... | | ||
LL | | | ||
LL | | } | ||
| |_- ...not the enclosing function body | ||
|
||
error[E0572]: return statement outside of function body | ||
--> $DIR/return-match-array-const.rs:5:10 | ||
--> $DIR/return-match-array-const.rs:9:10 | ||
| | ||
LL | [(); return match 0 { 0 => 0 }]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | / fn main() { | ||
LL | | | ||
LL | | | ||
LL | | | ||
... | | ||
LL | | [(); return match 0 { 0 => 0 }]; | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... | ||
... | | ||
LL | | | ||
LL | | } | ||
| |_- ...not the enclosing function body | ||
|
||
error[E0572]: return statement outside of function body | ||
--> $DIR/return-match-array-const.rs:8:10 | ||
--> $DIR/return-match-array-const.rs:13:10 | ||
| | ||
LL | / fn main() { | ||
LL | | | ||
LL | | | ||
LL | | | ||
... | | ||
LL | | [(); return match () { 'a' => 0, _ => 0 }]; | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the return is part of this body... | ||
... | | ||
LL | | | ||
LL | | } | ||
| |_- ...not the enclosing function body | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/return-match-array-const.rs:13:28 | ||
| | ||
LL | [(); return match () { 'a' => 0, _ => 0 }]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| -- ^^^ expected `()`, found `char` | ||
| | | ||
| this expression has type `()` | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0572`. | ||
Some errors have detailed explanations: E0308, E0572. | ||
For more information about an error, try `rustc --explain E0308`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![feature(min_type_alias_impl_trait)] | ||
#![feature(type_alias_impl_trait)] | ||
#![allow(incomplete_features)] | ||
|
||
trait MyTrait {} | ||
|
||
impl MyTrait for () {} | ||
|
||
type Bar = impl MyTrait; | ||
|
||
impl MyTrait for Bar {} | ||
//~^ ERROR: cannot implement trait on type alias impl trait | ||
|
||
fn bazr() -> Bar { } | ||
|
||
fn main() {} |
Oops, something went wrong.