Skip to content

Commit c2f7e94

Browse files
committed
Update closure errors to use span_note
1 parent 31bfdd7 commit c2f7e94

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
596596
if let Some(&(ty::ClosureKind::FnOnce, Some((span, name)))) =
597597
self.tables.closure_kinds.get(&node_id)
598598
{
599-
err.help(&format!("closure cannot be invoked more than once because \
600-
it moves the variable `{}` out of its environment",
601-
name));
602-
err.span_label(span, format!("{} moved here", name));
599+
err.span_note(span, &format!(
600+
"closure cannot be invoked more than once because \
601+
it moves the variable `{}` out of its environment",
602+
name
603+
));
603604
false
604605
} else {
605606
true

src/test/ui/fn_once-moved.stderr

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
error[E0382]: use of moved value: `debug_dump_dict`
22
--> $DIR/fn_once-moved.rs:21:5
33
|
4-
16 | for (key, value) in dict {
5-
| ---- dict moved here
6-
...
74
20 | debug_dump_dict();
85
| --------------- value moved here
96
21 | debug_dump_dict();
107
| ^^^^^^^^^^^^^^^ value used here after move
118
|
12-
= help: closure cannot be invoked more than once because it moves the variable `dict` out of its environment
9+
note: closure cannot be invoked more than once because it moves the variable `dict` out of its environment
10+
--> $DIR/fn_once-moved.rs:16:29
11+
|
12+
16 | for (key, value) in dict {
13+
| ^^^^
1314

1415
error: aborting due to previous error
1516

0 commit comments

Comments
 (0)