about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-05-26 19:32:32 +0800
committerGitHub <noreply@github.com>2018-05-26 19:32:32 +0800
commit5089ebc5682ed71ee01b309c6681cb1ca127c62e (patch)
tree4a9a178d777ec0a6cc5b9a9f4de2ce6ed49eb2d9 /src/rustllvm/RustWrapper.cpp
parent239e3d2dd7e2b8a8d46eedff73018c5e17a4f051 (diff)
parent5724dad82ed34f4461f58b3c035b1b06747d8669 (diff)
downloadrust-5089ebc5682ed71ee01b309c6681cb1ca127c62e.tar.gz
rust-5089ebc5682ed71ee01b309c6681cb1ca127c62e.zip
Rollup merge of #51070 - est31:fix_break_const_ice, r=estebank
Fail typecheck if we encounter a bogus break

Lone breaks outside of loops create errors in the
loop check pass but as they are not fatal,
compilation continues.

MIR building code assumes all HIR break statements
to point to valid locations and fires ICEs if this
assumption is violated. In normal compilation,
this causes no issues, as code apparently prevents
MIR from being built if errors are present.

However, before that, typecheck runs and with it
MIR const eval. Here we operate differently
from normal compilation: it doesn't check for any
errors except for type checker ones and then
directly builds the MIR.

This constellation causes an ICE-on-error if
bogus break statements are being put into array
length expressions.

This commit fixes this ICE by letting typecheck
fail if bogus break statements are encountered.
This way, MIR const eval fails cleanly with a
type check error.

Fixes #50576
Fixes #50581
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions