if let Err(_) = infer::mk_eqty(&infcx, true, infer::TypeOrigin::Misc(drop_impl_span),
named_type, fresh_impl_self_ty) {
- span_err!(tcx.sess, drop_impl_span, E0366,
- "Implementations of Drop cannot be specialized");
let item_span = tcx.map.span(self_type_node_id);
- tcx.sess.span_note(item_span,
- "Use same sequence of generic type and region \
- parameters that is on the struct/enum definition");
+ struct_span_err!(tcx.sess, drop_impl_span, E0366,
+ "Implementations of Drop cannot be specialized")
+ .span_note(item_span,
+ "Use same sequence of generic type and region \
+ parameters that is on the struct/enum definition")
+ .emit();
return Err(());
}
if !assumptions_in_impl_context.contains(&predicate) {
let item_span = tcx.map.span(self_type_node_id);
- span_err!(tcx.sess, drop_impl_span, E0367,
- "The requirement `{}` is added only by the Drop impl.", predicate);
- tcx.sess.span_note(item_span,
- "The same requirement must be part of \
- the struct/enum definition");
+ struct_span_err!(tcx.sess, drop_impl_span, E0367,
+ "The requirement `{}` is added only by the Drop impl.", predicate)
+ .span_note(item_span,
+ "The same requirement must be part of \
+ the struct/enum definition")
+ .emit();
}
}
Ok(()) => {}
Err(Error::Overflow(ref ctxt, ref detected_on_typ)) => {
let tcx = rcx.tcx();
- span_err!(tcx.sess, span, E0320,
- "overflow while adding drop-check rules for {}", typ);
+ let mut err = struct_span_err!(tcx.sess, span, E0320,
+ "overflow while adding drop-check rules for {}", typ);
match *ctxt {
TypeContext::Root => {
// no need for an additional note if the overflow
format!("`{}`", field)
};
span_note!(
- rcx.tcx().sess,
+ &mut err,
span,
"overflowed on {} field {} type: {}",
variant_name,
detected_on_typ);
}
}
+ err.emit();
}
}
}