From e32e81c9da5adcc77bd12192d45d2d4af54d0ee9 Mon Sep 17 00:00:00 2001 From: Basile Desloges Date: Fri, 6 Oct 2017 18:23:53 +0200 Subject: [PATCH] mir-borrowck: Implement end-user output for field of subslice and slice type --- src/librustc_mir/borrow_check.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/librustc_mir/borrow_check.rs b/src/librustc_mir/borrow_check.rs index 3546b998532..14e6f597826 100644 --- a/src/librustc_mir/borrow_check.rs +++ b/src/librustc_mir/borrow_check.rs @@ -1135,13 +1135,10 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx> format!("{}", def.variants[variant_index].fields[field_index].name), ProjectionElem::Field(_, field_type) => self.describe_field_from_ty(&field_type, field_index), - ProjectionElem::Index(..) | ProjectionElem::ConstantIndex { .. } => + ProjectionElem::Index(..) + | ProjectionElem::ConstantIndex { .. } + | ProjectionElem::Subslice { .. } => format!("{}", self.describe_field(&proj.base, field_index)), - ProjectionElem::Subslice { .. } => { - debug!("End-user description not implemented for field of projection {:?}", - proj); - format!("{}", field_index) - } } } } @@ -1169,7 +1166,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx> ty::TyRef(_, tnm) | ty::TyRawPtr(tnm) => { self.describe_field_from_ty(&tnm.ty, field_index) }, - ty::TyArray(ty, _) => { + ty::TyArray(ty, _) | ty::TySlice(ty) => { self.describe_field_from_ty(&ty, field_index) } _ => {