Skip to content

Commit aa40ec7

Browse files
author
srdja
committed
Update E0007 to new format
1 parent 0cb8439 commit aa40ec7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/librustc_const_eval/check_match.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,10 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
11121112

11131113
// x @ Foo(..) is legal, but x @ Foo(y) isn't.
11141114
if sub.map_or(false, |p| pat_contains_bindings(&p)) {
1115-
span_err!(cx.tcx.sess, p.span, E0007, "cannot bind by-move with sub-bindings");
1115+
struct_span_err!(cx.tcx.sess, p.span, E0007,
1116+
"cannot bind by-move with sub-bindings")
1117+
.span_label(p.span, &format!("binds an already bound by-move value by moving it"))
1118+
.emit();
11161119
} else if has_guard {
11171120
struct_span_err!(cx.tcx.sess, p.span, E0008,
11181121
"cannot bind by-move into a pattern guard")

src/test/compile-fail/E0007.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
fn main() {
1212
let x = Some("s".to_string());
1313
match x {
14-
op_string @ Some(s) => {}, //~ ERROR E0007
15-
//~| ERROR E0303
14+
op_string @ Some(s) => {},
15+
//~^ ERROR E0007
16+
//~| NOTE binds an already bound by-move value by moving it
17+
//~| ERROR E0303
1618
None => {},
1719
}
1820
}

0 commit comments

Comments
 (0)