Skip to content

Commit ecff2d8

Browse files
authored
Rollup merge of rust-lang#77827 - jyn514:stable-primitives, r=GuillaumeGomez
Don't link to nightly primitives on stable channel I am not sure how to test this. Closes rust-lang#77775 r? @GuillaumeGomez
2 parents 8369c56 + 54bf8a6 commit ecff2d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/librustdoc/clean/types.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use rustc_ast::{self as ast, AttrStyle};
1414
use rustc_ast::{FloatTy, IntTy, UintTy};
1515
use rustc_attr::{Stability, StabilityLevel};
1616
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
17+
use rustc_feature::UnstableFeatures;
1718
use rustc_hir as hir;
1819
use rustc_hir::def::Res;
1920
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
@@ -679,9 +680,13 @@ impl Attributes {
679680
"../".repeat(depth)
680681
}
681682
Some(&(_, _, ExternalLocation::Remote(ref s))) => s.to_string(),
682-
Some(&(_, _, ExternalLocation::Unknown)) | None => {
683-
String::from("https://doc.rust-lang.org/nightly")
684-
}
683+
Some(&(_, _, ExternalLocation::Unknown)) | None => String::from(
684+
if UnstableFeatures::from_environment().is_nightly_build() {
685+
"https://doc.rust-lang.org/nightly"
686+
} else {
687+
"https://doc.rust-lang.org"
688+
},
689+
),
685690
};
686691
// This is a primitive so the url is done "by hand".
687692
let tail = fragment.find('#').unwrap_or_else(|| fragment.len());

0 commit comments

Comments
 (0)