diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-07 16:48:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-07 16:48:02 +0200 |
| commit | 9ab654c53e17c5d7a2efe25cf859472fd5b9e03c (patch) | |
| tree | cf7a17ce38defc381c4eba38060a91b98c21f97c /src/librustc_mir/borrow_check | |
| parent | c1c60d292e2dd2deff7084208274f9a02f750d43 (diff) | |
| parent | de677b993fba6a2af9dbcbda0db1671f2d84f451 (diff) | |
| download | rust-9ab654c53e17c5d7a2efe25cf859472fd5b9e03c.tar.gz rust-9ab654c53e17c5d7a2efe25cf859472fd5b9e03c.zip | |
Rollup merge of #61332 - kennethbgoodin:borrowck-remove-asterisk-suggestion, r=matthewjasper
Remove asterisk suggestion for move errors in borrowck As per the decision in #54985 completely removes the suggestion to add an asterisk when checking move errors. I believe I've preserved the correct behavior with the "consider borrowing here" branch of the original match arm, but I'm not positive on that. This is my first PR to rustc so any feedback is greatly appreciated. Thanks.
Diffstat (limited to 'src/librustc_mir/borrow_check')
| -rw-r--r-- | src/librustc_mir/borrow_check/move_errors.rs | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index f892c159705..c421839513c 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -503,32 +503,12 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { move_from, .. } => { - let try_remove_deref = match move_from { - Place::Projection(box Projection { - elem: ProjectionElem::Deref, - .. - }) => true, - _ => false, - }; - if try_remove_deref && snippet.starts_with('*') { - // The snippet doesn't start with `*` in (e.g.) index - // expressions `a[b]`, which roughly desugar to - // `*Index::index(&a, b)` or - // `*IndexMut::index_mut(&mut a, b)`. - err.span_suggestion( - span, - "consider removing the `*`", - snippet[1..].to_owned(), - Applicability::Unspecified, - ); - } else { - err.span_suggestion( - span, - "consider borrowing here", - format!("&{}", snippet), - Applicability::Unspecified, - ); - } + err.span_suggestion( + span, + "consider borrowing here", + format!("&{}", snippet), + Applicability::Unspecified, + ); if binds_to.is_empty() { let place_ty = move_from.ty(self.mir, self.infcx.tcx).ty; |
