@@ -25,7 +25,7 @@ use crate::infer::combine::ConstEquateRelation;
2525use crate :: infer:: InferCtxt ;
2626use crate :: infer:: { ConstVarValue , ConstVariableValue } ;
2727use crate :: infer:: { TypeVariableOrigin , TypeVariableOriginKind } ;
28- use crate :: traits:: PredicateObligation ;
28+ use crate :: traits:: { Obligation , PredicateObligation } ;
2929use rustc_data_structures:: fx:: FxHashMap ;
3030use rustc_middle:: traits:: ObligationCause ;
3131use rustc_middle:: ty:: error:: TypeError ;
@@ -93,7 +93,7 @@ pub trait TypeRelatingDelegate<'tcx> {
9393 ) ;
9494
9595 fn const_equate ( & mut self , a : ty:: Const < ' tcx > , b : ty:: Const < ' tcx > ) ;
96- fn register_opaque_type_obligations ( & mut self , obligations : Vec < PredicateObligation < ' tcx > > ) ;
96+ fn register_obligations ( & mut self , obligations : Vec < PredicateObligation < ' tcx > > ) ;
9797
9898 /// Creates a new universe index. Used when instantiating placeholders.
9999 fn create_next_universe ( & mut self ) -> ty:: UniverseIndex ;
@@ -416,7 +416,7 @@ where
416416 . infcx
417417 . handle_opaque_type ( a, b, true , & cause, self . delegate . param_env ( ) ) ?
418418 . obligations ;
419- self . delegate . register_opaque_type_obligations ( obligations) ;
419+ self . delegate . register_obligations ( obligations) ;
420420 trace ! ( a = ?a. kind( ) , b = ?b. kind( ) , "opaque type instantiated" ) ;
421421 Ok ( a)
422422 }
@@ -545,7 +545,14 @@ where
545545 }
546546
547547 fn mark_ambiguous ( & mut self ) {
548- bug ! ( )
548+ let cause = ObligationCause :: dummy_with_span ( self . delegate . span ( ) ) ;
549+ let param_env = self . delegate . param_env ( ) ;
550+ self . delegate . register_obligations ( vec ! [ Obligation :: new(
551+ self . tcx( ) ,
552+ cause,
553+ param_env,
554+ ty:: Binder :: dummy( ty:: PredicateKind :: Ambiguous ) ,
555+ ) ] ) ;
549556 }
550557
551558 #[ instrument( skip( self , info) , level = "trace" , ret) ]
0 commit comments