Skip to content

Commit fe272c4

Browse files
committed
coerce_to_ref: no structural identity reliance
1 parent f07b5e6 commit fe272c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
414414
}
415415
};
416416

417-
if coerced_a == a && mt_a.mutbl.is_not() && autoderef.step_count() == 1 {
417+
if mt_a.mutbl.is_not() && mutbl_b.is_not() && autoderef.step_count() == 1 {
418418
// As a special case, if we would produce `&'a *x`, that's
419419
// a total no-op. We end up with the type `&'a T` just as
420420
// we started with. In that case, just skip it

0 commit comments

Comments
 (0)