File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -116,12 +116,24 @@ pub enum NoSolutionOrAmbiguous {
116
116
}
117
117
118
118
impl NoSolutionOrAmbiguous {
119
+ // Expect unambiguous errors only
119
120
pub fn expect_unambiguous ( self ) -> NoSolution {
120
121
match self {
121
122
NoSolutionOrAmbiguous :: NoSolution => NoSolution ,
122
123
NoSolutionOrAmbiguous :: Ambiguous => bug ! ( "unexpected ambiguity" ) ,
123
124
}
124
125
}
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
+ }
125
137
}
126
138
127
139
impl From < NoSolution > for NoSolutionOrAmbiguous {
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ where
221
221
let Normalized { value, obligations } = infcx
222
222
. at ( & ObligationCause :: dummy ( ) , param_env)
223
223
. normalize ( value)
224
- . map_err ( |err| err. expect_unambiguous ( ) ) ?;
224
+ . map_err ( |err| err. delay_ambiguous ( infcx . tcx , DUMMY_SP ) ) ?;
225
225
fulfill_cx. register_predicate_obligations ( infcx, obligations) ;
226
226
Ok ( value)
227
227
}
You can’t perform that action at this time.
0 commit comments