diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-10-11 14:56:12 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-10-11 15:13:34 -0400 |
| commit | 54bf8a681bededa6c7e09f4c1da3cb68efb885a3 (patch) | |
| tree | ab383c56f41648f5334d941f119bf0b10ea834cc /src | |
| parent | c38f001db5e16f1e0db47c5aed80394e9df5430a (diff) | |
| download | rust-54bf8a681bededa6c7e09f4c1da3cb68efb885a3.tar.gz rust-54bf8a681bededa6c7e09f4c1da3cb68efb885a3.zip | |
Don't link to nightly primitives on stable channel
I am not sure how to test this.
Diffstat (limited to 'src')
| -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 1e07f8e2eac..f81c6c3df76 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -14,6 +14,7 @@ use rustc_ast::util::comments::beautify_doc_string; use rustc_ast::{self as ast, AttrStyle}; use rustc_ast::{FloatTy, IntTy, UintTy}; 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}; @@ -698,9 +699,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()); |
