Skip to content

Rollup of 8 pull requests #142762

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 28 commits into from
Closed

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Jun 20, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Qelxiros and others added 28 commits June 18, 2025 00:38
This does change the logic a bit: previously, we didn't forward reverse
implications of negated features to the backend, instead relying on the backend
to handle the implication itself.
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
rewrite `optimize` attribute to use new attribute parsing infrastructure

r? ``@oli-obk``

I'm afraid we'll get quite a few of these PRs in the future. If we get a lot of trivial changes I'll start merging multiple into one PR. They should be easy to review :)

Waiting on rust-lang#138165 first
…n, r=nnethercote,WaffleLapkin

Extract some shared code from codegen backend target feature handling

There's a bunch of code duplication between the GCC and LLVM backends in target feature handling. This moves that into new shared helper functions in `rustc_codegen_ssa`.

The first two commits should be purely refactoring. I am fairly sure the LLVM-side behavior stays the same; if the GCC side deliberately diverges from this then I may have missed that. I did account for one divergence, which I do not know is deliberate or not: GCC does not seem to use the `-Ctarget-feature` flag to populate `cfg(target_feature)`. That seems odd, since the `-Ctarget-feature` flag is used to populate the return value of `global_gcc_features` which controls the target features actually used by GCC. `@GuillaumeGomez` `@antoyo` is there a reason `target_config` ignores `-Ctarget-feature` but `global_gcc_features`  does not? The second commit also cleans up a bunch of unneeded complexity added in rust-lang#135927.

The third commit extracts some shared logic out of the functions that populate `cfg(target_feature)` and the backend target feature set, respectively. This one actually has some slight functional changes:
- Before, with `-Ctarget-feature=-feat`, if there is some other feature `x` that implies `feat` we would *not* add `-x` to the backend target feature set. Now, we do. This fixes rust-lang#134792.
- The logic that removes `x` from `cfg(target_feature)` in this case also changed a bit, avoiding a large number of calls to the (uncached) `sess.target.implied_target_features` (if there were a large number of positive features listed before a negative feature) but instead constructing a full inverse implication map when encountering the first negative feature. Ideally this would be done with queries but the backend target feature logic runs before `tcx` so we can't use that...
- Previously, if feature "a" implied "b" and "b" was unstable, then using `-Ctarget-feature=+a` would also emit a warning about `b`. I had to remove this since when accounting for negative implications, this emits a ton of warnings in a bunch of existing tests... I assume this was unintentional anyway.

The fourth commit increases consistency of the GCC backend with the LLVM backend.

The last commit does some further cleanup:
- Get rid of RUSTC_SPECIAL_FEATURES. It was only needed for s390x "backchain", but since LLVM 19 that is always a regular target feature so we don't need this hack any more. The hack also has various unintended side-effects so we don't want to keep it. Fixes rust-lang#142412.
- Move RUSTC_SPECIFIC_FEATURES handling into the shared parse_rust_feature_flag helper so all consumers of `-Ctarget-feature` that only care about actual target features (and not "crt-static") have it. Previously, we actually set `cfg(target_feature = "crt-static")` twice: once in the backend target feature logic, and once specifically for that one feature. IIUC, some targets are meant to ignore `-Ctarget-feature=+crt-static`, it seems like before this PR that flag still incorrectly enabled `cfg(target_feature = "crt-static")` (but I didn't test this).
- Move fixed_x18 handling together with retpoline handling.
- Forbid setting fixed_x18 as a regular target feature, even unstably. It must be set via the `-Z` flag.

`@bjorn3` I did not touch the cranelift backend here, since AFAIK it doesn't really support target features. But if you ever do, please use the new helpers. :)

Cc `@workingjubilee`
…r=ChrisDenton,tgross35

Implement send_signal for unix child processes

Tracking issue: rust-lang#141975

There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`.

try-job: `dist-various*`
try-job: `test-various*`
…=workingjubilee

error on calls to ABIs that cannot be called

We recently added `extern "custom"`, which cannot be called using a rust call expression. But there are more ABIs that can't be called in that way, because the call does not semantically make sense.

More details are in rust-lang#140566 (comment)

r? `@workingjubilee`
vec_deque/fmt/vec tests: remove static mut

More rust-lang#125035.

r? ``@tgross35``
Reduce uses of `hir_crate`.

I tried rebasing my old incremental-HIR branch. This is a by-product, which is required if we want to get rid of `hir_crate` entirely.

The second commit is a drive-by cleanup. It can be pulled into its own PR.

r? ```@oli-obk```
Update books

## rust-lang/book

1 commits in 4433c9f0cad8460bee05ede040587f8a1fa3f1de..8a6d44e45b7b564eeb6bae30507e1fbac439d72d
2025-06-18 17:06:36 UTC to 2025-06-18 17:06:36 UTC

- Chapter 12 from tech review (rust-lang/book#4410)

## rust-lang/reference

6 commits in d4c66b346f4b72d29e70390a3fa3ea7d4e064db1..50fc1628f36563958399123829c73755fa7a8421
2025-06-19 02:02:39 UTC to 2025-06-17 21:18:46 UTC

- Document inferred const args (`feature(generic_arg_infer)`) (rust-lang/reference#1835)
- const_eval: we allow references to statics and promoteds (rust-lang/reference#1858)
- Fix missing rule on destructors (rust-lang/reference#1861)
- Fix inconsistent heading depth (rust-lang/reference#1860)
- Fix recursive root-accessible grammar check (rust-lang/reference#1852)
- Fix grammar links (rust-lang/reference#1851)

## rust-lang/rust-by-example

1 commits in 9baa9e863116cb9524a177d5a5c475baac18928a..05c7d8bae65f23a1837430c5a19be129d414f5ec
2025-06-18 13:15:17 UTC to 2025-06-18 13:15:17 UTC

- Revert "introduce new ```@media``` query to set a higher content width on ultra wide screens" (rust-lang/rust-by-example#1939)
…r, r=Kobzol

add comment to `src/bootstrap/build.rs`

I attempted to remove this build script but it's apparently needed. Add a comment for why.
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Jun 20, 2025
@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend O-unix Operating system: Unix-like 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-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jun 20, 2025
@tgross35
Copy link
Contributor Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Jun 20, 2025

📌 Commit 8e4d77f has been approved by tgross35

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 Jun 20, 2025
@bors
Copy link
Collaborator

bors commented Jun 20, 2025

⌛ Testing commit 8e4d77f with merge 03e63d3...

bors added a commit that referenced this pull request Jun 20, 2025
Rollup of 8 pull requests

Successful merges:

 - #138291 (rewrite `optimize` attribute to use new attribute parsing infrastructure)
 - #140920 (Extract some shared code from codegen backend target feature handling)
 - #141990 (Implement send_signal for unix child processes)
 - #142597 (error on calls to ABIs that cannot be called)
 - #142668 (vec_deque/fmt/vec tests: remove static mut)
 - #142687 (Reduce uses of `hir_crate`.)
 - #142699 (Update books)
 - #142714 (add comment to `src/bootstrap/build.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19-3 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [codegen] tests/codegen/naked-asan.rs stdout ----

error: compilation failed!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/checkout/tests/codegen/naked-asan.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "-Cdebug-assertions=no" "--emit" "llvm-ir" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/naked-asan/naked-asan.ll" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Zsanitizer=address" "-Ctarget-feature=-crt-static"
stdout: none
--- stderr -------------------------------
error: functions with the "x86-interrupt" ABI cannot be called
##[error]  --> /checkout/tests/codegen/naked-asan.rs:12:5
   |
12 |     page_fault_handler(1, 2);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: an `extern "x86-interrupt"` function can only be called using inline assembly
  --> /checkout/tests/codegen/naked-asan.rs:12:5
   |
12 |     page_fault_handler(1, 2);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^

@bors
Copy link
Collaborator

bors commented Jun 20, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 20, 2025
@tgross35 tgross35 closed this Jun 20, 2025
@tgross35 tgross35 deleted the rollup-wi1rum8 branch June 20, 2025 06:48
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustdoc-json Area: Rustdoc JSON backend O-unix Operating system: Unix-like rollup A PR which is a rollup 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-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.