Skip to content

Rollup of 9 pull requests #145351

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 24 commits into from

Conversation

jdonszelmann
Copy link
Contributor

@jdonszelmann jdonszelmann commented Aug 13, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

github-actions and others added 24 commits August 10, 2025 00:27
compiler & tools dependencies:
     Locking 18 packages to latest compatible versions
    Updating anstream v0.6.19 -> v0.6.20
    Updating anstyle-query v1.1.3 -> v1.1.4
    Updating anstyle-svg v0.1.9 -> v0.1.10
    Updating anstyle-wincon v3.0.9 -> v3.0.10
    Updating camino v1.1.10 -> v1.1.11
    Updating clap v4.5.42 -> v4.5.43
    Updating clap_builder v4.5.42 -> v4.5.43
    Updating cxx v1.0.161 -> v1.0.166
    Updating cxx-build v1.0.161 -> v1.0.166
    Updating cxxbridge-cmd v1.0.161 -> v1.0.166
    Updating cxxbridge-flags v1.0.161 -> v1.0.166
    Updating cxxbridge-macro v1.0.161 -> v1.0.166
    Updating derive-where v1.5.0 -> v1.6.0
    Updating hashbrown v0.15.4 -> v0.15.5
    Updating indenter v0.3.3 -> v0.3.4
    Updating rustversion v1.0.21 -> v1.0.22
    Updating scratch v1.0.8 -> v1.0.9
    Updating zerovec v0.11.2 -> v0.11.4
note: pass `--verbose` to see 36 unchanged dependencies behind latest

library dependencies:
     Locking 1 package to latest compatible version
    Updating hashbrown v0.15.4 -> v0.15.5
note: pass `--verbose` to see 2 unchanged dependencies behind latest

rustbook dependencies:
     Locking 10 packages to latest compatible versions
    Updating anstream v0.6.19 -> v0.6.20
    Updating anstyle-query v1.1.3 -> v1.1.4
    Updating anstyle-wincon v3.0.9 -> v3.0.10
    Updating cc v1.2.31 -> v1.2.32
    Updating clap v4.5.42 -> v4.5.43
    Updating clap_builder v4.5.42 -> v4.5.43
    Updating clap_complete v4.5.55 -> v4.5.56
    Updating hashbrown v0.15.4 -> v0.15.5
    Updating rustversion v1.0.21 -> v1.0.22
    Updating zerovec v0.11.2 -> v0.11.4
…taining interpolated tokens

Co-authored-by: Jana Dönszelmann <jana@donsz.nl>
LLVM removed the size parameter from the lifetime format.
Tolerate not having that size parameter.
…e kind

Review everything that uses `MacroKind`, and switch anything that could
refer to more than one kind to use `MacroKinds`.

Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros,
using the concrete `MacroRulesMacroExpander` type, and have it track
which kinds it can handle. Eliminate the separate optional `attr_ext`,
now that a `SyntaxExtension` can handle multiple macro kinds.

This also avoids the need to downcast when calling methods on
`MacroRulesMacroExpander`, such as `get_unused_rule`.

Integrate macro kind checking into name resolution's
`sub_namespace_match`, so that we only find a macro if it's the right
type, and eliminate the special-case hack for attributes.
I discovered this via research through the git log, and I want to leave
additional guidance for future macro spelunkers.
This eliminates the case in `failed_to_match_macro` to check for a
function-like invocation of a macro with no function-like rules.

Instead, macro kind mismatches now result in an unresolved macro, and we
detect this case in `unresolved_macro_suggestions`, which now carefully
distinguishes between a kind mismatch and other errors.

This also handles cases of forward-referenced attributes and cyclic
attributes.

Expand test coverage to include all of these cases.
The use of `Not` to describe the `!` in `macro_rules!` reads
confusingly, and also results in search collisions with the diagnostic
structure `MacroRulesNot` elsewhere in the compiler. Rename it to use
the more conventional `Bang` for `!`.
This updates two clippy lints which had exceptions for `MacroKind::Bang`
macros to extend those exceptions to any macro, now that a macro_rules
macro can be any kind of macro.
This makes the minimal fixes necessary for rustdoc to compile and pass
existing tests with the switch to `MacroKinds`. It only works for macros
that don't actually have multiple kinds, and will panic (with a `todo!`)
if it encounters a macro with multiple kinds.

rustdoc needs further fixes to handle macros with multiple kinds, and to
handle attributes and derive macros that aren't proc macros.
In the desugaring of `assert!`, we now expand to a `match` expression
instead of `if !cond {..}`.

The span of incorrect conditions will point only at the expression, and not
the whole `assert!` invocation.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091.rs:2:13
   |
LL |     assert!(1,1);
   |             ^ expected `bool`, found integer
```

We no longer mention the expression needing to implement the `Not` trait.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091-2.rs:15:13
   |
LL |     assert!(x, x);
   |             ^ expected `bool`, found `BytePos`
```

`assert!(val)` now desugars to:

```rust
match val {
    true => {},
    _ => $crate::panic::panic_2021!(),
}
```

Fix rust-lang#122159.

We make some minor changes to some diagnostics to avoid span overlap on
type mismatch or inverted "expected"/"found" on type errors.

We remove some unnecessary parens from core, alloc and miri.

address review comments
…t modifiers with custom consistency check function
This seem to have been overlooked in <rust-lang#138162>
set

* Enforce the `-Zregparm=N` flag by setting the NumRegisterParameters
LLVM module flag * Add assembly tests verifying that the parameters are
passed in registers for reparm values 1, 2, and 3, for both LLVM
intrinsics and non-builtin functions * Add c_void type to minicore
…ochenkov

Change the desugaring of `assert!` for better error output

In the desugaring of `assert!`, we now expand to a `match` expression instead of `if !cond {..}`.

The span of incorrect conditions will point only at the expression, and not the whole `assert!` invocation.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091.rs:2:13
   |
LL |     assert!(1,1);
   |             ^ expected `bool`, found integer
```

We no longer mention the expression needing to implement the `Not` trait.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091-2.rs:15:13
   |
LL |     assert!(x, x);
   |             ^ expected `bool`, found `BytePos`
```

Now `assert!(val)` desugars to:

```rust
match val {
    true => {},
    _ => $crate::panic::panic_2021!(),
}
```

Fix rust-lang#122159.
…modificators, r=rcvalle

Sanitizers target modificators

Depends on bool flag fix: rust-lang#138483.

Some sanitizers need to be target modifiers, and some do not. For now, we should mark all sanitizers as target modifiers except for these: AddressSanitizer, LeakSanitizer

For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier.

Many test errors was with sanizer flags inconsistent with std deps. Tests are fixed with `-C unsafe-allow-abi-mismatch`.
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? ``````@compiler-errors`````` ``````@BoxyUwU``````
llvm: Accept new LLVM lifetime format

In llvm/llvm-project#150248 LLVM removed the size parameter from the lifetime format. Tolerate not having that size parameter.
…=petrochenkov

Handle macros with multiple kinds, and improve errors

(I recommend reviewing this commit-by-commit.)

Switch to a bitflags `MacroKinds` to support macros with more than one kind

Review everything that uses `MacroKind`, and switch anything that could refer to more than one kind to use `MacroKinds`.

Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros, using the concrete `MacroRulesMacroExpander` type, and have it track which kinds it can handle. Eliminate the separate optional `attr_ext`, now that a `SyntaxExtension` can handle multiple macro kinds.

This also avoids the need to downcast when calling methods on `MacroRulesMacroExpander`, such as `get_unused_rule`.

Integrate macro kind checking into name resolution's `sub_namespace_match`, so that we only find a macro if it's the right type, and eliminate the special-case hack for attributes.

This allows detecting and report macro kind mismatches early, and more precisely, improving various error messages. In particular, this eliminates the case in `failed_to_match_macro` to check for a function-like invocation of a macro with no function-like rules.

Instead, macro kind mismatches now result in an unresolved macro, and we detect this case in `unresolved_macro_suggestions`, which now carefully distinguishes between a kind mismatch and other errors.

This also handles cases of forward-referenced attributes and cyclic attributes.

----

In this PR, I've minimally fixed up `rustdoc` so that it compiles and passes tests. This is just the minimal necessary fixes to handle the switch to `MacroKinds`, and it only works for macros that don't actually have multiple kinds. This will panic (with a `todo!`) if it encounters a macro with multiple kinds.

rustdoc needs further fixes to handle macros with multiple kinds, and to handle attributes and derive macros that aren't proc macros. I'd appreciate some help from a rustdoc expert on that.

----

r? `````@petrochenkov`````
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.
r? dep-bumps

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 18 packages to latest compatible versions
    Updating anstream v0.6.19 -> v0.6.20
    Updating anstyle-query v1.1.3 -> v1.1.4
    Updating anstyle-svg v0.1.9 -> v0.1.10
    Updating anstyle-wincon v3.0.9 -> v3.0.10
    Updating camino v1.1.10 -> v1.1.11
    Updating clap v4.5.42 -> v4.5.43
    Updating clap_builder v4.5.42 -> v4.5.43
    Updating cxx v1.0.161 -> v1.0.166
    Updating cxx-build v1.0.161 -> v1.0.166
    Updating cxxbridge-cmd v1.0.161 -> v1.0.166
    Updating cxxbridge-flags v1.0.161 -> v1.0.166
    Updating cxxbridge-macro v1.0.161 -> v1.0.166
    Updating derive-where v1.5.0 -> v1.6.0
    Updating hashbrown v0.15.4 -> v0.15.5
    Updating indenter v0.3.3 -> v0.3.4
    Updating rustversion v1.0.21 -> v1.0.22
    Updating scratch v1.0.8 -> v1.0.9
    Updating zerovec v0.11.2 -> v0.11.4
note: pass `--verbose` to see 36 unchanged dependencies behind latest

library dependencies:
     Locking 1 package to latest compatible version
    Updating hashbrown v0.15.4 -> v0.15.5
note: pass `--verbose` to see 2 unchanged dependencies behind latest

rustbook dependencies:
     Locking 10 packages to latest compatible versions
    Updating anstream v0.6.19 -> v0.6.20
    Updating anstyle-query v1.1.3 -> v1.1.4
    Updating anstyle-wincon v3.0.9 -> v3.0.10
    Updating cc v1.2.31 -> v1.2.32
    Updating clap v4.5.42 -> v4.5.43
    Updating clap_builder v4.5.42 -> v4.5.43
    Updating clap_complete v4.5.55 -> v4.5.56
    Updating hashbrown v0.15.4 -> v0.15.5
    Updating rustversion v1.0.21 -> v1.0.22
    Updating zerovec v0.11.2 -> v0.11.4
```
…, r=jdonszelmann

Add regression test for former ICE involving malformed meta items containing interpolated tokens

Add regression test for rust-lang#140612 from rust-lang#140601 or rather rust-lang#140859 that only added it to `stable` not `master`.
Supersedes rust-lang#140584.

r? ``````@jdonszelmann`````` or anyone
…ross35

Fix `-Zregparm` for LLVM builtins

This fixes the issue where `-Zregparm=N` was not working correctly when calling LLVM intrinsics

By default on `x86-32`, arguments are passed on the stack. The `-Zregparm=N` flag allows the first `N` arguments to be passed in registers instead.

When calling intrinsics like `memset`, LLVM still passes parameters on the stack, which prevents optimizations like tail calls.

As proposed by `@tgross35,` I fixed this by setting the `NumRegisterParameters` LLVM module flag to `N` when the `-Zregparm=N` is set.

```rust
// compiler/rust_codegen_llvm/src/context.rs#375-382
if let Some(regparm_count) = sess.opts.unstable_opts.regparm {
    llvm::add_module_flag_u32(
        llmod,
        llvm::ModuleFlagMergeBehavior::Error,
        "NumRegisterParameters",
        regparm_count,
    );
}
```
[Here](https://rust.godbolt.org/z/YMezreo48) is a before/after compiler explorer.

Here is the final result for the code snippet in the original issue:
```asm
entrypoint:
        push    esi
        mov     esi, eax
        mov     eax, ecx
        mov     ecx, esi
        pop     esi
        jmp     memset   ; Tail call parameters in registers
```

Fixes: rust-lang#145271
…oss35

Make std use the edition 2024 prelude

This seem to have been overlooked in <rust-lang#138162>
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. labels Aug 13, 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. rollup A PR which is a rollup labels Aug 13, 2025
@jdonszelmann
Copy link
Contributor Author

@bors r+ rollup=never p=1

@bors
Copy link
Collaborator

bors commented Aug 13, 2025

📌 Commit 4eb209b has been approved by jdonszelmann

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 Aug 13, 2025
@bors
Copy link
Collaborator

bors commented Aug 13, 2025

⌛ Testing commit 4eb209b with merge 3177c00...

bors added a commit that referenced this pull request Aug 13, 2025
Rollup of 9 pull requests

Successful merges:

 - #122661 (Change the desugaring of `assert!` for better error output)
 - #138736 (Sanitizers target modificators)
 - #144955 (search graph: lazily update parent goals)
 - #145120 (llvm: Accept new LLVM lifetime format)
 - #145153 (Handle macros with multiple kinds, and improve errors)
 - #145189 (Weekly `cargo update`)
 - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens)
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145331 (Make std use the edition 2024 prelude)

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

The job aarch64-apple failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs#ok ... ignored, ignored on targets without kernel CFI sanitizer
test [ui] tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs#wrong_flag ... ignored, ignored on targets without kernel CFI sanitizer
test [ui] tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs#wrong_sanitizer ... ignored, ignored on targets without kernel CFI sanitizer
test [ui] tests/ui/target_modifiers/no_value_bool.rs#ok ... ok
test [ui] tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs#wrong_leak_san ... ignored, ignored on targets without leak sanitizer
test [ui] tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs#good ... ignored, ignored on targets without SafeStack support
test [ui] tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs#good_reverted ... ignored, ignored on targets without SafeStack support
test [ui] tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs#missed_both ... ignored, ignored on targets without SafeStack support
test [ui] tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs#missed_kcfi ... ignored, ignored on targets without SafeStack support
test [ui] tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.rs#missed_safestack ... ignored, ignored on targets without SafeStack support
test [ui] tests/ui/target_modifiers/no_value_bool.rs#ok_explicit ... ok
test [ui] tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs#wrong_address_san ... ok
test [ui] tests/ui/target_modifiers/two_flags.rs#unknown_allowed ... ok
test [ui] tests/ui/target_modifiers/two_flags.rs#two_allowed ... ok
test [ui] tests/ui/test-attrs/custom-test-frameworks/issue-107454.rs ... ok
test [ui] tests/ui/test-attrs/decl-macro-test.rs ... ok
test [ui] tests/ui/test-attrs/inaccessible-test-modules.rs ... ok
---
failures:

---- [ui] tests/ui/sanitizer/address.rs stdout ----

error: error pattern ' 'xs' (line 14) <== Memory access at offset' not found!
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage2/bin/rustc" "/Users/runner/work/rust/rust/tests/ui/sanitizer/address.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=/Users/runner/.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/Users/runner/work/rust/rust/vendor" "--sysroot" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/stage2" "--target=aarch64-apple-darwin" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/Users/runner/work/rust/rust/build/aarch64-apple-darwin/test/ui/sanitizer/address/a" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Lnative=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/native/rust-test-helpers" "-Z" "sanitizer=address" "-O" "-g" "-C" "unsafe-allow-abi-mismatch=sanitizer"
stdout: none
stderr: none



@bors
Copy link
Collaborator

bors commented Aug 13, 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 Aug 13, 2025
@klensy
Copy link
Contributor

klensy commented Aug 13, 2025

rollup failed, can you r- #145309? Thanks. (fail should not be related for that pr)

@fmease fmease closed this Aug 13, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 13, 2025
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-run-make Area: port run-make Makefiles to rmake.rs A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup T-clippy Relevant to the Clippy team. 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.