Use new macro instead

This commit is contained in:
Guillaume Gomez 2017-06-12 19:02:09 +02:00
parent f8d3658147
commit b6e9ed1e40
2 changed files with 5 additions and 5 deletions

View File

@ -3889,9 +3889,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
element_ty
}
None => {
let mut err = struct_span_err!(tcx.sess, expr.span, E0608,
"cannot index into a value of type `{}`",
base_t);
let mut err = type_error_struct!(tcx.sess, expr.span, base_t, E0608,
"cannot index into a value of type `{}`",
base_t);
// Try to give some advice about indexing tuples.
if let ty::TyTuple(..) = base_t.sty {
let mut needs_note = true;

View File

@ -4105,8 +4105,8 @@ Erroneous code example:
0u8[2]; // error: cannot index into a value of type `u8`
```
To be able to index a value from a type, it needs to implement the
`std::ops::Index` trait. Example:
To be able to index into a type it needs to implement the `std::ops::Index`
trait. Example:
```
let v: Vec<u8> = vec![0, 1, 2, 3];