Commit Graph

46474 Commits

Author SHA1 Message Date
David Wood
febb16a40f type_ir: add faster exit for types_may_unify 2025-05-13 16:47:10 +00:00
David Wood
a5e1dba0cd trait_sel: deep reject match_normalize_trait_ref
Spotted during an in-person review of unrelated changes,
`match_normalize_trait_ref` could be using `DeepRejectCtxt` to exit early
as an optimisation for prejection candidates, like is done in param
candidates.
2025-05-13 07:33:51 +00:00
bors
4eca99a18e Auto merge of #140887 - pietroalbini:pa-bootstrap-update, r=compiler-errors
Stage0 bootstrap update

This PR [follows the release process](https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday) to update the stage0 compiler.

The only thing of note is 58651d1b31, which was flagged by clippy as a correctness fix. I think allowing that lint in our case makes sense, but it's worth to have a second pair of eyes on it.

r? `@Mark-Simulacrum`
2025-05-13 09:54:28 +00:00
bors
32d23857f1 Auto merge of #140935 - omahs:patch-5, r=jieyouxu
Fix typos

Fix typos
2025-05-13 03:33:22 +00:00
bors
1a7f290a9a Auto merge of #140914 - Zalathar:asm-bindings, r=compiler-errors
cg_llvm: Clean up some inline assembly bindings

This PR combines a few loosely-related cleanups to LLVM bindings related to inline assembly. These include:
- Replacing `LLVMRustInlineAsm` with LLVM-C's `LLVMGetInlineAsm`
- Adjusting FFI declarations to avoid the need for explicit `as_c_char_ptr` conversions
- Flattening control flow in `inline_asm_call`

There should be no functional changes.
2025-05-12 17:39:21 +00:00
omahs
1caaa88700 Fix typos 2025-05-12 17:20:49 +00:00
Pietro Albini
2ce08ca5d6 update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
Pietro Albini
a360940ac9 update version placeholders 2025-05-12 15:33:30 +02:00
bors
718ddf660e Auto merge of #140923 - Zalathar:operand-bundle, r=lcnr
cg_llvm: Rename `OperandBundleOwned` to `OperandBundleBox`

As with `DIBuilderBox`, the "Box" suffix does a better job of communicating that this is an owning pointer to some borrowable resource.

This also renames the `raw` method to `as_ref`, which is what it would have been named originally if the `Deref` problem (#137603) had been known at the time.

No functional change.
2025-05-12 01:26:55 +00:00
bors
6812af9821 Auto merge of #140842 - tmiasko:print-mono-items, r=saethlin
Remove mono item collection strategy override from -Zprint-mono-items

Previously `-Zprint-mono-items` would override the mono item collection
strategy. When debugging one doesn't want to change the behaviour, so
this was counter productive. Additionally, the produced behaviour was
artificial and might never arise without using the option in the first
place (`-Zprint-mono-items=eager` without `-Clink-dead-code`).  Finally,
the option was incorrectly marked as `UNTRACKED`.

Resolve those issues, by turning `-Zprint-mono-items` into a boolean
flag that prints results of mono item collection without changing the
behaviour of mono item collection.

For codegen-units test incorporate `-Zprint-mono-items` flag directly
into compiletest tool.

Test changes are mechanical. `-Zprint-mono-items=lazy` was removed
without additional changes, and `-Zprint-mono-items=eager` was turned
into `-Clink-dead-code`.  Linking dead code disables internalization, so
tests have been updated accordingly.
2025-05-11 22:15:30 +00:00
bors
3528a5b76d Auto merge of #140915 - matthiaskrgr:rollup-lxce4zr, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #140397 (Add T-compiler backports Zulip notifications)
 - #140851 (Warn when `#[export_name]` is used with generic functions)
 - #140862 (Enable non-leaf Frame Pointers for Arm64EC Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-11 15:46:50 +00:00
Zalathar
dbdbde2a72 Rename OperandBundleOwned to OperandBundleBox
As with `DIBuilderBox`, the "Box" suffix does a better job of communicating
that this is an owning pointer to some borrowable resource.

This also renames the `raw` method to `as_ref`, which is what it would have
been named originally if the `Deref` problem had been known at the time.
2025-05-11 21:21:38 +10:00
bors
16c1c54a29 Auto merge of #140902 - azhogin:azhogin/async-drop-open-drop-for-adt-fix, r=oli-obk
Async drop fix for async_drop_in_place<T> layout for unspecified T

Fix for https://github.com/rust-lang/rust/issues/140423.
Layout of `async_drop_in_place<T>::{closure}` is calculated for unspecified T from dataflow_const_prop `try_make_constant`.

`@oli-obk,` do you think, it may be a better solution to add check like `if !args[0].is_fully_specialized() { return None; }` in `fn async_drop_coroutine_layout`?
And could you, pls, recommend, how to implement `is_fully_specialized()` in a most simple way?
2025-05-11 09:22:50 +00:00
Matthias Krüger
4d3c4726d2 Rollup merge of #140862 - dpaoliello:arm64ecfp, r=wesleywiser
Enable non-leaf Frame Pointers for Arm64EC Windows

This was enabled for native Arm64 via #140828

r? `@workingjubilee`
2025-05-11 08:38:48 +02:00
Matthias Krüger
5f55d0d7cd Rollup merge of #140851 - mu001999-contrib:new-lint, r=bjorn3
Warn when `#[export_name]` is used with generic functions

Fixes #140742
2025-05-11 08:38:48 +02:00
bors
9a7e19f2b6 Auto merge of #135015 - heiher:stabilize-loongarch-target-features, r=Amanieu
Partially stabilize LoongArch target features

Stabilization PR for the LoongArch target features. This PR stabilizes some of the target features tracked by #44839.

Specifically, this PR stabilizes the following target features:

* f
* d
* frecipe
* lasx
* lbt
* lsx
* lvz

Docs PR: https://github.com/rust-lang/reference/pull/1707

r? `@Amanieu`
2025-05-11 06:10:41 +00:00
Zalathar
eccf0647d3 Flatten control-flow in inline_asm_call after verification 2025-05-11 14:38:42 +10:00
Zalathar
b6300294a8 Make LLVMRustInlineAsmVerify take *const c_uchar
This avoids the need for an explicit `as_c_char_ptr` conversion.
2025-05-11 14:38:42 +10:00
Zalathar
b1094f6a0a Add a safe wrapper for LLVMAppendModuleInlineAsm
This patch also changes the Rust-side declaration to take `*const c_uchar`
instead of `*const c_char`, to avoid the need for `AsCCharPtr`.
2025-05-11 14:38:42 +10:00
Zalathar
d1bb310a7a Use LLVMGetInlineAsm
This LLVM-C binding replaces the existing `LLVMRustInlineAsm` function.
2025-05-11 14:37:54 +10:00
Zalathar
8764ecd0c1 Add a searchable tag PTR_LEN_STR to explain *const c_uchar bindings
This module comment describes why it's OK for LLVM bindings to declare a
parameter type of `*const c_uchar` for pointer/length strings, even though the
corresponding parameter on the C/C++ side uses `const char *`.

Adding a searchable term to each such parameter should make it easier for
future maintainers to understand why `*const c_uchar` is being used instead of
`*const c_char`.
2025-05-11 14:26:14 +10:00
León Orell Valerian Liehr
f9fdf40eac Rollup merge of #140878 - nnethercote:two-expand-cleanups, r=compiler-errors
Two expand-related cleanups

Minor improvements I found while looking at this code. Best reviewed one commit at a time.

r? `@BoxyUwU`
2025-05-11 02:44:38 +02:00
León Orell Valerian Liehr
15df33326e Rollup merge of #140795 - mu001999-contrib:sugg-stable-import-first, r=petrochenkov
Prefer to suggest stable candidates rather than unstable ones

Fixes #140240

The logic is to replace unstable suggestions if we meet a new stable one, and do nothing if any other situation. In old logic, we just use the first candidate we meet as the suggestion for the same items.

E.g., `std::range::legacy::Range` vs `std::ops::Range`, `legacy` in the former is unstable, we prefer to suggest use the latter.
2025-05-11 02:44:37 +02:00
León Orell Valerian Liehr
3c8950c30d Rollup merge of #140792 - Urgau:minimum-maximum-intrinsics, r=scottmcm,traviscross,tgross35
Use intrinsics for `{f16,f32,f64,f128}::{minimum,maximum}` operations

This PR creates intrinsics for `{f16,f32,f64,f64}::{minimum,maximum}` operations.

This wasn't done when those operations were added as the LLVM support was too weak but now that LLVM has libcalls for unsupported platforms we can finally use them.

Cranelift and GCC[^1] support are partial, Cranelift doesn't support `f16` and `f128`, while GCC doesn't support `f16`.

r? `@tgross35`

try-job: aarch64-gnu
try-job: dist-various-1
try-job: dist-various-2

[^1]: https://www.gnu.org/software///gnulib/manual/html_node/Functions-in-_003cmath_002eh_003e.html
2025-05-11 02:44:36 +02:00
Andrew Zhogin
13178c75ce Async drop fix for async_drop_in_place<T> layout calculated for unspecified T 2025-05-11 03:48:50 +07:00
bors
dbab4e152b Auto merge of #140895 - matthiaskrgr:rollup-rfvqv4t, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #129334 (Implement (part of) ACP 429: add `DerefMut` to `Lazy[Cell/Lock]`)
 - #139562 (rustdoc: add a handle that makes sidebar resizing more obvious)
 - #140151 (remove intrinsics::drop_in_place)
 - #140660 (remove 'unordered' atomic intrinsics)
 - #140783 (Update documentation of OnceLock::get_or_init.)
 - #140789 (Update hermit-abi to 0.5.1)
 - #140879 (1.87.0 release notes: remove nonsensical `~` operator)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-10 17:29:42 +00:00
Urgau
7f0ae5e3ad Use the fallback body for {minimum,maximum}f128 on LLVM as well. 2025-05-10 17:34:54 +02:00
Matthias Krüger
b8c55b438d Rollup merge of #140660 - RalfJung:more-order, r=WaffleLapkin
remove 'unordered' atomic intrinsics

As their doc comment already indicates, these operations do not currently have a place in our memory model. The intrinsics were introduced to support a hack in compiler-builtins, but that hack recently got removed (see https://github.com/rust-lang/compiler-builtins/issues/788).
2025-05-10 16:26:02 +02:00
bors
b10555674f Auto merge of #140854 - oli-obk:merge-queries, r=nnethercote
Merge typeck loop with static/const item eval loop

r? `@ghost`

Let's try a small one first. Doing this in general has some bad cache coherence issues because the query caches are laid out in `Vec<QueryResult>` lists per query where each index refers to a `DefId` in the same order as we're iterating. Iterating two or more lists at the same time does have cache issues, so I want to poke a bit at it to see if we can't merge just a few of them at a time.
2025-05-10 14:20:43 +00:00
Mu001999
0de994a368 Warn when #[export_name] is used with generic functions 2025-05-10 18:48:32 +08:00
bors
7e432c456b Auto merge of #140880 - nnethercote:Ident-new-debug-assert, r=oli-obk
Make the assertion in `Ident::new` debug-only.

This fixes a perf regression introduced in #140252.

r? `@oli-obk`
2025-05-10 10:01:38 +00:00
Nicholas Nethercote
4cb9f0309d Make the assertion in Ident::new debug-only.
This fixes a perf regression introduced in #140252.
2025-05-10 09:39:04 +10:00
Nicholas Nethercote
5ebcbfc1e1 Remove AstDeref.
It's a "utility trait to reduce boilerplate" implemented for `P` and
`AstNodeWrapper`, but removing it gives a net reduction of twenty lines
of code. It's also simpler to just implement
`HasNodeId`/`HasAttrs`/`HasTokens` directly on types instead of via
`AstDeref`.

(I decided to make this change when doing some related refactoring and
the error messages involving `AstDeref` and `HasAttrs` were hard to
understand; removing it helped a lot.)
2025-05-10 08:58:47 +10:00
Matthias Krüger
967a29f4c0 Rollup merge of #140848 - kornelski:not-a-dead-end, r=compiler-errors
Improved error message for top-level or-patterns

I was confused by "top-level or-patterns are not allowed in `let` bindings" error, because it sounded like or-patterns were completely unsupported.

This error has an auto-fix suggestion that shows otherwise, but the auto-fix isn't always visible in IDEs.

I've changed the wording to be consistent with "`Fn` bounds require arguments in parentheses", and it doesn't sound like a dead-end any more.
2025-05-09 21:50:08 +02:00
Daniel Paoliello
35679bad98 Enable non-leaf Frame Pointers for Arm64EC Windows 2025-05-09 11:44:22 -07:00
Ralf Jung
79dfd0a472 remove 'unordered' atomic intrinsics 2025-05-09 17:39:52 +02:00
Oli Scherer
0b6e493515 Merge typeck loop with static/const item eval loop 2025-05-09 15:31:27 +00:00
Urgau
e7247df590 Use intrinsics for {f16,f32,f64,f128}::{minimum,maximum} operations 2025-05-09 17:11:23 +02:00
mu001999
7c253ac504 Suggest stable candidates rather than unstable ones 2025-05-09 22:05:59 +08:00
Kornel
fc20650c6a Error message for top-level or-patterns suggesting a solution 2025-05-09 22:16:34 +09:00
bors
dcecb99176 Auto merge of #140839 - pietroalbini:pa-version-bump, r=pietroalbini
Bump version number to 1.89.0

Part of the release process. This PR must not be rolled up.

Closes #129461.

r? `@ghost`
2025-05-09 12:13:38 +00:00
Tomasz Miąsko
8c8225afe8 Remove mono item collection strategy override from -Zprint-mono-items
Previously `-Zprint-mono-items` would override the mono item collection
strategy. When debugging one doesn't want to change the behaviour, so
this was counter productive. Additionally, the produced behaviour was
artificial and might never arise without using the option in the first
place (`-Zprint-mono-items=eager` without `-Clink-dead-code`).  Finally,
the option was incorrectly marked as `UNTRACKED`.

Resolve those issues, by turning `-Zprint-mono-items` into a boolean
flag that prints results of mono item collection without changing the
behaviour of mono item collection.

For codegen-units test incorporate `-Zprint-mono-items` flag directly
into compiletest tool.

Test changes are mechanical. `-Zprint-mono-items=lazy` was removed
without additional changes, and `-Zprint-mono-items=eager` was turned
into `-Clink-dead-code`.  Linking dead code disables internalization, so
tests have been updated accordingly.
2025-05-09 12:19:09 +02:00
Jieyou Xu
7dae31828b Disarm time bomb (diagnostics)
Revert "Rollup merge of #129343 - estebank:time-version, r=jieyouxu"

This reverts commit 26f75a65d7, reversing
changes made to 2572e0e8c9.

Imports are modified to fix merge conflicts and remove unused ones.
2025-05-09 12:09:15 +02:00
bors
da1e442ebd Auto merge of #140838 - Zalathar:rollup-13hybry, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - #140801 (Use span before macro expansion in lint for-loops-over-falibles)
 - #140804 (add signed ints to unn- transmutes to ensure feature parity)
 - #140812 (Fix `tests/rustdoc-json` triagebot message path)
 - #140817 (bootstrap: more consistent use of `...` when citing configuration snippets)
 - #140828 (Enable non-leaf Frame Pointers for Arm64 Windows)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-09 08:31:19 +00:00
Stuart Cook
d91e86e963 Rollup merge of #140828 - dpaoliello:arm64fp, r=workingjubilee
Enable non-leaf Frame Pointers for Arm64 Windows

Microsoft recommends enabling frame pointers for Arm64 Windows as it enables fast stack walking, from <https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#integer-registers>:

> The frame pointer (x29) is required for compatibility with fast stack walking used by ETW and other services. It must point to the previous {x29, x30} pair on the stack.

I'm setting this to "non-leaf" as leaf functions shouldn't be spilling registers and so won't touch the frame pointer.
2025-05-09 16:25:06 +10:00
Stuart Cook
16ca18d1da Rollup merge of #140804 - bend-n:signed, r=lcnr
add signed ints to unn- transmutes to ensure feature parity

i forgot a few cases https://github.com/rust-lang/rust-clippy/pull/14703/#pullrequestreview-2824194994

adds

- char -> i32
-  i32 -> char
- float -> size ()
-  size -> float
-   i32 -> float
``@rustbot`` label L-unnecessary_transmutes
2025-05-09 16:25:04 +10:00
Stuart Cook
b165a4c280 Rollup merge of #140801 - xizheyin:issue-140747, r=SparrowLii
Use span before macro expansion in lint for-loops-over-falibles

Fixes #140747

I think there are going to be a lot of cases where macros are expanded in the compiler resulting in span offsets, and I'd like to know how that's typically handled. Does it have to be handled specially every time?
2025-05-09 16:25:03 +10:00
bors
a7b1b24587 Auto merge of #140252 - nnethercote:rm-Ident-empty, r=oli-obk
Remove `Ident::empty`

All uses have been removed. And it's nonsensical: an identifier by definition has at least one char.

r? `@oli-obk`
2025-05-09 05:16:40 +00:00
Nicholas Nethercote
0984db553d Remove Ident::empty.
All uses have been removed. And it's nonsensical: an identifier by
definition has at least one char.

The commits adds an is-non-empty assertion to `Ident::new` to enforce
this, and converts some `Ident` constructions to use `Ident::new`.
Adding the assertion requires making `Ident::new` and
`Ident::with_dummy_span` non-const, which is no great loss.

The commit amends a couple of places that do path splitting to ensure no
empty identifiers are created.
2025-05-09 13:57:49 +10:00
WANG Rui
72393a672d Partially stabilize LoongArch target features 2025-05-09 11:01:05 +08:00