Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beta] Prepare beta 1.53.0 #84909

Merged
merged 14 commits into from
May 6, 2021
Merged
Prev Previous commit
Next Next commit
Revert PR 83866
That PR caused multiple test failures when Rust's channel is changed
from nightly to anything else. The commit will have to be landed again
after the test suite is fixed.
  • Loading branch information
pietroalbini committed May 5, 2021
commit bbfdfa9174deeb8212ca82248f0ec34f461cdb3a
7 changes: 3 additions & 4 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,9 @@ impl Item {
Some(&(_, _, ExternalLocation::Remote(ref s))) => {
format!("{}/std/", s.trim_end_matches('/'))
}
Some(&(_, _, ExternalLocation::Unknown)) | None => format!(
"https://doc.rust-lang.org/{}/std/",
crate::doc_rust_lang_org_channel(),
),
Some(&(_, _, ExternalLocation::Unknown)) | None => {
"https://doc.rust-lang.org/nightly/std/".to_string()
}
};
// This is a primitive so the url is done "by hand".
let tail = fragment.find('#').unwrap_or_else(|| fragment.len());
Expand Down
11 changes: 0 additions & 11 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,3 @@ crate fn has_doc_flag(attrs: ty::Attributes<'_>, flag: Symbol) -> bool {
&& attr.meta_item_list().map_or(false, |l| rustc_attr::list_contains_name(&l, flag))
})
}

/// Return a channel suitable for using in a `doc.rust-lang.org/{channel}` format string.
crate fn doc_rust_lang_org_channel() -> &'static str {
match env!("CFG_RELEASE_CHANNEL") {
"stable" => env!("CFG_RELEASE_NUM"),
"beta" => "beta",
"nightly" | "dev" => "nightly",
// custom build of rustdoc maybe? link to the stable docs just in case
_ => "",
}
}
9 changes: 3 additions & 6 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,18 +450,15 @@ crate fn run_global_ctxt(
let mut krate = tcx.sess.time("clean_crate", || clean::krate(&mut ctxt));

if krate.module.doc_value().map(|d| d.is_empty()).unwrap_or(true) {
let help = format!(
"The following guide may be of use:\n\
https://doc.rust-lang.org/{}/rustdoc/how-to-write-documentation.html",
crate::doc_rust_lang_org_channel(),
);
let help = "The following guide may be of use:\n\
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html";
tcx.struct_lint_node(
crate::lint::MISSING_CRATE_LEVEL_DOCS,
DocContext::as_local_hir_id(tcx, krate.module.def_id).unwrap(),
|lint| {
let mut diag =
lint.build("no documentation found for this crate's top-level module");
diag.help(&help);
diag.help(help);
diag.emit();
},
);
Expand Down
7 changes: 1 addition & 6 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ use rustc_session::config::{make_crate_type_option, ErrorOutputType, RustcOptGro
use rustc_session::getopts;
use rustc_session::{early_error, early_warn};

use crate::clean::utils::doc_rust_lang_org_channel;

/// A macro to create a FxHashMap.
///
/// Example:
Expand Down Expand Up @@ -605,10 +603,7 @@ fn usage(argv0: &str) {
}
println!("{}", options.usage(&format!("{} [options] <input>", argv0)));
println!(" @path Read newline separated options from `path`\n");
println!(
"More information available at https://doc.rust-lang.org/{}/rustdoc/what-is-rustdoc.html",
doc_rust_lang_org_channel()
);
println!("More information available at https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html")
}

/// A result type used by several functions under `main()`.
Expand Down
9 changes: 1 addition & 8 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1993,14 +1993,7 @@ fn disambiguator_error(
msg: &str,
) {
diag_info.link_range = disambiguator_range;
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |diag, _sp| {
let msg = format!(
"see https://doc.rust-lang.org/{}/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators \
for more info about disambiguators",
crate::doc_rust_lang_org_channel(),
);
diag.note(&msg);
});
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |_diag, _sp| {});
}

/// Report an ambiguity error, where there were multiple possible resolutions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ note: the lint level is defined here
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]`
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

error: aborting due to previous error

11 changes: 0 additions & 11 deletions src/test/rustdoc-ui/intra-doc/unknown-disambiguator.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,36 @@ note: the lint level is defined here
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(warnings)]`
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

error: unknown disambiguator `bar`
--> $DIR/unknown-disambiguator.rs:3:35
|
LL | //! Linking to [foo@banana] and [`bar@banana!()`].
| ^^^
|
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

error: unknown disambiguator `foo`
--> $DIR/unknown-disambiguator.rs:9:34
|
LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello].
| ^^^
|
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

error: unknown disambiguator `foo`
--> $DIR/unknown-disambiguator.rs:9:48
|
LL | //! And with weird backticks: [``foo@hello``] [foo`@`hello].
| ^^^
|
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

error: unknown disambiguator ``
--> $DIR/unknown-disambiguator.rs:6:31
|
LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()).
| ^
|
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

error: unknown disambiguator ``
--> $DIR/unknown-disambiguator.rs:6:57
|
LL | //! And to [no disambiguator](@nectarine) and [another](@apricot!()).
| ^
|
= note: see https://doc.rust-lang.org/nightly/rustdoc/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators

error: aborting due to 6 previous errors