Commit graph

314063 commits

Author SHA1 Message Date
maradini77
fc6df9cec7 fix: typos and grammar errors in README files
- fix `FIMXE`/`FXIME` typos → `FIXME`
- fix grammar: `these terminology are` → `this terminology is`
- fix apostrophe: `it's data` → `its data`
- remove duplicate word: `less less` → `less`
2025-12-25 15:11:01 +02:00
bors
63001d79ef Auto merge of #150359 - notriddle:stringdex-0.0.5, r=yotamofek
Bump stringdex, fix compiler-docs

Fixes https://github.com/rust-lang/rust/issues/150346
2025-12-25 06:35:26 +00:00
Michael Howell
69f987dbe8 Bump stringdex, fix compiler-docs
Fixes https://github.com/rust-lang/rust/issues/150346
2025-12-24 19:53:06 -07:00
bors
e7d44143a1 Auto merge of #150351 - JonathanBrouwer:rollup-knpqs9d, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#150141 (Misc cleanups from reading some borrowck code)
 - rust-lang/rust#150297 (Fix compile issue in Vita libstd)
 - rust-lang/rust#150341 (Fix some divergences with the cg_clif subtree)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-24 16:30:07 +00:00
Jonathan Brouwer
990783f83e
Rollup merge of #150341 - bjorn3:fix_cg_clif_divergence, r=bjorn3
Fix some divergences with the cg_clif subtree

For some reason git-subtree incorrectly synced those changes.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2025-12-24 16:37:11 +01:00
Jonathan Brouwer
8e84475e25
Rollup merge of #150297 - forkgull:notgull/vita, r=joboet
Fix compile issue in Vita libstd

Unfortunately it looks like the Vita libc does not support
the "utimensat" function, which is needed for setting file times.
To fix the build, this commit marks Vita as unsupported for the
function that sets the file times.
2025-12-24 16:37:11 +01:00
Jonathan Brouwer
c772ca3a6a
Rollup merge of #150141 - BoxyUwU:borrowck_cleanup_1, r=lcnr
Misc cleanups from reading some borrowck code

title

r? lcnr
2025-12-24 16:37:10 +01:00
bjorn3
a8c9cb5f77 Fix some divergences with the cg_clif subtree
For some reason git-subtree incorrectly synced those changes.
2025-12-24 15:16:59 +00:00
Boxy Uwu
0e0911b5d8 Misc cleanups 2025-12-24 15:06:06 +00:00
bors
24ac030a79 Auto merge of #150343 - JonathanBrouwer:rollup-1mwkrdv, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#150311 (Avoid using env::temp when linking a binary)
 - rust-lang/rust#150336 (Disable f16 on LoongArch for LLVM < 21)
 - rust-lang/rust#150338 (Include rustc version in ICE messages)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-24 13:21:20 +00:00
Jonathan Brouwer
e84aea3db1
Rollup merge of #150338 - bjorn3:ice_message_version, r=lqd,hkBst
Include rustc version in ICE messages

Rather than only including them in the ICE file. Not every user includes the ICE file in their bug reports, nor do they always list the rustc version.
2025-12-24 14:19:23 +01:00
Jonathan Brouwer
2622cc2129
Rollup merge of #150336 - heiher:loong-no-f16-llvm20, r=lqd
Disable f16 on LoongArch for LLVM < 21

The `f16` type works on the LoongArch target starting from LLVM 21. However, the current minimum supported external LLVM version is 20, so `f16` must not be enabled on LoongArch for LLVM version < 21.
2025-12-24 14:19:23 +01:00
Jonathan Brouwer
77fe25a741
Rollup merge of #150311 - ChrisDenton:no-temp, r=Kivooeo
Avoid using env::temp when linking a binary

This keeps all build artefacts (even temporary ones) within the build directory.

Fixes rust-lang/rust#139963
2025-12-24 14:19:22 +01:00
bjorn3
13c6256efe Include rustc version in ICE messages
Rather than only including them in the ICE file. Not every user includes
the ICE file in their bug reports, nor do they always list the rustc
version.
2025-12-24 10:21:07 +00:00
bors
c4aa646f15 Auto merge of #150334 - jhpratt:rollup-met2i6d, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#150016 (stabilize `lazy_get`)
 - rust-lang/rust#150139 (Correct terminology in Clone)
 - rust-lang/rust#150238 (mir_build: Classify `TestableCase::Constant` into multiple sub-kinds)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-24 09:31:51 +00:00
WANG Rui
855281c887 Disable f16 on LoongArch for LLVM < 21
The `f16` type works on the LoongArch target starting from LLVM 21.
However, the current minimum supported external LLVM version is 20,
so `f16` must not be enabled on LoongArch for LLVM version < 21.
2025-12-24 16:10:38 +08:00
Jacob Pratt
f9e3c618b8
Rollup merge of #150238 - Zalathar:pat-const-kind, r=Nadrieril
mir_build: Classify `TestableCase::Constant` into multiple sub-kinds

In match lowering, when choosing a test for a `TestableCase::Constant`, there is some ad-hoc logic for inspecting the pattern type and deciding what kind of test is suitable. There is also some very similar logic later, when partitioning cases into buckets based on the chosen test.

Instead of having that ad-hoc logic in multiple places, I think it's better to perform an up-front classification when lowering `thir::PatKind::Constant` to `TestableCase::Constant`, and then have the later steps simply match on an enum variant.

There should be no change to the resulting built MIR.

(I will note that the logic/invariants involved are a bit unclear, so there is a risk of accidental minor differences.)
2025-12-24 02:52:59 -05:00
Jacob Pratt
ef4f2d640e
Rollup merge of #150139 - GKFX:clone-docs, r=jhpratt
Correct terminology in Clone

I think the current wording around Clone here is confusing:

- "Rust does not allow you to reimplement `Copy`" - reimplement isn't a piece of Rust terminology, but as written it sounds like you can't write `impl Copy for X`, which you can.
- "you may reimplement `Clone`" - again reimplement isn't really a thing that you do to a trait, the distinction is between manually implementing and deriving.
- "you can automatically make anything `Copy` be `Clone` as well" - you don't have a choice about it, so it doesn't really make sense to say you "can ... make" this happen.
2025-12-24 02:52:59 -05:00
Jacob Pratt
1c2dbcf33b
Rollup merge of #150016 - usamoi:stabilize-lazy-get, r=jhpratt
stabilize `lazy_get`

closes https://github.com/rust-lang/rust/issues/129333
FCP is finished in https://github.com/rust-lang/rust/issues/129333#issuecomment-3477510482

```@rustbot``` modify labels: +T-libs-api
2025-12-24 02:52:58 -05:00
Chris Denton
6e354544bf
Rename invalid-tmpdir-env-var
to invalid-tmpdir-no-ice
2025-12-24 06:41:44 +00:00
Chris Denton
b5c473e414
Avoid using env::temp when linking a binary
This keeps all build artefacts (even temporary ones) within the build directory.
2025-12-24 06:41:42 +00:00
bors
efa32de15b Auto merge of #150283 - Urgau:remap-debuginfo-absolute, r=jieyouxu
Remap both absolute and relative paths when building `rustc` and `std`

Turns out [#150110](https://github.com/rust-lang/rust/issues/150110) didn't work as expected, because when the standard library sources are present, we [helpfully un-remap the paths](e951f470d7/compiler/rustc_metadata/src/rmeta/decoder.rs (L1656-L1702)) to the local directory of the user, including when we are building the compiler and standard library it-self (duh!), and since those paths are absolute (not relative), our purely relative remapping didn't pick them up.

This behavior wasn't a issue before because the un-remap logic immediately tries to remap them again, and since we had the absolute remapping we would just remap them to the the same thing.

To fix that issue I've adjusted our remapping to remap both the absolute and relative paths when building `rustc` and `std`, as well as added a run-make to make sure we don't regress it again (with a new `needs-std-remap-debuginfo` directive).

r? `@jieyouxu`
2025-12-24 06:23:00 +00:00
bors
5a7ad8ee06 Auto merge of #150324 - matthiaskrgr:rollup-cl7wrqn, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#149800 (Fix ICE in normalization during closure capture analysis (rust-lang/rust#149746))
 - rust-lang/rust#150182 (Don't export upstream monomorphizations from compiler-builtins)
 - rust-lang/rust#150216 (Tidying up tests/ui/issues 15 tests [6/N])
 - rust-lang/rust#150308 (Update bors configuration)
 - rust-lang/rust#150314 (rustc-dev-guide subtree update)
 - rust-lang/rust#150319 (use new term in description of --target)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-24 03:02:44 +00:00
Zalathar
1296925d1b Split out a separate PatConstKind::Float
Unlike the other types covered by `PatConstKind::Other`, const-float patterns
can also interact with range patterns.
2025-12-24 13:40:08 +11:00
Zalathar
b7729998d2 Classify TestableCase::Constant into multiple sub-kinds 2025-12-24 13:40:07 +11:00
Matthias Krüger
2237db5d27
Rollup merge of #150319 - tshepang:triple-is-tuple, r=Kivooeo
use new term in description of --target

this changes _triple_ to _tuple_ in `--target` description
2025-12-24 00:54:37 +01:00
Matthias Krüger
6348e9454c
Rollup merge of #150314 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to 1127d2ac60.

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

r? ``@ghost``
2025-12-24 00:54:37 +01:00
Matthias Krüger
ebfdc44ceb
Rollup merge of #150308 - Kobzol:bors-conf, r=marcoieni
Update bors configuration

Updates the configuration of bors to bring it up to speed with homu, in preparation for https://github.com/rust-lang/infra-team/issues/168. Mirrors configuration from homu's [configuration file](https://github.com/rust-lang/homu/blob/master/cfg.production.toml#L46).

This PR also enables reporting of merge conflicts, so that we can test this part of bors on `rust-lang/rust`. The merge conflict reports will be duplicated (until/unless we disable it in homu), but that hopefully shouldn't be such a big deal.

r? ``@marcoieni``
2025-12-24 00:54:36 +01:00
Matthias Krüger
b6c2dab72b
Rollup merge of #150216 - reddevilmidzy:t13, r=Kivooeo
Tidying up tests/ui/issues 15 tests [6/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

r? Kivooeo
2025-12-24 00:54:36 +01:00
Matthias Krüger
62129792bb
Rollup merge of #150182 - saethlin:dont-prefer-c-builtins, r=bjorn3
Don't export upstream monomorphizations from compiler-builtins
2025-12-24 00:54:35 +01:00
Matthias Krüger
f6c6e847e1
Rollup merge of #149800 - Delta17920:fix-ice-149746, r=lcnr
Fix ICE in normalization during closure capture analysis (#149746)

This fixes an internal compiler error that occurred when normalizing associated types during closure capture analysis.

The Fix: Modified rustc_middle/src/ty/normalize_erasing_regions.rs to gracefully handle projection normalization failures instead of panicking when analyzing closure captures.

Regression Test: Added tests/ui/associated-types/normalization-ice-issue-149746.rs, a reproduction case involving complex associated type projections (<() as Owner>::Ty<T>) that previously crashed the compiler. Verified it now emits a standard type error (E0277).

Fixes rust-lang/rust#149746
2025-12-24 00:54:34 +01:00
bors
8796b3b8b4 Auto merge of #149114 - BoxyUwU:mgca_adt_exprs, r=lcnr
MGCA: Support struct expressions without intermediary anon consts

r? oli-obk

tracking issue: rust-lang/rust#132980

Fixes rust-lang/rust#127972
Fixes rust-lang/rust#137888
Fixes rust-lang/rust#140275

due to delaying a bug instead of ICEing in HIR ty lowering.

### High level goal

Under `feature(min_generic_const_args)` this PR adds another kind of const argument. A struct/variant construction const arg kind. We represent the values of the fields as themselves being const arguments which allows for uses of generic parameters subject to the existing restrictions present in `min_generic_const_args`:
```rust
fn foo<const N: Option<u32>>() {}

trait Trait {
    #[type_const]
    const ASSOC: usize;
}

fn bar<T: Trait, const N: u32>() {
    // the initializer of `_0` is a `N` which is a legal const argument
    // so this is ok.
    foo::<{ Some::<u32> { 0: N } }>();

    // this is allowed as mgca supports uses of assoc consts in the
    // type system. ie `<T as Trait>::ASSOC` is a legal const argument
    foo::<{ Some::<u32> { 0: <T as Trait>::ASSOC } }>();

    // this on the other hand is not allowed as `N + 1` is not a legal
    // const argument
    foo::<{ Some::<u32> { 0: N + 1 } }>();
}
```

This PR does not support uses of const ctors, e.g. `None`. And also does not support tuple constructors, e.g. `Some(N)`. I believe that it would not be difficult to add support for such functionality after this PR lands so have left it out deliberately.

We currently require that all generic parameters on the type being constructed be explicitly specified. I haven't really looked into why that is but it doesn't seem desirable to me as it should be legal to write `Some { ... }` in a const argument inside of a body and have that desugar to `Some::<_> { ... }`. Regardless this can definitely be a follow-up PR and I assume this is some underlying consistency with the way that elided args are handled with type paths elsewhere.

This PRs implementation of supporting struct expressions is somewhat incomplete. We don't handle `Foo { ..expr }` at all and aren't handling privacy/stability. The printing of `ConstArgKind::Struct` HIR nodes doesn't really exist either :')

I've tried to keep the implementation here somewhat deliberately incomplete as I think a number of these issues are actually quite small and self contained after this PR lands and I'm hoping it could be a good set of issues to mentor newer contributors on 🤔 I just wanted the "bare minimum" required to actually demonstrate that the previous changes are "necessary".

### `ValTree` now recurse through `ty::Const`

In order to actually represent struct/variant construction in `ty::Const` without going through an anon const we would need to introduce some new `ConstKind` variant. Let's say some hypothetical `ConstKind::ADT(Ty<'tcx>, List<Const<'tcx>>)`.

This variant would represent things the same way that `ValTree` does with the first element representing the `VariantIdx` of the enum (if its an enum), and then followed by a list of field values in definition order.

This *could* work but there are a few reasons why it's suboptimal.

First it would mean we have a second kind of `Const` that can be normalized. Right now we only have `ConstKind::Unevaluated` which possibly needs normalization. Similarly with `TyKind` we *only* have `TyKind::Alias`. If we introduced `ConstKind::ADT` it would need to be normalized to a `ConstKind::Value` eventually. This feels to me like it has the potential to cause bugs in the long run where only `ConstKind::Unevaluated` is handled by some code paths.

Secondly it would make type equality/inference be kind of... weird... It's desirable for `Some { 0: ?x } eq Some { 0: 1_u32 }` to result in `?x=1_u32`.  I can't see a way for this to work with this `ConstKind::ADT` design under the current architecture for how we represent types/consts and generally do equality operations.

We would need to wholly special case these two variants in type equality and have a custom recursive walker separate from the existing architecture for doing type equality. It would also be somewhat unique in that it's a non-rigid `ty::Const` (it can be normalized more later on in type inference) while also having somewhat "structural" equality behaviour.

Lastly, it's worth noting that its not *actually* `ConstKind::ADT` that we want. It's desirable to extend this setup to also support tuples and arrays, or even references if we wind up supporting those in const generics. Therefore this isn't really `ConstKind::ADT` but a more general `ConstKind::ShallowValue` or something to that effect. It represents at least one "layer" of a types value :')

Instead of doing this implementation choice we instead change `ValTree::Branch`:
```rust
enum ValTree<'tcx> {
    Leaf(ScalarInt),
    // Before this PR:
    Branch(Box<[ValTree<'tcx>]>),
    // After this PR
    Branch(Box<[Const<'tcx>]>),
}
```

The representation for so called "shallow values" is now the same as the representation for the *entire* full value. The desired inference/type equality behaviour just falls right out of this. We also don't wind up with these shallow values actually being non-rigid. And `ValTree` *already* supports references/tuples/arrays so we can handle those just fine.

I think in the future it might be worth considering inlining `ValTree` into `ty::ConstKind`. E.g:
```rust
enum ConstKind {
    Scalar(Ty<'tcx>, ScalarInt),
    ShallowValue(Ty<'tcx>, List<Const<'tcx>>),
    Unevaluated(UnevaluatedConst<'tcx>),
    ...
}
```

This would imply that the usage of `ValTree`s in patterns would now be using `ty::Const` but they already kind of are anyway and I think that's probably okay in the long run. It also would mean that the set of things we *could* represent in const patterns is greater which may be desirable in the long run for supporting things such as const patterns of const generic parameters.

Regardless, this PR doesn't actually inline `ValTree` into `ty::ConstKind`, it only changes `Branch` to recurse through `Const`. This change could be split out of this PR if desired.

I'm not sure if there'll be a perf impact from this change. It's somewhat plausible as now all const pattern values that have nesting will be interning a lot more `Ty`s. We shall see :>

### Forbidding generic parameters under mgca

Under mgca we now allow all const arguments to resolve paths to generic parameters. We then *later* actually validate that the const arg should be allowed to access generic parameters if it did wind up resolving to any.

This winds up just being a lot simpler to implement than trying to make name resolution "keep track" of whether we're inside of a non-anon-const const arg and then encounter a `const { ... }` indicating we should now stop allowing resolving to generic parameters.

It's also somewhat in line with what we'll need for a `feature(generic_const_args)` where we'll want to decide whether an anon const should have any generic parameters based off syntactically whether any generic parameters were used. Though that design is entirely hypothetical at this point :)

### Followup Work

- Make HIR ty lowering check whether lowering generic parameters is supported and if not lower to an error type/const. Should make the code cleaner, fix some other bugs, and maybe(?) recover perf since we'll be accessing less queries which I think is part of the perf regression of this PR
- Make the ValTree setup less scuffed. We should find a new name for `ConstKind::Value` and the `Val` part of `ValTree` and `ty::Value` as they no longer correspond to a fully normalized structure. It may also be worth looking into inlining `ValTreeKind` into `ConstKind` or atleast into `ty::Value` or sth 🤔
- Support tuple constructors and const constructors not just struct expressions.
- Reduce code duplication between HIR ty lowering's handling of struct expressions, and HIR typeck's handling of struct expressions
- Try fix perf https://github.com/rust-lang/rust/pull/149114#issuecomment-3668038853. Maybe this will clear up once we clean up `ValTree` a bit and stop doing double interning and whatnot
2025-12-23 23:53:55 +00:00
Tshepang Mbambo
e7965821e8 use new term in description of --target 2025-12-23 23:35:58 +02:00
bors
2ca7bcd03b Auto merge of #150313 - bjorn3:sync_cg_clif-2025-12-23, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlight this time is a Cranelift update.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2025-12-23 18:01:43 +00:00
bjorn3
0c80ea5705 Merge commit '6f3f6bdacb' into sync_cg_clif-2025-12-23 2025-12-23 17:47:42 +00:00
bjorn3
6f3f6bdacb Rustup to rustc 1.94.0-nightly (4f14395c3 2025-12-22) 2025-12-23 16:22:22 +00:00
bjorn3
de4168be8c Sync from rust 4f14395c37 2025-12-23 16:07:31 +00:00
bjorn3
6bb3a40d53 Update to Cranelift 0.127 2025-12-23 15:31:24 +00:00
bjorn3
c252af5cbb Fix audit workflow 2025-12-23 15:30:38 +00:00
Jakub Beránek
bbf4ec3b0f
Add support for automation/bors/auto merge branch 2025-12-23 15:47:03 +01:00
bors
99ff3fbb86 Auto merge of #149202 - ZuseZ4:automate-offload-clangs, r=oli-obk
automate offload, part 2 - clang calls

This automates steps 2+3 (the clang invocations) of the rust offload usage pipeline.
Now all that remains is a clang-linker-invocation after this step.

r? oli-obk
2025-12-23 14:37:46 +00:00
Boxy Uwu
79fd535473 Fix tools 2025-12-23 13:55:00 +00:00
Boxy Uwu
484480412e Lower hir::ConstArgKind::Struct to a ValTree 2025-12-23 13:54:59 +00:00
Boxy Uwu
6722805cdc Make ValTree recurse through ty::Const 2025-12-23 13:54:59 +00:00
Boxy Uwu
c65551e835 Introduce hir::ConstArgKind::Struct 2025-12-23 13:54:59 +00:00
Boxy Uwu
8f3a76bd38 mgca always resolve params 2025-12-23 13:54:59 +00:00
Manuel Drehwald
8e1d80305f Update offloading docs to account for simplified usage 2025-12-23 05:20:11 -08:00
Manuel Drehwald
3fdc6da2aa adding proper error handling for offload 2025-12-23 05:20:11 -08:00
Manuel Drehwald
dfef2e96fe Remove the need to call clang for std::offload usages 2025-12-23 05:20:07 -08:00
Jakub Beránek
75f53dd70e
Update bors configuration 2025-12-23 14:16:25 +01:00