diff options
| author | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-03-09 20:12:47 +0530 |
|---|---|---|
| committer | Henry Boisdequin <65845077+henryboisdequin@users.noreply.github.com> | 2021-03-12 06:18:33 +0530 |
| commit | 26478c81fd3152eb0d272209dc02cdacfcb22aba (patch) | |
| tree | 02da80f47a2d62ffb5831ce8a17f68ff509f4cdb /compiler | |
| parent | bba2bac9fe6a4c72aff5c5ad10616d7ca7d169c1 (diff) | |
| download | rust-26478c81fd3152eb0d272209dc02cdacfcb22aba.tar.gz rust-26478c81fd3152eb0d272209dc02cdacfcb22aba.zip | |
Don't show note if `span` is `DUMMY_SP`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs b/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs index 24b9408ffb6..eb942b195b2 100644 --- a/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs +++ b/compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs @@ -13,7 +13,7 @@ use rustc_middle::mir::{ use rustc_middle::ty::{self, suggest_constraining_type_param, Ty, TypeFoldable}; use rustc_span::source_map::DesugaringKind; use rustc_span::symbol::sym; -use rustc_span::Span; +use rustc_span::{Span, DUMMY_SP}; use crate::dataflow::drop_flag_effects; use crate::dataflow::indexes::{MoveOutIndex, MovePathIndex}; @@ -216,12 +216,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); } // Avoid pointing to the same function in multiple different - // error messages - if self.fn_self_span_reported.insert(self_arg.span) { + // error messages. + if span != DUMMY_SP && self.fn_self_span_reported.insert(self_arg.span) + { err.span_note( - self_arg.span, - &format!("this function takes ownership of the receiver `self`, which moves {}", place_name) - ); + self_arg.span, + &format!("this function takes ownership of the receiver `self`, which moves {}", place_name) + ); } } // Deref::deref takes &self, which cannot cause a move |
