-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continue inside a labeled block now lowers to a error when to lowerin…
…g the ast
- Loading branch information
1 parent
53ed660
commit 17a6cf3
Showing
12 changed files
with
157 additions
and
21 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
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
28 changes: 28 additions & 0 deletions
28
tests/ui/lowering/cont-in-block/cont-in-fn-issue-113379.rs
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 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(adt_const_params)] | ||
|
||
trait Trait<const S: &'static str> {} | ||
|
||
struct Bug<T> | ||
where | ||
T: Trait< | ||
{ | ||
'b: { //~ ERROR [E0308] | ||
continue 'b; //~ ERROR [E0696] | ||
} | ||
}, | ||
>, | ||
{ | ||
t: T, | ||
} | ||
|
||
fn f() -> impl Sized { | ||
'b: { | ||
continue 'b; | ||
//~^ ERROR [E0696] | ||
} | ||
} | ||
|
||
fn main() { | ||
f(); | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/ui/lowering/cont-in-block/cont-in-fn-issue-113379.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,31 @@ | ||
error[E0696]: `continue` pointing to a labeled block | ||
--> $DIR/cont-in-fn-issue-113379.rs:11:17 | ||
| | ||
LL | / 'b: { | ||
LL | | continue 'b; | ||
| | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d | ||
LL | | } | ||
| |_____________- labeled block the `continue` points to | ||
|
||
error[E0696]: `continue` pointing to a labeled block | ||
--> $DIR/cont-in-fn-issue-113379.rs:21:9 | ||
| | ||
LL | / 'b: { | ||
LL | | continue 'b; | ||
| | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d | ||
LL | | | ||
LL | | } | ||
| |_____- labeled block the `continue` points to | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/cont-in-fn-issue-113379.rs:10:13 | ||
| | ||
LL | / 'b: { | ||
LL | | continue 'b; | ||
LL | | } | ||
| |_____________^ expected `&str`, found `()` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0308, E0696. | ||
For more information about an error, try `rustc --explain E0308`. |
8 changes: 8 additions & 0 deletions
8
tests/ui/lowering/cont-in-block/cont-in-match-arm-issue-121623.rs
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,8 @@ | ||
fn main() { | ||
match () { | ||
_ => 'b: { | ||
continue 'b; | ||
//~^ ERROR [E0696] | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/lowering/cont-in-block/cont-in-match-arm-issue-121623.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,14 @@ | ||
error[E0696]: `continue` pointing to a labeled block | ||
--> $DIR/cont-in-match-arm-issue-121623.rs:4:13 | ||
| | ||
LL | _ => 'b: { | ||
| ______________- | ||
LL | | continue 'b; | ||
| | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d | ||
LL | | | ||
LL | | } | ||
| |_________- labeled block the `continue` points to | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0696`. |