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");
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
_ => {},
}
}