@@ -245,35 +245,35 @@ pub enum EvalResult {
245
245
Unmarked ,
246
246
}
247
247
248
- impl < ' tcx > TyCtxt < ' tcx > {
249
- // See issue #38412.
250
- fn skip_stability_check_due_to_privacy ( self , mut def_id : DefId ) -> bool {
251
- // Check if `def_id` is a trait method.
252
- match self . def_kind ( def_id) {
253
- Some ( DefKind :: Method ) | Some ( DefKind :: AssocTy ) | Some ( DefKind :: AssocConst ) => {
254
- if let ty:: TraitContainer ( trait_def_id) = self . associated_item ( def_id) . container {
255
- // Trait methods do not declare visibility (even
256
- // for visibility info in cstore). Use containing
257
- // trait instead, so methods of `pub` traits are
258
- // themselves considered `pub`.
259
- def_id = trait_def_id;
260
- }
248
+ // See issue #38412.
249
+ fn skip_stability_check_due_to_privacy ( tcx : TyCtxt < ' _ > , mut def_id : DefId ) -> bool {
250
+ // Check if `def_id` is a trait method.
251
+ match tcx. def_kind ( def_id) {
252
+ Some ( DefKind :: Method ) | Some ( DefKind :: AssocTy ) | Some ( DefKind :: AssocConst ) => {
253
+ if let ty:: TraitContainer ( trait_def_id) = tcx. associated_item ( def_id) . container {
254
+ // Trait methods do not declare visibility (even
255
+ // for visibility info in cstore). Use containing
256
+ // trait instead, so methods of `pub` traits are
257
+ // themselves considered `pub`.
258
+ def_id = trait_def_id;
261
259
}
262
- _ => { }
263
260
}
261
+ _ => { }
262
+ }
264
263
265
- let visibility = self . visibility ( def_id) ;
264
+ let visibility = tcx . visibility ( def_id) ;
266
265
267
- match visibility {
268
- // Must check stability for `pub` items.
269
- ty:: Visibility :: Public => false ,
266
+ match visibility {
267
+ // Must check stability for `pub` items.
268
+ ty:: Visibility :: Public => false ,
270
269
271
- // These are not visible outside crate; therefore
272
- // stability markers are irrelevant, if even present.
273
- ty:: Visibility :: Restricted ( ..) | ty:: Visibility :: Invisible => true ,
274
- }
270
+ // These are not visible outside crate; therefore
271
+ // stability markers are irrelevant, if even present.
272
+ ty:: Visibility :: Restricted ( ..) | ty:: Visibility :: Invisible => true ,
275
273
}
274
+ }
276
275
276
+ impl < ' tcx > TyCtxt < ' tcx > {
277
277
/// Evaluates the stability of an item.
278
278
///
279
279
/// Returns `EvalResult::Allow` if the item is stable, or unstable but the corresponding
@@ -338,7 +338,7 @@ impl<'tcx> TyCtxt<'tcx> {
338
338
}
339
339
340
340
// Issue #38412: private items lack stability markers.
341
- if self . skip_stability_check_due_to_privacy ( def_id) {
341
+ if skip_stability_check_due_to_privacy ( self , def_id) {
342
342
return EvalResult :: Allow ;
343
343
}
344
344
@@ -402,9 +402,7 @@ impl<'tcx> TyCtxt<'tcx> {
402
402
}
403
403
}
404
404
}
405
- }
406
405
407
- impl < ' tcx > TyCtxt < ' tcx > {
408
406
pub fn lookup_deprecation ( self , id : DefId ) -> Option < Deprecation > {
409
407
self . lookup_deprecation_entry ( id) . map ( |depr| depr. attr )
410
408
}
0 commit comments