diff options
| author | Basile Desloges <basile.desloges@gmail.com> | 2017-10-06 18:23:53 +0200 |
|---|---|---|
| committer | Basile Desloges <basile.desloges@gmail.com> | 2017-10-06 18:23:53 +0200 |
| commit | e32e81c9da5adcc77bd12192d45d2d4af54d0ee9 (patch) | |
| tree | 65480ddcb32c0344b34496268cd806d9a3894b4a | |
| parent | 8b8cdd984aa31eebccea2a9fb5c1f7931dd01c27 (diff) | |
mir-borrowck: Implement end-user output for field of subslice and slice type
| -rw-r--r-- | src/librustc_mir/borrow_check.rs | 11 |
1 files 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!("<subslice>{}", 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) } _ => { |
