diff options
| author | bors <bors@rust-lang.org> | 2021-09-11 03:30:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-11 03:30:55 +0000 |
| commit | 22719efcc570b043f2e519d6025e5f36eab38fe2 (patch) | |
| tree | f7fb4178f9e9964f7a1965b9c13e9c1654cb1cd4 /compiler/rustc_borrowck | |
| parent | b69fe57261086e70aea9d5b58819a1794bf7c121 (diff) | |
| parent | f77311bc2b01a2708e5676a9a3bcb3d07d5040e2 (diff) | |
| download | rust-22719efcc570b043f2e519d6025e5f36eab38fe2.tar.gz rust-22719efcc570b043f2e519d6025e5f36eab38fe2.zip | |
Auto merge of #88824 - Manishearth:rollup-7bzk9h6, r=Manishearth
Rollup of 15 pull requests
Successful merges:
- #85200 (Ignore derived Clone and Debug implementations during dead code analysis)
- #86165 (Add proc_macro::Span::{before, after}.)
- #87088 (Fix stray notes when the source code is not available)
- #87441 (Emit suggestion when passing byte literal to format macro)
- #88546 (Emit proper errors when on missing closure braces)
- #88578 (fix(rustc): suggest `items` be borrowed in `for i in items[x..]`)
- #88632 (Fix issues with Markdown summary options)
- #88639 (rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields)
- #88667 (Tweak `write_fmt` doc.)
- #88720 (Rustdoc coverage fields count)
- #88732 (RustWrapper: avoid deleted unclear attribute methods)
- #88742 (Fix table in docblocks)
- #88776 (Workaround blink/chromium grid layout limitation of 1000 rows)
- #88807 (Fix typo in docs for iterators)
- #88812 (Fix typo `option` -> `options`.)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_borrowck')
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index ce1e7c14b1f..f4cbbb60b05 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -218,7 +218,19 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); if self.fn_self_span_reported.insert(fn_span) { err.span_note( - self_arg.span, + // Check whether the source is accessible + if self + .infcx + .tcx + .sess + .source_map() + .span_to_snippet(self_arg.span) + .is_ok() + { + self_arg.span + } else { + fn_call_span + }, "calling this operator moves the left-hand side", ); } @@ -429,7 +441,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { deref_target_ty )); - err.span_note(deref_target, "deref defined here"); + // Check first whether the source is accessible (issue #87060) + if self.infcx.tcx.sess.source_map().span_to_snippet(deref_target).is_ok() { + err.span_note(deref_target, "deref defined here"); + } } if let Some((_, mut old_err)) = |
