Skip to content

Commit

Permalink
enable suggest convert to slice for binary operation
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Aug 3, 2023
1 parent 3635b48 commit cde8f06
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3953,9 +3953,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
candidate_impls: &[ImplCandidate<'tcx>],
span: Span,
) {
// We can only suggest the slice coersion for function arguments since the suggestion
// would make no sense in turbofish or call
let ObligationCauseCode::FunctionArgumentObligation { .. } = obligation.cause.code() else {
// We can only suggest the slice coersion for function and binary operation arguments,
// since the suggestion would make no sense in turbofish or call
let (ObligationCauseCode::BinOp { .. }
| ObligationCauseCode::FunctionArgumentObligation { .. }) = obligation.cause.code()
else {
return;
};

Expand Down

0 comments on commit cde8f06

Please sign in to comment.