From bf76ffe4e3b985128d69adbacf21573887282ad5 Mon Sep 17 00:00:00 2001 From: David Wood Date: Fri, 17 Nov 2017 16:20:34 +0000 Subject: [PATCH] Corrected error output with many labels. --- src/librustc_mir/borrow_check.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/borrow_check.rs b/src/librustc_mir/borrow_check.rs index 6ba3f505479..bd9ba366905 100644 --- a/src/librustc_mir/borrow_check.rs +++ b/src/librustc_mir/borrow_check.rs @@ -25,7 +25,7 @@ use rustc_data_structures::indexed_set::{self, IdxSetBuf}; use rustc_data_structures::indexed_vec::{Idx}; use syntax::ast::{self}; -use syntax_pos::{DUMMY_SP, Span, MultiSpan}; +use syntax_pos::{DUMMY_SP, Span}; use dataflow::{do_dataflow}; use dataflow::{MoveDataParamEnv}; @@ -1525,9 +1525,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { _ => span }; - let mut err = self.tcx.path_does_not_live_long_enough(proper_span, - "borrowed value", Origin::Mir); - err.span = MultiSpan::from_span(proper_span); + let mut err = self.tcx.path_does_not_live_long_enough(span, "borrowed value", Origin::Mir); err.span_label(proper_span, "temporary value created here"); err.span_label(span, "temporary value dropped here while still borrowed"); err.note("consider using a `let` binding to increase its lifetime");