reword to "consider borrowing here: `{suggestion}`"
This commit is contained in:
parent
97d8d04f3f
commit
fa44927d2c
|
@ -835,7 +835,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
if let hir::ExprIndex(_, _) = expr.node {
|
||||
if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(expr.span) {
|
||||
err.span_suggestion(expr.span,
|
||||
"consider a slice instead",
|
||||
"consider borrowing here",
|
||||
format!("&{}", snippet));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ fn main() { //~ NOTE expected `()` because of default return type
|
|||
//~| NOTE expected type
|
||||
let v = s[..2];
|
||||
//~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied
|
||||
//~| HELP consider a slice instead
|
||||
//~| HELP consider borrowing here
|
||||
//~| NOTE `str` does not have a constant size known at compile-time
|
||||
//~| HELP the trait `std::marker::Sized` is not implemented for `str`
|
||||
//~| NOTE all local variables must have a statically known size
|
||||
|
|
|
@ -23,7 +23,7 @@ error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
|
|||
--> $DIR/str-array-assignment.rs:21:7
|
||||
|
|
||||
21 | let v = s[..2];
|
||||
| ^ ------ help: consider a slice instead: `&s[..2]`
|
||||
| ^ ------ help: consider borrowing here: `&s[..2]`
|
||||
| |
|
||||
| `str` does not have a constant size known at compile-time
|
||||
|
|
||||
|
|
Loading…
Reference in New Issue