diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index 1a216ebf117c6..f5761da60f2c2 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -529,6 +529,8 @@ declare_features! (
(unstable, inline_const_pat, "1.58.0", Some(76001)),
/// Allows using `pointer` and `reference` in intra-doc links
(unstable, intra_doc_pointers, "1.51.0", Some(80896)),
+ // Allows using the `kl` and `widekl` target features and the associated intrinsics
+ (unstable, keylocker_x86, "CURRENT_RUSTC_VERSION", Some(134813)),
// Allows setting the threshold for the `large_assignments` lint.
(unstable, large_assignments, "1.52.0", Some(83518)),
/// Allow to have type alias types for inter-crate use.
diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
index 20a728d6d5b2c..0aa61152330a7 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
@@ -155,42 +155,41 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
fn lower_pattern_range_endpoint(
&mut self,
expr: Option<&'tcx hir::PatExpr<'tcx>>,
- ) -> Result<
- (Option>, Option>, Option),
- ErrorGuaranteed,
- > {
- match expr {
- None => Ok((None, None, None)),
- Some(expr) => {
- let (kind, ascr, inline_const) = match self.lower_lit(expr) {
- PatKind::ExpandedConstant { subpattern, def_id, is_inline: true } => {
- (subpattern.kind, None, def_id.as_local())
- }
- PatKind::ExpandedConstant { subpattern, is_inline: false, .. } => {
- (subpattern.kind, None, None)
- }
- PatKind::AscribeUserType { ascription, subpattern: box Pat { kind, .. } } => {
- (kind, Some(ascription), None)
- }
- kind => (kind, None, None),
- };
- let value = match kind {
- PatKind::Constant { value } => value,
- PatKind::ExpandedConstant { subpattern, .. }
- if let PatKind::Constant { value } = subpattern.kind =>
- {
- value
- }
- _ => {
- let msg = format!(
- "found bad range pattern endpoint `{expr:?}` outside of error recovery"
- );
- return Err(self.tcx.dcx().span_delayed_bug(expr.span, msg));
+ // Out-parameters collecting extra data to be reapplied by the caller
+ ascriptions: &mut Vec>,
+ inline_consts: &mut Vec,
+ ) -> Result>, ErrorGuaranteed> {
+ let Some(expr) = expr else { return Ok(None) };
+
+ // Lower the endpoint into a temporary `PatKind` that will then be
+ // deconstructed to obtain the constant value and other data.
+ let mut kind: PatKind<'tcx> = self.lower_lit(expr);
+
+ // Unpeel any ascription or inline-const wrapper nodes.
+ loop {
+ match kind {
+ PatKind::AscribeUserType { ascription, subpattern } => {
+ ascriptions.push(ascription);
+ kind = subpattern.kind;
+ }
+ PatKind::ExpandedConstant { is_inline, def_id, subpattern } => {
+ if is_inline {
+ inline_consts.extend(def_id.as_local());
}
- };
- Ok((Some(PatRangeBoundary::Finite(value)), ascr, inline_const))
+ kind = subpattern.kind;
+ }
+ _ => break,
}
}
+
+ // The unpeeled kind should now be a constant, giving us the endpoint value.
+ let PatKind::Constant { value } = kind else {
+ let msg =
+ format!("found bad range pattern endpoint `{expr:?}` outside of error recovery");
+ return Err(self.tcx.dcx().span_delayed_bug(expr.span, msg));
+ };
+
+ Ok(Some(PatRangeBoundary::Finite(value)))
}
/// Overflowing literals are linted against in a late pass. This is mostly fine, except when we
@@ -253,11 +252,15 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
self.tcx.dcx().span_bug(span, msg);
}
- let (lo, lo_ascr, lo_inline) = self.lower_pattern_range_endpoint(lo_expr)?;
- let (hi, hi_ascr, hi_inline) = self.lower_pattern_range_endpoint(hi_expr)?;
+ // Collect extra data while lowering the endpoints, to be reapplied later.
+ let mut ascriptions = vec![];
+ let mut inline_consts = vec![];
+
+ let mut lower_endpoint =
+ |expr| self.lower_pattern_range_endpoint(expr, &mut ascriptions, &mut inline_consts);
- let lo = lo.unwrap_or(PatRangeBoundary::NegInfinity);
- let hi = hi.unwrap_or(PatRangeBoundary::PosInfinity);
+ let lo = lower_endpoint(lo_expr)?.unwrap_or(PatRangeBoundary::NegInfinity);
+ let hi = lower_endpoint(hi_expr)?.unwrap_or(PatRangeBoundary::PosInfinity);
let cmp = lo.compare_with(hi, ty, self.tcx, self.typing_env);
let mut kind = PatKind::Range(Box::new(PatRange { lo, hi, end, ty }));
@@ -298,13 +301,13 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
// If we are handling a range with associated constants (e.g.
// `Foo::<'a>::A..=Foo::B`), we need to put the ascriptions for the associated
// constants somewhere. Have them on the range pattern.
- for ascription in [lo_ascr, hi_ascr].into_iter().flatten() {
+ for ascription in ascriptions {
kind = PatKind::AscribeUserType {
ascription,
subpattern: Box::new(Pat { span, ty, kind }),
};
}
- for def in [lo_inline, hi_inline].into_iter().flatten() {
+ for def in inline_consts {
kind = PatKind::ExpandedConstant {
def_id: def.to_def_id(),
is_inline: true,
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index b23cc90991154..382b12638f43f 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -1148,6 +1148,7 @@ symbols! {
iterator,
iterator_collect_fn,
kcfi,
+ keylocker_x86,
keyword,
kind,
kreg,
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index 0d8a4988dce0e..38bb9eae03a3b 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -409,6 +409,7 @@ const X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("fma", Stable, &["avx"]),
("fxsr", Stable, &[]),
("gfni", Unstable(sym::avx512_target_feature), &["sse2"]),
+ ("kl", Unstable(sym::keylocker_x86), &["sse2"]),
("lahfsahf", Unstable(sym::lahfsahf_target_feature), &[]),
("lzcnt", Stable, &[]),
("movbe", Stable, &[]),
@@ -433,6 +434,7 @@ const X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("tbm", Unstable(sym::tbm_target_feature), &[]),
("vaes", Unstable(sym::avx512_target_feature), &["avx2", "aes"]),
("vpclmulqdq", Unstable(sym::avx512_target_feature), &["avx", "pclmulqdq"]),
+ ("widekl", Unstable(sym::keylocker_x86), &["kl"]),
("x87", Unstable(sym::x87_target_feature), &[]),
("xop", Unstable(sym::xop_target_feature), &[/*"fma4", */ "avx", "sse4a"]),
("xsave", Stable, &[]),
diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs
index 5fcf7eda8df79..441674936c666 100644
--- a/src/bootstrap/src/bin/main.rs
+++ b/src/bootstrap/src/bin/main.rs
@@ -11,12 +11,12 @@ use std::str::FromStr;
use std::{env, process};
use bootstrap::{
- Build, CONFIG_CHANGE_HISTORY, Config, Flags, Subcommand, find_recent_config_change_ids,
+ Build, CONFIG_CHANGE_HISTORY, Config, Flags, Subcommand, debug, find_recent_config_change_ids,
human_readable_changes, t,
};
use build_helper::ci::CiEnv;
#[cfg(feature = "tracing")]
-use tracing::{debug, instrument};
+use tracing::instrument;
#[cfg_attr(feature = "tracing", instrument(level = "trace", name = "main"))]
fn main() {
@@ -29,10 +29,8 @@ fn main() {
return;
}
- #[cfg(feature = "tracing")]
debug!("parsing flags");
let flags = Flags::parse(&args);
- #[cfg(feature = "tracing")]
debug!("parsing config based on flags");
let config = Config::parse(flags);
@@ -95,7 +93,6 @@ fn main() {
let dump_bootstrap_shims = config.dump_bootstrap_shims;
let out_dir = config.out.clone();
- #[cfg(feature = "tracing")]
debug!("creating new build based on config");
Build::new(config).build();
@@ -207,8 +204,9 @@ fn check_version(config: &Config) -> Option {
// Due to the conditional compilation via the `tracing` cargo feature, this means that `tracing`
// usages in bootstrap need to be also gated behind the `tracing` feature:
//
-// - `tracing` macros (like `trace!`) and anything from `tracing`, `tracing_subscriber` and
-// `tracing-tree` will need to be gated by `#[cfg(feature = "tracing")]`.
+// - `tracing` macros with log levels (`trace!`, `debug!`, `warn!`, `info`, `error`) should not be
+// used *directly*. You should use the wrapped `tracing` macros which gate the actual invocations
+// behind `feature = "tracing"`.
// - `tracing`'s `#[instrument(..)]` macro will need to be gated like `#![cfg_attr(feature =
// "tracing", instrument(..))]`.
#[cfg(feature = "tracing")]
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index f447d186a5242..cd3558ac6a49b 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -339,7 +339,7 @@ fn copy_self_contained_objects(
// to using gcc from a glibc-targeting toolchain for linking.
// To do that we have to distribute musl startup objects as a part of Rust toolchain
// and link with them manually in the self-contained mode.
- if target.contains("musl") && !target.contains("unikraft") {
+ if target.needs_crt_begin_end() {
let srcdir = builder.musl_libdir(target).unwrap_or_else(|| {
panic!("Target {:?} does not have a \"musl-libdir\" key", target.triple)
});
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index 3cf25373b8963..82779dc630634 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -1295,7 +1295,9 @@ impl Step for CrtBeginEnd {
}
fn make_run(run: RunConfig<'_>) {
- run.builder.ensure(CrtBeginEnd { target: run.target });
+ if run.target.needs_crt_begin_end() {
+ run.builder.ensure(CrtBeginEnd { target: run.target });
+ }
}
/// Build crtbegin.o/crtend.o for musl target.
diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
index f6a03a386d170..2ecab262413fa 100644
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -659,7 +659,10 @@ impl Builder<'_> {
// Build proc macros both for the host and the target unless proc-macros are not
// supported by the target.
if target != compiler.host && cmd_kind != Kind::Check {
- let error = command(self.rustc(compiler))
+ let mut rustc_cmd = command(self.rustc(compiler));
+ self.add_rustc_lib_path(compiler, &mut rustc_cmd);
+
+ let error = rustc_cmd
.arg("--target")
.arg(target.rustc_target_arg())
.arg("--print=file-names")
@@ -667,6 +670,7 @@ impl Builder<'_> {
.arg("-")
.run_capture(self)
.stderr();
+
let not_supported = error
.lines()
.any(|line| line.contains("unsupported crate type `proc-macro`"));
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 781d0e602c339..4694dd2ca4e2e 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -575,6 +575,10 @@ impl TargetSelection {
env::var("OSTYPE").is_ok_and(|v| v.to_lowercase().contains("cygwin"))
}
+ pub fn needs_crt_begin_end(&self) -> bool {
+ self.contains("musl") && !self.contains("unikraft")
+ }
+
/// Path to the file defining the custom target, if any.
pub fn filepath(&self) -> Option<&Path> {
self.file.as_ref().map(Path::new)
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index d56f35f866cb8..2dd83d5938e9d 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -28,8 +28,6 @@ use std::{env, fs, io, str};
use build_helper::ci::gha;
use build_helper::exit;
use termcolor::{ColorChoice, StandardStream, WriteColor};
-#[cfg(feature = "tracing")]
-use tracing::{debug, instrument, span, trace};
use utils::build_stamp::BuildStamp;
use utils::channel::GitInfo;
@@ -46,6 +44,8 @@ pub use core::builder::PathSet;
pub use core::config::Config;
pub use core::config::flags::{Flags, Subcommand};
+#[cfg(feature = "tracing")]
+use tracing::{instrument, span};
pub use utils::change_tracker::{
CONFIG_CHANGE_HISTORY, find_recent_config_change_ids, human_readable_changes,
};
@@ -541,72 +541,71 @@ impl Build {
/// Executes the entire build, as configured by the flags and configuration.
#[cfg_attr(feature = "tracing", instrument(level = "debug", name = "Build::build", skip_all))]
pub fn build(&mut self) {
- #[cfg(feature = "tracing")]
trace!("setting up job management");
unsafe {
crate::utils::job::setup(self);
}
- #[cfg(feature = "tracing")]
- trace!("downloading rustfmt early");
-
// Download rustfmt early so that it can be used in rust-analyzer configs.
+ trace!("downloading rustfmt early");
let _ = &builder::Builder::new(self).initial_rustfmt();
- #[cfg(feature = "tracing")]
- let hardcoded_span =
- span!(tracing::Level::DEBUG, "handling hardcoded subcommands (Format, Suggest, Perf)")
- .entered();
-
- // hardcoded subcommands
- match &self.config.cmd {
- Subcommand::Format { check, all } => {
- return core::build_steps::format::format(
- &builder::Builder::new(self),
- *check,
- *all,
- &self.config.paths,
- );
- }
- Subcommand::Suggest { run } => {
- return core::build_steps::suggest::suggest(&builder::Builder::new(self), *run);
- }
- Subcommand::Perf { .. } => {
- return core::build_steps::perf::perf(&builder::Builder::new(self));
- }
- _cmd => {
- #[cfg(feature = "tracing")]
- debug!(cmd = ?_cmd, "not a hardcoded subcommand; returning to normal handling");
+ // Handle hard-coded subcommands.
+ {
+ #[cfg(feature = "tracing")]
+ let _hardcoded_span = span!(
+ tracing::Level::DEBUG,
+ "handling hardcoded subcommands (Format, Suggest, Perf)"
+ )
+ .entered();
+
+ match &self.config.cmd {
+ Subcommand::Format { check, all } => {
+ return core::build_steps::format::format(
+ &builder::Builder::new(self),
+ *check,
+ *all,
+ &self.config.paths,
+ );
+ }
+ Subcommand::Suggest { run } => {
+ return core::build_steps::suggest::suggest(&builder::Builder::new(self), *run);
+ }
+ Subcommand::Perf { .. } => {
+ return core::build_steps::perf::perf(&builder::Builder::new(self));
+ }
+ _cmd => {
+ debug!(cmd = ?_cmd, "not a hardcoded subcommand; returning to normal handling");
+ }
}
- }
- #[cfg(feature = "tracing")]
- drop(hardcoded_span);
- #[cfg(feature = "tracing")]
- debug!("handling subcommand normally");
+ debug!("handling subcommand normally");
+ }
if !self.config.dry_run() {
#[cfg(feature = "tracing")]
let _real_run_span = span!(tracing::Level::DEBUG, "executing real run").entered();
+ // We first do a dry-run. This is a sanity-check to ensure that
+ // steps don't do anything expensive in the dry-run.
{
#[cfg(feature = "tracing")]
let _sanity_check_span =
span!(tracing::Level::DEBUG, "(1) executing dry-run sanity-check").entered();
-
- // We first do a dry-run. This is a sanity-check to ensure that
- // steps don't do anything expensive in the dry-run.
self.config.dry_run = DryRun::SelfCheck;
let builder = builder::Builder::new(self);
builder.execute_cli();
}
- #[cfg(feature = "tracing")]
- let _actual_run_span =
- span!(tracing::Level::DEBUG, "(2) executing actual run").entered();
- self.config.dry_run = DryRun::Disabled;
- let builder = builder::Builder::new(self);
- builder.execute_cli();
+ // Actual run.
+ {
+ #[cfg(feature = "tracing")]
+ let _actual_run_span =
+ span!(tracing::Level::DEBUG, "(2) executing actual run").entered();
+ self.config.dry_run = DryRun::Disabled;
+ let builder = builder::Builder::new(self);
+ builder.execute_cli();
+ }
} else {
#[cfg(feature = "tracing")]
let _dry_run_span = span!(tracing::Level::DEBUG, "executing dry run").entered();
diff --git a/src/bootstrap/src/utils/mod.rs b/src/bootstrap/src/utils/mod.rs
index ea56932b40437..caef8ce3088a7 100644
--- a/src/bootstrap/src/utils/mod.rs
+++ b/src/bootstrap/src/utils/mod.rs
@@ -14,6 +14,8 @@ pub(crate) mod render_tests;
pub(crate) mod shared_helpers;
pub(crate) mod tarball;
+pub(crate) mod tracing;
+
#[cfg(feature = "build-metrics")]
pub(crate) mod metrics;
diff --git a/src/bootstrap/src/utils/tracing.rs b/src/bootstrap/src/utils/tracing.rs
new file mode 100644
index 0000000000000..9cd3b6165be61
--- /dev/null
+++ b/src/bootstrap/src/utils/tracing.rs
@@ -0,0 +1,49 @@
+//! Wrapper macros for [`tracing`] macros to avoid having to write `cfg(feature = "tracing")`-gated
+//! `debug!`/`trace!` everytime, e.g.
+//!
+//! ```rust,ignore (example)
+//! #[cfg(feature = "tracing")]
+//! trace!("...");
+//! ```
+//!
+//! When `feature = "tracing"` is inactive, these macros expand to nothing.
+
+#[macro_export]
+macro_rules! trace {
+ ($($tokens:tt)*) => {
+ #[cfg(feature = "tracing")]
+ ::tracing::trace!($($tokens)*)
+ }
+}
+
+#[macro_export]
+macro_rules! debug {
+ ($($tokens:tt)*) => {
+ #[cfg(feature = "tracing")]
+ ::tracing::debug!($($tokens)*)
+ }
+}
+
+#[macro_export]
+macro_rules! warn {
+ ($($tokens:tt)*) => {
+ #[cfg(feature = "tracing")]
+ ::tracing::warn!($($tokens)*)
+ }
+}
+
+#[macro_export]
+macro_rules! info {
+ ($($tokens:tt)*) => {
+ #[cfg(feature = "tracing")]
+ ::tracing::info!($($tokens)*)
+ }
+}
+
+#[macro_export]
+macro_rules! error {
+ ($($tokens:tt)*) => {
+ #[cfg(feature = "tracing")]
+ ::tracing::error!($($tokens)*)
+ }
+}
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 7853e311a040c..f13428fc4203c 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1934,7 +1934,7 @@ fn can_elide_trait_object_lifetime_bound<'tcx>(
preds: &'tcx ty::List>,
tcx: TyCtxt<'tcx>,
) -> bool {
- // Below we quote extracts from https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes
+ // Below we quote extracts from https://doc.rust-lang.org/stable/reference/lifetime-elision.html#default-trait-object-lifetimes
// > If the trait object is used as a type argument of a generic type then the containing type is
// > first used to try to infer a bound.
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs
index 0b4fd9c22589c..f1921b90cc686 100644
--- a/src/librustdoc/clean/utils.rs
+++ b/src/librustdoc/clean/utils.rs
@@ -588,9 +588,9 @@ pub(crate) fn attrs_have_doc_flag<'a>(
/// so that the channel is consistent.
///
/// Set by `bootstrap::Builder::doc_rust_lang_org_channel` in order to keep tests passing on beta/stable.
-pub(crate) const DOC_RUST_LANG_ORG_CHANNEL: &str = env!("DOC_RUST_LANG_ORG_CHANNEL");
-pub(crate) static DOC_CHANNEL: Lazy<&'static str> =
- Lazy::new(|| DOC_RUST_LANG_ORG_CHANNEL.rsplit('/').find(|c| !c.is_empty()).unwrap());
+pub(crate) const DOC_RUST_LANG_ORG_VERSION: &str = env!("DOC_RUST_LANG_ORG_CHANNEL");
+pub(crate) static RUSTDOC_VERSION: Lazy<&'static str> =
+ Lazy::new(|| DOC_RUST_LANG_ORG_VERSION.rsplit('/').find(|c| !c.is_empty()).unwrap());
/// Render a sequence of macro arms in a format suitable for displaying to the user
/// as part of an item declaration.
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index a072b1256f479..6af35157a43df 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -387,7 +387,7 @@ pub(crate) fn run_global_ctxt(
let help = format!(
"The following guide may be of use:\n\
{}/rustdoc/how-to-write-documentation.html",
- crate::DOC_RUST_LANG_ORG_CHANNEL
+ crate::DOC_RUST_LANG_ORG_VERSION
);
tcx.node_lint(
crate::lint::MISSING_CRATE_LEVEL_DOCS,
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index b4bc0b80d6c66..d957cf1b569e3 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -112,7 +112,7 @@ pub(crate) fn render(
display_krate_with_trailing_slash,
display_krate_version_number,
display_krate_version_extra,
- rust_channel: *crate::clean::utils::DOC_CHANNEL,
+ rust_channel: *crate::clean::utils::RUSTDOC_VERSION,
rustdoc_version,
}
.render()
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 5d96dbc0ee659..1cefdf96bbcd2 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -32,7 +32,7 @@ use crate::html::render::write_shared::write_shared;
use crate::html::url_parts_builder::UrlPartsBuilder;
use crate::html::{layout, sources, static_files};
use crate::scrape_examples::AllCallLocations;
-use crate::try_err;
+use crate::{DOC_RUST_LANG_ORG_VERSION, try_err};
/// Major driving force in all rustdoc rendering. This contains information
/// about where in the tree-like hierarchy rendering is occurring and controls
@@ -730,7 +730,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
\
\
You need to enable JavaScript to use keyboard commands or search.
\
- For more information, browse the rustdoc handbook .
\
+ For more information, browse the rustdoc handbook .
\
\
",
)
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index a27a9d202eb80..f7dcb87e4f3d0 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -79,7 +79,7 @@ use crate::html::markdown::{
use crate::html::static_files::SCRAPE_EXAMPLES_HELP_MD;
use crate::html::{highlight, sources};
use crate::scrape_examples::{CallData, CallLocation};
-use crate::{DOC_RUST_LANG_ORG_CHANNEL, try_none};
+use crate::{DOC_RUST_LANG_ORG_VERSION, try_none};
pub(crate) fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
fmt::from_fn(move |f| {
@@ -480,7 +480,7 @@ fn scrape_examples_help(shared: &SharedContext<'_>) -> String {
content.push_str(&format!(
"## More information\n\n\
If you want more information about this feature, please read the [corresponding chapter in \
- the Rustdoc book]({DOC_RUST_LANG_ORG_CHANNEL}/rustdoc/scraped-examples.html)."
+ the Rustdoc book]({DOC_RUST_LANG_ORG_VERSION}/rustdoc/scraped-examples.html)."
));
let mut ids = IdMap::default();
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 37fea09ace310..c50adf116160a 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -924,7 +924,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
dyn compatible .
\
In older versions of Rust, dyn compatibility was called \"object safety\", \
so this trait is not object safe.
",
- base = crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL
+ base = crate::clean::utils::DOC_RUST_LANG_ORG_VERSION
),
);
}
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index ccf4002bb300d..bfd5cb7764fd4 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -1534,10 +1534,10 @@ function preLoadCss(cssUrl) {
function buildHelpMenu() {
const book_info = document.createElement("span");
- const channel = getVar("channel");
+ const drloChannel = `https://doc.rust-lang.org/${getVar("channel")}`;
book_info.className = "top";
book_info.innerHTML = `You can find more information in \
-the rustdoc book .`;
+the rustdoc book .`;
const shortcuts = [
["?", "Show this help dialog"],
@@ -1557,8 +1557,8 @@ function preLoadCss(cssUrl) {
div_shortcuts.innerHTML = "Keyboard Shortcuts " + shortcuts + " ";
const infos = [
- `For a full list of all search features, take a look here .`,
+ `For a full list of all search features, take a look \
+ here .`,
"Prefix searches with a type followed by a colon (e.g., fn:
) to \
restrict the search to a given item kind.",
"Accepted kinds are: fn
, mod
, struct
, \
@@ -1568,10 +1568,10 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
-> vec
or String, enum:Cow -> bool
)",
"You can look for items with an exact name by putting double quotes around \
your request: \"string\"
",
- "Look for functions that accept or return \
- slices and \
- arrays by writing \
- square brackets (e.g., -> [u8]
or [] -> Option
)",
+ `Look for functions that accept or return \
+ slices and \
+ arrays by writing square \
+ brackets (e.g., -> [u8]
or [] -> Option
)`,
"Look for items inside another one by searching for a path: vec::Vec
",
].map(x => "" + x + "
").join("");
const div_infos = document.createElement("div");
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 1ad32721e0687..662e951069973 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1,5 +1,5 @@
// ignore-tidy-filelength
-/* global addClass, getNakedUrl, getSettingValue */
+/* global addClass, getNakedUrl, getSettingValue, getVar */
/* global onEachLazy, removeClass, searchState, browserSupportsHistoryApi, exports */
"use strict";
@@ -4923,17 +4923,18 @@ ${item.displayPath}${name} \
}
});
} else if (query.error === null) {
+ const dlroChannel = `https://doc.rust-lang.org/${getVar("channel")}`;
output.className = "search-failed" + extraClass;
output.innerHTML = "No results :( " +
"Try on DuckDuckGo ? " +
"Or try looking in one of these:";
diff --git a/src/librustdoc/html/templates/type_layout.html b/src/librustdoc/html/templates/type_layout.html
index 9c62826ccc2e3..0034552bdd3b7 100644
--- a/src/librustdoc/html/templates/type_layout.html
+++ b/src/librustdoc/html/templates/type_layout.html
@@ -10,7 +10,7 @@