Skip to content

Commit 394c449

Browse files
authored
Rollup merge of rust-lang#35744 - DevShep:ds/update_E0009, r=jonathandturner
Update E0009 to new format Part of rust-lang#35233 Fixes rust-lang#35193 r? @jonathandturner
2 parents 7a27444 + d01bfb1 commit 394c449

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/librustc_const_eval/check_match.rs

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

src/test/compile-fail/E0009.rs

Lines changed: 4 additions & 1 deletion
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)