Skip to content

Commit 54bf8a6

Browse files
committed
Don't link to nightly primitives on stable channel
I am not sure how to test this.
1 parent c38f001 commit 54bf8a6

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::util::comments::beautify_doc_string;
1414
use rustc_ast::{self as ast, AttrStyle};
1515
use rustc_ast::{FloatTy, IntTy, UintTy};
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};
@@ -698,9 +699,13 @@ impl Attributes {
698699
"../".repeat(depth)
699700
}
700701
Some(&(_, _, ExternalLocation::Remote(ref s))) => s.to_string(),
701-
Some(&(_, _, ExternalLocation::Unknown)) | None => {
702-
String::from("https://doc.rust-lang.org/nightly")
703-
}
702+
Some(&(_, _, ExternalLocation::Unknown)) | None => String::from(
703+
if UnstableFeatures::from_environment().is_nightly_build() {
704+
"https://doc.rust-lang.org/nightly"
705+
} else {
706+
"https://doc.rust-lang.org"
707+
},
708+
),
704709
};
705710
// This is a primitive so the url is done "by hand".
706711
let tail = fragment.find('#').unwrap_or_else(|| fragment.len());

0 commit comments

Comments
 (0)