diff options
| author | David Wood <david@davidtw.co> | 2020-06-25 15:16:38 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2020-07-02 13:48:32 +0100 |
| commit | cb541dc12cdf2ba14a8f5d210ac7a6b1efa69c22 (patch) | |
| tree | ffa00e1d79b5033bdb8e4aa51a92726e942842a1 /src/librustc_error_codes/error_codes | |
| parent | b7856f695d65a8ebc846754f97d15814bcb1c244 (diff) | |
| download | rust-cb541dc12cdf2ba14a8f5d210ac7a6b1efa69c22.tar.gz rust-cb541dc12cdf2ba14a8f5d210ac7a6b1efa69c22.zip | |
resolve: disallow label use through closure/async
This commit modifies resolve to disallow `break`/`continue` to labels through closures or async blocks. This doesn't make sense and should have been prohibited anyway. Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0767.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0767.md b/src/librustc_error_codes/error_codes/E0767.md new file mode 100644 index 00000000000..679fe7e41e9 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0767.md @@ -0,0 +1,20 @@ +An unreachable label was used. + +Erroneous code example: + +```compile_fail,E0767 +'a: loop { + || { + loop { break 'a } // error: use of unreachable label `'a` + }; +} +``` + +Ensure that the label is within scope. Labels are not reachable through +functions, closures, async blocks or modules. Example: + +``` +'a: loop { + break 'a; // ok! +} +``` |
