File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -116,12 +116,24 @@ pub enum NoSolutionOrAmbiguous {
116116}
117117
118118impl NoSolutionOrAmbiguous {
119+ // Expect unambiguous errors only
119120 pub fn expect_unambiguous ( self ) -> NoSolution {
120121 match self {
121122 NoSolutionOrAmbiguous :: NoSolution => NoSolution ,
122123 NoSolutionOrAmbiguous :: Ambiguous => bug ! ( "unexpected ambiguity" ) ,
123124 }
124125 }
126+
127+ /// Delay an ambiguity as a `delay_span_bug`.
128+ pub fn delay_ambiguous ( self , tcx : TyCtxt < ' _ > , span : Span ) -> NoSolution {
129+ match self {
130+ NoSolutionOrAmbiguous :: NoSolution => NoSolution ,
131+ NoSolutionOrAmbiguous :: Ambiguous => {
132+ tcx. sess . delay_span_bug ( span, "unexpected ambiguity" ) ;
133+ NoSolution
134+ }
135+ }
136+ }
125137}
126138
127139impl From < NoSolution > for NoSolutionOrAmbiguous {
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ where
221221 let Normalized { value, obligations } = infcx
222222 . at ( & ObligationCause :: dummy ( ) , param_env)
223223 . normalize ( value)
224- . map_err ( |err| err. expect_unambiguous ( ) ) ?;
224+ . map_err ( |err| err. delay_ambiguous ( infcx . tcx , DUMMY_SP ) ) ?;
225225 fulfill_cx. register_predicate_obligations ( infcx, obligations) ;
226226 Ok ( value)
227227}
You can’t perform that action at this time.
0 commit comments