Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
dc49fdd
Add `kl` and `widekl` target features, and the feature gate
sayantn Dec 27, 2024
a063cf5
fix(rustdoc): always use a channel when linking to doc.rust-lang.org
poliorcetics Dec 26, 2024
139d6ba
set rustc dylib on manually constructed rustc command
onur-ozkan Jan 30, 2025
88260f4
bootstrap: only build `crt{begin,end}.o` when compiling to MUSL
japaric Jan 21, 2025
acb3bab
bootstrap: add wrapper macros for `tracing`-gated tracing macros
jieyouxu Jan 31, 2025
0878692
Ported tests/ui/simd to use the intrinsic macro
vayunbiyani Jan 21, 2025
5465770
Pretty print pattern type values with `transmute` if they don't satis…
oli-obk Jan 29, 2025
7de67a1
Flatten the option check in `lower_pattern_range_endpoint`
Zalathar Feb 3, 2025
85f4cdc
Return range endpoint ascriptions/consts via a `&mut Vec`
Zalathar Feb 3, 2025
2fb1261
Simplify the pattern unpeeling in `lower_pattern_range_endpoint`
Zalathar Feb 3, 2025
8ba9efd
Rollup merge of #134807 - poliorcetics:ab/push-skpynvsmwkll, r=camelid
jieyouxu Feb 3, 2025
1c368e4
Rollup merge of #134814 - sayantn:keylocker, r=oli-obk
jieyouxu Feb 3, 2025
b53310c
Rollup merge of #135836 - ferrocene:ja-gh135782-build-crt-only-for-mu…
jieyouxu Feb 3, 2025
1f3c713
Rollup merge of #136022 - vayunbiyani:port_tests, r=RalfJung
jieyouxu Feb 3, 2025
2542aca
Rollup merge of #136235 - oli-obk:transmuty-pat-tys, r=RalfJung
jieyouxu Feb 3, 2025
a60a7c3
Rollup merge of #136309 - onur-ozkan:133629, r=jieyouxu
jieyouxu Feb 3, 2025
6f7ec37
Rollup merge of #136392 - jieyouxu:wrap-tracing, r=onur-ozkan
jieyouxu Feb 3, 2025
74901e2
Rollup merge of #136462 - Zalathar:endpoint, r=oli-obk
jieyouxu Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(rustdoc): always use a channel when linking to doc.rust-lang.org
  • Loading branch information
poliorcetics committed Jan 30, 2025
commit a063cf5f1c151873f753905c75d8e67115308f9d
2 changes: 1 addition & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ fn can_elide_trait_object_lifetime_bound<'tcx>(
preds: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
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.
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,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.
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub(crate) fn render<T: Print, S: Print>(
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()
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -730,7 +730,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
<noscript>\
<section>\
<p>You need to enable JavaScript to use keyboard commands or search.</p>\
<p>For more information, browse the <a href=\"https://doc.rust-lang.org/rustdoc/\">rustdoc handbook</a>.</p>\
<p>For more information, browse the <a href=\"{DOC_RUST_LANG_ORG_VERSION}/rustdoc/\">rustdoc handbook</a>.</p>\
</section>\
</noscript>",
)
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
<a href=\"{base}/reference/items/traits.html#dyn-compatibility\">dyn compatible</a>.</p>\
<p><i>In older versions of Rust, dyn compatibility was called \"object safety\", \
so this trait is not object safe.</i></p></div>",
base = crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL
base = crate::clean::utils::DOC_RUST_LANG_ORG_VERSION
),
);
}
Expand Down
16 changes: 8 additions & 8 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
<a href="https://doc.rust-lang.org/${channel}/rustdoc/">the rustdoc book</a>.`;
<a href="${drloChannel}/rustdoc/">the rustdoc book</a>.`;

const shortcuts = [
["?", "Show this help dialog"],
Expand All @@ -1557,8 +1557,8 @@ function preLoadCss(cssUrl) {
div_shortcuts.innerHTML = "<h2>Keyboard Shortcuts</h2><dl>" + shortcuts + "</dl></div>";

const infos = [
`For a full list of all search features, take a look <a \
href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.html">here</a>.`,
`For a full list of all search features, take a look \
<a href="${drloChannel}/rustdoc/read-documentation/search.html">here</a>.`,
"Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to \
restrict the search to a given item kind.",
"Accepted kinds are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \
Expand All @@ -1568,10 +1568,10 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
<code>-&gt; vec</code> or <code>String, enum:Cow -&gt; bool</code>)",
"You can look for items with an exact name by putting double quotes around \
your request: <code>\"string\"</code>",
"Look for functions that accept or return \
<a href=\"https://doc.rust-lang.org/std/primitive.slice.html\">slices</a> and \
<a href=\"https://doc.rust-lang.org/std/primitive.array.html\">arrays</a> by writing \
square brackets (e.g., <code>-&gt; [u8]</code> or <code>[] -&gt; Option</code>)",
`Look for functions that accept or return \
<a href="${drloChannel}/std/primitive.slice.html">slices</a> and \
<a href="${drloChannel}/std/primitive.array.html">arrays</a> by writing square \
brackets (e.g., <code>-&gt; [u8]</code> or <code>[] -&gt; Option</code>)`,
"Look for items inside another one by searching for a path: <code>vec::Vec</code>",
].map(x => "<p>" + x + "</p>").join("");
const div_infos = document.createElement("div");
Expand Down
9 changes: 5 additions & 4 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ignore-tidy-filelength
/* global addClass, getNakedUrl, getSettingValue */
/* global addClass, getNakedUrl, getSettingValue, getVar */
/* global onEachLazy, removeClass, searchState, browserSupportsHistoryApi, exports */

"use strict";
Expand Down Expand Up @@ -4923,17 +4923,18 @@ ${item.displayPath}<span class="${type}">${name}</span>\
}
});
} else if (query.error === null) {
const dlroChannel = `https://doc.rust-lang.org/${getVar("channel")}`;
output.className = "search-failed" + extraClass;
output.innerHTML = "No results :(<br/>" +
"Try on <a href=\"https://duckduckgo.com/?q=" +
encodeURIComponent("rust " + query.userQuery) +
"\">DuckDuckGo</a>?<br/><br/>" +
"Or try looking in one of these:<ul><li>The <a " +
"href=\"https://doc.rust-lang.org/reference/index.html\">Rust Reference</a> " +
`href="${dlroChannel}/reference/index.html">Rust Reference</a> ` +
" for technical details about the language.</li><li><a " +
"href=\"https://doc.rust-lang.org/rust-by-example/index.html\">Rust By " +
`href="${dlroChannel}/rust-by-example/index.html">Rust By ` +
"Example</a> for expository code examples.</a></li><li>The <a " +
"href=\"https://doc.rust-lang.org/book/index.html\">Rust Book</a> for " +
`href="${dlroChannel}/book/index.html">Rust Book</a> for ` +
"introductions to language features and the language itself.</li><li><a " +
"href=\"https://docs.rs\">Docs.rs</a> for documentation of crates released on" +
" <a href=\"https://crates.io/\">crates.io</a>.</li></ul>";
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/type_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h2 id="layout" class="section-header"> {# #}
unstable</strong> and may even differ between compilations. {#+ #}
The only exception is types with certain <code>repr(...)</code> {#+ #}
attributes. Please see the Rust Reference's {#+ #}
<a href="https://doc.rust-lang.org/reference/type-layout.html">“Type Layout”</a> {#+ #}
<a href="{{ crate::DOC_RUST_LANG_ORG_VERSION }}/reference/type-layout.html">“Type Layout”</a> {#+ #}
chapter for details on type layout guarantees. {# #}
</p> {# #}
</div> {# #}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/type_layout_size.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
{{ size +}} bytes
{% endif %}
{% if is_uninhabited %}
{# +#} (<a href="https://doc.rust-lang.org/stable/reference/glossary.html#uninhabited">uninhabited</a>)
{# +#} (<a href="{{ crate::DOC_RUST_LANG_ORG_VERSION }}/reference/glossary.html#uninhabited">uninhabited</a>)
{% endif %}
{% endif %}
4 changes: 2 additions & 2 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ use rustc_session::config::{ErrorOutputType, RustcOptGroup, make_crate_type_opti
use rustc_session::{EarlyDiagCtxt, getopts};
use tracing::info;

use crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL;
use crate::clean::utils::DOC_RUST_LANG_ORG_VERSION;

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

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ fn disambiguator_error(
report_diagnostic(cx.tcx, BROKEN_INTRA_DOC_LINKS, msg, &diag_info, |diag, _sp, _link_range| {
let msg = format!(
"see {}/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators",
crate::DOC_RUST_LANG_ORG_CHANNEL
crate::DOC_RUST_LANG_ORG_VERSION
);
diag.note(msg);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/rustdoc/type-layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ pub enum WithNiche {
}

//@ hasraw type_layout/enum.Uninhabited.html 'Size: '
//@ hasraw - '0 bytes (<a href="https://doc.rust-lang.org/stable/reference/glossary.html#uninhabited">uninhabited</a>)'
//@ hasraw - '0 bytes (<a href="{{channel}}/reference/glossary.html#uninhabited">uninhabited</a>)'
pub enum Uninhabited {}

//@ hasraw type_layout/struct.Uninhabited2.html 'Size: '
//@ hasraw - '8 bytes (<a href="https://doc.rust-lang.org/stable/reference/glossary.html#uninhabited">uninhabited</a>)'
//@ hasraw - '8 bytes (<a href="{{channel}}/reference/glossary.html#uninhabited">uninhabited</a>)'
pub struct Uninhabited2(std::convert::Infallible, u64);

pub trait Project { type Assoc; }
Expand Down
Loading