Skip to content

Commit 1797a94

Browse files
committed
Add span label to E0381 for MIR borrowck
1 parent a6a7dac commit 1797a94

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/librustc_mir/borrow_check.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,13 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
896896
fn report_use_of_moved(&mut self,
897897
_context: Context,
898898
(lvalue, span): (&Lvalue, Span)) {
899-
let mut err = self.tcx.cannot_act_on_uninitialized_variable(
900-
span, "use", &self.describe_lvalue(lvalue), Origin::Mir);
901-
// FIXME: add span_label for use of uninitialized variable
902-
err.emit();
899+
self.tcx.cannot_act_on_uninitialized_variable(span,
900+
"use",
901+
&self.describe_lvalue(lvalue),
902+
Origin::Mir)
903+
.span_label(span, format!("use of possibly uninitialized `{}`",
904+
self.describe_lvalue(lvalue)))
905+
.emit();
903906
}
904907

905908
fn report_move_out_while_borrowed(&mut self,

0 commit comments

Comments
 (0)