Commit Graph

300570 Commits

Author SHA1 Message Date
Samuel Tardieu
bbda0c9fb5 Rollup merge of #143855 - JonathanBrouwer:omit_gdb_pretty_printer_section, r=jdonszelmann
Port `#[omit_gdb_pretty_printer_section]` to the new attribute parsing

Ports `#[omit_gdb_pretty_printer_section]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? ```@jdonszelmann```
2025-07-14 18:05:45 +02:00
Samuel Tardieu
c59bc44ca9 Rollup merge of #143848 - makai410:smir-rename, r=oli-obk
Rename `stable_mir` and `rustc_smir`

This PR only renames the two crate names.

There is no doubt that we want to rename `stable_mir` to `rustc_public`, while it hasn't been discussed yet that what the new name for `rustc_smir` should be.

This PR proposes a new name for `rustc_smir`, that is `rustc_public_shim`, since `rustc_smir` now is mostly a proxy to do calls to rustc queries and the public API of rustc that is invoked by the `rustc_public` crate.

However, I don't think that name is good enough. I hope there would be a way better name.

r? `@oli-obk`
2025-07-14 18:05:44 +02:00
Samuel Tardieu
30b46e3f8c Rollup merge of #143710 - joshtriplett:random-updates, r=joshtriplett
Updates to random number generation APIs

Updates based on discussions about random number generation.

- Add comment on `RandomSource::fill_bytes` about multiple calls, to allow
  efficient implementations for random sources that generate a word at a time.

- Drop the `Random` trait in favor of `Distribution<T>`, which will let people
  make calls like random(1..=6), and which allows for future expansion to
  non-uniform distributions, as well as floating-point. (For now, this is only
  implemented for `RangeFull`, to get the interface in place. Subsequent PRs
  will implement it for other range types.)
2025-07-14 18:05:44 +02:00
Samuel Tardieu
74b5ac5c15 Rollup merge of #141809 - ChrisDenton:no-cleaup, r=jhpratt
Don't call WSACleanup on process exit

This isn't necessary as cleanup will happen when the process exits regardless.

fixes rust-lang/rust#141799
2025-07-14 18:05:43 +02:00
Chris Denton
c8fb37a521 Don't call WSACleanup on process exit 2025-07-14 14:27:49 +00:00
Jake Goulding
5530744318 Reword mismatched-lifetime-syntaxes text based on feedback
Key changes include:

- Removal of the word "syntax" from the lint message. More accurately,
  it could have been something like "syntax group" or "syntax
  category", but avoiding it completely is easier.
- The primary lint message now reflects exactly which mismatch is
  occurring, instead of trying to be general. A new `help` line is
  general across the mismatch kinds.
- Suggestions have been reduced to be more minimal, no longer also
  changing non-idiomatic but unrelated aspects.
- Suggestion text no longer mentions changes when those changes don't
  occur in that specific suggestion.
2025-07-14 09:52:58 -04:00
Oli Scherer
000e67aafb Preserve constness in trait objects up to hir ty lowering 2025-07-14 12:52:44 +00:00
bors
cccf075eba Auto merge of #143919 - Kobzol:rollup-acyaygs, r=Kobzol
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#143217 (Port #[link_ordinal] to the new attribute parsing infrastructure)
 - rust-lang/rust#143681 (bootstrap/miri: avoid rebuilds for test builds)
 - rust-lang/rust#143724 (Tidy cleanup)
 - rust-lang/rust#143733 (Change bootstrap's `tool.TOOL_NAME.features` to work on any subcommand)
 - rust-lang/rust#143850 (Compiletest: Simplify {Html,Json}DocCk directive handling)
 - rust-lang/rust#143875 (update issue number for `const_trait_impl`)
 - rust-lang/rust#143881 (Use zero for initialized Once state)
 - rust-lang/rust#143887 (Run bootstrap tests sooner in the `x test` pipeline)
 - rust-lang/rust#143917 (Change "allocated object" to "allocation".)
 - rust-lang/rust#143918 (Tier check cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-14 12:17:15 +00:00
Chris Denton
9fd3886838 Add experimental backtrace-trace-only std feature 2025-07-14 11:52:17 +00:00
Jieyou Xu
b19a508b90 Use TestSuite enum instead of stringly-typed test suites 2025-07-14 17:44:50 +08:00
Makai
6598c61725 rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
Jakub Beránek
0d69847b3c Rollup merge of #143918 - hkBst:tier-check-cleanup, r=Kobzol
Tier check cleanup

clippy cleanup + edition 2024
2025-07-14 11:04:57 +02:00
Jakub Beránek
b5312fe567 Rollup merge of #143917 - theemathas:change-allocated-object-to-allocation, r=oli-obk
Change "allocated object" to "allocation".

These seem like they were missed in <https://github.com/rust-lang/rust/pull/141224>
2025-07-14 11:04:56 +02:00
Jakub Beránek
37b5d79108 Rollup merge of #143887 - Kobzol:reroder-bootstrap-tests, r=jieyouxu
Run bootstrap tests sooner in the `x test` pipeline

With the recently added bootstrap snapshot tests, and in general with our plans to test more things in bootstrap, I feel like the original comment isn't accurate anymore. Recently, on several occasions I had to wait for 40+ minutes of CI just to find out that the bootstrap snapshot tests have failed. I think we should run bootstrap tests towards the beginning instead now.

r? ```@jieyouxu```
2025-07-14 11:04:56 +02:00
Jakub Beránek
70301da7c7 Rollup merge of #143881 - orlp:once-state-repr, r=tgross35
Use zero for initialized Once state

By re-labeling which integer represents which internal state for `Once` we can ensure that the initialized state is the all-zero state. This is beneficial because some CPU architectures (such as Arm) have specialized instructions to specifically branch on non-zero, and checking for the initialized state is by far the most important operation.

As an example, take this:

```rust
use std::sync::atomic::{AtomicU32, Ordering};

const INIT: u32 = 3;

#[inline(never)]
#[cold]
pub fn slow(state: &AtomicU32) {
    state.store(INIT, Ordering::Release);
}

pub fn ensure_init(state: &AtomicU32) {
    if state.load(Ordering::Acquire) != INIT {
        slow(state)
    }
}
```

If `INIT` is 3 (as is currently the state for `Once`), we see the following assembly on `aarch64-apple-darwin`:

```asm
example::ensure_init::h332061368366e313:
        ldapr   w8, [x0]
        cmp     w8, #3
        b.ne    LBB1_2
        ret
LBB1_2:
        b       example::slow::ha042bd6a4f33724e
```

By changing the `INIT` state to zero we get the following:

```asm
example::ensure_init::h332061368366e313:
        ldapr   w8, [x0]
        cbnz    w8, LBB1_2
        ret
LBB1_2:
        b       example::slow::ha042bd6a4f33724e
```

So this PR saves 1 instruction every time a `LazyLock` gets accessed on platforms such as these.
2025-07-14 11:04:55 +02:00
Jakub Beránek
a7ad680269 Rollup merge of #143875 - fee1-dead-contrib:push-zvqrmzrprpzt, r=compiler-errors
update issue number for `const_trait_impl`

r? project-const-traits

cc rust-lang/rust#67792 rust-lang/rust#143874
2025-07-14 11:04:55 +02:00
Jakub Beránek
2ec48e0489 Rollup merge of #143850 - fmease:comptest-simp-docck-handling, r=jieyouxu
Compiletest: Simplify {Html,Json}DocCk directive handling

So much more maintainable and extensible.

r? ````@jieyouxu```` as discussed
2025-07-14 11:04:54 +02:00
Jakub Beránek
197ba7e4f1 Rollup merge of #143733 - Stypox:bootstrap-tool-config-any, r=Kobzol
Change bootstrap's `tool.TOOL_NAME.features` to work on any subcommand

This is a followup to rust-lang/rust#142379 to make the bootstrap option `tool.TOOL_NAME.features` work on any subcommand instead of just build (so also run/test/...). I also made the `TOOL_NAME` comparisons look at the tool path instead of the tool name to determine to which tool a `TOOL_NAME` refers to, so you can specify tools by path like in other places of the bootstrap (e.g. `tool."tools/miri".features`).
2025-07-14 11:04:54 +02:00
Jakub Beránek
0d4d85b9ea Rollup merge of #143724 - hkBst:tidy-cleanup, r=Mark-Simulacrum
Tidy cleanup
2025-07-14 11:04:53 +02:00
Jakub Beránek
33d477fe31 Rollup merge of #143681 - RalfJung:bootstrap-miri-rebuilds, r=Kobzol
bootstrap/miri: avoid rebuilds for test builds

When building Miri in its own repo, we always build with `--all-targets`:
a009612691/src/tools/miri/miri-script/src/util.rs (L167-L174)
This saves a bunch of time since some of Miri's dependencies get more features enabled by some of Miri's dev-dependencies, and they all get built twice otherwise if you do `cargo build && cargo test` (which is typically what you end up doing inside `./miri test` and also inside `./x test miri`).

This applies the same approach to bootstrap, drastically reducing the edit-compile cycle for Miri work here. :)
2025-07-14 11:04:52 +02:00
Jakub Beránek
93c10272d0 Rollup merge of #143217 - Periodic1911:link-ordinal, r=jdonszelmann
Port #[link_ordinal] to the new attribute parsing infrastructure

Ports link_ordinal to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-07-14 11:04:52 +02:00
fuder.eth
19fccacd4a Update SUMMARY.md
Update README.md
2025-07-14 12:01:41 +03:00
bors
64b185edda Auto merge of #143873 - dianqk:update-llvm, r=nikic
Update LLVM to 20.1.8

I made a new branch with patches that aren't yet in LLVM 20.1.8.
2025-07-14 08:58:27 +00:00
Oli Scherer
eef08a3f44 Give all bytes of TypeId provenance 2025-07-14 08:33:51 +00:00
Marijn Schouten
39059f6181 tiercheck: edition 2024 2025-07-14 08:30:27 +00:00
Oli Scherer
7f95f04267 Eliminate all direct uses of LLVMMDStringInContext2 2025-07-14 08:27:08 +00:00
Oli Scherer
56d22cd29f Use context methods instead of directly calling FFI 2025-07-14 08:27:08 +00:00
Oli Scherer
b9baf63f99 Merge typeid_metadata and create_metadata 2025-07-14 08:27:08 +00:00
Oli Scherer
e574fef728 Shrink some unsafe blocks in cg_llvm 2025-07-14 08:27:08 +00:00
Oli Scherer
d3d51b4fdb Avoid a bunch of unnecessary unsafe blocks in cg_llvm 2025-07-14 08:27:08 +00:00
Marijn Schouten
90660f4d50 tiercheck: clippy fixes 2025-07-14 08:19:58 +00:00
Tim (Theemathas) Chirananthavat
6080c75d62 Change "allocated object" to "allocation".
These seem like they were missed in <https://github.com/rust-lang/rust/pull/141224>
2025-07-14 15:01:58 +07:00
Stypox
940aa20408 Add comment about features not part of "extra-features" 2025-07-14 09:37:25 +02:00
Stypox
b3ed03529f Only compare tool name to apply features to 2025-07-14 09:37:24 +02:00
Stypox
937ef9381c Bootstrap's tool.TOOL_NAME.features now works on any subcommand 2025-07-14 09:37:23 +02:00
Shoyu Vanilla (Flint)
356a54df2e Merge pull request #20234 from Hmikihiro/migrate_ted_remove_default
Remove `ConstParam::remove_default` and `TypeParam::remove_default` to migrate from ted
2025-07-14 06:42:36 +00:00
xizheyin
1cac8cbde9 Add test array-type-no-semi.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-14 14:26:47 +08:00
Ralf Jung
794dc328b4 Merge pull request #4467 from rust-lang/rustup-2025-07-14
Automatic Rustup
2025-07-14 06:06:20 +00:00
Martin Nordholts
500b743f7e tests: Test line debuginfo for linebreaked function parameters 2025-07-14 07:11:57 +02:00
The Miri Cronjob Bot
8812d741eb Merge from rustc 2025-07-14 05:07:40 +00:00
The Miri Cronjob Bot
dbeb05cd2a Preparing for merge from rustc 2025-07-14 05:00:14 +00:00
bors
ad635e5d06 Auto merge of #143779 - JonathanBrouwer:automatically_derived_parser, r=oli-obk
Port `#[automatically_derived]` to the new attribute parsing infrastructure

Ports `#[automatically_derived]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? `@oli-obk`
cc `@jdonszelmann`
2025-07-14 04:29:53 +00:00
bors
9c3064e131 Auto merge of #143357 - cjgillot:no-assoc-item-kind, r=compiler-errors
Retire hir::*ItemRef.

This information was kept for various places that iterate on HIR to know about trait-items and impl-items.

This PR replaces them by uses of the `associated_items` query that contain pretty much the same information.

This shortens many spans to just `def_span`, which can be easier to read.
2025-07-13 22:39:10 +00:00
Nik Revenco
f5485e5564 docs(alloc::fmt): Make type optional, instead of matching the empty string 2025-07-13 23:24:27 +01:00
Kivooeo
b7d024b056 moved tests 2025-07-14 02:28:43 +05:00
René Kijewski
6760cd2859 core: make str::split_at_unchecked() inline
This PR adds `#[inline]` to the method `str::split_at_unchecked()`.
This is done for two reasons:

1. The method is tiny, e.g. on AMD-64 (<https://godbolt.org/z/ba68fdfxn>):

   ```asm
   movq    %rdi, %rax
   subq    %rcx, %rdx
   movq    %rsi, (%rdi)
   addq    %rcx, %rsi
   movq    %rcx, 8(%rdi)
   movq    %rsi, 16(%rdi)
   movq    %rdx, 24(%rdi)
   retq
   ```

2. More importantly, inlining the method enables further automatic
   optimizations. E.g. if you split at index 3, then in the compiler
   (rustc, llvm or both) knows that this code cannot fail, and the
   panicking path is omitted in the generated code:

   ```rust
   pub fn punctuation(i: &str) -> Result<(), ()> {
       const THREE_CHARS: &[[u8; 3]] = &[*b"<<=", *b">>=", *b"...", *b"..="];

       if let Some((head, _)) = i.split_at_checked(3)
           && THREE_CHARS.contains(&head.as_bytes().try_into().unwrap())
       {
           Ok(())
       } else {
           Err(())
       }
   }
   ```

   <details>
   <summary>Without PR</summary>

   <https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=0234de8158f467eebd73286f20d6e27a>

   ```asm
   playground::punctuation:
           subq    $40, %rsp
           movq    %rsi, %rdx
           movq    %rdi, %rsi
           movb    $1, %al
           cmpq    $3, %rdx
           ja      .LBB2_2
           je      .LBB2_3
   .LBB2_11:
           addq    $40, %rsp
           retq
   .LBB2_2:
           cmpb    $-64, 3(%rsi)
           jl      .LBB2_11
   .LBB2_3:
           leaq    8(%rsp), %rdi
           movl    $3, %ecx
           callq   *core::str::<impl str>::split_at_unchecked@GOTPCREL(%rip)
           movq    8(%rsp), %rcx
           movb    $1, %al
           testq   %rcx, %rcx
           je      .LBB2_11
           cmpq    $3, 16(%rsp)
           jne     .LBB2_12
           movzwl  (%rcx), %edx
           movzbl  2(%rcx), %ecx
           shll    $16, %ecx
           orl     %edx, %ecx
           cmpl    $4013115, %ecx
           jg      .LBB2_8
           cmpl    $3026478, %ecx
           je      .LBB2_10
           cmpl    $4009518, %ecx
           je      .LBB2_10
           jmp     .LBB2_11
   .LBB2_8:
           cmpl    $4013630, %ecx
           je      .LBB2_10
           cmpl    $4013116, %ecx
           jne     .LBB2_11
   .LBB2_10:
           xorl    %eax, %eax
           addq    $40, %rsp
           retq
   .LBB2_12:
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.2(%rip), %rdi
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.1(%rip), %rcx
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.6(%rip), %r8
           leaq    7(%rsp), %rdx
           movl    $43, %esi
           callq   *core::result::unwrap_failed@GOTPCREL(%rip)
   ```
   </details>

   <details>
   <summary>With PR</summary>

   <https://play.rust-lang.org/?version=stable&mode=release&edition=2024&gist=5d4058c79ce0f6cb1a434190427d2055>

   ```asm
   playground::punctuation:
           movb    $1, %al
           cmpq    $3, %rsi
           ja      .LBB0_2
           je      .LBB0_3
   .LBB0_9:
           retq
   .LBB0_2:
           cmpb    $-64, 3(%rdi)
           jl      .LBB0_9
   .LBB0_3:
           movzwl  (%rdi), %eax
           movzbl  2(%rdi), %ecx
           shll    $16, %ecx
           orl     %eax, %ecx
           movb    $1, %al
           cmpl    $4013115, %ecx
           jg      .LBB0_6
           cmpl    $3026478, %ecx
           je      .LBB0_8
           cmpl    $4009518, %ecx
           je      .LBB0_8
           jmp     .LBB0_9
   .LBB0_6:
           cmpl    $4013630, %ecx
           je      .LBB0_8
           cmpl    $4013116, %ecx
           jne     .LBB0_9
   .LBB0_8:
           xorl    %eax, %eax
           retq
   ```
   </details>
2025-07-13 23:00:42 +02:00
Antoni Boucher
b0ab2bf68e Fix LTO test 2025-07-13 16:38:37 -04:00
Antoni Boucher
b01bbe06cc Fix no-f16-f128 feature name 2025-07-13 16:38:37 -04:00
Antoni Boucher
623609e713 Ignore failing test 2025-07-13 16:38:37 -04:00
Antoni Boucher
56a82a2402 Fix empty backtrace 2025-07-13 16:14:30 -04:00