Don't ice in validation when error body is created
This commit is contained in:
parent
698a3c7ade
commit
e32c1ddc52
@ -60,6 +60,8 @@ impl<'tcx> MirPass<'tcx> for Validator {
|
||||
ty::Closure(..) => Abi::RustCall,
|
||||
ty::CoroutineClosure(..) => Abi::RustCall,
|
||||
ty::Coroutine(..) => Abi::Rust,
|
||||
// No need to do MIR validation on error bodies
|
||||
ty::Error(_) => return,
|
||||
_ => {
|
||||
span_bug!(body.span, "unexpected body ty: {:?} phase {:?}", body_ty, mir_phase)
|
||||
}
|
||||
|
9
tests/ui/mir/validate/error-body.rs
Normal file
9
tests/ui/mir/validate/error-body.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// compile-flags: -Zvalidate-mir
|
||||
|
||||
fn _test() {
|
||||
let x = || 45;
|
||||
missing();
|
||||
//~^ ERROR cannot find function `missing` in this scope
|
||||
}
|
||||
|
||||
fn main() {}
|
9
tests/ui/mir/validate/error-body.stderr
Normal file
9
tests/ui/mir/validate/error-body.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0425]: cannot find function `missing` in this scope
|
||||
--> $DIR/error-body.rs:5:5
|
||||
|
|
||||
LL | missing();
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
Loading…
x
Reference in New Issue
Block a user