Skip to content

Rollup of 12 pull requests #144345

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

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Jul 23, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

RalfJung and others added 25 commits July 21, 2025 11:20
On the 32-bit win7 target, we use OS TLS instead of native TLS, due to
issues with how the OS handles alignment. Unfortunately, this caused
issues due to the TLS destructors not running, causing memory leaks
among other problems.

On Windows, to support OS TLS, the TlsAlloc family of function is used
by Rust. This function does not support TLS destructors at all. However,
rust has some code to emulate those destructors, by leveraging the TLS
support functionality found in the MSVC CRT (specifically, in tlssup.c
of the CRT). Specifically, the CRT provides the ability to register
callbacks that are called (among other things) on thread destruction. By
registering our own callback, we can run through a list of registered
destructors functions to execute.

To use this functionality, the user must do two things:

1. They must put the address to their callback in a section between
   `.CRT$XLB` and `.CRT$XLY`.
2. They must add a reference to `_tls_used` (or `__tls_used` on x86) to
   make sure the TLS support code in tlssup.c isn't garbage collected by
   the linker.

Prior to this commit, this second bit wasn't being done properly by the
Rust TLS support code. Instead of adding a reference to _tls_used, it
instead had a reference to its own callback to prevent it from getting
GC'd by the linker. While this is _also_ necessary, not having a
reference on _tls_used made the entire support non-functional.

This commit reworks the code to:

1. Add an unconditional `#[used]` attribute on the CALLBACK, which
   should be enough to prevent it from getting GC'd by the linker.
2. Add a reference to `_tls_used`, which should pull the TLS support
   code into the Rust programs and not let it be GC'd by the linker.
Rather than adding `get_unused_rule` to the `TTMacroExpander` trait, put
it on the concrete `MacroRulesMacroExpander`, and downcast to that type
via `Any` in order to call it.

Suggested-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
This allows us to assume that coverage spans will only be discarded during
codegen in very unusual situations.
1. Rename `make_unclosed_delims_error` and return `Vec<Diag>`
2. change magic number `unclosed_delimiter_show_limit` to const
3. move `eof_err` below parsing logic
4. Add `calculate_spacing` for `bump` and `bump_minimal`

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
I missed this in the promotion to tier 2 with host tools.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
this ensures that js-related tests can still be run from within
such a dist tarball.
Previously, the musl root would only be set to the fallback /usr by
the sanity check, which isn't ran for the bootstrap tests.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
Remove tidy checks for `tests/ui/issues/`

r? `````@jieyouxu`````

As it is making cleanup efforts more difficult.

This change was discussed here [#t-compiler > Discussion for ui test suite improvements @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Discussion.20for.20ui.20test.20suite.20improvements/near/529566433)
…isDenton

Fix broken TLS destructors on 32-bit win7

Fixes rust-lang#141300

On the 32-bit win7 target, we use OS TLS instead of native TLS, due to issues with how the OS handles alignment. Unfortunately, this caused issues due to the TLS destructors not running, causing memory leaks among other problems.

On Windows, to support OS TLS, the TlsAlloc family of function is used by Rust. This function does not support TLS destructors at all. However, rust has some code to emulate those destructors, by leveraging the TLS support functionality found in the MSVC CRT (specifically, in tlssup.c of the CRT).

To use this functionality, the user must do two things:

1. They must put the address to their callback in a section between `.CRT$XLB` and `.CRT$XLY`.
2. They must add a reference to `_tls_used` (or `__tls_used` on x86) to make sure the TLS support code in tlssup.c isn't garbage collected by the linker.

Prior to this commit, this second bit wasn't being done properly by the Rust TLS support code. Instead of adding a reference to _tls_used, it instead had a reference to its own callback to prevent it from getting GC'd by the linker. While this is _also_ necessary, not having a reference on _tls_used made the entire support non-functional.

This commit reworks the code to:

1. Add an unconditional `#[used]` attribute on the CALLBACK, which should be enough to prevent it from getting GC'd by the linker.
2. Add a reference to `_tls_used`, which should pull the TLS support code into the Rust programs and not let it be GC'd by the linker.
Clean `rustc/parse/src/lexer` to improve maintainability

This PR refactors the lexer code to improve maintainability and eliminate code duplication.
In the first commit, I improve the error handling:
- rename `make_unclosed_delims_error` to more appropriate `make_mismatched_closing_delims_errors`
- changes return type from Option<Diag> to `Vec<Diag>` to avoid lengthy vec processing at `lex_token_trees`
- use `splice` instead of `extend` to make the logic clearer, since `errs` sounds more generic and better suited as a return value

In the second commit, I replace the magic number 5 with UNCLOSED_DELIMITER_SHOW_LIMIT constant.

In the third commit, I moves `eof_err` function below parsing logic for better code flow.

In the forth one, I extract `calculate_spacing` function to eliminate duplicate spacing logic between `bump` and `bump_minimal` functions.

r? compiler
coretests/num: use ldexp instead of hard-coding a power of 2

r? ``@tgross35``
Don't ICE on non-TypeId metadata within TypeId

fixes rust-lang#144253

r? `````@RalfJung`````
resolve: Make disambiguators for underscore bindings module-local (take 2)

The difference with rust-lang#144013 can be seen in the second commit.

Now we just keep a separate disambiguator counter in every `Module`, instead of a global counter in `Resolver`.
This will be ok for parallel import resolution because we'll need to lock the module anyway when updating `resolutions` and other fields in it.
And for external modules the disabmiguator could be just passed as an argument to `define_extern`, without using any cells or locks, once rust-lang#143884 lands.

Unblocks rust-lang#143884.
update tests/ui/SUMMARY.md

follow-up of rust-lang#143985 .

r? ``@jieyouxu``
…-for-get-unused-rule, r=petrochenkov

mbe: Use concrete type for `get_unused_rule`

Rather than adding `get_unused_rule` to the `TTMacroExpander` trait, put
it on the concrete `MacroRulesMacroExpander`, and downcast to that type
via `Any` in order to call it.

Suggested-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>

r? ``@petrochenkov``
coverage: Enlarge empty spans during MIR instrumentation, not codegen

This re-lands the part of rust-lang#140847 that was (hopefully) not responsible for the coverage-instrumentation regressions that caused that PR to be reverted.

---

Enlarging empty spans was historically performed during MIR instrumentation, but had to be moved to codegen as part of larger changes in rust-lang#134497, leading to the status quo. But now there should be no reason not to move that step back to its more logical home in instrumentaion.
…=Kobzol

Add powerpc64le-unknown-linux-musl to CI rustc targets

I missed this in the promotion to tier 2 with host tools.
…e.json, r=Kobzol

bootstrap: add package.json and package-lock.json to dist tarball

this ensures that js-related tests can still be run from within such a dist tarball.

followup to rust-lang#142924

r? ``@Kobzol``
…=Kobzol

bootstrap: Move musl-root fallback out of sanity check

Previously, the musl root would only be set to the fallback `/usr` by the sanity check, which isn't ran for the bootstrap tests.

r? ``@Kobzol``
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-tidy Area: The tidy tool 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) labels Jul 23, 2025
@rustbot rustbot added T-compiler Relevant to the compiler 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 23, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Jul 23, 2025

@bors r+ rollup=never p=5

@rustbot rustbot added the rollup A PR which is a rollup label Jul 23, 2025
@bors
Copy link
Collaborator

bors commented Jul 23, 2025

📌 Commit 2f11e13 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors 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 23, 2025
@matthiaskrgr
Copy link
Member

#144272 is already failing I think

@jhpratt jhpratt deleted the rollup-55jy8wr branch July 23, 2025 06:28
@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_helper test:false 0.757
error: unneeded `return` statement
    --> src/bootstrap/src/lib.rs:1346:13
     |
1346 |             return Some(Path::new("/usr"));
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
     = note: `-D clippy::needless-return` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::needless_return)]`
help: remove `return`
     |
1346 -             return Some(Path::new("/usr"));
1346 +             Some(Path::new("/usr"))
     |

[RUSTC-TIMING] bootstrap test:false 10.231
error: could not compile `bootstrap` (lib) due to 1 previous error
Build completed unsuccessfully in 0:15:59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-tidy Area: The tidy tool rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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-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.