Skip to content

Commit 73e10ea

Browse files
committed
Suppress the clone_for_ref suggestion in extern macro
Signed-off-by: xizheyin <[email protected]>
1 parent 0e3fd88 commit 73e10ea

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12631263
expr_ty: Ty<'tcx>,
12641264
expected_ty: Ty<'tcx>,
12651265
) -> bool {
1266-
if let ty::Ref(_, inner_ty, hir::Mutability::Not) = expr_ty.kind()
1266+
if !expr.span.in_external_macro(self.tcx.sess.source_map())
1267+
&& let ty::Ref(_, inner_ty, hir::Mutability::Not) = expr_ty.kind()
12671268
&& let Some(clone_trait_def) = self.tcx.lang_items().clone_trait()
12681269
&& expected_ty == *inner_ty
12691270
&& self

0 commit comments

Comments
 (0)