Skip to content

Rollup of 6 pull requests - #164630

Closed
JonathanBrouwer wants to merge 20 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-5mRYGCk
Closed

JonathanBrouwer wants to merge 20 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-5mRYGCk

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

evan-dickinson and others added 20 commits September 11, 2026 16:09
If we try to eagerly process our skip count, we might see the end of the
inner iterator. `Iterator::advance_by` is supposed to return a non-zero
`Err` count when exhausted, but there's no room for `Skip` to report
anything in this case. So, it's better that we don't even try.
Rust currently ignores LLVM diagnostic kinds that it does not know
about. This means that we sometimes ignore error diagnostics,
which can then result in silent miscompiles.

This exposes `LLVMGetDiagInfoSeverity` returning `DiagnosticSeverity`,
renamed from `DiagnosticLevel` to match LLVM terminology. Custom
code to fetch the diagnostic severity for inline asm diagnostics
can then be dropped.

For unknown diagnostics, we emit a warning/error depending on
severity. Notes and remarks continue to be ignored.

One oddity I ran into along the way is that the linker diagnostic
has severity error, but we only report a warning. I've kept this
for now as we still error down the line and this ends up providing
a bit more information (which file the duplicate symbol originates
from).
Merge the PGO, Unsupported into UnknownDiagnostic and rename it to
Other. We don't do anything special for them, so there is no need
to represent them differently.
[debuginfo] Emit `usize` and `isize` as typedefs

See: llvm/llvm-project#196812

TL;DR sidesteps a name collision issue that affects generics, e.g. `S<u64>` and `S<usize>` resolving as the same type.

This is accomplished by wrapping an existing primitive node in a `usize`/`isize` typedef instead.

I'd love to output typedefs for all the primitive types too, so LLDB displays the type names rust-style, but I've got a couple worries with that. Firstly, GDB doesn't seem to like it w.r.t. enums? IIRC it's because of a small difference in how GDB treats typedefs compared to LLDB. I'm like 80% sure it's hard-coded in GDB itself, so it's not something I want to touch atm.

```
Breakpoint 1, borrowed_enum::main () at tests/debuginfo/borrowed-enum.rs:67
67          zzz(); // #break
$1 = <error reading variable: Could not find active enum variant>
$2 = borrowed_enum::ABC::TheB(0, 286331153, 286331153)
$3 = borrowed_enum::Univariant::TheOnlyCase(4820353753753434)
```

Secondly, I'm not entirely sure it's a good idea to have both a type and a typedef with the exact same name in the first place. I could easily imagine that causing some similar issues to the one we're trying to solve.

This also includes a small extention to the `Rc` test to ensure we can read both `Rc<u64>` and `Rc<usize>`. Without this change, the second `v` command would fail to materialize any value:

```
...
(lldb) v rc_u64
(alloc::rc::Rc<unsigned long, alloc::alloc::Global>) rc_u64 = strong=1, weak=0 { value = 10 }
(lldb) v rc_usize

error: Invalid type: Cannot determine size

(lldb) quit
```
Don't try to skip anything in `Skip::advance_by(0)`

If we try to eagerly process our skip count, we might see the end of the
inner iterator. `Iterator::advance_by` is supposed to return a non-zero
`Err` count when exhausted, but there's no room for `Skip` to report
anything in this case. So, it's better that we don't even try.

Fixes rust-lang#164480
Don't ignore unknown LLVM diagnostics

Rust currently ignores LLVM diagnostic kinds that it does not know about. This means that we sometimes ignore error diagnostics, which can then result in silent miscompiles.

This exposes `LLVMGetDiagInfoSeverity` returning `DiagnosticSeverity`, renamed from `DiagnosticLevel` to match LLVM terminology. Custom code to fetch the diagnostic severity for inline asm diagnostics can then be dropped.

For unknown diagnostics, we emit a warning/error depending on severity. Notes and remarks continue to be ignored.

One oddity I ran into along the way is that the linker diagnostic has severity error, but we only report a warning. I've kept this for now as we still error down the line and this ends up providing a bit more information (which file the duplicate symbol originates from).

Fixes rust-lang#146393.
Improve bit permutation codegen

This PR allows AArch64 use `usra`  to improves bit permutation codegen for `extract_bits`.

For `extract_bits`, `(x ^ q) ^ (q >> n)` is equivalent to `(x & !masks[stage]) + (q >> n)`, since `q >> n` and `x ^ q` have no overlapping set bits.
- `extract_bits` benchmarks

Type | Mask | AArch64 XOR | AArch64 Add | Change
-- | -- | -- | -- | --
u8 | constant | 102.64 | 49.74 | -51.54%
u8 | invariant | 108.00 | 82.32 | -23.78%
u8 | variable | 408.10 | 378.12 | -7.35%
u16 | constant | 150.31 | 90.10 | -40.06%
u16 | invariant | 176.41 | 126.84 | -28.10%
u16 | variable | 692.12 | 619.49 | -10.49%
u32 | constant | 201.93 | 131.06 | -35.10%
u32 | invariant | 228.70 | 167.32 | -26.84%
u32 | variable | 1022.22 | 1001.70 | -2.01%
u64 | constant | 259.48 | 187.71 | -27.66%
u64 | invariant | 288.77 | 211.51 | -26.75%
u64 | variable | 1463.05 | 1413.12 | -3.41%
u128 | constant | 331.50 | 331.50 | 0.00%
u128 | invariant | 411.30 | 411.29 | -0.00%
u128 | variable | 1489.14 | 1489.19 | +0.00%
…Titor

document that `!` does bitwise and logical negation

The documentation summary for `core::ops::Not` says that it performs
logical negation. That's misleading because it also performs bitwise
negation on integers. Since C has separate operators for logical and
bitwise negation, this could lead a C programmer to look
elsewhere for Rust's equivalent of `~`.

I also updated the documentation for `Not::not()` to clarify the meaning of logical not vs bitwise not.
…=jieyouxu

lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons

Fixes rust-lang#164143

### about this bug

`invalid_nan_comparisons` turned `b != &f64::NAN` into `b.is_nan()`. That is fine for something like `3.3f32` or `let x: f64 = 3.3`, but not for type unannotated `let b = &3.3`; the comparison is what makes `{float}` into `f64`, and after the edit `.is_nan()` does not resolve. Same for `let mut`.

### lint behaviors after this fix

- If the operand is a float, the suggestion is `<Type>::is_nan(...)`, using the NAN constant's type and adding dereferences and parentheses as needed;
- Preserve the original type path or alias. For macro-generated f32/f64 constants, use an absolute primitive path through `std` or `core`;
- If it is not a float, or a safe replacement cannot be constructed, only keep the help text.

I decide to use the type-qualified form even for suffixed or explicitly typed operands.

`.is_nan()` can work in those cases, but the resolved type alone does not tell us whether removing the comparison preserves inference.

Using one form avoids incomplete initializer heuristics. `<Type>::` also ensures the reused path is interpreted as a type, avoiding ambiguity with modules.

### llm disclosure

The LLM (specifically, Grok 4.7 and GPT 6.1 Sol) was used for:

- help me find out what HIR or AST feature can be used to distinguish unsuffixed float
- draft the initial naive fix reference before I hand written & review the code
- help me improve the ui test case edge case coverage
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Oct 20, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Oct 20, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r+ p=5 force

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,test-x86_64-gnu-aux,test-x86_64-msvc-1,test-aarch64-apple-1,test-aarch64-apple-2,test-x86_64-mingw-1,test-i686-msvc,test-armhf-gnu,test-x86_64-gnu-llvm-22-3

@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 157c2cb has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Oct 20, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 20, 2026
Rollup of 6 pull requests


try-job: dist-various-1
try-job: test-various
try-job: test-x86_64-gnu-aux
try-job: test-x86_64-msvc-1
try-job: test-aarch64-apple-1
try-job: test-aarch64-apple-2
try-job: test-x86_64-mingw-1
try-job: test-i686-msvc
try-job: test-armhf-gnu
try-job: test-x86_64-gnu-llvm-22-3
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 20, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs)
 - #164488 (Don't try to skip anything in `Skip::advance_by(0)`)
 - #164578 (Don't ignore unknown LLVM diagnostics)
 - #164611 (Improve bit permutation codegen)
 - #162668 (document that `!` does bitwise and logical negation)
 - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job dist-x86_64-freebsd failed! Check out the build log: (web) (plain enhanced) (plain)

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

@rust-bors rust-bors Bot 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 Oct 20, 2026
@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 47c5889 failed: CI. Failed job:

@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 20, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 20, 2026
@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors treeclosed=5 spurious failures

@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Tree closed for PRs with priority less than 5.

@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b8b83ee (b8b83ee24968764867ceb7a1ee8643306b1b6761)
Base parent: a7c37f9 (a7c37f9f0ee5e93396106e9de20f4a86b4154e63)

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. rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants