Skip to content

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Aug 17, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Kivooeo and others added 24 commits August 5, 2025 01:21
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
This handles various kinds of errors, but does not allow applying the
derive yet.

This adds the feature gate `macro_derive`.
Add infrastructure to apply a derive macro to arguments, consuming and
returning a `TokenTree` only.

Handle `SyntaxExtensionKind::MacroRules` when expanding a derive, if the
macro's kinds support derive.

Add tests covering various cases of `macro_rules` derives.

Note that due to a pre-existing FIXME in `expand.rs`, derives are
re-queued and some errors get emitted twice. Duplicate diagnostic
suppression makes them not visible, but the FIXME should still get
fixed.
this fixes `tests/ui/process/nofile-limit.rs` which fails to link on
nixos for me without this change
The target is removed by `copy_link` too, so no need to duplicate the syscall.
Fix outdated doc comment

This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality

fixes rust-lang#138572

r? ```````@tgross35```````
…szelmann

Port `#[custom_mir(..)]` to the new attribute system

r? ``````@jdonszelmann``````
…enkov

Implement declarative (`macro_rules!`) derive macros (RFC 3698)

This is a draft for review, and should not be merged yet.

This is layered atop rust-lang#145153 , and has
only two additional commits atop that. The first handles parsing and provides a
test for various parse errors. The second implements expansion and handles
application.

This implements RFC 3698, "Declarative (`macro_rules!`) derive macros".
Tracking issue: rust-lang#143549

This has one remaining issue, which I could use some help debugging: in
`tests/ui/macros/macro-rules-derive-error.rs`, the diagnostics for
`derive(fn_only)` (for a `fn_only` with no `derive` rules) and
`derive(ForwardReferencedDerive)` both get emitted twice, as a duplicate
diagnostic.

From what I can tell via adding some debugging code,
`unresolved_macro_suggestions` is getting called twice from
`finalize_macro_resolutions` for each of them, because
`self.single_segment_macro_resolutions` has two entries for the macro, with two
different `parent_scope` values. I'm not clear on why that happened; it doesn't
happen with the equivalent code using attrs.

I'd welcome any suggestions for fixing this.
…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
cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`

This PR replaces two existing `LLVMRust` bindings with equivalent calls to the LLVM-C API.

For `LLVMGetTypeKind`, we avoid the UB hazard by declaring the foreign function to return `RawEnum<TypeKind>` (which is a wrapper around `u32`), and then perform checked conversion from `u32` to `TypeKind`.
…rieb

Add static glibc to the nix dev shell

This fixes `tests/ui/process/nofile-limit.rs` which fails to link on nixos for me without this change.
…dirs, r=jieyouxu

Speedup `copy_src_dirs` in bootstrap

I was kinda offended by how slow it was. Just the `copy_src_dirs` part took ~3s locally in the `x dist rustc-src` step. In release mode it was just 1s, but that's kind of cheating (I wonder if we should build bootstrap in release mode on CI though...).

Did some basic optimizations to bring it down to ~1s also in debug mode.

Maybe it's overkill, due to rust-lang#145455. Up to you whether we should merge it or close it :)

r? ``````@jieyouxu``````
Fix typo in doc for library/std/src/fs.rs#set_permissions

"privalage" -> "privilege".

Was reading the docs and have noticed this.
…rgets, r=jdonszelmann

Fix deprecation attributes on foreign statics

r? `````@jdonszelmann`````

Fixes rust-lang#145437
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` 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. labels Aug 17, 2025
@rustbot rustbot added 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 Aug 17, 2025
@Zalathar
Copy link
Contributor Author

Continuation of #145519, with the failing PR removed and the next two iffy PRs added.

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Aug 17, 2025

📌 Commit b940910 has been approved by Zalathar

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 17, 2025
@Zalathar
Copy link
Contributor Author

@bors try jobs=test-various,dist-ohos-x86_64,x86_64-gnu-llvm-19-3,aarch64-apple

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 17, 2025
Rollup of 10 pull requests

try-job: test-various
try-job: dist-ohos-x86_64
try-job: x86_64-gnu-llvm-19-3
try-job: aarch64-apple
@rust-bors
Copy link

rust-bors bot commented Aug 17, 2025

☀️ Try build successful (CI)
Build commit: b36dfae (b36dfae0e0da484f2101b0c24ed36eba58f419bd, parent: 99ba5565678a51c2488322a5e75d5b59e323b498)

bors added a commit that referenced this pull request Aug 17, 2025
Rollup of 10 pull requests

Successful merges:

 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Aug 17, 2025

💥 Test timed out

@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 17, 2025
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@Zalathar
Copy link
Contributor Author

@bors retry (msvc timeout)

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

bors commented Aug 18, 2025

⌛ Testing commit b940910 with merge ab964e1...

bors added a commit that referenced this pull request Aug 18, 2025
Rollup of 10 pull requests

Successful merges:

 - #144838 (Fix outdated doc comment)
 - #145206 (Port `#[custom_mir(..)]` to the new attribute system)
 - #145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698))
 - #145309 (Fix `-Zregparm` for LLVM builtins)
 - #145355 (Add codegen test for issue 122734)
 - #145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`)
 - #145451 (Add static glibc to the nix dev shell)
 - #145460 (Speedup `copy_src_dirs` in bootstrap)
 - #145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions)
 - #145485 (Fix deprecation attributes on foreign statics)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Aug 18, 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 18, 2025
@Zalathar
Copy link
Contributor Author

Looks like a runner flaked out again. I'm going to close this particular rollup in case bors thinks it's haunted.

@Zalathar Zalathar closed this Aug 18, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 18, 2025
@Zalathar Zalathar deleted the rollup-4boj5q8 branch August 18, 2025 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` 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-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.