Update E0008 to new format
This commit is contained in:
parent
b42a384a80
commit
0cb8439aa3
2 changed files with 7 additions and 2 deletions
|
|
@ -1114,7 +1114,10 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
|
|||
if sub.map_or(false, |p| pat_contains_bindings(&p)) {
|
||||
span_err!(cx.tcx.sess, p.span, E0007, "cannot bind by-move with sub-bindings");
|
||||
} else if has_guard {
|
||||
span_err!(cx.tcx.sess, p.span, E0008, "cannot bind by-move into a pattern guard");
|
||||
struct_span_err!(cx.tcx.sess, p.span, E0008,
|
||||
"cannot bind by-move into a pattern guard")
|
||||
.span_label(p.span, &format!("moves value into pattern guard"))
|
||||
.emit();
|
||||
} else if by_ref_span.is_some() {
|
||||
let mut err = struct_span_err!(cx.tcx.sess, p.span, E0009,
|
||||
"cannot bind by-move and by-ref in the same pattern");
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
fn main() {
|
||||
match Some("hi".to_string()) {
|
||||
Some(s) if s.len() == 0 => {}, //~ ERROR E0008
|
||||
Some(s) if s.len() == 0 => {},
|
||||
//~^ ERROR E0008
|
||||
//~| NOTE moves value into pattern guard
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue