Skip to content

Commit

Permalink
reword to "consider borrowing here: {suggestion}"
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 27, 2017
1 parent 97d8d04 commit fa44927
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/suggestions/str-array-assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/suggestions/str-array-assignment.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down

0 comments on commit fa44927

Please sign in to comment.