Skip to content

Rollup of 6 pull requests#159192

Merged
rust-bors[bot] merged 14 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-d2abRmH
Jul 13, 2026
Merged

Rollup of 6 pull requests#159192
rust-bors[bot] merged 14 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-d2abRmH

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

kn1g78 and others added 14 commits July 11, 2026 15:26
The small-buffer path in Stdin::read allocates a one-element UTF-16
scratch buffer. When a pending surrogate exists,
read_u16s_fixup_surrogates requires temporary storage for both the
buffered surrogate and one newly read UTF-16 code unit.

Increase the scratch buffer to two UTF-16 code units so the surrogate
path can complete without panicking.
std resolves environ through dlsym on FreeBSD so that shared libraries
can link, but a statically linked executable has no dynamic symbol
table: the lookup returns null and the env iteration dereferences it.
Take a weak reference instead: it binds at link time in any executable,
and in a shared library the runtime linker resolves it against the
environ the executable exports. Treat a null environ as an empty
environment instead of dereferencing it.
When bootstrap runs a step by default, without explicit paths, it will normally
act as though the user had explicitly requested all of the paths and aliases
that the step registered through `ShouldRun`.

For the coverage test suite, that gives the wrong outcome. Running a command
like `./x test --skip=tests` or `./x test --skip=coverage` should skip the
coverage tests, but instead the coverage tests would run anyway, due to the
`coverage-map` and `coverage-run` aliases being treated as implied command-line
arguments.

This commit fixes that problem by adding a special flag to `ShouldRun`. When
creating pathsets for a step that is being run by default, if the step has set
the `default_to_suites_only` flag, all non-suite pathsets are discarded. That
gives the desired behavior for skipping coverage tests, without affecting other
steps, since other steps don't set the flag.
… `error_helper.rs` into the `diagnostics` folder in `rustc_resolve`
… r=JonathanBrouwer

Apply MCP 1003 and move diagnostics.rs into its own module

Part of rust-lang#158699.

r? @JonathanBrouwer
bootstrap: Allow path-based skipping of the coverage test suite

- Alternative to rust-lang#159079
---

When bootstrap runs a step by default, without explicit paths, it will normally act as though the user had explicitly requested all of the paths and aliases that the step registered through `ShouldRun`.

For the coverage test suite, that gives the wrong outcome. Running a command like `./x test --skip=tests` or `./x test --skip=coverage` should skip the coverage tests, but instead the coverage tests would run anyway, due to the `coverage-map` and `coverage-run` aliases being treated as implied command-line arguments.

This PR fixes that problem by adding a special flag to `ShouldRun`. When creating pathsets for a step that is being run by default, if the step has set the `default_to_suites_only` flag, all non-suite pathsets are discarded. That gives the desired behaviour for skipping coverage tests, without affecting other steps, since other steps don't set the flag.

The end result is that `./x test --skip=tests` should now skip the coverage tests, as intended. This lets us remove some `--skip` arguments from CI scripts, which were only required by the previous incorrect behaviour.

---

The `default_to_suites_only` flag is a bit of a hack, but to me it seems like the cleanest way to resolve this problem without having to completely overhaul how CLI paths work, which is a much bigger task. And I think being able to remove the weird extra `--skip` arguments from CI scripts makes this a net positive.

r? jieyouxu
…, r=Darksonn

std: fix panic in Windows Stdin::read_vectored with pending surrogate

Fixes rust-lang#158096.

The small-buffer path in `Stdin::read_vectored` allocates a one-element UTF-16 scratch buffer before calling `read_u16s_fixup_surrogates`.

When a pending surrogate exists, `read_u16s_fixup_surrogates` needs temporary storage for both the buffered surrogate and one newly read UTF-16 code unit. The one-element buffer causes an out-of-bounds slice before `ReadConsoleW` is called.

Increase the scratch buffer to two UTF-16 code units, matching the  function's requirements while leaving the normal read path unchanged.
Print duration of BOLT instrumentation and optimization steps

The opt-dist pipeline has been on the longer side again recently, I want to make it easier to see where the time is being spent.
… r=clarfonthey

Fix segfault in env access in statically linked FreeBSD binaries

On FreeBSD `environ` is provided by the startup object linked into every executable (crt1.o) rather than by libc.so, so rust-lang#153718 switched std to a dlsym lookup to keep shared libraries linkable with `-Wl,--no-undefined` (rust-lang#153451). But dlsym needs a dynamic symbol table, which statically linked executables do not have: it returns null, and both `env::vars_os` and the `Command` spawn paths dereference it (rust-lang#158939).

Resolve `environ` through a weak reference first: crt1.o defines it in every executable, statically linked ones included, and a weak undefined symbol does not break shared library links. Fall back to dlsym only when the weak reference is null, i.e. inside a shared library, where the dynamic lookup is available. Also stop dereferencing a null table pointer in `env()`, so an unresolvable `environ` degrades to an empty environment instead of a crash.

The `extern_weak` reference is the same mechanism std already uses for `__dso_handle` and `__cxa_thread_atexit_impl` in `sys/thread_local/destructors/linux_like.rs`.

## Testing

CI cannot execute FreeBSD tests (the target is cross-compiled only), so:

- `./x check library/std --target x86_64-unknown-freebsd` and a host check pass.
- The reproduction from rust-lang#158939, built with `-C target-feature=+crt-static`, was executed on FreeBSD 14.4-RELEASE (amd64): built with stock 1.96.0 it segfaults on `vars_os()` (SIGSEGV, exit 139); built against std from this branch it iterates the environment, spawns a child with an inherited environment, and exits cleanly.
- Downstream, the crash was originally isolated and worked around in a production daemon whose CI runs the exact affected configuration (static, LTO) on a real FreeBSD kernel per commit; that harness stands ready to validate a nightly containing this fix.

This is a regression from stable to stable (1.95 -> 1.96) and may be worth a beta backport.

Fixes rust-lang#158939
…f, r=jieyouxu

compiletest: use VecDeque::pop_front_if

`VecDeque::pop_front_if` has been stable since Rust 1.93 and is now available to bootstrap.

Replace compiletest's local compatibility helper with the standard library method and remove the obsolete FIXME.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jul 12, 2026
@rustbot rustbot added A-CI Area: Our Github Actions CI A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 12, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

@rust-bors

rust-bors Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7f9a0ab has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 12, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 13, 2026
@rust-bors

rust-bors Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: JonathanBrouwer
Duration: 3h 18m 59s
Pushing d39561c to main...

@rust-timer

Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#158732 Apply MCP 1003 and move diagnostics.rs into its own module 27e3875b8ffaa3d3115209b35db2b8b079e5b8ef (link)
#159131 bootstrap: Allow path-based skipping of the coverage test s… 58ef8f2beea90a402c986648dc6e123e507f3f54 (link)
#159134 std: fix panic in Windows Stdin::read_vectored with pending… c3b2cb599ade3505d245c3407850c79fd246ed36 (link)
#159178 Print duration of BOLT instrumentation and optimization ste… 2bf7323caf7268b99612cd7024ecc8958b25aa47 (link)
#159112 Fix segfault in env access in statically linked FreeBSD bin… 7918ac8227c9ed25f03acae976a3c35b4c0aa12e (link)
#159124 compiletest: use VecDeque::pop_front_if d4fa8ca37bf39b827c275a9e462d62ce9fdf9c7e (link)

previous master: 77cf889bc1

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 77cf889 (parent) -> d39561c (this PR)

Test differences

Show 31 test diffs

Stage 0

  • core::builder::cli_paths::tests::x_test_skip_coverage_map: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_skip_coverage_run: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_skip_tests_coverage: [missing] -> pass (J0)

Additionally, 28 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard d39561c2d2b55985d3b6331cc52403e038e7fc8b --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-gcc-core-tests: 14m 9s -> 7m 49s (-44.7%)
  2. x86_64-gnu: 1h 40m -> 2h 23m (+42.1%)
  3. i686-gnu-nopt-2: 1h 44m -> 2h 18m (+33.2%)
  4. tidy: 2m -> 2m 34s (+28.7%)
  5. x86_64-gnu-llvm-22-3: 1h 57m -> 1h 25m (-26.6%)
  6. dist-apple-various: 1h 23m -> 1h 43m (+24.6%)
  7. dist-x86_64-linux-alt: 2h 29m -> 1h 54m (-23.3%)
  8. dist-ohos-armv7: 1h -> 1h 14m (+22.5%)
  9. x86_64-mingw-1: 2h 21m -> 2h 53m (+22.3%)
  10. dist-i686-linux: 1h 48m -> 1h 26m (-19.6%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (d39561c): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.7% [4.3%, 5.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-3.4%, -0.8%] 4
All ❌✅ (primary) - - 0

Cycles

Results (secondary -3.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.0% [1.9%, 9.6%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-8.8% [-16.4%, -2.1%] 9
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 489.838s -> 487.649s (-0.45%)
Artifact size: 389.25 MiB -> 389.89 MiB (0.16%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants