Skip to content

Commit 912b49d

Browse files
committed
Suppress swapping equality suggestion in extern macro when check overloaded binop
Signed-off-by: xizheyin <[email protected]>
1 parent 1e008dd commit 912b49d

File tree

1 file changed

+2
-1
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+2
-1
lines changed

compiler/rustc_hir_typeck/src/op.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
249249
rhs_ty_var,
250250
Some(lhs_expr),
251251
|err, ty| {
252-
if let Op::BinOp(binop) = op
252+
if !expr.span.in_external_macro(self.tcx.sess.source_map())
253+
&& let Op::BinOp(binop) = op
253254
&& binop.node == hir::BinOpKind::Eq
254255
{
255256
self.suggest_swapping_lhs_and_rhs(err, ty, lhs_ty, rhs_expr, lhs_expr);

0 commit comments

Comments
 (0)