Skip to content

Commit 24d9add

Browse files
committed
Prefer identity equality over equating types during coercion.
These types are always generic only over their own generic parameters with no inference variables involved.
1 parent 1dea922 commit 24d9add

File tree

1 file changed

+4
-6
lines changed
  • compiler/rustc_hir_analysis/src/coherence

1 file changed

+4
-6
lines changed

compiler/rustc_hir_analysis/src/coherence/builtin.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -433,14 +433,12 @@ pub fn coerce_unsized_info<'tcx>(
433433
// something more accepting, but we use
434434
// equality because we want to be able to
435435
// perform this check without computing
436-
// variance where possible. (This is because
437-
// we may have to evaluate constraint
436+
// variance or constraining opaque types' hidden types.
437+
// (This is because we may have to evaluate constraint
438438
// expressions in the course of execution.)
439439
// See e.g., #41936.
440-
if let Ok(ok) = infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, a, b) {
441-
if ok.obligations.is_empty() {
442-
return None;
443-
}
440+
if a == b {
441+
return None;
444442
}
445443

446444
// Collect up all fields that were significantly changed

0 commit comments

Comments
 (0)