Fix wrong span for trait selection failure error reporting
This commit is contained in:
parent
fcf3006e01
commit
3635b48973
4 changed files with 83 additions and 0 deletions
|
@ -2987,6 +2987,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
unsatisfied_const: bool,
|
||||
) {
|
||||
let body_def_id = obligation.cause.body_id;
|
||||
let span = if let ObligationCauseCode::BinOp { rhs_span: Some(rhs_span), .. } =
|
||||
obligation.cause.code()
|
||||
{
|
||||
*rhs_span
|
||||
} else {
|
||||
span
|
||||
};
|
||||
|
||||
// Try to report a help message
|
||||
if is_fn_trait
|
||||
&& let Ok((implemented_kind, params)) = self.type_implements_fn_trait(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue