@@ -2703,13 +2703,16 @@ fn stability_tags(item: &clean::Item) -> String {
27032703 tags. push_str ( "[<div class='stab deprecated'>Deprecated</div>] " ) ;
27042704 }
27052705
2706- if item
2706+ if let Some ( stab ) = item
27072707 . stability
27082708 . as_ref ( )
27092709 . filter ( |s| s. level == stability:: Unstable )
2710- . is_some ( )
27112710 {
2712- tags. push_str ( "[<div class='stab unstable'>Experimental</div>] " ) ;
2711+ if stab. feature . as_ref ( ) . map ( |s| & * * s) == Some ( "rustc_private" ) {
2712+ tags. push_str ( "[<div class='stab internal'>Internal</div>] " ) ;
2713+ } else {
2714+ tags. push_str ( "[<div class='stab unstable'>Experimental</div>] " ) ;
2715+ }
27132716 }
27142717
27152718 if let Some ( ref cfg) = item. attrs . cfg {
@@ -2752,9 +2755,14 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
27522755 . as_ref ( )
27532756 . filter ( |stab| stab. level == stability:: Unstable )
27542757 {
2755- let mut message = String :: from (
2756- "<span class=microscope>🔬</span> This is a nightly-only experimental API." ,
2757- ) ;
2758+ let is_rustc_private = stab. feature . as_ref ( ) . map ( |s| & * * s) == Some ( "rustc_private" ) ;
2759+
2760+ let mut message = if is_rustc_private {
2761+ "<span class='emoji'>⚙️</span> This is an internal compiler API."
2762+ } else {
2763+ "<span class='emoji'>🔬</span> This is a nightly-only experimental API."
2764+ }
2765+ . to_owned ( ) ;
27582766
27592767 if let Some ( feature) = stab. feature . as_ref ( ) {
27602768 let mut feature = format ! ( "<code>{}</code>" , Escape ( & feature) ) ;
@@ -2770,6 +2778,17 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
27702778 }
27712779
27722780 if let Some ( unstable_reason) = & stab. unstable_reason {
2781+ // Provide a more informative message than the compiler help.
2782+ let unstable_reason = if is_rustc_private {
2783+ "This crate is being loaded from the sysroot, a permanently unstable location \
2784+ for private compiler dependencies. It is not intended for general use. Prefer \
2785+ using a public version of this crate from \
2786+ [crates.io](https://crates.io) via [`Cargo.toml`]\
2787+ (https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html)."
2788+ } else {
2789+ unstable_reason
2790+ } ;
2791+
27732792 let mut ids = cx. id_map . borrow_mut ( ) ;
27742793 message = format ! (
27752794 "<details><summary>{}</summary>{}</details>" ,
@@ -2778,7 +2797,12 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
27782797 ) ;
27792798 }
27802799
2781- stability. push ( format ! ( "<div class='stab unstable'>{}</div>" , message) )
2800+ let class = if is_rustc_private {
2801+ "internal"
2802+ } else {
2803+ "unstable"
2804+ } ;
2805+ stability. push ( format ! ( "<div class='stab {}'>{}</div>" , class, message) ) ;
27822806 }
27832807
27842808 if let Some ( ref cfg) = item. attrs . cfg {
0 commit comments