Commit graph

313392 commits

Author SHA1 Message Date
Jonathan Brouwer
f3fa567fdf
Rollup merge of #150032 - Kivooeo:annotate-snippets-stable, r=Muscraft
Use annotate-snippet as default emitter on stable

This is implementation of https://github.com/rust-lang/rust/issues/149932

Now, after MCP was accepted, we can use annotate-snippet as default emitter for errors, that means that we not longer need of previous emitter, so this PR removed previous emitter and makes annotate-snippet new default one both on stable and nightly

(this PR does not remove a code of previous emitter it just removes a `Default` option of `HumanReadableErrorType` enum, and keeping only `HumanReadableErrorType::AnnotateSnippet` as it now uses by default)
2025-12-16 20:21:10 +01:00
Jonathan Brouwer
9308518af9
Rollup merge of #150025 - BoxyUwU:mgca_no_unused_defids, r=oli-obk
dont create unnecessary `DefId`s under mgca

Fixes rust-lang/rust#149977
Fixes rust-lang/rust#148838

Accidentally left this out of rust-lang/rust#149136 even though being able to do this was a large part of the point of the PR :3

First ICE was caused by the fact that we create a defid but never lower the nodeid associated with it to a hirid which later parts of the compiler can't handle.

See test for second ICE

r? oli-obk
2025-12-16 20:21:09 +01:00
Jonathan Brouwer
ef2c71c3cc
Rollup merge of #149967 - folkertdev:va-list-hexagon, r=workingjubilee
custom `VaList` layout for Hexagon

I noticed while browsing LLVM source that we use an incorrect `VaList` definition for the musl hexagon target.

relevant links

- 0cdc1b6dd4/clang/include/clang/Basic/TargetInfo.h (L333)
- 0cdc1b6dd4/clang/lib/CodeGen/Targets/Hexagon.cpp (L407-L417)

cc target maintainer `@androm3da` can you confirm that this looks OK? In particular the `#[rustc_pass_indirectly_in_non_rustic_abis]` attribute is used to simulate pointer decay (like if the struct were wrapped in a 1-element array in C). The clang comment suggests that the Tag is wrapped in such a single-element array, but I haven't actually been able to confirm it.

For stabilizing `c_variadic` (on the hexagon targets) we will also need a custom `va_arg` implementation to mirror the one in `clang` in [va_arg.rs](https://github.com/rust-lang/rust/blob/main/compiler/rustc_codegen_llvm/src/va_arg.rs). Would you be able to contribute one?

r? `@workingjubilee`
2025-12-16 20:21:08 +01:00
Jonathan Brouwer
297cdc8137
Rollup merge of #149804 - xiaolinny:main, r=lcnr
chore: fix some minor issues in the comments

fix some minor issues in the comments
2025-12-16 20:21:08 +01:00
Jonathan Brouwer
f108cd7232
Rollup merge of #149767 - reddevilmidzy:t11, r=Kivooeo
Tidying up tests/ui/issues 33 tests [4/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895

`tests/ui/compile-flags` split it into `tests/ui/compile-flags/invalid/` and `tests/ui/compile-flags/run-pass/`

r? Kivooeo
2025-12-16 20:21:07 +01:00
Jonathan Brouwer
6c7ee7d84a
Rollup merge of #149734 - Kobzol:gcc-9.2.0, r=marcoieni
Mirror GCC 9.5.0

The GCC servers can be unreliable.

r? `@marcoieni`
2025-12-16 20:21:06 +01:00
Jonathan Brouwer
d93b93bcb0
Rollup merge of #147939 - theemathas:add-const-supertrait, r=oli-obk
Make `const BorrowMut` require `const Borrow` and make `const Fn` require `const FnMut`

This makes it consistent with other const traits in the standard library with supertraits.

I am currently unsure if `const FnMut` should require `const FnOnce` or not. See [zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/.5Bconst.5D.20implied.20bounds.20for.20implicit.20trait.20bounds/near/546152748).
2025-12-16 20:21:05 +01:00
Kivooeo
84f2854bc3 remove fixme & update stderr files 2025-12-16 13:23:48 +00:00
Kivooeo
a47c8b292e remove human-annotate-rs 2025-12-16 13:23:45 +00:00
bors
95a27adcf9 Auto merge of #143924 - davidtwco:sve-infrastructure, r=workingjubilee
`rustc_scalable_vector(N)`

Supercedes rust-lang/rust#118917.

Initial experimental implementation of rust-lang/rfcs#3838. Introduces a `rustc_scalable_vector(N)` attribute that can be applied to types with a single `[$ty]` field (for `u{16,32,64}`, `i{16,32,64}`, `f{32,64}`, `bool`). `rustc_scalable_vector` types are lowered to scalable vectors in the codegen backend.

As with any unstable feature, there will necessarily be follow-ups as we experiment and find cases that we've not considered or still need some logic to handle, but this aims to be a decent baseline to start from.

See rust-lang/rust#145052 for request for a lang experiment.
2025-12-16 12:53:53 +00:00
Kivooeo
6d6068f6c5 stabilize annotate-snippet as default formatter 2025-12-16 11:20:27 +00:00
David Wood
f0dfeab43d
abi: Display bound on TyAbiInterface
The `fmt::Debug` impl for `TyAndLayout<'a, Ty>'` requires `fmt::Display`
on the `Ty` parameter. In `ArgAbi`, `TyAndLayout`'s Ty` is instantiated
with a parameter that implements `TyAbiInterface`. `TyAbiInterface`
only required `fmt::Debug` be implemented on `Self`, not `fmt::Display`,
which meant that it wasn't actually possible to debug print `ArgAbi`.
2025-12-16 11:01:26 +00:00
David Wood
5f27abdbc8
mono: require target feature for scalable vectors
Scalable vector types only work with the relevant target features
enabled, so require this for any function with the types in its
signature.
2025-12-16 11:01:26 +00:00
David Wood
4185e9f2ec
mir_transform: prohibit scalable vectors in async
Scalable vectors cannot be members of ADTs and thus cannot be kept over
await points in async functions.
2025-12-16 11:00:12 +00:00
David Wood
89eea57594
debuginfo: no spill <vscale x N x i1> for N!=16
LLVM doesn't handle stores on `<vscale x N x i1>` for `N != 16`, a type
used internally in SVE intrinsics. Spilling to the stack to create
debuginfo will cause errors during instruction selection. These types
that are an internal implementation detail to the intrinsic, so users
should never see them types and won't need any debuginfo.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
2025-12-16 11:00:12 +00:00
David Wood
a56b1b9283
codegen: implement repr(scalable)
Introduces `BackendRepr::ScalableVector` corresponding to scalable
vector types annotated with `repr(scalable)` which lowers to a scalable
vector type in LLVM.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
2025-12-16 11:00:12 +00:00
David Wood
ba9262936e
hir/trait_sel: prohibit scalable vectors in types
Extend well-formedness checking and HIR analysis to prohibit the use of
scalable vectors in structs, enums, unions, tuples and arrays. LLVM does
not support scalable vectors being members of other types, so these
restrictions are necessary.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
2025-12-16 11:00:12 +00:00
David Wood
78b06057ef
attr: parse rustc_scalable_vector(N)
Extend parsing of `ReprOptions` with `rustc_scalable_vector(N)` which
optionally accepts a single literal integral value - the base multiple of
lanes that are in a scalable vector. Can only be applied to structs.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
2025-12-16 11:00:11 +00:00
bors
61cc47e367 Auto merge of #149948 - WaffleLapkin:dereferenceablen't, r=RalfJung
Stop applying `dereferenceable(n)` to return types

It looks like the semantics of `dereferenceable(n)` on return types is "dereferenceable until the end of the program", which is not sound for how we were using it. See [dereferenceable on return type](https://rust-lang.zulipchat.com/#narrow/channel/136281-t-opsem/topic/LLVM.20dereferenceable.20on.20return.20type/with/563001493) zulip thread.

cc `@rust-lang/opsem` `@nikic`
2025-12-16 09:38:19 +00:00
Jakub Beránek
fca8611a3e
Mirror GCC 2025-12-16 09:42:42 +01:00
bors
6e7dd2cd99 Auto merge of #150041 - Zalathar:rollup-sa5nez6, r=Zalathar
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#148756 (Warn on codegen attributes on required trait methods)
 - rust-lang/rust#148790 (Add new Tier-3 target: riscv64im-unknown-none-elf)
 - rust-lang/rust#149271 (feat: dlopen Enzyme)
 - rust-lang/rust#149459 (std: sys: fs: uefi: Implement set_times and set_perm)
 - rust-lang/rust#149771 (bootstrap readme: make easy to read when editor wrapping is not enabled)
 - rust-lang/rust#149856 (Provide an extended framework for type visit, for use in rust-analyzer)
 - rust-lang/rust#149950 (Simplify how inline asm handles `MaybeUninit`)
 - rust-lang/rust#150014 (Metadata loader cleanups)
 - rust-lang/rust#150021 (document that mpmc channels deliver an item to (at most) one receiver)
 - rust-lang/rust#150029 (Update books)
 - rust-lang/rust#150031 (assert impossible branch is impossible)
 - rust-lang/rust#150034 (do not add `I-prioritize` when `F-*` labels are present)
 - rust-lang/rust#150036 (Use the embeddable filename for coverage artifacts)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-16 06:27:13 +00:00
Stuart Cook
f9d6cb5622
Rollup merge of #150036 - Urgau:filenames-coverage-150020, r=Zalathar
Use the embeddable filename for coverage artifacts

Like debuginfo, coverage artifacts should use the embeddable path (aka absolute path).

Unfortunately due to `coverage-run` and `compiletest`, I'm unable to create a reproducer in our test-suite, but when manually invoking `rustc` with the reproducer (https://github.com/rust-lang/rust/issues/150020#issuecomment-3657097712) I think the issue is fixed.

Fixes https://github.com/rust-lang/rust/issues/150020
r? Zalathar
2025-12-16 14:40:48 +11:00
Stuart Cook
3687a78be9
Rollup merge of #150034 - cyrgani:triagebotconf, r=BoxyUwU
do not add `I-prioritize` when `F-*` labels are present
2025-12-16 14:40:47 +11:00
Stuart Cook
06bc79bb60
Rollup merge of #150031 - yaahc:derive-helper-ambig-assert, r=petrochenkov
assert impossible branch is impossible

The second half of this boolean or expression should not be possible with the current visitation implementation.

Reasoning:

- Innermost res will always be the first candidate visited.
- the first scopes visited are `derive_helper` candidates, followed by a single step at `derive_helper_compat`: ee447067/compiler/rustc_resolve/src/ident.rs (L180-L192)
  - if there are candidates for both kinds the derive_helper candidate will always be innermost
  - there can only be one derive_helper_compat candidate
- The first branch handles cases where the first candidate is a `derive_helper_compat`
- if the first candidate is not a `derive_helper_compat` (as enforced by the first branch) and it is not a `derive_helper` (as enforced by the end of the second boolean expression) then then the first candidate and all subsequent candidates must be from later scope types, res cannot possibly be a `derive_helper_compat`

r? ``@petrochenkov``
2025-12-16 14:40:47 +11:00
Stuart Cook
fd755c6240
Rollup merge of #150029 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/nomicon

1 commits in 9fe8fa599ad228dda74f240cc32b54bc5c1aa3e6..5b3a9d084cbc64e54da87e3eec7c7faae0e48ba9
2025-12-12 12:24:05 UTC to 2025-12-12 12:24:05 UTC

- Update method lookup link in dot-operator.md (rust-lang/nomicon#513)

## rust-lang/reference

4 commits in 50c5de90487b68d429a30cc9466dc8f5b410128f..ec78de0ffe2f8344bd0e222b17ac7a7d32dc7a26
2025-12-15 16:17:43 UTC to 2025-12-15 16:15:06 UTC

- tokens: clarify in escape tables that digits are hex (rust-lang/reference#2105)
- tokens: remove misplaced ".token." within a word (rust-lang/reference#2106)
- macros-by-example: add space in `macro.decl.repetition.fragment` example (rust-lang/reference#2107)
- Fix restrictions of or-patterns (rust-lang/reference#2108)
2025-12-16 14:40:46 +11:00
Stuart Cook
2739ccb2b1
Rollup merge of #150021 - david-d-h:main, r=ChrisDenton
document that mpmc channels deliver an item to (at most) one receiver

Tiny documentation change related to mpmc (tracking issue rust-lang/rust#126840).

This PR is meant to supersede rust-lang/rust#140158 due to it's inactivity. It is essentially the same addition structured a little differently.
2025-12-16 14:40:45 +11:00
Stuart Cook
0d0f136ead
Rollup merge of #150014 - bjorn3:metadata_loader_cleanups, r=jieyouxu
Metadata loader cleanups

Couple of cleanups I found while working on https://github.com/rust-lang/rust/pull/149273

This renames some fields and enum variants to clarify what they are used for, moves a check to another method and slightly simplifies the way profiler_builtins is linked.
2025-12-16 14:40:45 +11:00
Stuart Cook
461d0d0dfd
Rollup merge of #149950 - WaffleLapkin:inlines-ur-mu-into-asm, r=jdonszelmann
Simplify how inline asm handles `MaybeUninit`

This is just better, but this is also allows it to handle changes from https://github.com/rust-lang/rust/pull/149614 (i.e. `ManuallyDrop` containing `MaybeDangle`).
2025-12-16 14:40:44 +11:00
Stuart Cook
d30f83ab8a
Rollup merge of #149856 - ChayimFriedman2:no-copy-solver-v3, r=jackh726
Provide an extended framework for type visit, for use in rust-analyzer

rust-analyzer needs to be able to visit types when treating not only `Ty`, `Const`, `Region` and `Predicate` specifically, but *all* rust-analyzer-made types specifically (excluding e.g. `TraitRef`, that is declared in rustc_type_ir). This is needed to implement garbage collection.

To support this, we introduce a second, rust-analyzer-only visit trait, named, without much thought, `CustomizableTypeVisitable`. It's simpler than `TypeVisitable` (for example, it does not have a trait for the visitor, and does not support early-returning) because this is what rust-analyzer needs, but its most distinguished feature is that the visitor is a generic of the *trait* instead of the *method*. This way, specific types can treat specific visitor types specifically and call their methods.

In rustc_type_ir we implement it for a bunch of basic types, and using a derive macro for the rest. The macro and trait are completely disabled when compiling for rustc (`feature = "nightly"`), so not even a compile time penalty will be paid.

r? types

This is a replacement to other efforts to support non-`Copy` type in the solver, replacing them with a GC in r-a, as decided by ``@rust-lang/rust-analyzer.`` The code is tiny in comparison, and I believe T-types will have no problem maintaining it, which mostly means adding the derive on new things when they are added and things break on the r-a side.
2025-12-16 14:40:43 +11:00
Stuart Cook
4f2188fb85
Rollup merge of #149771 - tshepang:patch-2, r=Zalathar
bootstrap readme: make easy to read when editor wrapping is not enabled

This also makes it more consistent with other text in the file
2025-12-16 14:40:43 +11:00
Stuart Cook
2de952e813
Rollup merge of #149459 - Ayush1325:uefi-fs-setinfo, r=joboet
std: sys: fs: uefi: Implement set_times and set_perm

- Tested on QEMU OVMF.
2025-12-16 14:40:42 +11:00
Stuart Cook
3be45cbe15
Rollup merge of #149271 - sgasho:enzyme-dlopen, r=bjorn3
feat: dlopen Enzyme

related issue: rust-lang/rust#145899
related pr: rust-lang/rust#146623

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

I refactored some code for rust-lang/rust#146623 and added the functions shown in rust-lang/rust#144197

r? ````@bjorn3````
cc: ````@ZuseZ4````

Zulip link: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/libload.20.2F.20dlopen.20Enzyme.2Fautodiff/near/553647912
2025-12-16 14:40:42 +11:00
Stuart Cook
0ea7d0b956
Rollup merge of #148790 - kevaundray:kw/rv64im-unknown-elf, r=davidtwco,JonathanBrouwer
Add new Tier-3 target: riscv64im-unknown-none-elf

This PR proposes to add riscv64im-unknown-none-elf, a subset of the already supported riscv64imac-unknown-none-elf.

The motivation behind this PR is that we want to standardize (most) zkVMs on riscv64im-none and riscv64ima-none. Having different variants of riscv extensions, also seems to be within expectation, atleast with respects to riscv32.

Note: This does not mean that we will be able to remove [riscv32im-risc0-zkvm-elf](https://doc.rust-lang.org/rustc/platform-support/riscv32im-risc0-zkvm-elf.html) -- I am not aware of all of the dependents for this

**Tier-3 Policy**

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I assigned  Rust Embedded Working Group, since they are already maintaining riscv64IMAC, though I am happy to assign myself.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

It follows the naming convention of the other bare metal riscv targets

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

This has the same requirements as riscv{32, 64}imac

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via ````@)```` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)

Acknowledging the above.
2025-12-16 14:40:41 +11:00
Stuart Cook
bd1e142ac0
Rollup merge of #148756 - JonathanBrouwer:link_section_targets2, r=jdonszelmann
Warn on codegen attributes on required trait methods

This PR turns applying the following attributes on required trait methods (that is, trait methods **without** a default implementation) into a FCW:
- `#[cold]`
- `#[link_section]`
- `#[linkage]` (unstable)
- `#[rustc_allow_const_fn_unstable]` (internal attribute)

These attributes already had no effect when applied to a required trait method, this PR only adds a warning.

Furthermore, it adds a comment in the code that the following codegen attributes are *inherited* when applied to a required trait method:
- `#[track_caller]`
- `#[align]` (unstable)

````@rustbot```` labels +I-lang-nominated
````@rust-lang/lang````

Two questions for the lang team:
- Is adding this warning ok?
- Does the current behaviour of these attributes align with that you would expect them to be?

Fixes https://github.com/rust-lang/rust/issues/147432
2025-12-16 14:40:40 +11:00
Chayim Refael Friedman
bb6d9363a7 Provide an extended framework for type visit, for use in rust-analyzer
rust-analyzer needs to be able to visit types when treating not only `Ty`, `Const`, `Region` and `Predicate` specifically, but *all* rust-analyzer-made types specifically (excluding e.g. `TraitRef`, that is declared in rustc_type_ir). This is needed to implement garbage collection.

To support this, we introduce a second, rust-analyzer-only visit trait, named `GenericTypeVisitable`. It's simpler than `TypeVisitable` (for example, it does not have a trait for the visitor, and does not support early-returning) because this is what rust-analyzer needs, but its most distinguished feature is that the visitor is a generic of the *trait* instead of the *method*. This way, specific types can treat specific visitor types specifically and call their methods.

In rustc_type_ir we implement it for a bunch of basic types, and using a derive macro for the rest. The macro and trait are completely disabled when compiling for rustc (`feature = "nightly"`), so not even a compile time penalty will be paid.
2025-12-16 01:47:28 +02:00
bors
cec70080fd Auto merge of #149354 - antoyo:bootstrap-config/libgccjit-libs-dir, r=Kobzol
Bootstrap config: libgccjit libs dir

r? `@Kobzol`
2025-12-15 23:11:45 +00:00
Boxy Uwu
dbfc8c218e dont create unnecessary DefIds under mgca 2025-12-15 22:59:15 +00:00
Urgau
f05ed901fc Use the embeddable filename for coverage artifacts 2025-12-15 22:09:07 +01:00
cyrgani
c194e9ef56 do not add I-prioritize when F-* labels are present 2025-12-15 20:55:33 +00:00
Antoni Boucher
b3c1dff330 Open bootstrap.example.toml with the utf-8 encoding 2025-12-15 14:46:15 -05:00
Jane Losare-Lusby
72c84a6c80 assert impossible branch is impossible 2025-12-15 11:11:06 -08:00
Folkert de Vries
023f38fe73
custom VaList layout for Hexagon 2025-12-15 20:00:05 +01:00
bors
21ff67df15 Auto merge of #149930 - joboet:small-sys-refactor, r=ChrisDenton
std: small `sys` refactor

Part of rust-lang/rust#117276

The large number of files changed just results from the need to update a lot of imports. Actually this PR only:
* combines the two definitions of `RawOsError` in `sys::pal` into one in `sys::io`
* moves `FULL_BACKTRACE_DEFAULT` from `sys::pal` to `sys::backtrace`
* moves the `FromInner`/`IntoInner`/... traits into `sys` (in preparation for removing `sys_common` entirely)
2025-12-15 18:46:48 +00:00
rustbot
6d139caded Update books 2025-12-15 19:01:33 +01:00
reddevilmidzy
1bd997a452 Cleaned up some tests
Split invalid-compile-flags into run-pass & invalid

Update tests/ui/README.md
2025-12-16 02:10:08 +09:00
sgasho
58aeab58ab add trailing line at compiler/rustc_codegen_llvm/Cargo.toml 2025-12-16 00:32:26 +09:00
sgasho
4d12cb0fb8 refactor: initialize EnzymeWrapper in LlvmCodegenBackend::init 2025-12-16 00:32:25 +09:00
sgasho
ddd5aad8a3 feat: dlopen Enzyme 2025-12-16 00:31:32 +09:00
bors
0160933b1d Auto merge of #150015 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 3d78b3f9e0.

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

r? `@ghost`
2025-12-15 15:20:36 +00:00
Antoni Boucher
b98a91e6ca Error out if a GCC cross-compiler cannot be found 2025-12-15 08:35:17 -05:00