diff options
| author | Keith Yeung <kungfukeith11@gmail.com> | 2017-09-23 02:25:17 -0700 |
|---|---|---|
| committer | Keith Yeung <kungfukeith11@gmail.com> | 2017-09-23 03:11:05 -0700 |
| commit | 1797a942b710f911cb5b0b0ae56b5dcf62a81d2d (patch) | |
| tree | 39479d48bb907e672e8867a10a13e826787fc109 | |
| parent | a6a7dac5cf929b04deac235e511073b2e9640433 (diff) | |
Add span label to E0381 for MIR borrowck
| -rw-r--r-- | src/librustc_mir/borrow_check.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc_mir/borrow_check.rs b/src/librustc_mir/borrow_check.rs index 5133e528b09..9b478fe2309 100644 --- a/src/librustc_mir/borrow_check.rs +++ b/src/librustc_mir/borrow_check.rs @@ -896,10 +896,13 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx> fn report_use_of_moved(&mut self, _context: Context, (lvalue, span): (&Lvalue, Span)) { - let mut err = self.tcx.cannot_act_on_uninitialized_variable( - span, "use", &self.describe_lvalue(lvalue), Origin::Mir); - // FIXME: add span_label for use of uninitialized variable - err.emit(); + self.tcx.cannot_act_on_uninitialized_variable(span, + "use", + &self.describe_lvalue(lvalue), + Origin::Mir) + .span_label(span, format!("use of possibly uninitialized `{}`", + self.describe_lvalue(lvalue))) + .emit(); } fn report_move_out_while_borrowed(&mut self, |
