File tree Expand file tree Collapse file tree 5 files changed +44
-3
lines changed Expand file tree Collapse file tree 5 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -400,7 +400,27 @@ impl Item {
400400 }
401401
402402 pub ( crate ) fn deprecation ( & self , tcx : TyCtxt < ' _ > ) -> Option < Deprecation > {
403- self . def_id ( ) . and_then ( |did| tcx. lookup_deprecation ( did) )
403+ self . def_id ( ) . and_then ( |did| tcx. lookup_deprecation ( did) ) . or_else ( || {
404+ // `allowed_through_unstable_modules` is a bug-compatibility hack for old rustc
405+ // versions; the paths that are exposed through it are "deprecated" because they
406+ // were never supposed to work at all.
407+ let stab = self . stability ( tcx) ?;
408+ if let rustc_attr_parsing:: StabilityLevel :: Stable {
409+ allowed_through_unstable_modules : true ,
410+ ..
411+ } = stab. level
412+ {
413+ Some ( Deprecation {
414+ // FIXME(#131676, #135003): when a note is added to this stability tag,
415+ // translate it here
416+ since : rustc_attr_parsing:: DeprecatedSince :: Unspecified ,
417+ note : None ,
418+ suggestion : None ,
419+ } )
420+ } else {
421+ None
422+ }
423+ } )
404424 }
405425
406426 pub ( crate ) fn inner_docs ( & self , tcx : TyCtxt < ' _ > ) -> bool {
Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ fn merge_stability(
107107 || parent_stab. stable_since ( ) . is_some_and ( |parent_since| parent_since > own_since) )
108108 {
109109 parent_stability
110+ } else if let Some ( mut own_stab) = own_stability
111+ && let StabilityLevel :: Stable { since, allowed_through_unstable_modules : true } =
112+ own_stab. level
113+ && parent_stability. is_some_and ( |stab| stab. is_stable ( ) )
114+ {
115+ // this property does not apply transitively through re-exports
116+ own_stab. level = StabilityLevel :: Stable { since, allowed_through_unstable_modules : false } ;
117+ Some ( own_stab)
110118 } else {
111119 own_stability
112120 }
Original file line number Diff line number Diff line change 1+ const FILTER_CRATE = "core" ;
2+ const EXPECTED = [
3+ {
4+ 'query' : 'generic:T -> generic:U' ,
5+ 'others' : [
6+ { 'path' : 'core::intrinsics::simd' , 'name' : 'simd_as' } ,
7+ { 'path' : 'core::intrinsics::simd' , 'name' : 'simd_cast' } ,
8+ { 'path' : 'core::mem' , 'name' : 'transmute' } ,
9+ ] ,
10+ } ,
11+ ] ;
Original file line number Diff line number Diff line change 11// should-fail
2+ const FILTER_CRATE = "std" ;
23const EXPECTED = [
34 {
45 // Keep this test case identical to `transmute`, except the
@@ -7,7 +8,7 @@ const EXPECTED = [
78 'others' : [
89 { 'path' : 'std::intrinsics::simd' , 'name' : 'simd_as' } ,
910 { 'path' : 'std::intrinsics::simd' , 'name' : 'simd_cast' } ,
10- { 'path' : 'std::intrinsics ' , 'name' : 'transmute' } ,
11+ { 'path' : 'std::mem ' , 'name' : 'transmute' } ,
1112 ] ,
1213 } ,
1314] ;
Original file line number Diff line number Diff line change 1+ const FILTER_CRATE = "std" ;
12const EXPECTED = [
23 {
34 // Keep this test case identical to `transmute-fail`, except the
@@ -6,7 +7,7 @@ const EXPECTED = [
67 'others' : [
78 { 'path' : 'std::intrinsics::simd' , 'name' : 'simd_as' } ,
89 { 'path' : 'std::intrinsics::simd' , 'name' : 'simd_cast' } ,
9- { 'path' : 'std::intrinsics ' , 'name' : 'transmute' } ,
10+ { 'path' : 'std::mem ' , 'name' : 'transmute' } ,
1011 ] ,
1112 } ,
1213] ;
You can’t perform that action at this time.
0 commit comments