|
3 | 3 | use rustc_index::bit_set::BitSet;
|
4 | 4 | use rustc_infer::infer::TyCtxtInferExt;
|
5 | 5 | use rustc_middle::mir::interpret::Scalar;
|
6 |
| -use rustc_middle::mir::traversal; |
7 | 6 | use rustc_middle::mir::visit::{PlaceContext, Visitor};
|
| 7 | +use rustc_middle::mir::{traversal, Place}; |
8 | 8 | use rustc_middle::mir::{
|
9 | 9 | AggregateKind, BasicBlock, Body, BorrowKind, Local, Location, MirPass, MirPhase, Operand,
|
10 | 10 | PlaceElem, PlaceRef, ProjectionElem, Rvalue, SourceScope, Statement, StatementKind, Terminator,
|
@@ -240,6 +240,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
240 | 240 | self.super_projection_elem(local, proj_base, elem, context, location);
|
241 | 241 | }
|
242 | 242 |
|
| 243 | + fn visit_place(&mut self, place: &Place<'tcx>, _: PlaceContext, location: Location) { |
| 244 | + // Set off any `bug!`s in the type computation code |
| 245 | + let ty = place.ty(&self.body.local_decls, self.tcx); |
| 246 | + if ty.variant_index.is_some() { |
| 247 | + self.fail(location, "Top level places may not have their variant index set!"); |
| 248 | + } |
| 249 | + } |
| 250 | + |
243 | 251 | fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
|
244 | 252 | match &statement.kind {
|
245 | 253 | StatementKind::Assign(box (dest, rvalue)) => {
|
|
0 commit comments