Skip to content

Commit 7675e4b

Browse files
author
Jacob
committed
Update E0009 to new format
1 parent 197be89 commit 7675e4b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/librustc_const_eval/check_match.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1120,10 +1120,11 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
11201120
.span_label(p.span, &format!("moves value into pattern guard"))
11211121
.emit();
11221122
} else if by_ref_span.is_some() {
1123-
let mut err = struct_span_err!(cx.tcx.sess, p.span, E0009,
1124-
"cannot bind by-move and by-ref in the same pattern");
1125-
span_note!(&mut err, by_ref_span.unwrap(), "by-ref binding occurs here");
1126-
err.emit();
1123+
struct_span_err!(cx.tcx.sess, p.span, E0009,
1124+
"cannot bind by-move and by-ref in the same pattern")
1125+
.span_label(p.span, &format!("by-move pattern here"))
1126+
.span_label(by_ref_span.unwrap(), &format!("both by-ref and by-move used"))
1127+
.emit();
11271128
}
11281129
};
11291130

src/test/compile-fail/E0009.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ fn main() {
1212
struct X { x: (), }
1313
let x = Some((X { x: () }, X { x: () }));
1414
match x {
15-
Some((y, ref z)) => {}, //~ ERROR E0009
15+
Some((y, ref z)) => {},
16+
//~^ ERROR E0009
17+
//~| NOTE by-move pattern here
18+
//~| NOTE both by-ref and by-move used
1619
None => panic!()
1720
}
1821
}

0 commit comments

Comments
 (0)