Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc: move the check_loop pass earlier.
This pass is purely AST based, and by running it earlier we emit more useful error messages, e.g. type inference fails in the case of `let r = break;` with few constraints on `r`, but its more useful to be told that the `break` is outside a loop (rather than a type error) when it is. Closes #13292.
- Loading branch information
Showing
3 changed files
with
11 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,6 @@ fn main() { | |
} | ||
|
||
let rs: Foo = Foo{t: pth}; | ||
|
||
let unconstrained = break; //~ ERROR: `break` outside of loop | ||
} |
3766453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from alexcrichton
at huonw@3766453
3766453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging huonw/rust/loop-error = 3766453 into auto
3766453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huonw/rust/loop-error = 3766453 merged ok, testing candidate = e714859
3766453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/5072
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/5072
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/4164
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/4178
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/5172
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/4259
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/4267
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/5174
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/4259
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/4264
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/4330
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2059
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/5171
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/4268
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/4279
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/4935
3766453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = e714859