1
Fork 0

Add fixme for precise path diagnostics

This commit is contained in:
Aman Arora 2021-01-12 14:54:12 -05:00
parent c748f32ee4
commit ffd53277dc
2 changed files with 7 additions and 5 deletions

View file

@ -215,6 +215,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
PlaceRef { local, projection: [proj_base @ .., elem] } => { PlaceRef { local, projection: [proj_base @ .., elem] } => {
match elem { match elem {
ProjectionElem::Deref => { ProjectionElem::Deref => {
// FIXME(project-rfc_2229#36): print capture precisely here.
let upvar_field_projection = self.is_upvar_field_projection(place); let upvar_field_projection = self.is_upvar_field_projection(place);
if let Some(field) = upvar_field_projection { if let Some(field) = upvar_field_projection {
let var_index = field.index(); let var_index = field.index();
@ -259,6 +260,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
ProjectionElem::Field(field, _ty) => { ProjectionElem::Field(field, _ty) => {
autoderef = true; autoderef = true;
// FIXME(project-rfc_2229#36): print capture precisely here.
let upvar_field_projection = self.is_upvar_field_projection(place); let upvar_field_projection = self.is_upvar_field_projection(place);
if let Some(field) = upvar_field_projection { if let Some(field) = upvar_field_projection {
let var_index = field.index(); let var_index = field.index();

View file

@ -73,8 +73,7 @@ crate use region_infer::RegionInferenceContext;
// FIXME(eddyb) perhaps move this somewhere more centrally. // FIXME(eddyb) perhaps move this somewhere more centrally.
#[derive(Debug)] #[derive(Debug)]
crate struct Upvar<'tcx> { crate struct Upvar<'tcx> {
// FIXME(project-rfc-2229#8): ty::CapturePlace should have a to_string(), or similar // FIXME(project-rfc_2229#36): print capture precisely here.
// then this should not be needed.
name: Symbol, name: Symbol,
place: CapturedPlace<'tcx>, place: CapturedPlace<'tcx>,
@ -2156,6 +2155,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
place: PlaceRef<'tcx>, place: PlaceRef<'tcx>,
is_local_mutation_allowed: LocalMutationIsAllowed, is_local_mutation_allowed: LocalMutationIsAllowed,
) -> Result<RootPlace<'tcx>, PlaceRef<'tcx>> { ) -> Result<RootPlace<'tcx>, PlaceRef<'tcx>> {
debug!("is_mutable: place={:?}, is_local...={:?}", place, is_local_mutation_allowed);
match place.last_projection() { match place.last_projection() {
None => { None => {
let local = &self.body.local_decls[place.local]; let local = &self.body.local_decls[place.local];
@ -2237,9 +2237,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
if let Some(field) = upvar_field_projection { if let Some(field) = upvar_field_projection {
let upvar = &self.upvars[field.index()]; let upvar = &self.upvars[field.index()];
debug!( debug!(
"upvar.mutability={:?} local_mutation_is_allowed={:?} \ "is_mutable: upvar.mutability={:?} local_mutation_is_allowed={:?} \
place={:?}", place={:?}, place_base={:?}",
upvar, is_local_mutation_allowed, place upvar, is_local_mutation_allowed, place, place_base
); );
match (upvar.place.mutability, is_local_mutation_allowed) { match (upvar.place.mutability, is_local_mutation_allowed) {
( (