Commit Graph

329039 Commits

Author SHA1 Message Date
Pieter-Louis Schoeman
e789c33edb Add missing tests and adress concerns 2026-06-08 21:52:44 +02:00
bors
f3ef3bd882 Auto merge of #157374 - khyperia:remove-UnevaluatedConstKind-def_id, r=BoxyUwU
remove UnevaluatedConstKind::def_id

this is some of the const side of https://github.com/rust-lang/rust/issues/152245

not quite a _full_ removal, there's still some spicy things such as `UnevaluatedConstKind::def_span` remaining that won't quite work for new non-DefID `UnevaluatedConstKind` cases, but IMO this is the bulk of the work, and feature-specific things can deal with their quirks in their own PRs when they know their own use cases.

r? @BoxyUwU 

self-reminder: file an issue on what to do about rustc_public's handling of the raw DefIds in rustc_public AliasTy/AliasConst
2026-06-08 13:24:32 +00:00
bors
877a13169d Auto merge of #157600 - JonathanBrouwer:rollup-iLVNIqp, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#157599 (`rust-analyzer` subtree update)
 - rust-lang/rust#157298 (Use alternate means of detecting enums in `is_udt`)
 - rust-lang/rust#155338 (Staticlib hide internal symbols)
 - rust-lang/rust#157402 (Implement feature `integer_casts`)
 - rust-lang/rust#157452 (Fix WASI links)
 - rust-lang/rust#157535 (Rename `errors.rs` file to `diagnostics.rs` (2/N))
 - rust-lang/rust#157585 (Rename `errors.rs` file to `diagnostics.rs` (3/N))
 - rust-lang/rust#157588 (Use `mul nuw nsw` in `intrinsics::copy`)
 - rust-lang/rust#157592 (Suggest comma multiple)
2026-06-08 09:58:02 +00:00
Jonathan Brouwer
0b6b505c92 Rollup merge of #157592 - ariagivens:suggest-comma-multiple, r=JonathanBrouwer
Suggest comma multiple

Following from rust-lang/rust#157545

If there are multiple missing comma's, suggest fixing all of them in one step to avoid error cascade.

For example:
```
error: attribute items not separated with `,`
   |
LL |     name = "name"
   |                  ^ help: try adding `,` here
```
followed by
```
error: attribute items not separated with `,`
   |
LL |     kind = "static"
   |                    ^ help: try adding `,` here
```
after adding the comma.

Now this becomes one error:
```
error: attribute items not separated with `,`
  --> $DIR/attr-missing-comma.rs:10:18
   |
LL |     name = "name"
   |                  ^
   |
help: try adding `,` here
   |
LL |     name = "name",
   |                  +
help: try adding `,` here
   |
LL |     kind = "static",
   |                    +
```
2026-06-08 09:41:58 +02:00
Jonathan Brouwer
87749cea75 Rollup merge of #157588 - scottmcm:copy-nsuw, r=saethlin
Use `mul nuw nsw` in `intrinsics::copy`

Essentially the same as rust-lang/rust#157560, just for `copy` instead of `copy_nonoverlapping`.

> Yeah, in fact both copy and copy_nonoverlapping could use this since we know the result must be at most isize::MAX else it cannot be inbounds.
> ~ https://github.com/rust-lang/rust/pull/157560#issuecomment-4642072687

r? saethlin
2026-06-08 09:41:58 +02:00
Jonathan Brouwer
4fc193e172 Rollup merge of #157585 - GuillaumeGomez:rename-err-to-diag-3, r=Kivooeo
Rename `errors.rs` file to `diagnostics.rs` (3/N)

Follow-up of https://github.com/rust-lang/rust/pull/157485.

r? @JonathanBrouwer
2026-06-08 09:41:57 +02:00
Jonathan Brouwer
91d945fe0a Rollup merge of #157535 - GuillaumeGomez:rename-err-to-diag-2, r=JonathanBrouwer
Rename `errors.rs` file to `diagnostics.rs` (2/N)

Follow-up of rust-lang/rust#157485.

r? @JonathanBrouwer
2026-06-08 09:41:56 +02:00
Jonathan Brouwer
d0a1aef0ba Rollup merge of #157452 - tyilo:fix-wasi-links, r=joboet
Fix WASI links
2026-06-08 09:41:56 +02:00
Jonathan Brouwer
150c383168 Rollup merge of #157402 - orlp:int-cast, r=jhpratt
Implement feature `integer_casts`

Tracking issue: https://github.com/rust-lang/rust/issues/157388
2026-06-08 09:41:55 +02:00
Jonathan Brouwer
d7bcfdb13f Rollup merge of #155338 - cezarbbb:staticlib-symbol-hygiene, r=petrochenkov
Staticlib hide internal symbols

According to issue rust-lang/rust#104707, when building a staticlib, all Rust internal symbols — mangled symbols, `#[rustc_std_internal_symbol]` items, allocator shims, etc. — leak out of the static archive. In contrast, cdylib correctly exports only `#[no_mangle]` symbols via a linker version script.

`-Zstaticlib-hide-internal-symbols` directly post-processes ELF object files in the archive: parsing the `SHT_SYMTAB` sections and setting `STV_HIDDEN` visibility on any `GLOBAL/WEAK` defined symbol that is not in the exported symbol set, without changing the binding. This is an in-place modification (only writing the st_other byte per matching entry), with zero overhead.

Supported on ELF targets (Linux, BSD, etc.) and Apple targets (macOS, iOS, etc.). On unsupported targets (Windows), a warning is emitted and the flag has no effect.

**Update**: The rename counterpart (`-Zstaticlib-rename-internal-symbols`) is in rust-lang/rust#156950.

The test code are as follows:

1.a std rust staticlib:
```rust
use std::collections::HashMap;
use std::panic::{catch_unwind, AssertUnwindSafe};

#[no_mangle]
pub extern "C" fn my_add(a: i32, b: i32) -> i32 { a + b }

#[no_mangle]
pub extern "C" fn my_hash_lookup(key: u64) -> u64 {
    let mut map = HashMap::new();
    for i in 0..100u64 { map.insert(i, i.wrapping_mul(2654435761)); }
    *map.get(&key).unwrap_or(&0)
}

pub fn internal_reverse(s: &str) -> String { s.chars().rev().collect() }

#[no_mangle]
pub extern "C" fn my_format_number(n: i32) -> i32 {
    let s = format!("number: {}", n); s.len() as i32
}

#[no_mangle]
pub extern "C" fn my_safe_div(a: i32, b: i32) -> i32 {
    match catch_unwind(AssertUnwindSafe(|| {
        if b == 0 { panic!("division by zero!"); }
        a / b
    })) {
        Ok(result) => result,
        Err(_) => -1,
    }
}

#[no_mangle]
pub extern "C" fn my_uncaught_panic() { panic!("uncaught panic across FFI"); }
```

1.b downstream c program:
```c
extern int my_add(int a, int b);
extern unsigned long my_hash_lookup(unsigned long key);
extern int my_format_number(int n);
extern int my_safe_div(int a, int b);
extern void my_uncaught_panic(void);

int main() {
    int failures = 0;
    if (my_add(10, 20) != 30) failures++;
    if (my_hash_lookup(5) != 5UL * 2654435761UL) failures++;
    if (my_format_number(42) != 10) failures++;
    if (my_safe_div(100, 5) != 20) failures++;
    if (my_safe_div(100, 0) != -1) failures++;
    pid_t pid = fork();
    if (pid == 0) { alarm(5); my_uncaught_panic(); _exit(0); }
    else { waitpid(pid, &status, 0); }
    return failures;
}
```

The test results with different compiler flags(which might cause binary size reduction) are as follows:
1.c result with `-Zstaticlib-hide-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 1.7M      1.5M  204K (12%)    1735       5    1730
  lto_thin                616K      584K  33K (5%)     246       5     241
  lto_fat                 525K      525K    0 (0%)       6       5       1
  opt_s                   1.7M      1.5M  204K (12%)    1735       5    1730
  opt_z                   1.7M      1.5M  204K (12%)    1735       5    1730
  lto_thin_z              602K      570K  32K (5%)     246       5     241
  lto_fat_z               514K      514K    0 (0%)       6       5       1
  full                    514K      514K    0 (0%)       6       5       1
```

1.d result with `-Zstaticlib-hide-internal-symbols + -Zstaticlib-rename-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 1.7M      1.5M  162K (9%)    1735       5    1730
  lto_thin                616K      599K  18K (2%)     246       5     241
  lto_fat                 525K      535K  -1% (-1%)       6       5       1
  opt_s                   1.7M      1.5M  162K (9%)    1735       5    1730
  opt_z                   1.7M      1.5M  162K (9%)    1735       5    1730
  lto_thin_z              602K      585K  18K (2%)     246       5     241
  lto_fat_z               514K      524K  -1% (-1%)       6       5       1
  full                    514K      523K  -1% (-1%)       6       5       1
```

2.a no_std rust staticlib
```rust
#![no_std]
#![feature(core_intrinsics)]

use core::panic::PanicInfo;

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! { loop {} }

#[no_mangle]
pub extern "C" fn embedded_add(a: i32, b: i32) -> i32 { a.wrapping_add(b) }

#[no_mangle]
pub extern "C" fn embedded_checksum(data: *const u8, len: usize) -> u8 {
    if data.is_null() { return 0; }
    let slice = unsafe { core::slice::from_raw_parts(data, len) };
    let mut sum: u8 = 0;
    for &byte in slice { sum = sum.wrapping_add(byte); }
    sum
}

fn internal_helper() -> i32 { 42 }
#[no_mangle]
pub extern "C" fn call_internal() -> i32 { internal_helper() }

#[no_mangle]
pub extern "C" fn embedded_trigger_abort() { core::intrinsics::abort(); }
```
2.b downstream c program
```c
extern int embedded_add(int a, int b);
extern unsigned char embedded_checksum(const unsigned char *data, unsigned long len);
extern int call_internal(void);
extern void embedded_trigger_abort(void);

int main() {
    int failures = 0;
    if (embedded_add(10, 20) != 30) failures++;
    unsigned char data[] = {1, 2, 3};
    if (embedded_checksum(data, 3) != 6) failures++;
    if (call_internal() != 42) failures++;
    pid_t pid = fork();
    if (pid == 0) { embedded_trigger_abort(); _exit(0); }
    else { waitpid(pid, &status, 0); }
    return failures;
}
```

The test results with different compiler flags(which might cause binary size reduction) are as follows:
2.c result with `-Zstaticlib-hide-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 485K      429K  56K (11%)     490       4     486
  lto_thin                180K      180K    0 (0%)       4       4       0
  lto_fat                 179K      179K    0 (0%)       4       4       0
  opt_s                   485K      429K  56K (11%)     490       4     486
  opt_z                   485K      429K  56K (11%)     490       4     486
  lto_thin_z              180K      180K    0 (0%)       4       4       0
  lto_fat_z               179K      179K    0 (0%)       4       4       0
  full                    179K      179K    0 (0%)       4       4       0
```

2.d result with `-Zstaticlib-hide-internal-symbols + -Zstaticlib-rename-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 485K      447K  39K (7%)     490       4     486
  lto_thin                180K      189K  -5% (-5%)       4       4       0
  lto_fat                 179K      189K  -5% (-5%)       4       4       0
  opt_s                   485K      448K  38K (7%)     490       4     486
  opt_z                   485K      448K  38K (7%)     490       4     486
  lto_thin_z              180K      189K  -5% (-5%)       4       4       0
  lto_fat_z               179K      189K  -5% (-5%)       4       4       0
  full                    179K      189K  -5% (-5%)       4       4       0
```

Test results show that this compiler option is beneficial for scenarios where LTO cannot be enabled.

r? @bjorn3 @petrochenkov
2026-06-08 09:41:54 +02:00
Jonathan Brouwer
3898939fe1 Rollup merge of #157298 - Walnut356:msvc_enum, r=jieyouxu
Use alternate means of detecting enums in `is_udt`

This fixes a small regression from https://github.com/rust-lang/rust/pull/155336

Flat enums are excluded from `is_udt` since LLDB natively handles them correctly. The previous logic (`SBType.IsScopedEnumerationType()`) behaved correctly for non-msvc targets, but for some reason on msvc enums don't count as scoped enumerations?

The new logic checks the type returned by `SBType.GetEnumerationIntegerType()`. If the queried type isn't an enum, the returned type is invalid. This behaves correctly on both msvc and non-msvc targets, and its behavior doesn't conflict with sum-type enums.

As always, testing on msvc isn't really possible atm. That should change soon though =)

---

try-job: aarch64-apple
2026-06-08 09:41:53 +02:00
Jonathan Brouwer
0a79d4d457 Rollup merge of #157599 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 57116fa264.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-06-08 09:41:52 +02:00
bors
06293ff2b1 Auto merge of #155607 - KowalskiThomas:kowalski/perf-use-get_unchecked-for-pattern, r=Mark-Simulacrum
perf: use `get_unchecked` for `TwoWaySearcher`



## What is this PR?

*This is related to rust-lang/rust#27721.*

This PR is a proposal for a performance improvement in `std::pattern`.  

Profiling of [https://github.com/quickwit-oss/quickwit](https://github.com/quickwit-oss/quickwit) in production shows that `TwoWaySearcher::next` is one of the most CPU-time-consuming functions, so I thought I would give it a look.  
I read the [contribution guide](https://std-dev-guide.rust-lang.org/development/perf-benchmarking.html) and this seems to be a fitting proposal.

It seems like `TwoWaySearcher::next` and `TwoWaySearcher::next_back` could be made faster by using `get_unchecked` in the inner loop comparisons instead of regular indexing, which is safe in the conditions where it would be done (indices are within bounds by construction).  
I added some `SAFETY` comments in the code to explain why this is safe, as I believe is customary in those cases (and according to [this page as well](https://std-dev-guide.rust-lang.org/policy/safety-comments.html)).

### Benchmarks

I ran the existing bencharmks before/after the changes (only on my laptop, I can run them in other places if that's necessary). 

```
./x.py bench library/coretests -- pattern::
```

We seem to be getting a ~7.5-12% performance improvement at a very low cost, which sounds worthwhile to me.  
But this is the first time I'm proposing a change in Rust, so I'm looking forward to feedback on this.

```
BEFORE CHANGES
    pattern::ends_with_char   3398.91ns/iter +/- 526.28
    pattern::ends_with_str    3545.04ns/iter +/- 1108.76
    pattern::starts_with_char 3348.31ns/iter +/- 352.38
    pattern::starts_with_str  3710.59ns/iter +/- 435.57

AFTER CHANGES
    pattern::ends_with_char   3125.99ns/iter +/- 567.09  (-8.03%)
    pattern::ends_with_str    3106.43ns/iter +/- 258.33  (-12.38%)
    pattern::starts_with_char 3094.55ns/iter +/- 595.42  (-7.59%)
    pattern::starts_with_str  3365.75ns/iter +/- 268.88  (-9.29%)
```

System info for the benchmarks run

<details>

```
Based on commit 8317fef204

rustc 1.96.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: aarch64-apple-darwin
release: 1.96.0-dev
LLVM version: 22.1.2

Apple M4 Max
16
64 GB
ProductName:		macOS
ProductVersion:		26.3
BuildVersion:		25D125
(this was run on AC and without any heavy load from other apps or whatnot)
```

</details>
2026-06-08 06:23:31 +00:00
Laurențiu Nicola
475a2dff99 Merge pull request #22544 from rust-lang/rustc-pull
Rustc pull update
2026-06-08 05:51:57 +00:00
Lukas Wirth
a0f2729c8d Merge pull request #22505 from Veykril/veykril/push-okqlunrolqyr
Adopt uv's AI policy
2026-06-08 05:42:49 +00:00
The rustc-josh-sync Cronjob Bot
0a6181ccc1 Merge ref '029c9e18dd1f' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@029c9e18dd
Filtered ref: rust-lang/rust-analyzer@912b3ed408
Upstream diff: 43a4909ee9...029c9e18dd

This merge was created using https://github.com/rust-lang/josh-sync.
2026-06-08 05:42:46 +00:00
The rustc-josh-sync Cronjob Bot
545fe3f8a5 Prepare for merging from rust-lang/rust
This updates the rust-version file to 029c9e18dd.
2026-06-08 05:40:34 +00:00
Aria Givens
c865af60ec Give multiple suggestions when multiple commas are missing in attribute argument list 2026-06-07 21:12:22 -04:00
Aria Givens
6f28d6569c Add test for missing comma in attribute argument list 2026-06-07 21:12:21 -04:00
cezarbbb
6caae67115 add -Zstaticlib-hide-internal-symbols 2026-06-08 08:33:13 +08:00
Scott McMurray
871664e02a Also use mul nuw nsw in intrinsics::copy
Essentially the same as 157560, just for `copy` instead of `copy_nonoverlapping`.
2026-06-07 16:57:55 -07:00
Orson Peters
d79b87b209 Add tests 2026-06-08 00:43:12 +02:00
Orson Peters
e70c619a9d Use 'representable' rather than 'lies in domain' 2026-06-08 00:43:12 +02:00
Orson Peters
537b091742 Use impl(self) instead of Sealed 2026-06-08 00:43:12 +02:00
Orson Peters
ac3874453b Implement feature integer_casts 2026-06-08 00:43:12 +02:00
bors
029c9e18dd Auto merge of #157586 - jhpratt:rollup-trnbzaA, r=jhpratt
Rollup of 25 pull requests

Successful merges:

 - rust-lang/rust#157447 (Move cross crate tests into the appropriate folder)
 - rust-lang/rust#145108 (Resolver: Batched Import Resolution)
 - rust-lang/rust#156119 (Further optimize `SliceIndex<str>` impl for `Range<usize>`)
 - rust-lang/rust#157224 (Manually unroll loop in `str::floor_char_boundary`)
 - rust-lang/rust#157289 (Add infallible primitive type lookups to template arg resolver)
 - rust-lang/rust#157540 (Cleanup and optimize `render_impls`)
 - rust-lang/rust#157444 (Couple of work product cleanups)
 - rust-lang/rust#157543 (Reorganize `tests/ui/issues` [5/N])
 - rust-lang/rust#153513 (Syntactically reject equality predicates)
 - rust-lang/rust#155797 (LineWriter: cap write_vectored newline scan to avoid quadratic write_all_vectored)
 - rust-lang/rust#156155 (macros: report unbound metavariables directly)
 - rust-lang/rust#156188 (riscv: promote d, e, and f target_features to CfgStableToggleUnstable)
 - rust-lang/rust#156666 (Clarify meaning of ranges in pointer offset docs)
 - rust-lang/rust#157078 (Document equivalence of `highest_one` and `ilog2` methods on integers)
 - rust-lang/rust#157129 (ci: update download-artifact action to v8)
 - rust-lang/rust#157169 (triagebot: Update messages to direct changes to appropriate repositories)
 - rust-lang/rust#157323 (Document Repeat::last panic behavior)
 - rust-lang/rust#157370 (Clarify MaybeUninit::zeroed padding docs)
 - rust-lang/rust#157399 (Silence llbc's output by default to prevent rustc's linker output warning)
 - rust-lang/rust#157500 (Improve documentation of `align_of` and `Alignment`.)
 - rust-lang/rust#157545 (Suggest using comma to separate valid attribute list items)
 - rust-lang/rust#157559 (chore: Update annotate-snippets to 0.12.16)
 - rust-lang/rust#157560 (In `copy_nonoverlapping`, use `mul nuw nsw` to compute the byte size)
 - rust-lang/rust#157580 (Importing suggestion reported twice when reporting privacy error)
 - rust-lang/rust#157581 (Test fixup)
2026-06-07 21:57:03 +00:00
Jacob Pratt
67d0937df5 Rollup merge of #157581 - qaijuang:157438-follow-up, r=GuillaumeGomez
Test fixup

Follow up to https://github.com/rust-lang/rust/pull/157438.

r? @GuillaumeGomez
2026-06-07 17:47:56 -04:00
Jacob Pratt
9d304e8c91 Rollup merge of #157580 - rperier:duplicate_importing_suggestion, r=folkertdev
Importing suggestion reported twice when reporting privacy error

cc rust-lang/rust#157454

This is a first fix proposal
2026-06-07 17:47:56 -04:00
Jacob Pratt
753665aff6 Rollup merge of #157560 - scottmcm:mul_nuw_nsw_in_memcpy, r=saethlin
In `copy_nonoverlapping`, use `mul nuw nsw` to compute the byte size

Seems like we might as well?  Adding these flags means the optimizer can tell the limited range on the count of items -- like how we use these flags (rust-lang/rust#136575) when calculating `size_of_val` for a slice.

Today we use a wrapping multiplication, which mean that `copy_nonoverlapping::<u32>(src, dst, 0x40000000_00000001)` appears like 4 bytes -- a perfectly reasonable size! -- once it gets to the `memcpy` call.

If I'm understanding <https://doc.rust-lang.org/std/ptr/fn.copy_nonoverlapping.html#safety> properly, this is just exploiting existing UB, since `src` and `dst` must each be inside an allocation, and those allocations can be at most `isize::MAX` bytes.  (Plus, fundamentally, to be non-overlapping there's not enough space in the address space to be bigger than `isize::MAX`.)

cc @RalfJung to make sure this is ok, as requested last he found out I was newly exploiting some UB in codegen 🙃
r? codegen
2026-06-07 17:47:55 -04:00
Jacob Pratt
94ddea385a Rollup merge of #157559 - InvalidPathException:main, r=jieyouxu
chore: Update annotate-snippets to 0.12.16

This PR updates `annotate-snippets` to [`0.12.16`](https://github.com/rust-lang/annotate-snippets-rs/blob/main/CHANGELOG.md#01216---2026-05-06) which fixes highlighting for indented code: https://github.com/rust-lang/annotate-snippets-rs/issues/405

Also fixes https://github.com/rust-lang/rust/issues/155873 (the same problem)
2026-06-07 17:47:55 -04:00
Jacob Pratt
61d26bbdb7 Rollup merge of #157545 - ariagivens:suggest-comma, r=JonathanBrouwer
Suggest using comma to separate valid attribute list items

If the parser encounters a missing comma in an attribute arg list and the next item is valid, suggest adding the comma.

For example:
```
error: attribute items not separated with `,`
  --> $DIR/expected-comma-found-token.rs:7:26
   |
LL |     message="the message"
   |                          ^ help: try adding `,` here
```
2026-06-07 17:47:54 -04:00
Jacob Pratt
3395ca9e4d Rollup merge of #157500 - kpreid:align-doc, r=Mark-Simulacrum
Improve documentation of `align_of` and `Alignment`.

* The documentation for `align_of_val()` and `Alignment::of_val()` did not explain its use in interacting with `dyn` types, and even contained the false statement that “Every reference to a value of the type `T` must be a multiple of this number”. This change removes that statement from everything except `align_of()`, and adds a mention of, and example code for, getting the alignment of a `dyn` value.

* The documentation for `align_of_val_raw()` did not explain how it relates to other functions in the family. Now it does.

* Added a caveat that the alignment of `i32` is not always 4, despite the examples asserting this.

@rustbot label A-docs
2026-06-07 17:47:53 -04:00
Jacob Pratt
51d4f1ac4b Rollup merge of #157399 - kulst:llbc-linker-output-fix, r=Mark-Simulacrum
Silence llbc's output by default to prevent rustc's linker output warning

https://github.com/rust-lang/rust/pull/153968 recently made visible that the llvm-bitcode-linker (llbc) always emits messages to stdout even when linking successfully. Additionally, these messages use ANSI escape sequences for coloring, which don't get rendered correctly.

This patch fixes both.

- It silences llbc's output by default and adds a verbosity command line argument to it (`-v` for verbose and `-vv` for very verbose, which can be added by using rustc's `-Clink-arg=` argument).
-  It also removes the ANSI escape sequences and makes the output more linker-like (by removing timestamps, tracing-level, tracing-target).

cc: @kjetilkjeka

@rustbot label +L-linker_messages +O-NVPTX
2026-06-07 17:47:53 -04:00
Jacob Pratt
2d29b1259d Rollup merge of #157370 - JinRudy:docs/maybeuninit-zeroed-padding, r=Mark-Simulacrum
Clarify MaybeUninit::zeroed padding docs

Closes rust-lang/rust#111608.

This clarifies that padding bytes in `MaybeUninit::zeroed()` are not guaranteed to remain zeroed when the `MaybeUninit<T>` value is returned, matching the existing `mem::zeroed` documentation that padding is not necessarily zeroed.

Verification:
- `git diff --check`
- `./x fmt --check`
- `./x test tidy`
- `./x test library/core --doc`
2026-06-07 17:47:52 -04:00
Jacob Pratt
1fcc354056 Rollup merge of #157323 - majiayu000:docs-repeat-last-panic, r=jhpratt
Document Repeat::last panic behavior

Fixes rust-lang/rust#149707

Documents that `Repeat::last` always panics because `Repeat` is infinite.

Tests:
- `./x fmt --check`
- `./x doc library/core`
- `./x test library/core`
2026-06-07 17:47:51 -04:00
Jacob Pratt
5866061330 Rollup merge of #157169 - xtqqczze:triagebot, r=Mark-Simulacrum
triagebot: Update messages to direct changes to appropriate repositories

Follow-up https://github.com/rust-lang/rust/pull/154465

Regularize messages that reference repository-specific changes, directing contributors to the appropriate repositories.
2026-06-07 17:47:51 -04:00
Jacob Pratt
0fa5cc4974 Rollup merge of #157129 - xtqqczze:ci/download-artifact, r=Mark-Simulacrum
ci: update download-artifact action to v8

Closes https://github.com/rust-lang/rust/issues/154738#issuecomment-4580377366
2026-06-07 17:47:50 -04:00
Jacob Pratt
c1e64adc9b Rollup merge of #157078 - Filiprogrammer:docs-highest-one-ilog2, r=Mark-Simulacrum
Document equivalence of `highest_one` and `ilog2` methods on integers

Add notes to the primitive integer and `NonZero` types clarifying the equivalence between `highest_one` and the `ilog2`/`checked_ilog2` methods for non-negative values.

Tracking issue: rust-lang/rust#145203
2026-06-07 17:47:50 -04:00
Jacob Pratt
035bf16958 Rollup merge of #156666 - RalfJung:offset-ranges, r=jhpratt
Clarify meaning of ranges in pointer offset docs

Supersedes https://github.com/rust-lang/rust/pull/154370
2026-06-07 17:47:49 -04:00
Jacob Pratt
139d1d1799 Rollup merge of #156188 - romancardenas:riscv-target-feature-cfg-stable-toggle-unstable, r=RalfJung
riscv: promote d, e, and f target_features to CfgStableToggleUnstable

Reference PR:

- https://github.com/rust-lang/reference/pull/2274

This PR is a continuation of rust-lang/rust#155962

It uses the new `CfgStableToggleUnstable` stability level for the `"d"`, `"e"`, and `"f"` `target_features` of RISC-V. This way, it will be possible to add conditional code blocks depending on whether the target architecture has FPU, for instance.

The PR is related to rust-lang/rust#150257

r? @RalfJung
2026-06-07 17:47:48 -04:00
Jacob Pratt
0805a9a0a3 Rollup merge of #156155 - matthew-demidoff:fix/unbound-macro-metavar-diagnostic, r=BoxyUwU
macros: report unbound metavariables directly

Fixes rust-lang/rust#95943.

When a macro expansion contains an unbound `$ident`, report it as a missing macro parameter instead of keeping the generic fragment parser error as the primary diagnostic.

This keeps the existing typo suggestions and available-metavariable notes.
2026-06-07 17:47:47 -04:00
Jacob Pratt
9de98dcc31 Rollup merge of #155797 - devnexen:linewritershim_upd, r=Mark-Simulacrum
LineWriter: cap write_vectored newline scan to avoid quadratic write_all_vectored

This also adds some test coverage to confirm LineWriter behaves as expected under some edge cases.
2026-06-07 17:47:47 -04:00
Jacob Pratt
364544d0a8 Rollup merge of #153513 - fmease:gate-eq-pred, r=jackh726
Syntactically reject equality predicates

### Background (History)

Equality predicates have been *syntactically* valid since PR rust-lang/rust#39158 / nightly-2017-02-02 / 1.16 (released 2017-03-16, 9 years ago), both forms that is: `$ty = $ty` *and* `$ty == $ty`. They're not registered as an unstable feature despite having a tracking issue (rust-lang/rust#20041). Naturally, they don't have a feature gate. Of course, we reject them post-expansion, so they are still semantically invalid.

Parser scaffolding for `$ident = $ty` was added in RUST-19391 (2014) which was then generalized to `$ty = $ty` in RUST-20002 (2014) and extended to additionally cover `$ty == $ty` in RUST-39158 (2017). As mentioned, the last PR also made them grammatical.

RUST-87471 (2021) attempted to start impl'ing typeck'ing but it was closed due to concerns: https://github.com/rust-lang/rust/pull/87471#issuecomment-889831233 (already back in 2017 there were concerns: https://github.com/rust-lang/rust/pull/39158/changes#r97811244).

In 2022, T-lang discussed this feature during a meeting and raised concerns: https://github.com/rust-lang/rust/issues/20041#issuecomment-1062456506. However, they were inclined to accept a restricted form, namely `T::AssocTy = $ty` (`T` is a (self) ty param or a self ty alias) and `<$ty as Trait>::AssocTy = $ty` since that's trivial to support in HIR ty lowering (this is still accurate).

### Change

This renders equality predicates `$ty = $ty` and `$ty == $ty` syntactically invalid again. On stable, they're merely semantically invalid. This is motivated by the fact that

1. their syntax isn't even decided upon
   1. should it be `=` or `==`?
   2. should the LHS be syntactically restricted to (possibly qualified) paths (i.e., *TypePath | QualifiedPathInType*), only semantically or not at all?
      * "syntactically" could indeed make sense since we might want to generalize types to so-called *terms* here (i.e., *Type | GenericArgsConst*) for [mGCA](https://github.com/rust-lang/rust/issues/132980) but we can't generalize `$ty = $ty` to `$term = $term` due to ambiguities [^1] that would require backtracking whereas `$typepath = $term` wouldn't have that problem
2. we might (decide to) never impl this feature
   * after all, implementation concerns were raised as early as 9 years ago which are still relevant today even with the next-gen trait solver on the horizon
3. the compiler + tools contain a bunch of code for dealing with these predicates
   * like lowering, name resolution, rustfmt and Clippy
   * that's entirely useless since they get unconditionally rejected anyway
   * this code doesn't need to exist (for now)

I've merely upgraded the semantic hard error to a syntactic hard error, I've intentionally not introduced an unstable feature under which equality predicates become legal.

That's because a hard error is easier to push through procedurally, it's an important first step (we can always turn it into a feature gate error later on) and since this potential feature isn't backed by any official lang experiment.

I don't consider T-lang's message https://github.com/rust-lang/rust/issues/20041#issuecomment-1062456506 from 2022 to be sufficient because it doesn't answer questions like (1.i), (1.ii) or whether code like `T: Trait<A>, <T as Trait<B>>::AssocTy = Ty` (`A` ≠ `B`) or `T: Trait<'r>, for<'a> <T as Trait<'a>>::AssocTy = Ty` should be legal (which would be more powerful / could lead to typechecking issues, idk) or not assuming we're going with the restricted form ofc (we would need input from T-types).

### Lang nomination

https://github.com/rust-lang/rust/pull/153513#issuecomment-4069728773

[^1]: Code like `fn f() -> i32 where { 0 }` is intentionally legal today but if we had `$term = $term` the `{ 0 }` could then also be the start of an equality predicate like `{ 0 } = 0`.
2026-06-07 17:47:46 -04:00
Jacob Pratt
604cdda15b Rollup merge of #157543 - zedddie:gsoc-batch-5-meow, r=Kivooeo
Reorganize `tests/ui/issues` [5/N]

Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues)

r? Kivooeo
@Teapot4195
2026-06-07 17:47:45 -04:00
Jacob Pratt
f86ef5c8f4 Rollup merge of #157444 - bjorn3:lto_refactors21, r=lqd
Couple of work product cleanups

Part of https://github.com/rust-lang/compiler-team/issues/908
2026-06-07 17:47:45 -04:00
Jacob Pratt
5e09019602 Rollup merge of #157540 - yotamofek:pr/rustdoc/render_all_impls-cleanup, r=GuillaumeGomez
Cleanup and optimize `render_impls`

- take ownership of the `Vec<&Impl>` instead of copying into another alloc
- reuse `ImplString` to do natural sort ordering
- lazy formatting

Somewhat of a follow-up to rust-lang/rust#157233 and rust-lang/rust#157179 (cc @nnethercote - thanks!)
This kinda undoes f7c8bc2b13 but IMHO it makes more sense to be explicit about negative impl ordering, and also seems kinda wasteful to "render" the negativity into a string and rely on however ASCII decided to order characters. I can also undo this part, I think this PR is still a positive change even without it.

r? @GuillaumeGomez

LLM disclosure:
I used LLM for reviewing my changes and making sure some assumptions I was making were correct (i.e. that `render_impls` will not render anything IFF the list of traits passed to it is empty)
2026-06-07 17:47:44 -04:00
Jacob Pratt
b5fcf7838a Rollup merge of #157289 - Walnut356:msvc_template_args, r=jieyouxu
Add infallible primitive type lookups to template arg resolver

Fixes a regression that seem to come from LLDB 22 where looking up primitive types by name on MSVC no longer works. Container types use type name lookups to resolve generics, so it causes container types (e.g. `Vec<i32>`) to fail to create their child values.

Before:

```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {}
(lldb) v vec_v[0]
error: <user expression 0>:1:6: array index 0 is not valid for "(Vec<i32,alloc::alloc::Global>) vec_v"
   1 | vec_v[0]
     | ^
```

After:

```
(lldb) v vec_v
(alloc::vec::Vec<i32,alloc::alloc::Global>) vec_v = size=5 {
  [0] = 10
  [1] = 20
  [2] = 30
  [3] = 40
  [4] = 50
}
(lldb) v vec_v[0]
(long) vec_v[0] = 10
```

This patch maps the type name to its `eBasicType` equivalent (i.e. the LLDB enum for primitive types) and looks up the type based on that. AFAIK, `eBasicType` lookups are 100% infallible. Even if the primitive type somehow isn't in the debug info, `TypeSystemClang` will invent the appropriate `SBType` object for it.

This isn't a major blocker for the test suite rework, but it does prevent me from blessing tests with container types on MSVC unless I downgrade to LLDB 21.

r? @jieyouxu, @Kobzol
2026-06-07 17:47:43 -04:00
Jacob Pratt
71b35b8db6 Rollup merge of #157224 - LiosK:round_char_boundary, r=Mark-Simulacrum
Manually unroll loop in `str::floor_char_boundary`

This commit manually unrolls the while loops to at most three iterations, exploiting the UTF-8 invariant that a character is at most four bytes long.

Benefits:

- Prevents LLVM from generating unbounded unrolled code when `index` is statically known - e.g., `s.floor_char_boundary(20)` previously could emit up to 20 repeated loop bodies.
- Eliminates the check at `index - 3`: the UTF-8 invariant guarantees that if `index - 2` is not a character boundary, `index - 3` must be, so the third iteration needs no conditional.
- Allows out-of-order CPUs to issue all three byte loads in parallel, since their offsets are statically known.

This commit will close rust-lang/rust#149466 with simpler code. The optimizer appears to be able to eliminate bound checks and panic paths.
2026-06-07 17:47:43 -04:00
Jacob Pratt
0efcd77acb Rollup merge of #156119 - Kmeakin:km/optimize-str-index, r=Mark-Simulacrum
Further optimize `SliceIndex<str>` impl for `Range<usize>`

We can shave a further 2 `icmp`s by inlining `is_char_boundary` and rearranging the checks.

Follow up to https://github.com/rust-lang/rust/pull/145024
2026-06-07 17:47:42 -04:00
Jacob Pratt
83490204ea Rollup merge of #145108 - LorrensP-2158466:batched-import-resolution, r=petrochenkov
Resolver: Batched Import Resolution

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/145108)*

Transforms the current algorithm for resolving imports to a batched algorithm. Every import in the `indeterminate_imports` set is resolved in isolation. This is the only real difference from the current algorithm.

r? petrochenkov
2026-06-07 17:47:41 -04:00