about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2018-05-26 02:48:08 +0200
committerest31 <MTest31@outlook.com>2018-05-26 03:09:55 +0200
commit5724dad82ed34f4461f58b3c035b1b06747d8669 (patch)
tree3aad7416f0bb6961578b9e1076528dbc0cf7f2f4 /src/rustllvm/RustWrapper.cpp
parent990d8aa743b1dda3cc0f68fe09524486261812c6 (diff)
downloadrust-5724dad82ed34f4461f58b3c035b1b06747d8669.tar.gz
rust-5724dad82ed34f4461f58b3c035b1b06747d8669.zip
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