Skip to content

Commit a609384

Browse files
committed
do not skip renumbering the place in place-type-ascriptions
1 parent 71fed06 commit a609384

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

src/librustc/mir/visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ macro_rules! make_mir_visitor {
214214
self.super_ty(ty);
215215
}
216216

217-
fn visit_canonical_ty(&mut self, ty: & $($mutability)* CanonicalTy<'tcx>) {
217+
fn visit_user_ty(&mut self, ty: & $($mutability)* CanonicalTy<'tcx>) {
218218
self.super_canonical_ty(ty);
219219
}
220220

@@ -640,7 +640,7 @@ macro_rules! make_mir_visitor {
640640
c_ty: & $($mutability)* CanonicalTy<'tcx>,
641641
location: Location) {
642642
self.visit_place(place, PlaceContext::Validate, location);
643-
self.visit_canonical_ty(c_ty);
643+
self.visit_user_ty(c_ty);
644644
}
645645

646646
fn super_place(&mut self,
@@ -736,7 +736,7 @@ macro_rules! make_mir_visitor {
736736
source_info: *source_info,
737737
});
738738
if let Some(user_ty) = user_ty {
739-
self.visit_canonical_ty(user_ty);
739+
self.visit_user_ty(user_ty);
740740
}
741741
self.visit_source_info(source_info);
742742
self.visit_source_scope(visibility_scope);

src/librustc_mir/borrow_check/nll/renumber.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use rustc::ty::subst::Substs;
1212
use rustc::ty::{self, CanonicalTy, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable};
13-
use rustc::mir::{BasicBlock, Location, Mir, Place, Statement, StatementKind};
13+
use rustc::mir::{BasicBlock, Location, Mir, Statement, StatementKind};
1414
use rustc::mir::visit::{MutVisitor, TyContext};
1515
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
1616

@@ -65,6 +65,14 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> {
6565
debug!("visit_ty: ty={:?}", ty);
6666
}
6767

68+
fn visit_user_ty(&mut self, _ty: &mut CanonicalTy<'tcx>) {
69+
// `user_ty` annotations represent the types that the user
70+
// wrote in the progarm. We don't want to erase the regions
71+
// from these types: rather, we want to add them as
72+
// constraints at type-check time.
73+
debug!("visit_user_ty: skipping renumber");
74+
}
75+
6876
fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, location: Location) {
6977
debug!("visit_substs(substs={:?}, location={:?})", substs, location);
7078

@@ -112,19 +120,6 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> {
112120
debug!("visit_closure_substs: substs={:?}", substs);
113121
}
114122

115-
fn visit_ascribe_user_ty(
116-
&mut self,
117-
_place: &mut Place<'tcx>,
118-
_variance: &mut ty::Variance,
119-
_c_ty: &mut CanonicalTy<'tcx>,
120-
_location: Location,
121-
) {
122-
// User-assert-ty statements represent types that the user added explicitly.
123-
// We don't want to erase the regions from these types: rather, we want to
124-
// add them as constraints at type-check time.
125-
debug!("visit_user_assert_ty: skipping renumber");
126-
}
127-
128123
fn visit_statement(
129124
&mut self,
130125
block: BasicBlock,

0 commit comments

Comments
 (0)