Skip to content

Commit e32e81c

Browse files
committed
mir-borrowck: Implement end-user output for field of subslice and slice type
1 parent 8b8cdd9 commit e32e81c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/librustc_mir/borrow_check.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1135,13 +1135,10 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
11351135
format!("{}", def.variants[variant_index].fields[field_index].name),
11361136
ProjectionElem::Field(_, field_type) =>
11371137
self.describe_field_from_ty(&field_type, field_index),
1138-
ProjectionElem::Index(..) | ProjectionElem::ConstantIndex { .. } =>
1138+
ProjectionElem::Index(..)
1139+
| ProjectionElem::ConstantIndex { .. }
1140+
| ProjectionElem::Subslice { .. } =>
11391141
format!("{}", self.describe_field(&proj.base, field_index)),
1140-
ProjectionElem::Subslice { .. } => {
1141-
debug!("End-user description not implemented for field of projection {:?}",
1142-
proj);
1143-
format!("<subslice>{}", field_index)
1144-
}
11451142
}
11461143
}
11471144
}
@@ -1169,7 +1166,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
11691166
ty::TyRef(_, tnm) | ty::TyRawPtr(tnm) => {
11701167
self.describe_field_from_ty(&tnm.ty, field_index)
11711168
},
1172-
ty::TyArray(ty, _) => {
1169+
ty::TyArray(ty, _) | ty::TySlice(ty) => {
11731170
self.describe_field_from_ty(&ty, field_index)
11741171
}
11751172
_ => {

0 commit comments

Comments
 (0)