diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-17 05:36:41 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-17 05:36:41 +0900 |
| commit | 8c4d8555f3071fd481a37db50c7b647dcf3ed34a (patch) | |
| tree | 0f8ca0bea9c494b2662ca6f7fa624f19f3ac1e15 | |
| parent | 3356ad7c26d11deef6b6da50ac21905e422bf4fb (diff) | |
| parent | 54bf8a681bededa6c7e09f4c1da3cb68efb885a3 (diff) | |
| download | rust-8c4d8555f3071fd481a37db50c7b647dcf3ed34a.tar.gz rust-8c4d8555f3071fd481a37db50c7b647dcf3ed34a.zip | |
Rollup merge of #77827 - jyn514:stable-primitives, r=GuillaumeGomez
Don't link to nightly primitives on stable channel I am not sure how to test this. Closes https://github.com/rust-lang/rust/issues/77775 r? @GuillaumeGomez
| -rw-r--r-- | src/librustdoc/clean/types.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 3b72cf5c4f9..32b3f69ecd4 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -14,6 +14,7 @@ use rustc_ast::{self as ast, AttrStyle}; use rustc_ast::{FloatTy, IntTy, UintTy}; use rustc_attr::{Stability, StabilityLevel}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_feature::UnstableFeatures; use rustc_hir as hir; use rustc_hir::def::Res; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -679,9 +680,13 @@ impl Attributes { "../".repeat(depth) } Some(&(_, _, ExternalLocation::Remote(ref s))) => s.to_string(), - Some(&(_, _, ExternalLocation::Unknown)) | None => { - String::from("https://doc.rust-lang.org/nightly") - } + Some(&(_, _, ExternalLocation::Unknown)) | None => String::from( + if UnstableFeatures::from_environment().is_nightly_build() { + "https://doc.rust-lang.org/nightly" + } else { + "https://doc.rust-lang.org" + }, + ), }; // This is a primitive so the url is done "by hand". let tail = fragment.find('#').unwrap_or_else(|| fragment.len()); |
