@@ -12,11 +12,8 @@ use crate::solve::{deeply_normalize_for_diagnostics, inspect, FulfillmentCtxt};
12
12
use crate :: traits:: engine:: TraitEngineExt as _;
13
13
use crate :: traits:: select:: IntercrateAmbiguityCause ;
14
14
use crate :: traits:: structural_normalize:: StructurallyNormalizeExt ;
15
- use crate :: traits:: NormalizeExt ;
16
- use crate :: traits:: SkipLeakCheck ;
17
- use crate :: traits:: {
18
- Obligation , ObligationCause , PredicateObligation , PredicateObligations , SelectionContext ,
19
- } ;
15
+ use crate :: traits:: { NormalizeExt , SelectionContext , SkipLeakCheck } ;
16
+ use crate :: traits:: { Obligation , ObligationCause , PredicateObligation , PredicateObligations } ;
20
17
use rustc_data_structures:: fx:: FxIndexSet ;
21
18
use rustc_errors:: { Diag , EmissionGuarantee } ;
22
19
use rustc_hir:: def:: DefKind ;
@@ -346,9 +343,12 @@ fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>(
346
343
) -> IntersectionHasImpossibleObligations < ' tcx > {
347
344
let infcx = selcx. infcx ;
348
345
346
+ // Elaborate obligations in case the current obligation is unknowable,
347
+ // but its super trait bound is not. See #124532 for more details.
348
+ let obligations = util:: elaborate ( infcx. tcx , obligations. iter ( ) . cloned ( ) ) ;
349
349
if infcx. next_trait_solver ( ) {
350
350
let mut fulfill_cx = FulfillmentCtxt :: new ( infcx) ;
351
- fulfill_cx. register_predicate_obligations ( infcx, obligations. iter ( ) . cloned ( ) ) ;
351
+ fulfill_cx. register_predicate_obligations ( infcx, obligations) ;
352
352
353
353
// We only care about the obligations that are *definitely* true errors.
354
354
// Ambiguities do not prove the disjointness of two impls.
@@ -371,7 +371,7 @@ fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>(
371
371
for obligation in obligations {
372
372
// We use `evaluate_root_obligation` to correctly track intercrate
373
373
// ambiguity clauses.
374
- let evaluation_result = selcx. evaluate_root_obligation ( obligation) ;
374
+ let evaluation_result = selcx. evaluate_root_obligation ( & obligation) ;
375
375
376
376
match evaluation_result {
377
377
Ok ( result) => {
0 commit comments