304366 Commits

Author SHA1 Message Date
Stuart Cook
211339faa8
Rollup merge of #145476 - alurm:patch-1, r=ibraheemdev
Fix typo in doc for library/std/src/fs.rs#set_permissions

"privalage" -> "privilege".

Was reading the docs and have noticed this.
2025-08-18 15:31:14 +10:00
Stuart Cook
9d7265104c
Rollup merge of #145460 - Kobzol:bootstrap-speedup-copy-src-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 https://github.com/rust-lang/rust/pull/145455. Up to you whether we should merge it or close it :)

r? `````````@jieyouxu`````````
2025-08-18 15:31:14 +10:00
Stuart Cook
3b396fcf7b
Rollup merge of #145451 - WaffleLapkin:norailoveyou, r=Noratrieb
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.
2025-08-18 15:31:13 +10:00
Stuart Cook
aa2dcbe583
Rollup merge of #145420 - Zalathar:llvm-c, r=WaffleLapkin
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`.
2025-08-18 15:31:12 +10:00
Stuart Cook
3a694c7595
Rollup merge of #145355 - clubby789:option-match-eq, r=nikic
Add codegen test for issue 122734

Closes rust-lang/rust#122734
2025-08-18 15:31:12 +10:00
Stuart Cook
1e454c64b2
Rollup merge of #145309 - winstonallo:issue-145271-fix, r=tgross35
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: https://github.com/rust-lang/rust/issues/145271
2025-08-18 15:31:11 +10:00
Stuart Cook
152b43c7cb
Rollup merge of #145208 - joshtriplett:mbe-derive, r=petrochenkov
Implement declarative (`macro_rules!`) derive macros (RFC 3698)

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

This is layered atop https://github.com/rust-lang/rust/pull/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: https://github.com/rust-lang/rust/issues/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.
2025-08-18 15:31:10 +10:00
Stuart Cook
d92e1fe8d7
Rollup merge of #145206 - scrabsha:push-uxovoqzrxnlx, r=jdonszelmann
Port `#[custom_mir(..)]` to the new attribute system

r? ``````````@jdonszelmann``````````
2025-08-18 15:31:10 +10:00
Stuart Cook
b94842dcac
Rollup merge of #144838 - Kivooeo:doc-subtype, r=notriddle
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/rust#138572

r? ````````````@tgross35````````````
2025-08-18 15:31:09 +10:00
bit-aloo
a0aaa1275a
clippy'ed 2025-08-18 10:56:58 +05:30
The Miri Cronjob Bot
5a3871d7b2 fmt 2025-08-18 05:07:40 +00:00
The Miri Cronjob Bot
d5b31abfa9 Merge ref '425a9c0a0e36' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0
Filtered ref: 7e955d5a6c676a099595bdfaec0705d3703e7a3c

This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-18 05:07:07 +00:00
The Miri Cronjob Bot
13bad19d7c Prepare for merging from rust-lang/rust
This updates the rust-version file to 425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0.
2025-08-18 04:59:33 +00:00
The rustc-josh-sync Cronjob Bot
5818cbdd44 Merge ref '425a9c0a0e36' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0
Filtered ref: 26b9fd24259f4fc5fd7634a99dd6dda2821fb2d0

This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-18 04:22:24 +00:00
The rustc-josh-sync Cronjob Bot
a3510c7199 Prepare for merging from rust-lang/rust
This updates the rust-version file to 425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0.
2025-08-18 04:22:18 +00:00
bit-aloo
77c3d6edfa
remove default config 2025-08-18 09:45:43 +05:30
huaihuaidelulu
8074d4f6fc
Update rust maintainers in openharmony.md 2025-08-18 11:09:30 +08:00
Zhongyao Chen
224fd13a9c change riscv64a23 target reqirements comments: linux kernel 6.8.0, glibc 2.39 2025-08-18 10:33:53 +08:00
Josh Triplett
c44c1bbe87 Fix up library crate order in linker test 2025-08-17 15:45:05 -07:00
blyxyas
479e31e2c1 Don't warn no-mentions on subtree updates 2025-08-18 00:40:08 +02:00
binarycat
ab19755630 bufreader::Buffer::backshift: don't move the uninit bytes
previous code was perfectly sound because of MaybeUninit,
but it did waste cycles on copying memory that is
known to be uninitialized.
2025-08-17 14:13:05 -05:00
Zachary S
c7cd1b3b9d Do not consider a T: !Sized candidate to satisfy a T: !MetaSized obligation. 2025-08-17 13:37:32 -05:00
Weihang Lo
08263c953a
Update cargo 2025-08-17 14:03:08 -04:00
Oneirical
75e0263af9 Rehome tests/ui/issues/ tests [5/?] 2025-08-17 13:01:02 -04:00
Samuel Moelius
cbfa17a993
Reorder lto options from most to least optimizing 2025-08-17 12:55:04 -04:00
llogiq
feb18ca1ee
clean-up collapsible_if a bit (#15503)
changelog: none
2025-08-17 15:44:04 +00:00
Miguel Ojeda
1a29d9c23f Add -Zindirect-branch-cs-prefix option
This is intended to be used for Linux kernel RETPOLINE builds.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-08-17 16:51:42 +02:00
Alice Ryhl
1cd7080c3a Add -Zindirect-branch-cs-prefix (from draft PR) 2025-08-17 16:50:23 +02:00
bohan
9878616a3d resolve: debug for block module 2025-08-17 22:37:42 +08:00
Samuel Moelius
3b0ff9cb69 Add //@ ignore-stage1 to query_stability.rs test 2025-08-17 10:32:13 -04:00
sayantn
40fc7df963
Add runtime detection for APX-F and AVX10 2025-08-17 19:34:18 +05:30
nilptr
6be749b619 fix: python formatting error 2025-08-17 21:15:18 +08:00
nilptr
c39ebeaa0b feat(lldb debug info): deref pointer types for more accurate rust type classification 2025-08-17 21:15:18 +08:00
nilptr
12eb1a0bce feat(lldb debug info): improve enum value formatting in lldb 2025-08-17 21:15:18 +08:00
Jason Newcomb
fc42a205e9
Misc clippy_dev changes (#14896)
changelog: none
2025-08-17 11:26:46 +00:00
bors
425a9c0a0e Auto merge of #145284 - nnethercote:type_name-print-regions, r=lcnr
Print regions in `type_name`.

Currently they are skipped, which is a bit weird, and it sometimes causes malformed output like `Foo<>` and `dyn Bar<, A = u32>`.

Most regions are erased by the time `type_name` does its work. So all regions are now printed as `'_` in non-optional places. Not perfect, but better than the status quo.

`c_name` is updated to trim lifetimes from MIR pass names, so that the `PASS_NAMES` sanity check still works. It is also renamed as `simplify_pass_type_name` and made non-const, because it doesn't need to be const and the non-const implementation is much shorter.

The commit also renames `should_print_region` as `should_print_optional_region`, which makes it clearer that it only applies to some regions.

Fixes rust-lang/rust#145168.

r? `@lcnr`
2025-08-17 10:24:20 +00:00
Varun Gandhi
be9cd3cc0a stdlib: Replace typedef -> type alias in doc comment 2025-08-17 17:44:06 +08:00
Sebastien Marie
8792010768 Rust build fails on OpenBSD after using file_lock feature
PR 130999 added the file_lock feature, but doesn't included OpenBSD in the supported targets (Tier 3 platform), leading to a compilation error ("try_lock() not supported").
2025-08-17 09:01:28 +02:00
bors
99ba556567 Auto merge of #144081 - RalfJung:const-ptr-fragments, r=oli-obk
const-eval: full support for pointer fragments

This fixes https://github.com/rust-lang/const-eval/issues/72 and makes `swap_nonoverlapping` fully work in const-eval by enhancing per-byte provenance tracking with tracking of *which* of the bytes of the pointer this one is. Later, if we see all the same bytes in the exact same order, we can treat it like a whole pointer again without ever risking a leak of the data bytes (that encode the offset into the allocation). This lifts the limitation that was discussed quite a bit in https://github.com/rust-lang/rust/pull/137280.

For a concrete piece of code that used to fail and now works properly consider this example doing a byte-for-byte memcpy in const without using intrinsics:
```rust
use std::{mem::{self, MaybeUninit}, ptr};

type Byte = MaybeUninit<u8>;

const unsafe fn memcpy(dst: *mut Byte, src: *const Byte, n: usize) {
    let mut i = 0;
    while i < n {
        *dst.add(i) = *src.add(i);
        i += 1;
    }
}

const _MEMCPY: () = unsafe {
    let ptr = &42;
    let mut ptr2 = ptr::null::<i32>();
    // Copy from ptr to ptr2.
    memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>());
    assert!(*ptr2 == 42);
};
```
What makes this code tricky is that pointers are "opaque blobs" in const-eval, we cannot just let people look at the individual bytes since *we don't know what those bytes look like* -- that depends on the absolute address the pointed-to object will be placed at. The code above "breaks apart" a pointer into individual bytes, and then puts them back together in the same order elsewhere. This PR implements the logic to properly track how those individual bytes relate to the original pointer, and to recognize when they are in the right order again.

We still reject constants where the final value contains a not-fully-put-together pointer: I have no idea how one could construct an LLVM global where one byte is defined as "the 3rd byte of a pointer to that other global over there" -- and even if LLVM supports this somehow, we can leave implementing that to a future PR. It seems unlikely to me anyone would even want this, but who knows.^^

This also changes the behavior of Miri, by tracking the order of bytes with provenance and only considering a pointer to have valid provenance if all bytes are in the original order again. This is related to https://github.com/rust-lang/unsafe-code-guidelines/issues/558. It means one cannot implement XOR linked lists with strict provenance any more, which is however only of theoretical interest. Practically I am curious if anyone will show up with any code that Miri now complains about - that would be interesting data. Cc `@rust-lang/opsem`
2025-08-17 04:33:31 +00:00
Karl Meakin
c9ce45cb1e Optimize char::encode_utf8
Save a few instructions in `encode_utf8_raw_unchecked` by performing
manual CSE.
2025-08-17 01:22:48 +01:00
Josh Triplett
bc9725c1ea Indent some code inside cfg_select!
The previous code inside `cfg_if!` wasn't indented, so the conversion to
`cfg_select!` left it not indented. Indent it.
2025-08-16 16:01:08 -07:00
binarycat
2050a3b297 std: fix more typos 2025-08-16 13:36:29 -05:00
binarycat
0d797d23cf typos: allow moreso 2025-08-16 13:36:29 -05:00
binarycat
d73e6b46e7 tidy: add better error reporting for if typos can't be run 2025-08-16 13:36:29 -05:00
binarycat
6a51eef11b tidy: run typos check in src root, not current dir 2025-08-16 13:36:29 -05:00
binarycat
1cb4fd7dd1 tidy now installs typos-cli as-needed via cargo 2025-08-16 13:36:29 -05:00
Camille Gillot
f35d001325 Visit and print async_fut local for async drop. 2025-08-16 18:26:27 +00:00
Camille Gillot
1460cfe8ea Only unpack span data once. 2025-08-16 18:09:26 +00:00
Deadbeef
e78b41703f refactor return type of suggest_ampmut into an enum 2025-08-17 01:33:49 +08:00
Alejandra González
1fd9504619
similar_names stop linting for 3-char names (#15100)
fixes rust-lang/rust-clippy#14869

Added a simple check if both chars are of length 3
If they are, we skip the check for that pair.

This won't handle the 4 v 3 case.
Not sure if this was the intent of the issue.

Also saw we have some hardcoded exemptions for `set, get` and `lhs, rhs`
Tried removing them thinking they would be handled by the new condition.
But we have to keep because they allow for `bla_lhs` v `bla_rhs` to be
skipped

changelog:[`similar_names`]: Stop triggering for 3-character names
2025-08-16 16:58:06 +00:00