Fix obscure compilation error
This commit is contained in:
parent
e45c7955e9
commit
de82fc4dc6
4 changed files with 16 additions and 9 deletions
|
|
@ -1544,5 +1544,5 @@ register_diagnostics! {
|
|||
E0490, // a value of type `..` is borrowed for too long
|
||||
E0491, // in type `..`, reference has a longer lifetime than the data it...
|
||||
E0495, // cannot infer an appropriate lifetime due to conflicting requirements
|
||||
E0524, // the closure implements `..` but not `..`
|
||||
E0524, // expected a closure that implements `..` but this closure only implements `..`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -471,9 +471,10 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
|||
let closure_span = infcx.tcx.map.span_if_local(closure_def_id).unwrap();
|
||||
let mut err = struct_span_err!(
|
||||
infcx.tcx.sess, closure_span, E0524,
|
||||
"the closure implements `{}` but not `{}`",
|
||||
found_kind,
|
||||
kind);
|
||||
"expected a closure that implements the `{}` trait, but this closure \
|
||||
only implements `{}`",
|
||||
kind,
|
||||
found_kind);
|
||||
err.span_note(
|
||||
obligation.cause.span,
|
||||
&format!("the requirement to implement `{}` derives from here", kind));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue