@@ -172,14 +172,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
172
172
let bound_predicate = predicate. kind ( ) ;
173
173
let mut err = match bound_predicate. skip_binder ( ) {
174
174
ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( data) ) => {
175
- let trait_ref = bound_predicate. rebind ( data. trait_ref ) ;
176
- debug ! ( ?trait_ref ) ;
175
+ let trait_pred = bound_predicate. rebind ( data) ;
176
+ debug ! ( ?trait_pred ) ;
177
177
178
178
if let Err ( e) = predicate. error_reported ( ) {
179
179
return e;
180
180
}
181
181
182
- if let Err ( guar) = self . tcx . ensure ( ) . coherent_trait ( trait_ref . def_id ( ) ) {
182
+ if let Err ( guar) = self . tcx . ensure ( ) . coherent_trait ( trait_pred . def_id ( ) ) {
183
183
// Avoid bogus "type annotations needed `Foo: Bar`" errors on `impl Bar for Foo` in case
184
184
// other `Foo` impls are incoherent.
185
185
return guar;
@@ -200,13 +200,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
200
200
// avoid inundating the user with unnecessary errors, but we now
201
201
// check upstream for type errors and don't add the obligations to
202
202
// begin with in those cases.
203
- if self . tcx . is_lang_item ( trait_ref . def_id ( ) , LangItem :: Sized ) {
203
+ if self . tcx . is_lang_item ( trait_pred . def_id ( ) , LangItem :: Sized ) {
204
204
match self . tainted_by_errors ( ) {
205
205
None => {
206
206
let err = self . emit_inference_failure_err (
207
207
obligation. cause . body_id ,
208
208
span,
209
- trait_ref . self_ty ( ) . skip_binder ( ) . into ( ) ,
209
+ trait_pred . self_ty ( ) . skip_binder ( ) . into ( ) ,
210
210
TypeAnnotationNeeded :: E0282 ,
211
211
false ,
212
212
) ;
@@ -251,10 +251,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
251
251
252
252
let mut ambiguities = compute_applicable_impls_for_diagnostics (
253
253
self . infcx ,
254
- & obligation. with ( self . tcx , trait_ref ) ,
254
+ & obligation. with ( self . tcx , trait_pred ) ,
255
255
) ;
256
- let has_non_region_infer =
257
- trait_ref. skip_binder ( ) . args . types ( ) . any ( |t| !t. is_ty_or_numeric_infer ( ) ) ;
256
+ let has_non_region_infer = trait_pred
257
+ . skip_binder ( )
258
+ . trait_ref
259
+ . args
260
+ . types ( )
261
+ . any ( |t| !t. is_ty_or_numeric_infer ( ) ) ;
258
262
// It doesn't make sense to talk about applicable impls if there are more than a
259
263
// handful of them. If there are a lot of them, but only a few of them have no type
260
264
// params, we only show those, as they are more likely to be useful/intended.
@@ -294,7 +298,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
294
298
if impl_candidates. len ( ) < 40 {
295
299
self . report_similar_impl_candidates (
296
300
impl_candidates. as_slice ( ) ,
297
- trait_ref ,
301
+ trait_pred ,
298
302
obligation. cause . body_id ,
299
303
& mut err,
300
304
false ,
@@ -306,7 +310,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
306
310
if let ObligationCauseCode :: WhereClause ( def_id, _)
307
311
| ObligationCauseCode :: WhereClauseInExpr ( def_id, ..) = * obligation. cause . code ( )
308
312
{
309
- self . suggest_fully_qualified_path ( & mut err, def_id, span, trait_ref . def_id ( ) ) ;
313
+ self . suggest_fully_qualified_path ( & mut err, def_id, span, trait_pred . def_id ( ) ) ;
310
314
}
311
315
312
316
if let Some ( ty:: GenericArgKind :: Type ( _) ) = arg. map ( |arg| arg. unpack ( ) )
0 commit comments