37327 Commits

Author SHA1 Message Date
bors
69b2702db7 Auto merge of #149273 - bjorn3:crate_locator_improvements, r=petrochenkov
Don't leak sysroot crates through dependencies

Previously if a dependency of the current crate depended on a sysroot crate, then `extern crate` would in the current crate would pick the first loaded version of said sysroot crate even in case of an ambiguity. This is surprising and brittle. For `-Ldependency=` we already blocked this since rust-lang/rust#110229, but the fix didn't account for sysroot crates.

Should fix https://github.com/rust-lang/rust/issues/147966
2025-12-14 09:16:11 +00:00
bors
1fc159d939 Auto merge of #146348 - jdonszelmann:eiiv3, r=lcnr,oli-obk
Externally implementable items

Supersedes https://github.com/rust-lang/rust/pull/140010
Tracking issue: https://github.com/rust-lang/rust/issues/125418

Getting started:

```rust
#![feature(eii)]

#[eii(eii1)]
pub fn decl1(x: u64)
// body optional (it's the default)
{
    println!("default {x}");
}

// in another crate, maybe
#[eii1]
pub fn decl2(x: u64) {
    println!("explicit {x}");
}

fn main() {
    decl1(4);
}
```

- tiny perf regression, underlying issue makes multiple things in the compiler slow, not just EII, planning to solve those separately.
- No codegen_gcc support, they don't have bindings for weak symbols yet but could
- No windows support yet for weak definitions

This PR merges the implementation of EII for just llvm + not windows, doesn't yet contain like a new panic handler implementation or alloc handler. With this implementation, it would support implementing the panic handler in terms of EII already since it requires no default implementation so no weak symbols

The PR has been open in various forms for about a year now, but I feel that having some implementation merged to build upon
2025-12-14 04:20:26 +00:00
bors
1ddfb0e254 Auto merge of #149192 - gmorenz:normalize_lifetimes, r=madsmtm
NFC normalize lifetime identifiers

Fixes rust-lang/rust#126759
2025-12-13 21:47:35 +00:00
bors
e32cdc16df Auto merge of #149934 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

29 commits in 2c283a9a5c5968eeb9a8f12313f04feb1ff8dfac..e91b2baa632c0c7e84216c91ecfe107c37d887c1
2025-12-04 16:47:28 +0000 to 2025-12-13 16:29:21 +0000
- refactor(lints): move from cargo::util::lints to cargo::lints (rust-lang/cargo#16392)
- test(lint): redact more due to line got omitted (rust-lang/cargo#16391)
- feat(report): cargo report timings HTML replay (rust-lang/cargo#16377)
- feat: stabilize `-Zconfig-include` (rust-lang/cargo#16284)
- fix(package): Don't verify registry for --list  (rust-lang/cargo#16341)
- Fixed incorrect locking logic when artifact-dir == build-dir (rust-lang/cargo#16385)
- feat(log): make timing messages ready for HTML replay (rust-lang/cargo#16382)
- chore(deps): update msrv (1 version) to v1.92 (rust-lang/cargo#16381)
- Downgrade curl-sys to 0.4.83 (rust-lang/cargo#16379)
- fix(timing): more self-contained timing/log data (rust-lang/cargo#16378)
- test: update to `proc_macro::tracked::path` (rust-lang/cargo#16380)
- refactor(lint): move lints to separate modules (rust-lang/cargo#16364)
- fix(index): Apply feedback from Cargo team (rust-lang/cargo#16369)
- fix(lints): handle lints separately at ws pkg level  (rust-lang/cargo#16367)
- feat(lint): new `implicit_minimum_version_req` lint (rust-lang/cargo#16321)
- fix(info): default to local without explicit reg (rust-lang/cargo#16358)
- Remove `[no-mentions]` handler in our triagebot config (rust-lang/cargo#16361)
- Don't read the config file twice when $CARGO_HOME is a symlink (rust-lang/cargo#16325)
- fix(timings): forgot to negate filter (rust-lang/cargo#16352)
- fix(doctest): Include all search paths with new build layout  (rust-lang/cargo#16348)
- fix(layout): Remove hashes from bins in new layout  (rust-lang/cargo#16351)
- docs(faq): Include an entry on disk space (rust-lang/cargo#16349)
- feat(timings): derive concurrency data from unit data (rust-lang/cargo#16350)
- perf(layout): Use unit_id, not pkg hash, for bin/lib pkg_dirs for new layout (rust-lang/cargo#16345)
- Validate target source paths before compilation with clearer errors (rust-lang/cargo#16338)
- test(doc): Remove unused build script (rust-lang/cargo#16344)
- refactor(timings): store UnitData in RenderContext instead  (rust-lang/cargo#16346)
- perf(clean): Optimize (legacy) clean with multiple -p specifiers (rust-lang/cargo#16264)
- test: Adjust output for out-of-tree build-dir (rust-lang/cargo#16343)
2025-12-13 18:20:52 +00:00
bors
5c3d6dc8d2 Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco
Overhaul filename handling for cross-compiler consistency

This PR overhauls the way we handle filenames in the compiler and `rmeta` in order to achieve achieve cross-compiler consistency (ie. having the same path no matter if the filename was created in the current compiler session or is coming from `rmeta`).

This is required as some parts of the compiler rely on consistent paths for the soundness of generated code (see rust-lang/rust#148328).

In order to achieved consistency multiple steps are being taken by this PR:
 - by making `RealFileName` immutable
 - by only having `SourceMap::to_real_filename` create `RealFileName`
   - currently `RealFileName` can be created from any `Path` and are remapped afterwards, which creates consistency issue
 - by also making `RealFileName` holds it's working directory, embeddable name and the remapped scopes
   - this removes the need for a `Session`, to know the current(!) scopes and cwd, which is invalid as they may not be equal to the scopes used when creating the filename

In order for `SourceMap::to_real_filename` to know which scopes to apply `FilePathMapping` now takes the current remapping scopes to apply, which makes `FileNameDisplayPreference` and company useless and are removed.

This PR is split-up in multiple commits (unfortunately not atomic), but should help review the changes.

Unblocks https://github.com/rust-lang/rust/pull/147611
Fixes https://github.com/rust-lang/rust/issues/148328
2025-12-13 14:32:09 +00:00
bors
aea6cfdecb Auto merge of #147372 - jieyouxu:rust-analyzer-main-tests, r=Kobzol
Run main rust-analyzer tests in rust-lang/rust CI

Part of rust-lang/rust#147370.
MCP: https://github.com/rust-lang/compiler-team/issues/923

This PR prepares `rust-analyzer` crates with `in-rust-tree` cargo featues where needed, and and updates bootstrap to run the main `rust-analyzer` tests in rust-lang/rust CI, not just the `proc-macro-srv` crate tests.

This supersedes the earlier attempt at https://github.com/rust-lang/rust/pull/136779. I was honestly expecting more failures in this PR, but looking back at the previous attempt, that makes sense because we no longer run `i686-mingw` (32-bit windows-gnu) which had a _bunch_ of these failures. In the earlier attempt I also disabled the `i686-mingw`-related failures for `i686-msvc` since I didn't feel like digging into 32-bit msvc at the time. Try results from this PR shows that it's most likely limited to 32-bit windows-gnu specifically.

### `rust-analyzer` test remarks

- I actually had to _remove_ the `CARGO_WORKSPACE_DIR` `expect-test`-hack in order for `expect-test` to be able to find the test expectation HTML files (for `syntax_highlighting` tests in `ide`). When I added the hack, ironically, it made `expect-test` unable to find the expectation files. I think this was because previously the path was of the `proc-macro-srv` crate specifically, now we point to the root r-a workspace?
- The `cfg`-related differences on `aarch64-apple-darwin` might've been fixed? I can't tell, but we don't seem to be observing the differences now.
- I'm not sure why `config::{generate_config_documentation, generate_package_json_config}` no longer fails. Perhaps they were fixed to no longer try to write to source directory?

### Review remarks

- Commit 1 updates r-a crates that are involved in tests needing artifacts from `rustc_private` compiler crates to use the `in-rust-tree` cargo feature. I briefly tried to use a plain `--cfg=in_rust_tree`, but quickly realized it was very hacky, and needed invasive bootstrap changes. The cargo feature approach seems most "natural"/well-supported to both bootstrap and cargo.
- Commit 2 updates bootstrap to not only run the `proc-macro-srv` tests, but the whole r-a tests.
- Commit 3 restricts r-a main tests to non-32-bit targets we test in CI, since (1) r-a repo does not run tests against 32-bit platforms, and (2) there are some target pointer width sensitive hash differences causing tests to fail. Notably, this means that we also no longer run r-a `proc-macro-srv` tests against 32-bit targets, but we don't expect that crate to be have target pointer width differences. Discussed this in [#t-compiler/rust-analyzer > 32-bit tests?](https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/32-bit.20tests.3F/with/563145736).

---

// try-job: aarch64-gnu
// try-job: aarch64-apple
// try-job: x86_64-mingw-1
// try-job: i686-msvc-1
// try-job: x86_64-msvc-1
// try-job: aarch64-msvc-1
2025-12-13 10:11:41 +00:00
Jana Dönszelmann
ed7cfb5256
EII liveness analysis 2025-12-12 11:32:28 +01:00
Jieyou Xu
acb575c6ab
rust-analyzer: prep crates for testing against in-tree rustc_private 2025-12-11 20:22:49 +08:00
bors
6effa6a466 Auto merge of #149535 - Jamesbarford:chore/refactor-struct-placeholder, r=lcnr
Move `struct Placeholder<T>`

r? ghost

Couple of issues I've encountered;
- `compiler/rustc_infer/src/infer/region_constraints/mod.rs` `GenericKind` I can't call `write!(f, "{p}")` due to error 1. Which looks like I may need to implement `Lift` for `Placeholder`?
- Using the `define_print_and_forward_display!` for `ty::PlaceholderType` caused error 2, as I've moved the struct it no longer exists in the crate. I suspect because I'm not using that macro it causes the error for `GenericKind`

<details>
<summary>Error 1</summary>

```
error: lifetime may not live long enough
   --> compiler/rustc_infer/src/infer/region_constraints/mod.rs:672:38
    |
668 | impl<'tcx> fmt::Display for GenericKind<'tcx> {
    |      ---- lifetime `'tcx` defined here
...
672 |             GenericKind::Placeholder(ref p) => write!(f, "{p}"),
    |                                      ^^^^^ assignment requires that `'tcx` must outlive `'static`
    |
    = note: requirement occurs because of the type `rustc_middle::ty::TyCtxt<'_>`, which makes the generic argument `'_` invariant
    = note: the struct `rustc_middle::ty::TyCtxt<'tcx>` is invariant over the parameter `'tcx`
    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance

error: implementation of `Lift` is not general enough
   --> compiler/rustc_infer/src/infer/region_constraints/mod.rs:672:38
    |
672 |             GenericKind::Placeholder(ref p) => write!(f, "{p}"),
    |                                      ^^^^^ implementation of `Lift` is not general enough
    |
    = note: `Lift<rustc_middle::ty::TyCtxt<'0>>` would have to be implemented for the type `rustc_type_ir::Placeholder<rustc_middle::ty::TyCtxt<'_>, BoundTy>`, for any lifetime `'0`...
    = note: ...but `Lift<rustc_middle::ty::TyCtxt<'1>>` is actually implemented for the type `rustc_type_ir::Placeholder<rustc_middle::ty::TyCtxt<'1>, BoundTy>`, for some specific lifetime `'1`

error: implementation of `Print` is not general enough
   --> compiler/rustc_infer/src/infer/region_constraints/mod.rs:672:38
    |
672 |             GenericKind::Placeholder(ref p) => write!(f, "{p}"),
    |                                      ^^^^^ implementation of `Print` is not general enough
```

</details>

<details>
<summary>Error 2</summary>

```
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
    --> compiler/rustc_middle/src/ty/print/pretty.rs:3060:38
     |
3057 | / macro_rules! forward_display_to_print {
3058 | |     ($($ty:ty),+) => {
3059 | |         // Some of the $ty arguments may not actually use 'tcx
3060 | |         $(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
     | |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...    |
3072 | |     };
3073 | | }
     | |_- in this expansion of `forward_display_to_print!`
...
3093 | / forward_display_to_print! {
3094 | |     ty::Region<'tcx>,
3095 | |     Ty<'tcx>,
3096 | |     &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
3097 | |     ty::Const<'tcx>,
3098 | |     &'tcx ty::PlaceholderType<'tcx>
     | |     ------------------------------- `rustc_type_ir::Placeholder` is not defined in the current crate
3099 | | }
     | |_- in this macro invocation
     |
     = note: impl doesn't have any local type before any uncovered type parameters
     = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules
     = note: define and implement a trait or new type instead

error: implementation of `Lift` is not general enough
    --> compiler/rustc_middle/src/ty/print/pretty.rs:3060:38
     |
3057 | / macro_rules! forward_display_to_print {
3058 | |     ($($ty:ty),+) => {
3059 | |         // Some of the $ty arguments may not actually use 'tcx
3060 | |         $(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
     | |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Lift` is not general enough
...    |
3072 | |     };
3073 | | }
     | |_- in this expansion of `forward_display_to_print!`
...
3093 | / forward_display_to_print! {
3094 | |     ty::Region<'tcx>,
3095 | |     Ty<'tcx>,
3096 | |     &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
3097 | |     ty::Const<'tcx>,
3098 | |     &'tcx ty::PlaceholderType<'tcx>
3099 | | }
     | |_- in this macro invocation
     |
     = note: `Lift<context::TyCtxt<'0>>` would have to be implemented for the type `rustc_type_ir::Placeholder<context::TyCtxt<'tcx>, BoundTy>`, for any lifetime `'0`...
     = note: ...but `Lift<context::TyCtxt<'1>>` is actually implemented for the type `rustc_type_ir::Placeholder<context::TyCtxt<'1>, BoundTy>`, for some specific lifetime `'1`

error: implementation of `print::Print` is not general enough
    --> compiler/rustc_middle/src/ty/print/pretty.rs:3060:38
     |
3057 | / macro_rules! forward_display_to_print {
3058 | |     ($($ty:ty),+) => {
3059 | |         // Some of the $ty arguments may not actually use 'tcx
3060 | |         $(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
     | |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `print::Print` is not general enough
...    |
3072 | |     };
3073 | | }
     | |_- in this expansion of `forward_display_to_print!`
...
3093 | / forward_display_to_print! {
3094 | |     ty::Region<'tcx>,
3095 | |     Ty<'tcx>,
3096 | |     &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
3097 | |     ty::Const<'tcx>,
3098 | |     &'tcx ty::PlaceholderType<'tcx>
3099 | | }
     | |_- in this macro invocation
     |
     = note: `print::Print<'0, print::pretty::FmtPrinter<'a, '0>>` would have to be implemented for the type `rustc_type_ir::Placeholder<context::TyCtxt<'tcx>, BoundTy>`, for any lifetime `'0`...
     = note: ...but `print::Print<'1, print::pretty::FmtPrinter<'a, 'tcx>>` is actually implemented for the type `rustc_type_ir::Placeholder<context::TyCtxt<'1>, BoundTy>`, for some specific lifetime `'1`

error: specializing impl repeats parameter `'tcx`
    --> compiler/rustc_middle/src/ty/print/pretty.rs:3060:38
     |
3057 | / macro_rules! forward_display_to_print {
3058 | |     ($($ty:ty),+) => {
3059 | |         // Some of the $ty arguments may not actually use 'tcx
3060 | |         $(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
     | |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...    |
3072 | |     };
3073 | | }
     | |_- in this expansion of `forward_display_to_print!`
...
3093 | / forward_display_to_print! {
3094 | |     ty::Region<'tcx>,
3095 | |     Ty<'tcx>,
3096 | |     &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
3097 | |     ty::Const<'tcx>,
3098 | |     &'tcx ty::PlaceholderType<'tcx>
3099 | | }
     | |_- in this macro invocation

error[E0277]: the trait bound `&Placeholder<TyCtxt<'tcx>, BoundTy>: Lift<...>` is not satisfied
    --> compiler/rustc_middle/src/ty/print/pretty.rs:3064:30
     |
3057 | / macro_rules! forward_display_to_print {
3058 | |     ($($ty:ty),+) => {
3059 | |         // Some of the $ty arguments may not actually use 'tcx
3060 | |         $(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
...    |
3064 | |                     tcx.lift(*self)
     | |                         ---- ^^^^^ unsatisfied trait bound
     | |                         |
     | |                         required by a bound introduced by this call
...    |
3072 | |     };
3073 | | }
     | |_- in this expansion of `forward_display_to_print!`
...
3093 | / forward_display_to_print! {
3094 | |     ty::Region<'tcx>,
3095 | |     Ty<'tcx>,
3096 | |     &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
3097 | |     ty::Const<'tcx>,
3098 | |     &'tcx ty::PlaceholderType<'tcx>
3099 | | }
     | |_- in this macro invocation
     |
     = help: the trait `Lift<context::TyCtxt<'_>>` is not implemented for `&rustc_type_ir::Placeholder<context::TyCtxt<'tcx>, BoundTy>`
note: required by a bound in `context::TyCtxt::<'tcx>::lift`
    --> compiler/rustc_middle/src/ty/context.rs:1807:20
     |
1807 |     pub fn lift<T: Lift<TyCtxt<'tcx>>>(self, value: T) -> Option<T::Lifted> {
     |                    ^^^^^^^^^^^^^^^^^^ required by this bound in `TyCtxt::<'tcx>::lift`
     = note: the full name for the type has been written to '/home/jambar02/Documents/arm/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_middle-16e5c44041028d8b.long-type-3843651570422266958.txt'
     = note: consider using `--verbose` to print the full type name to the console
help: consider dereferencing here
     |
3064 |                     tcx.lift(**self)
     |                              +

error[E0282]: type annotations needed
    --> compiler/rustc_middle/src/ty/print/pretty.rs:3064:21
     |
3057 | /  macro_rules! forward_display_to_print {
3058 | |      ($($ty:ty),+) => {
3059 | |          // Some of the $ty arguments may not actually use 'tcx
3060 | |          $(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
...    |
3064 | |/                     tcx.lift(*self)
3065 | ||                         .expect("could not lift for printing")
     | ||______________________________________________________________^ cannot infer type
...    |
3072 | |      };
3073 | |  }
     | |__- in this expansion of `forward_display_to_print!`
...
3093 |  / forward_display_to_print! {
3094 |  |     ty::Region<'tcx>,
3095 |  |     Ty<'tcx>,
3096 |  |     &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
3097 |  |     ty::Const<'tcx>,
3098 |  |     &'tcx ty::PlaceholderType<'tcx>
3099 |  | }
     |  |_- in this macro invocation
```

</details>
2025-12-10 17:00:22 +00:00
bors
55b60f6000 Auto merge of #147602 - JohnTitor:dedup-lifetime-capture-errors, r=estebank
Deduplicate higher-ranked lifetime capture errors in impl Trait

  Previously, when an `impl Trait` captured multiple higher-ranked
  lifetimes from an outer `impl Trait`, the compiler would emit a
  separate error for each captured lifetime. This resulted in verbose
  and confusing diagnostics, especially in edition 2024 where implicit
  captures caused duplicate errors.

  This commit introduces error accumulation that collects all capture
  spans and lifetime declaration spans, then emits a single consolidated
  diagnostic using MultiSpan. The new error shows all captured lifetimes
  with visual indicators and lists all declarations in a single note.

r? `@estebank`
Fixes https://github.com/rust-lang/rust/issues/143022
2025-12-10 06:52:27 +00:00
bors
74475963bc Auto merge of #149757 - jdonszelmann:revert-duplicate-span-lowering, r=nnethercote
Revert "early return on duplicate span lowerings"

r? `@nnethercote`

reverts rust-lang/rust#149060 because of perf regressions that are still wild to me
2025-12-09 11:38:27 +00:00
bors
74afa932b1 Auto merge of #147572 - alexcrichton:wasi-use-libc, r=Mark-Simulacrum
std: Use more `unix.rs` code on WASI targets

This commit is a large change to the implementation of filesystem and
other system-related operations on WASI targets. Previously the standard
library explicitly used the `wasi` crate at the 0.11.x version track
which means that it used WASIp1 APIs directly. This meant that `std` was
hard-coded to use WASIp1 syscalls and there was no separate
implementation for the WASIp{2,3} targets, for example. The high-level
goal of this commit is to decouple this interaction and avoid the use of
the `wasi` crate on the WASIp2 target.

Historically when WASIp1 was originally added to Rust the wasi-libc
library was in a much different position than it is today. Nowadays Rust
already depends on wasi-libc on WASI targets for things like memory
allocation and environment variable management. As a libc library it
also has all the functions necessary to implement all filesystem
operations Rust wants. Recently wasi-libc additionally was updated to
use WASIp2 APIs directly on the `wasm32-wasip2` target instead of using
`wasm32-wasip1` APIs. This commit is leveraging this work by enabling
Rust to completely sever the dependence on WASIp1 APIs when compiling
for `wasm32-wasip2`. This is also intended to make it easier to migrate
to `wasm32-wasip3` internally in the future where now only libc need be
updated and Rust doesn't need to explicitly change as well.

The overall premise of this commit is that there's no need for
WASI-specific implementation modules throughout the standard library.
Instead the libc-style bindings already implemented for Unix-like
targets are sufficient. This means that Rust will now be using
libc-style interfaces to interact with the filesystem, for example, and
wasi-libc is the one responsible for translating these POSIX-ish
functions into WASIp{1,2} calls.

Concrete changes here are:

* `std` for `wasm32-wasip2` no longer depends on `wasi 0.11.x`
* The implementation of `std::os::wasi::fs`, which was previously
  unstable and still is, now has portions gated to only work on the
  WASIp1 target which use the `wasi` crate directly. Traits have been
  trimmed down in some cases, updated in others, or now present a
  different API on WASIp1 and WASIp2. It's expected this'll get further
  cleanup in the future.
* The `std::sys::fd::wasi` module is deleted and `unix` is used instead.
* The `std::sys::fs::wasi` module is deleted and `unix` is used instead.
* The `std::sys::io::io_slice::wasi` module is deleted and `unix` is used
  instead.
* The `std::sys::pal::{wasip1,wasip2}` modules are now merged together
  as their difference is much smaller than before.
* The `std::sys::pal::wasi::time` is deleted and the `unix` variant is
  used directly instead.
* The `std::sys::stdio::wasip{1,2}` modules are deleted and the `unix`
  variant is used instead.
* The `std::sys:🧵:wasip{1,2}` modules are deleted and the `unix`
  variant is used instead.

Overall Rust's libstd is effectively more tightly bound to libc when
compiled to WASI targets. This is intended to mirror how it's expected
all other languages will also bind to WASI. This additionally has the
nice goal of drastically reducing the WASI-specific maintenance burden
in libstd (in theory) and the only real changes required here are extra
definitions being added to `libc` (done in separate PRs). This might be
required for more symbols in the future but for now everything should be
mostly complete.
2025-12-09 05:10:32 +00:00
bors
9f7200cd05 Auto merge of #149426 - antoyo:libgccjit-targets, r=Kobzol
Move the libgccjit.so file in a target directory

Since GCC is not multi-target, we need multiple libgccjit.so. Our solution to have a directory per target so that we can have multiple libgccjit.so.

r? `@Kobzol`
2025-12-09 01:58:46 +00:00
bors
29d1f7c6ed Auto merge of #149776 - bjorn3:sync_cg_clif-2025-12-08, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlights this time are a Cranelift update and adding actual support for `-Cdebuginfo=line-tables-only` rather than treating it the same as `-Cdebuginfo=full`.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2025-12-08 22:35:48 +00:00
bors
051d26823c Auto merge of #149766 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 5e3e9c4e61.

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

r? `@ghost`
2025-12-08 19:24:45 +00:00
bors
cb099d846a Auto merge of #147754 - Dan54:friendly-clamp, r=Mark-Simulacrum
Improve error message for std integer clamp() if min > max

For rust-lang/rust#142309: change the error message for `Ord::clamp()` for std integer types if min > max to be more useful.

Message is now `min > max. min = {min:?}, max = {max:?}`

Also add `#[track_caller]` to `clamp()`
2025-12-08 00:04:02 +00:00
bors
36bcb16921 Auto merge of #149517 - WaffleLapkin:alphabet-blessing, r=jdonszelmann
Implement blessing for tidy alphabetical check

r? `@jdonszelmann`
2025-12-07 20:08:33 +00:00
bors
f9caa8aee0 Auto merge of #149060 - jdonszelmann:duplicate-span-lowering, r=WaffleLapkin
early return on duplicate span lowerings

`@bors2` try
2025-12-07 16:56:12 +00:00
Lukas Wirth
5e3e9c4e61
Merge pull request #21222 from A4-Tacks/no-comp-resugar-unit-ret-ty
No complete unit RetType in resugar async assoc item
2025-12-08
2025-12-07 15:06:49 +00:00
Lukas Wirth
6dd5f16f07
Merge pull request #21223 from Veykril/push-xpmrpxnwpono
fix: Disable postcard use temporarily
2025-12-07 14:02:19 +00:00
Lukas Wirth
d659c2eab3 fix: Disable postcard use temporarily 2025-12-07 14:52:10 +01:00
A4-Tacks
5955a29f6a
No complete unit RetType in resugar async assoc item
Example
---
```rust
use core::future::Future;

trait DesugaredAsyncTrait {
    fn foo(&self) -> impl Future<Output = ()> + Send;
}

impl DesugaredAsyncTrait for () {
    $0
}
```

**Before this PR**

```rust
use core::future::Future;

trait DesugaredAsyncTrait {
    fn foo(&self) -> impl Future<Output = ()> + Send;
}

impl DesugaredAsyncTrait for () {
    async fn foo(&self) -> () {
        $0
    }
}
```

**After this PR**

```rust
use core::future::Future;

trait DesugaredAsyncTrait {
    fn foo(&self) -> impl Future<Output = ()> + Send;
}

impl DesugaredAsyncTrait for () {
    async fn foo(&self) {
        $0
    }
}
```
2025-12-07 21:18:40 +08:00
Lukas Wirth
e059280fbb
Merge pull request #21178 from Veykril/tracked-modules
internal: Make `ModuleId` a tracked struct
2025-12-07 08:41:04 +00:00
Lukas Wirth
64cabd87be Turn BlockLoc into a tracked struct 2025-12-07 09:31:53 +01:00
Lukas Wirth
30550d917b Make ModuleId a tracked struct
optimize some stuff

Optimize `pub(crate)` visibility resolution

Optimize private visibility resolution
2025-12-07 09:31:19 +01:00
Lukas Wirth
41f0d80622
Merge pull request #21215 from ChayimFriedman2/unsized-struct
fix: Don't implement sizedness check via `all_field_tys()`
2025-12-07 08:30:54 +00:00
Chayim Refael Friedman
40727e8840
Merge pull request #21218 from ChayimFriedman2/update-supported-version
internal: Update supported Rust version to 1.90.0
2025-12-07 00:24:54 +00:00
Chayim Refael Friedman
9e1ccc2309 Update supported Rust version to 1.90.0
We no longer work properly with older versions.
2025-12-07 02:14:39 +02:00
Chayim Refael Friedman
3172d19886 Don't implement sizedness check via all_field_tys()
Since we don't implement it currently for perf reasons, but here we only need a struct's tail field, it will be wrong.
2025-12-06 21:23:21 +02:00
bors
2c1100b349 Auto merge of #149495 - scottmcm:assume-filter-count, r=Mark-Simulacrum
Assume the returned value in `.filter(…).count()`

Similar to how this helps in `slice::Iter::position`, LLVM sometimes loses track of how high this can get, so for `TrustedLen` iterators tell it what the upper bound is.
2025-12-06 09:13:21 +00:00
bors
0cee245c2e Auto merge of #141980 - beetrees:va-list-proposal, r=workingjubilee
`c_variadic`: make `VaList` abi-compatible with C

tracking issue: https://github.com/rust-lang/rust/issues/44930
related PR: rust-lang/rust#144529

On some platforms, the C `va_list` type is actually a single-element array of a struct (on other platforms it is just a pointer). In C, arrays passed as function arguments expirience array-to-pointer decay, which means that C will pass a pointer to the array in the caller instead of the array itself, and modifications to the array in the callee will be visible to the caller (this does not match Rust by-value semantics). However, for `va_list`, the C standard explicitly states that it is undefined behaviour to use a `va_list` after it has been passed by value to a function (in Rust parlance, the `va_list` is moved, not copied). This matches Rust's pass-by-value semantics, meaning that when the C `va_list` type is a single-element array of a struct, the ABI will match C as long as the Rust type is always be passed indirectly.

In the old implementation, this ABI was achieved by having two separate types: `VaList` was the type that needed to be used when passing a `VaList` as a function parameter, whereas `VaListImpl` was the actual `va_list` type that was correct everywhere else. This however is quite confusing, as there are lots of footguns: it is easy to cause bugs by mixing them up (e.g. the C function `void foo(va_list va)` was equivalent to the Rust `fn foo(va: VaList)` whereas the C function `void bar(va_list* va)` was equivalent to the Rust `fn foo(va: *mut VaListImpl)`, not `fn foo(va: *mut VaList)` as might be expected); also converting from `VaListImpl` to `VaList` with `as_va_list()` had platform specific behaviour: on single-element array of a struct platforms it would return a `VaList` referencing the original `VaListImpl`, whereas on other platforms it would return a cioy,

In this PR, there is now just a single `VaList` type (renamed from `VaListImpl`) which represents the C `va_list` type and will just work in all positions. Instead of having a separate type just to make the ABI work, rust-lang/rust#144529 adds a `#[rustc_pass_indirectly_in_non_rustic_abis]` attribute, which when applied to a struct will force the struct to be passed indirectly by non-Rustic calling conventions. This PR then implements the `VaList` rework, making use of the new attribute on all platforms where the C `va_list` type is a single-element array of a struct.

Cleanup of the `VaList` API and implementation is also included in this PR: since it was decided it was OK to experiment with Rust requiring that not calling `va_end` is not undefined behaviour (https://github.com/rust-lang/rust/issues/141524#issuecomment-3028383594), I've removed the `with_copy` method as it was redundant to the `Clone` impl (the `Drop` impl of `VaList` is a no-op as `va_end` is a no-op on all known platforms).

Previous discussion: rust-lang/rust#141524 and [t-compiler > c_variadic API and ABI](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/c_variadic.20API.20and.20ABI)
Tracking issue: https://github.com/rust-lang/rust/issues/44930
r? `@joshtriplett`
2025-12-05 23:36:55 +00:00
bors
3f2410cec7 Auto merge of #148602 - BoxyUwU:coercion_cleanup_uncontroversial, r=lcnr
misc coercion cleanups and handle safety correctly

r? lcnr

### "remove normalize call"

Fixes rust-lang/rust#132765

If the normalization fails we would sometimes get a `TypeError` containing inference variables created inside of the probe used by coercion. These would then get leaked out causing ICEs in diagnostics logic

### "leak check and lub for closure<->closure coerce-lubs of same defids"

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/233
```rust
fn peculiar() -> impl Fn(u8) -> u8 {
    return |x| x + 1
}
```
the `|x| x + 1` expr has a type of `Closure(?31t)` which we wind up inferring the RPIT to. The `CoerceMany` `ret_coercion` for the whole `peculiar` typeck has an expected type of `RPIT` (unnormalized). When we type check the `return |x| x + 1` expr we go from the never type to `Closure(?31t)` which then participates in the `ret_coercion` giving us a `coerce-lub(RPIT, Closure(?31t))`.

Normalizing `RPIT` gives us some `Closure(?50t)` where `?31t` and `?50t` have been unified with `?31t` as the root var. `resolve_vars_if_possible` doesn't resolve infer vars to their roots so these wind up with different structural identities so the fast path doesn't apply and we fall back to coercing to a `fn` ptr. cc rust-lang/rust#147193 which also fixes this

New solver probably just gets more inference variables here because canonicalization + generally different approach to normalization of opaques. Idk :3

### FCP worthy stuffy

there are some other FCP worthy things but they're in my FCP comment which also contains some analysis of the breaking nature of the previously listed changes in this PR: https://github.com/rust-lang/rust/pull/148602#issuecomment-3503497467
2025-12-05 11:46:41 +00:00
Lukas Wirth
2cbf3587d3
Merge pull request #21208 from ChayimFriedman2/lint-attrs-hir
internal: Handle lint attributes via hir-expand attr handling
2025-12-05 09:12:21 +00:00
Chayim Refael Friedman
753449bdae Handle lint attributes via hir-expand attr handling
This avoids code duplication.
2025-12-05 07:04:18 +02:00
Chayim Refael Friedman
d4f45d7ae2
Merge pull request #21203 from A4-Tacks/hide-placeholder-hints
Add config hide placeholders type hints
2025-12-04 21:57:01 +00:00
Chayim Refael Friedman
98418dce79
Merge pull request #21205 from eihqnh/fix/cfg-attr-index-mismatch
fix: Skip cfg attributes in macro input attribute stripping
2025-12-04 19:58:03 +00:00
eihqnh
80d84e7cca fix: Skip cfg attributes when stripping macro input attributes 2025-12-05 03:42:39 +08:00
A4-Tacks
e8ee597340
Add config hide placeholders type hints
In the inferred type hints, expand the line too long. add config to disable it.

Example
---
```json
{"rust-analyzer.inlayHints.typeHints.hideInferredTypes": true}
```

```rust
use std::collections::HashMap;
fn foo(iter: Vec<Result<HashMap<String, String>, std::io::Error>>) {
    let output = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();
}
```

**Before this PR**

```rust
let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_ = HashMap<String, String>>, _ = Error>>().unwrap();
```

**After this PR**

```rust
let output: Vec<HashMap<String, String>> = iter.into_iter().collect::<Result<Vec<_>, _>>().unwrap();
```
2025-12-05 02:09:59 +08:00
bors
f079db2fbd Auto merge of #149586 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to acb3a0074d.

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

r? `@ghost`
2025-12-04 11:28:11 +00:00
bors
53c5d60220 Auto merge of #149631 - matthiaskrgr:rollup-jbx443u, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#147841 (Fix ICE when applying test macro to crate root)
 - rust-lang/rust#149147 (Fix unused_assignments false positives from macros)
 - rust-lang/rust#149183 (Use `TypingMode::PostAnalysis` in `try_evaluate_const`)
 - rust-lang/rust#149456 (std: don't call `current_os_id` from signal handler)
 - rust-lang/rust#149501 (CTFE: avoid emitting a hard error on generic normalization failures)
 - rust-lang/rust#149528 (reword error for invalid range patterns)
 - rust-lang/rust#149539 (Additional test for uN::{gather,scatter}_bits)
 - rust-lang/rust#149549 (Regression test for system register `ttbr0_el2`)
 - rust-lang/rust#149550 (Disable native-lib for x check miri)
 - rust-lang/rust#149554 (build-manifest: generate MSI and MINGW arrays from rustc)
 - rust-lang/rust#149557 (c-variadic: bpf and spirv do not support c-variadic definitions)
 - rust-lang/rust#149569 (Fix mailmap issue)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-04 08:18:30 +00:00
Lukas Wirth
86779be51d
Merge pull request #21183 from ChayimFriedman2/define-opaque
fix: Register `define_opaque` builtin attribute macro
2025-12-04 07:57:54 +00:00
Matthias Krüger
9b57a8fad0
Rollup merge of #149539 - quaternic:gather-scatter-bits, r=Mark-Simulacrum
Additional test for uN::{gather,scatter}_bits

Feature gate: #![feature(uint_gather_scatter_bits)]
Tracking issue: https://github.com/rust-lang/rust/issues/149069
Accepted ACP: https://github.com/rust-lang/libs-team/issues/695#issuecomment-3549284861

Adds an additional runtime test for `uN::gather_bits` and `uN::scatter_bits` in coretests. They are each other's inverses in a sense, so a shared test can test both with relative ease.

I plan to follow up with optimized implementations for these functions.
2025-12-04 08:46:22 +01:00
Matthias Krüger
54d2dd325d
Rollup merge of #149501 - lcnr:no-hard-error-on-norm-failure, r=lqd,oli-obk
CTFE: avoid emitting a hard error on generic normalization failures

Fixes rust-lang/rust#149081.

The fix is quite unsatisfying and should not be necessary, cc rust-lang/rust#149283. That change is significantly more involved. This temporary fix introduces some unnecessary complexity and may hide other type system bugs.

cc ````@rust-lang/types```` I think we should try to fix issue rust-lang/rust#149283 in the near future and then remove this hack again.

I originally intended a more targeted fix. I wanted to skip evaluating constants in MIR opts if their body was polymorphic and the current generic arguments still reference generic parameters. Notes from looking into this:
- we only fetch the MIR in the `eval_to_allocation_raw` query
- figuring out which MIR to use is hard
	- dealing with trivial consts is annoying
	- need to resolve instances for associated consts
	- implementing this by hand is hard
- inlining handles this issue by bailing on literally all normalization failures, even the ones that imply an unsoundness
	- `try_normalize_after_erasing_regions` generally does two things
		- deal with ambiguity after inlining
		- deal with error tainting issues (please don't, we should stop doing that)
- CTFE could be changed to always silently ignore normalization failures if we're in a generic body
	- hides actual bugs <- went with this option

r? types
2025-12-04 08:46:20 +01:00
Matthias Krüger
c63ffb81dc
Rollup merge of #149456 - joboet:async-safe-tid, r=Mark-Simulacrum
std: don't call `current_os_id` from signal handler

`current_os_id` is not always async-signal-safe depending on the platform, hence it may not be called from the SIGSEGV handler. Instead, store the thread ID along with the thread name during setup. With rust-lang/rust#144465 merged, this information is available even before the thread main function.
2025-12-04 08:46:19 +01:00
Matthias Krüger
df184e7e1e
Rollup merge of #149183 - tiif:typing_env_fix, r=BoxyUwU
Use `TypingMode::PostAnalysis` in `try_evaluate_const`

As mentioned in https://github.com/rust-lang/rust/pull/148698#discussion_r2541882341, we should use ``TypingMode::PostAnalysis`` for that path.

````@BoxyUwU```` prefer the match in ``try_evaluate_const`` to be exhaustive, so I also included that in this PR :3
2025-12-04 08:46:19 +01:00
Matthias Krüger
06ee911930
Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer
Fix unused_assignments false positives from macros

Fixes rust-lang/rust#147648
2025-12-04 08:46:18 +01:00
bors
c21e8e29ed Auto merge of #149602 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to 633cff2520.

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

r? `@ghost`
2025-12-04 05:03:04 +00:00
Lukas Wirth
633cff2520
Merge pull request #21195 from Veykril/push-nnzprznzurwz
fix: More proc-macro-srv proto fixes
2025-12-03 16:15:37 +00:00
Lukas Wirth
c3afa4406f fix: More proc-macro-srv proto fixes 2025-12-03 16:17:51 +01:00
Chayim Refael Friedman
0b6dc8648b
Merge pull request #21198 from A4-Tacks/nested-incomplete-let-semi
Fix nested expr missing semicolon in incomplete-let
2025-12-03 11:16:26 +00:00