@@ -25,7 +25,7 @@ use crate::infer::combine::ConstEquateRelation;
25
25
use crate :: infer:: InferCtxt ;
26
26
use crate :: infer:: { ConstVarValue , ConstVariableValue } ;
27
27
use crate :: infer:: { TypeVariableOrigin , TypeVariableOriginKind } ;
28
- use crate :: traits:: PredicateObligation ;
28
+ use crate :: traits:: { Obligation , PredicateObligation } ;
29
29
use rustc_data_structures:: fx:: FxHashMap ;
30
30
use rustc_middle:: traits:: ObligationCause ;
31
31
use rustc_middle:: ty:: error:: TypeError ;
@@ -93,7 +93,7 @@ pub trait TypeRelatingDelegate<'tcx> {
93
93
) ;
94
94
95
95
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 > > ) ;
97
97
98
98
/// Creates a new universe index. Used when instantiating placeholders.
99
99
fn create_next_universe ( & mut self ) -> ty:: UniverseIndex ;
@@ -416,7 +416,7 @@ where
416
416
. infcx
417
417
. handle_opaque_type ( a, b, true , & cause, self . delegate . param_env ( ) ) ?
418
418
. obligations ;
419
- self . delegate . register_opaque_type_obligations ( obligations) ;
419
+ self . delegate . register_obligations ( obligations) ;
420
420
trace ! ( a = ?a. kind( ) , b = ?b. kind( ) , "opaque type instantiated" ) ;
421
421
Ok ( a)
422
422
}
@@ -545,7 +545,14 @@ where
545
545
}
546
546
547
547
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
+ ) ] ) ;
549
556
}
550
557
551
558
#[ instrument( skip( self , info) , level = "trace" , ret) ]
0 commit comments