Start block is not allowed to have basic block predecessors
This commit is contained in:
parent
8e398f5ba7
commit
5118dd5a2f
1 changed files with 4 additions and 1 deletions
|
@ -9,7 +9,7 @@ use rustc_middle::mir::visit::{PlaceContext, Visitor};
|
||||||
use rustc_middle::mir::{
|
use rustc_middle::mir::{
|
||||||
AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, PlaceElem,
|
AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPhase, Operand, PlaceElem,
|
||||||
PlaceRef, ProjectionElem, Rvalue, SourceScope, Statement, StatementKind, Terminator,
|
PlaceRef, ProjectionElem, Rvalue, SourceScope, Statement, StatementKind, Terminator,
|
||||||
TerminatorKind,
|
TerminatorKind, START_BLOCK,
|
||||||
};
|
};
|
||||||
use rustc_middle::ty::fold::BottomUpFolder;
|
use rustc_middle::ty::fold::BottomUpFolder;
|
||||||
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeFoldable};
|
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeFoldable};
|
||||||
|
@ -130,6 +130,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_edge(&self, location: Location, bb: BasicBlock, edge_kind: EdgeKind) {
|
fn check_edge(&self, location: Location, bb: BasicBlock, edge_kind: EdgeKind) {
|
||||||
|
if bb == START_BLOCK {
|
||||||
|
self.fail(location, "start block must not have predecessors")
|
||||||
|
}
|
||||||
if let Some(bb) = self.body.basic_blocks().get(bb) {
|
if let Some(bb) = self.body.basic_blocks().get(bb) {
|
||||||
let src = self.body.basic_blocks().get(location.block).unwrap();
|
let src = self.body.basic_blocks().get(location.block).unwrap();
|
||||||
match (src.is_cleanup, bb.is_cleanup, edge_kind) {
|
match (src.is_cleanup, bb.is_cleanup, edge_kind) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue