@@ -10,7 +10,6 @@ use rustc_attr::{
1010use rustc_data_structures:: unord:: UnordMap ;
1111use rustc_errors:: { Applicability , Diag , EmissionGuarantee } ;
1212use rustc_feature:: GateIssue ;
13- use rustc_hir:: def:: DefKind ;
1413use rustc_hir:: def_id:: { DefId , LocalDefId , LocalDefIdMap } ;
1514use rustc_hir:: { self as hir, HirId } ;
1615use rustc_macros:: { Decodable , Encodable , HashStable , Subdiagnostic } ;
@@ -24,7 +23,7 @@ use rustc_span::symbol::{Symbol, sym};
2423use tracing:: debug;
2524
2625pub use self :: StabilityLevel :: * ;
27- use crate :: ty:: { self , TyCtxt } ;
26+ use crate :: ty:: TyCtxt ;
2827
2928#[ derive( PartialEq , Clone , Copy , Debug ) ]
3029pub enum StabilityLevel {
@@ -273,22 +272,6 @@ pub enum EvalResult {
273272 Unmarked ,
274273}
275274
276- // See issue #38412.
277- fn skip_stability_check_due_to_privacy ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> bool {
278- if tcx. def_kind ( def_id) == DefKind :: TyParam {
279- // Have no visibility, considered public for the purpose of this check.
280- return false ;
281- }
282- match tcx. visibility ( def_id) {
283- // Must check stability for `pub` items.
284- ty:: Visibility :: Public => false ,
285-
286- // These are not visible outside crate; therefore
287- // stability markers are irrelevant, if even present.
288- ty:: Visibility :: Restricted ( ..) => true ,
289- }
290- }
291-
292275// See issue #83250.
293276fn suggestion_for_allocator_api (
294277 tcx : TyCtxt < ' _ > ,
@@ -407,11 +390,6 @@ impl<'tcx> TyCtxt<'tcx> {
407390 def_id, span, stability
408391 ) ;
409392
410- // Issue #38412: private items lack stability markers.
411- if skip_stability_check_due_to_privacy ( self , def_id) {
412- return EvalResult :: Allow ;
413- }
414-
415393 match stability {
416394 Some ( Stability {
417395 level : attr:: Unstable { reason, issue, is_soft, implied_by } ,
@@ -495,11 +473,6 @@ impl<'tcx> TyCtxt<'tcx> {
495473 "body stability: inspecting def_id={def_id:?} span={span:?} of stability={stability:?}"
496474 ) ;
497475
498- // Issue #38412: private items lack stability markers.
499- if skip_stability_check_due_to_privacy ( self , def_id) {
500- return EvalResult :: Allow ;
501- }
502-
503476 match stability {
504477 Some ( DefaultBodyStability {
505478 level : attr:: Unstable { reason, issue, is_soft, .. } ,
0 commit comments