Skip to content

Rollup of 10 pull requests #140877

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
307a67a
Replace flag `--doctest-compilation-args` with a simpler one: `--doct…
fmease Apr 15, 2025
ca42f15
update hermit-abi to 0.5.1
mkroening May 7, 2025
71e767f
also export metrics from librustdoc
yaahc May 8, 2025
b67549e
Add regression test for 125877
reddevilmidzy May 8, 2025
d9f513f
run-make-support: support "ejecting" the underlying std command
jieyouxu May 9, 2025
84ed40d
tests: fix `broken-pipe-no-ice` to use `bare_rustc`/`rustc`
jieyouxu May 9, 2025
fc20650
Error message for top-level or-patterns suggesting a solution
kornelski May 9, 2025
577e82f
Update the edition guide for let chains
est31 May 9, 2025
3caca6d
fix new apis being marked as becoming const this release
pietroalbini May 9, 2025
cb25349
update links to point to stable
pietroalbini May 9, 2025
3c8efb5
update wording
pietroalbini May 9, 2025
35679ba
Enable non-leaf Frame Pointers for Arm64EC Windows
dpaoliello May 9, 2025
3fa98a1
rustdoc: add a handle that makes sidebar resizing more obvious
notriddle Apr 8, 2025
3c9e1f9
rustdoc: add tooltip to resize track
notriddle Apr 9, 2025
e6e5206
rustdoc: use a different style of grip track
notriddle Apr 11, 2025
2efa964
Rollup merge of #139562 - notriddle:notriddle/ew-resize, r=GuillaumeG…
GuillaumeGomez May 9, 2025
c4c4266
Rollup merge of #139863 - fmease:simp-doctest-build-arg-passing, r=Gu…
GuillaumeGomez May 9, 2025
af5d9e8
Rollup merge of #140789 - hermit-os:hermit-abi-0.5.1, r=Mark-Simulacrum
GuillaumeGomez May 9, 2025
9057ec7
Rollup merge of #140815 - yaahc:rustdoc-metrics, r=GuillaumeGomez
GuillaumeGomez May 9, 2025
98ea9fd
Rollup merge of #140819 - reddevilmidzy:add-test, r=petrochenkov
GuillaumeGomez May 9, 2025
c19c59e
Rollup merge of #140843 - jieyouxu:broken-pipe, r=Kobzol
GuillaumeGomez May 9, 2025
b37529c
Rollup merge of #140848 - kornelski:not-a-dead-end, r=compiler-errors
GuillaumeGomez May 9, 2025
7e0d0e4
Rollup merge of #140852 - est31:edition_guide_let_chains, r=ehuss
GuillaumeGomez May 9, 2025
11f54d3
Rollup merge of #140862 - dpaoliello:arm64ecfp, r=wesleywiser
GuillaumeGomez May 9, 2025
259e0b4
Rollup merge of #140864 - pietroalbini:pa-fix-relnotes, r=BoxyUwU
GuillaumeGomez May 9, 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
152 changes: 76 additions & 76 deletions RELEASES.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiler/rustc_parse/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ parse_nul_in_c_str = null characters in C string literals are not supported
parse_or_in_let_chain = `||` operators are not supported in let chain conditions
parse_or_pattern_not_allowed_in_fn_parameters = top-level or-patterns are not allowed in function parameters
parse_or_pattern_not_allowed_in_let_binding = top-level or-patterns are not allowed in `let` bindings
parse_or_pattern_not_allowed_in_fn_parameters = function parameters require top-level or-patterns in parentheses
parse_or_pattern_not_allowed_in_let_binding = `let` bindings require top-level or-patterns in parentheses
parse_out_of_range_hex_escape = out of range hex escape
.label = must be a character in the range [\x00-\x7f]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Lld, Target, TargetMetadata, add_link_args, base};
use crate::spec::{FramePointer, LinkerFlavor, Lld, Target, TargetMetadata, add_link_args, base};

pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
Expand All @@ -10,6 +10,12 @@ pub(crate) fn target() -> Target {
&["/machine:arm64ec", "softintrin.lib"],
);

// Microsoft recommends enabling frame pointers on Arm64 Windows.
// From https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers
// "The frame pointer (x29) is required for compatibility with fast stack walking used by ETW
// and other services. It must point to the previous {x29, x30} pair on the stack."
base.frame_pointer = FramePointer::NonLeaf;

Target {
llvm_target: "arm64ec-pc-windows-msvc".into(),
metadata: TargetMetadata {
Expand Down
4 changes: 2 additions & 2 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ dependencies = [

[[package]]
name = "hermit-abi"
version = "0.5.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e"
checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-alloc",
Expand Down
2 changes: 1 addition & 1 deletion src/doc/edition-guide
6 changes: 3 additions & 3 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub(crate) struct Options {
pub(crate) expanded_args: Vec<String>,

/// Arguments to be used when compiling doctests.
pub(crate) doctest_compilation_args: Vec<String>,
pub(crate) doctest_build_args: Vec<String>,
}

impl fmt::Debug for Options {
Expand Down Expand Up @@ -802,7 +802,7 @@ impl Options {
let scrape_examples_options = ScrapeExamplesOptions::new(matches, dcx);
let with_examples = matches.opt_strs("with-examples");
let call_locations = crate::scrape_examples::load_call_locations(with_examples, dcx);
let doctest_compilation_args = matches.opt_strs("doctest-compilation-args");
let doctest_build_args = matches.opt_strs("doctest-build-arg");

let unstable_features =
rustc_feature::UnstableFeatures::from_environment(crate_name.as_deref());
Expand Down Expand Up @@ -851,7 +851,7 @@ impl Options {
scrape_examples_options,
unstable_features,
expanded_args: args,
doctest_compilation_args,
doctest_build_args,
};
let render_options = RenderOptions {
output,
Expand Down
44 changes: 1 addition & 43 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,46 +51,6 @@ pub(crate) struct GlobalTestOptions {
pub(crate) args_file: PathBuf,
}

/// Function used to split command line arguments just like a shell would.
fn split_args(args: &str) -> Vec<String> {
let mut out = Vec::new();
let mut iter = args.chars();
let mut current = String::new();

while let Some(c) = iter.next() {
if c == '\\' {
if let Some(c) = iter.next() {
// If it's escaped, even a quote or a whitespace will be ignored.
current.push(c);
}
} else if c == '"' || c == '\'' {
while let Some(new_c) = iter.next() {
if new_c == c {
break;
} else if new_c == '\\' {
if let Some(c) = iter.next() {
// If it's escaped, even a quote will be ignored.
current.push(c);
}
} else {
current.push(new_c);
}
}
} else if " \n\t\r".contains(c) {
if !current.is_empty() {
out.push(current.clone());
current.clear();
}
} else {
current.push(c);
}
}
if !current.is_empty() {
out.push(current);
}
out
}

pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) -> Result<(), String> {
let mut file = File::create(file_path)
.map_err(|error| format!("failed to create args file: {error:?}"))?;
Expand Down Expand Up @@ -119,9 +79,7 @@ pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) ->
content.push(format!("-Z{unstable_option_str}"));
}

for compilation_args in &options.doctest_compilation_args {
content.extend(split_args(compilation_args));
}
content.extend(options.doctest_build_args.clone());

let content = content.join("\n");

Expand Down
22 changes: 0 additions & 22 deletions src/librustdoc/doctest/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,28 +381,6 @@ fn main() {
assert_eq!((output, len), (expected, 1));
}

#[test]
fn check_split_args() {
fn compare(input: &str, expected: &[&str]) {
let output = super::split_args(input);
let expected = expected.iter().map(|s| s.to_string()).collect::<Vec<_>>();
assert_eq!(expected, output, "test failed for {input:?}");
}

compare("'a' \"b\"c", &["a", "bc"]);
compare("'a' \"b \"c d", &["a", "b c", "d"]);
compare("'a' \"b\\\"c\"", &["a", "b\"c"]);
compare("'a\"'", &["a\""]);
compare("\"a'\"", &["a'"]);
compare("\\ a", &[" a"]);
compare("\\\\", &["\\"]);
compare("a'", &["a"]);
compare("a ", &["a"]);
compare("a b", &["a", "b"]);
compare("a\n\t \rb", &["a", "b"]);
compare("a\n\t1 \rb", &["a", "1", "b"]);
}

#[test]
fn comment_in_attrs() {
// If there is an inline code comment after attributes, we need to ensure that
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/css/noscript.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ nav.sub {
--settings-button-border-focus: #717171;
--sidebar-background-color: #f5f5f5;
--sidebar-background-color-hover: #e0e0e0;
--sidebar-border-color: #ddd;
--code-block-background-color: #f5f5f5;
--scrollbar-track-background-color: #dcdcdc;
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
Expand Down Expand Up @@ -149,6 +150,7 @@ nav.sub {
--settings-button-border-focus: #ffb900;
--sidebar-background-color: #505050;
--sidebar-background-color-hover: #676767;
--sidebar-border-color: #2A2A2A;
--code-block-background-color: #2A2A2A;
--scrollbar-track-background-color: #717171;
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);
Expand Down
52 changes: 38 additions & 14 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* When static files are updated, their suffixes need to be updated.
/* ignore-tidy-filelength */
/*
When static files are updated, their suffixes need to be updated.
1. In the top directory run:
./x.py doc --stage 1 library/core
2. Find the directory containing files named with updated suffixes:
Expand Down Expand Up @@ -496,12 +498,13 @@ img {
top: 0;
left: 0;
z-index: var(--desktop-sidebar-z-index);
/* resize indicator: hide this when on touch or mobile */
border-right: solid 1px var(--sidebar-border-color);
}

.rustdoc.src .sidebar {
flex-basis: 50px;
width: 50px;
border-right: 1px solid;
overflow-x: hidden;
/* The sidebar is by default hidden */
overflow-y: hidden;
Expand All @@ -515,12 +518,27 @@ img {
.sidebar-resizer {
touch-action: none;
width: 9px;
cursor: col-resize;
cursor: ew-resize;
z-index: calc(var(--desktop-sidebar-z-index) + 1);
position: fixed;
height: 100%;
/* make sure there's a 1px gap between the scrollbar and resize handle */
left: calc(var(--desktop-sidebar-width) + 1px);
left: var(--desktop-sidebar-width);
display: flex;
align-items: center;
justify-content: flex-start;
color: var(--right-side-color);
}
.sidebar-resizer::before {
content: "";
border-right: dotted 2px currentColor;
width: 2px;
height: 12px;
}
.sidebar-resizer::after {
content: "";
border-right: dotted 2px currentColor;
width: 2px;
height: 16px;
}

.rustdoc.src .sidebar-resizer {
Expand All @@ -543,11 +561,12 @@ img {
}

.sidebar-resizing * {
cursor: col-resize !important;
cursor: ew-resize !important;
}

.sidebar-resizing .sidebar {
position: fixed;
border-right: solid 2px var(--sidebar-resizer-active);
}
.sidebar-resizing > body {
padding-left: var(--resizing-sidebar-width);
Expand All @@ -561,8 +580,9 @@ img {
margin: 0;
/* when active or hovered, place resizer glow on top of the sidebar (right next to, or even
on top of, the scrollbar) */
left: var(--desktop-sidebar-width);
left: calc(var(--desktop-sidebar-width) - 1px);
border-left: solid 1px var(--sidebar-resizer-hover);
color: var(--sidebar-resizer-hover);
}

.src-sidebar-expanded .rustdoc.src .sidebar-resizer:hover,
Expand All @@ -578,21 +598,20 @@ img {
/* too easy to hit the resizer while trying to hit the [-] toggle */
display: none !important;
}
.sidebar {
/* resize indicator: hide this when on touch or mobile */
border-right: none;
}
}

.sidebar-resizer.active {
/* make the resize tool bigger when actually resizing, to avoid :hover styles on other stuff
while resizing */
padding: 0 140px;
width: 2px;
width: calc(140px + 140px + 9px + 2px);
margin-left: -140px;
border-left: none;
}
.sidebar-resizer.active::before {
border-left: solid 2px var(--sidebar-resizer-active);
display: block;
height: 100%;
content: "";
color: var(--sidebar-resizer-active);
}

.sidebar, .mobile-topbar, .sidebar-menu-toggle,
Expand Down Expand Up @@ -2509,6 +2528,8 @@ in src-script.js and main.js
/* Reduce height slightly to account for mobile topbar. */
height: calc(100vh - 45px);
width: 200px;
/* resize indicator: hide this when on touch or mobile */
border-right: none;
}

/* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
Expand Down Expand Up @@ -2897,6 +2918,7 @@ by default.
--settings-button-border-focus: #717171;
--sidebar-background-color: #f5f5f5;
--sidebar-background-color-hover: #e0e0e0;
--sidebar-border-color: #ddd;
--code-block-background-color: #f5f5f5;
--scrollbar-track-background-color: #dcdcdc;
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
Expand Down Expand Up @@ -3002,6 +3024,7 @@ by default.
--settings-button-border-focus: #ffb900;
--sidebar-background-color: #505050;
--sidebar-background-color-hover: #676767;
--sidebar-border-color: #999;
--code-block-background-color: #2A2A2A;
--scrollbar-track-background-color: #717171;
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);
Expand Down Expand Up @@ -3114,6 +3137,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--settings-button-border-focus: #e0e0e0;
--sidebar-background-color: #14191f;
--sidebar-background-color-hover: rgba(70, 70, 70, 0.33);
--sidebar-border-color: #5c6773;
--code-block-background-color: #191f26;
--scrollbar-track-background-color: transparent;
--scrollbar-thumb-background-color: #5c6773;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h2>Files</h2> {# #}
{% endif %}
{{ sidebar|safe }}
</nav> {# #}
<div class="sidebar-resizer"></div> {# #}
<div class="sidebar-resizer" title="Drag to resize sidebar"></div> {# #}
<main>
{% if page.css_class != "src" %}<div class="width-limiter">{% endif %}
{# defined in storage.js to avoid duplicating complex UI across every page #}
Expand Down
25 changes: 22 additions & 3 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ extern crate tikv_jemalloc_sys as jemalloc_sys;

use std::env::{self, VarError};
use std::io::{self, IsTerminal};
use std::path::Path;
use std::process;

use rustc_errors::DiagCtxtHandle;
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_interface::interface;
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{ErrorOutputType, RustcOptGroup, make_crate_type_option};
Expand Down Expand Up @@ -654,9 +656,9 @@ fn opts() -> Vec<RustcOptGroup> {
Unstable,
Multi,
"",
"doctest-compilation-args",
"",
"add arguments to be used when compiling doctests",
"doctest-build-arg",
"One argument (of possibly many) to be used when compiling doctests",
"ARG",
),
opt(
Unstable,
Expand Down Expand Up @@ -904,6 +906,10 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) {
rustc_interface::passes::write_dep_info(tcx);
}

if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
dump_feature_usage_metrics(tcx, metrics_dir);
}

if run_check {
// Since we're in "check" mode, no need to generate anything beyond this point.
return;
Expand All @@ -923,3 +929,16 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) {
})
})
}

fn dump_feature_usage_metrics(tcxt: TyCtxt<'_>, metrics_dir: &Path) {
let hash = tcxt.crate_hash(LOCAL_CRATE);
let crate_name = tcxt.crate_name(LOCAL_CRATE);
let metrics_file_name = format!("unstable_feature_usage_metrics-{crate_name}-{hash}.json");
let metrics_path = metrics_dir.join(metrics_file_name);
if let Err(error) = tcxt.features().dump_feature_usage_metrics(metrics_path) {
// FIXME(yaahc): once metrics can be enabled by default we will want "failure to emit
// default metrics" to only produce a warning when metrics are enabled by default and emit
// an error only when the user manually enables metrics
tcxt.dcx().err(format!("cannot emit feature usage metrics: {error}"));
}
}
6 changes: 6 additions & 0 deletions src/tools/run-make-support/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ impl Command {
}
}

// Internal-only.
pub(crate) fn into_raw_command(mut self) -> std::process::Command {
self.drop_bomb.defuse();
self.cmd
}

/// Specify a stdin input buffer. This is a convenience helper,
pub fn stdin_buf<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self {
self.stdin_buf = Some(input.as_ref().to_vec().into_boxed_slice());
Expand Down
Loading