Commit graph

315740 commits

Author SHA1 Message Date
Asuna
79ec275e2d Support primitives in type info reflection
Support {bool,char,int,uint,float,str} primitive types for feature
`type_info` reflection.
2026-01-14 19:15:39 +01:00
Esteban Küber
92db7b2b5a Recover parse gracefully from <const N>
When a const param doesn't have a `: Type`, recover the parser state and provide a structured suggestion. This not only provides guidance on what was missing, but it also makes subsuequent errors to be emitted that would otherwise be silenced.

```
error: expected `:`, found `>`
  --> $DIR/incorrect-const-param.rs:26:16
   |
LL | impl<T, const N> From<[T; N]> for VecWrapper<T>
   |                ^ expected `:`
   |
help: you might have meant to write the type of the const parameter here
   |
LL | impl<T, const N: /* Type */> From<[T; N]> for VecWrapper<T>
   |                ++++++++++++
```
2026-01-14 17:56:31 +00:00
Jakub Beránek
9f1cf9efe0
Add temporary new bors e-mail address to the mailmap
To match it to bors in thanks.
2026-01-14 18:01:50 +01:00
Vadim Petrochenkov
83c5f2c194 resolve: Relax one more assert in glob overwriting and add a test
Also avoid losing some glob ambiguities when re-fetching globs
2026-01-14 19:58:40 +03:00
Vadim Petrochenkov
1c3841b372 Add a test for issue 150977 2026-01-14 19:58:40 +03:00
Vadim Petrochenkov
81ef42d5b7 resolve: Consistently use old decls before new decls in interfaces
The opposite ordering was a consistent source of confusion during debuggingю
`report_conflict` actually used an incorrect order due to similar confusion.
2026-01-14 19:58:33 +03:00
Vadim Petrochenkov
8b52c73b3e resolve: Relax some asserts in glob overwriting and add tests 2026-01-14 19:57:21 +03:00
mejrs
00384df080 Delete MetaItemOrLitParser::Err 2026-01-14 17:47:11 +01:00
bors
86a49fd71f Auto merge of #130998 - the8472:bail-before-memcpy, r=nnethercote
avoid phi node for pointers flowing into Vec appends

Elide temporary allocations in patterns like `vec.append(slice.to_vec())`

related discussion: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/nocapture.20and.20allocation.20elimination
2026-01-14 16:36:26 +00:00
Vadim Petrochenkov
0361bd004a resolve: In visit_scopes do not extract ctxt out of span unless necessary 2026-01-14 19:26:07 +03:00
Colin Murphy
c1bcae0638 Fix WASI threading regression with minimal invasive change
Recent changes made WASI targets use the Unix threading implementation, but
WASI does not support threading. When the Unix code tries to call
pthread_create, it fails with EAGAIN, causing libraries like rayon to
panic when trying to initialize their global thread pool.

This fix adds an early return in Thread::new() that checks for WASI and
returns UNSUPPORTED_PLATFORM. This approach:
- Continues using most of the unix.rs code path (less invasive)
- Only requires a small cfg check at the start of Thread::new()
- Can be easily removed once wasi-sdk is updated with the proper fix

The real fix is being tracked in `WebAssembly/wasi-libc#716` which will
change the error code returned by pthread_create to properly indicate
unsupported operations. Once that propagates to wasi-sdk, this workaround
can be removed.

Fixes the regression where rayon-based code (e.g., lopdf in PDF handling)
panicked on WASI after nightly-2025-12-10.

Before fix:
  pthread_create returns EAGAIN (error code 6)
  ThreadPoolBuildError { kind: IOError(Os { code: 6,
  kind: WouldBlock, message: "Resource temporarily unavailable" }) }

After fix:
  Thread::new returns Err(io::Error::UNSUPPORTED_PLATFORM)
  Libraries can gracefully handle the lack of threading support
2026-01-14 09:20:43 -05:00
Taiki Endo
7d80e7d720 rustc_target: Remove unused Arch::PowerPC64LE
target_arch for powerpc64le- targets is "powerpc64".
2026-01-14 23:12:57 +09:00
bjorn3
2b209a69cf Avoid serde dependency in build_helper when not necessary 2026-01-14 13:21:16 +00:00
bors
8c52f735ab Auto merge of #151107 - JonathanBrouwer:rollup-9CIxxuZ, r=JonathanBrouwer
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#149408 (refactor: remove Ord bound from BinaryHeap::new etc)
 - rust-lang/rust#150406 (Change some `matches!(.., .. if ..)` with let-chains)
 - rust-lang/rust#150723 (std: move `errno` and related functions into `sys::io`)
 - rust-lang/rust#150877 (resolve: Refactor away the side table `decl_parent_modules`)
 - rust-lang/rust#150902 (Update to_uppercase docs to avoid ß->SS example)
 - rust-lang/rust#151034 (std: Change UEFI env vars to volatile storage)
 - rust-lang/rust#151036 (Better handle when trying to iterate on a `Range` of a type that isn't `Step`)
 - rust-lang/rust#151067 (Avoid should-fail in two ui tests and a codegen-llvm test)
 - rust-lang/rust#151072 (also handle ENOTTY ioctl errors when checking pidfd -> pid support)
 - rust-lang/rust#151077 (Recognize potential `impl<const N: usize>` to `impl<N>` mistake)
 - rust-lang/rust#151096 (Remove `Deref`/`DerefMut` impl for `Providers`.)

Failed merges:

 - rust-lang/rust#150939 (resolve: Relax some asserts in glob overwriting and add tests)

r? @ghost
2026-01-14 13:12:51 +00:00
mu001999
12b4b72715 Add test for issue 151048 2026-01-14 20:59:41 +08:00
mu001999
80bd069138 Fix review comments 2026-01-14 20:59:41 +08:00
mu001999
37f20b7631 Bless tests 2026-01-14 20:59:41 +08:00
mu001999
e27fcfd28e Remove FeedConstTy 2026-01-14 20:59:41 +08:00
mu001999
d0b760369f Remove all usage of FeedConstTy::No 2026-01-14 20:59:38 +08:00
dianqk
5769006794
Run dummy_span.rs test with SimplifyComparisonIntegral 2026-01-14 18:57:17 +08:00
Jonathan Brouwer
db10879fd1
Rollup merge of #151096 - rm-providers-deref, r=oli-obk
Remove `Deref`/`DerefMut` impl for `Providers`.

It's described as a "backwards compatibility hack to keep the diff small". Removing it requires only a modest amount of churn, and the resulting code is clearer without the invisible derefs.

r? @oli-obk
2026-01-14 11:05:42 +01:00
Jonathan Brouwer
18c62b5d44
Rollup merge of #151077 - issue-84327, r=fmease
Recognize potential `impl<const N: usize>` to `impl<N>` mistake

When encountering code like `impl<N> Bar<N> for [u8; N]`, suggest `impl<const N: Type> Bar<N> for [u8; N]` as a possibility.

```
error[E0423]: expected value, found type parameter `T`
  --> $DIR/issue-69654.rs:5:25
   |
LL | impl<T> Bar<T> for [u8; T] {}
   |      -                  ^ not a value
   |      |
   |      found this type parameter
   |
help: you might have meant to write a const parameter here
   |
LL | impl<const T: Type> Bar<T> for [u8; T] {}
   |      +++++  ++++++
```

Addresses "case 3" from rust-lang/rust#84327.
2026-01-14 11:05:41 +01:00
Jonathan Brouwer
be22fe2128
Rollup merge of #151072 - fix-pidfd-ioctl, r=jhpratt
also handle ENOTTY ioctl errors when checking pidfd -> pid support

Otherwise the std testsuite fails on older kernels.

Reported in https://github.com/rust-lang/rust/pull/150412#issuecomment-3744390883
2026-01-14 11:05:41 +01:00
Jonathan Brouwer
b431a5e685
Rollup merge of #151067 - ui_test_no_should_fail, r=lqd
Avoid should-fail in two ui tests and a codegen-llvm test

`should-fail` is only meant for testing the compiletest framework itself. It checks that the test runner itself panicked.

With this there are still a bunch of rustdoc-html tests that use it due to this test suite not supporting anything like `//@ doc-fail`.
2026-01-14 11:05:40 +01:00
Jonathan Brouwer
cbcd1c3eef
Rollup merge of #151036 - issue-151026, r=mati865
Better handle when trying to iterate on a `Range` of a type that isn't `Step`

Mention when a trait bound corresponds to an unstable trait.

Mention `Range` when `Step` bound is unment, and explain that only some std types impl `Iterator` for `Range`.

CC rust-lang/rust#151026
2026-01-14 11:05:40 +01:00
Jonathan Brouwer
4874f18c54
Rollup merge of #151034 - bishop-fix-nv, r=joboet
std: Change UEFI env vars to volatile storage

The UEFI variables set by the env vars should be volatile, otherwise they will persist after reboot and use up scarce non-volatile storage.

CC @Ayush1325
2026-01-14 11:05:39 +01:00
Jonathan Brouwer
28476376f9
Rollup merge of #150902 - docs-150888-to_uppercase, r=Noratrieb,workingjubilee
Update to_uppercase docs to avoid ß->SS example

Fixes rust-lang/rust#150888

Updates the `to_uppercase` documentation examples to avoid relying on the ß → "SS" mapping and instead uses a stable multi-character case-mapping example ('ffi' → "FFI").

Note: the example uses U+FB03 (LATIN SMALL LIGATURE FFI), not the ASCII string "ffi".
2026-01-14 11:05:39 +01:00
Jonathan Brouwer
129f88cf5c
Rollup merge of #150877 - declmod, r=nnethercote
resolve: Refactor away the side table `decl_parent_modules`

Instead keep parent modules in `DeclData` itself.
Follow up to https://github.com/rust-lang/rust/pull/150445.

r? @nnethercote
2026-01-14 11:05:38 +01:00
Jonathan Brouwer
95ea4c5699
Rollup merge of #150723 - move_pal_error, r=@tgross35
std: move `errno` and related functions into `sys::io`

Part of rust-lang/rust#117276.

Currently, `errno` and related functions like `decode_error_kind` are split across `sys::pal` and `sys::pal::os`. This PR moves all of them into a new module inside `sys::io`.
2026-01-14 11:05:38 +01:00
Jonathan Brouwer
4e4bee8add
Rollup merge of #150406 - matches-let-chain, r=Kivooeo,oli-obk,BoxyUwU,fmease
Change some `matches!(.., .. if ..)` with let-chains

Follow up to rust-lang/rust#149933.
2026-01-14 11:05:37 +01:00
Jonathan Brouwer
91429523f1
Rollup merge of #149408 - aatifsyed/binary-heap-no-ord, r=tgross35,dtolnay
refactor: remove Ord bound from BinaryHeap::new etc

This adds consistency with e.g `BTreeMap::new`, and makes it easier to e.g `#[derive(Default)]`[^1]

[^1]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f848e472a176fae155f17455bdfe0aee
2026-01-14 11:05:36 +01:00
bors
2fd6efc327 Auto merge of #150541 - Kobzol:dist-gcc-component, r=jieyouxu
Add a dist component for libgccjit

Companion to https://github.com/rust-lang/rust/pull/150538.

try-job: dist-x86_64-linux
2026-01-14 09:57:06 +00:00
Zalathar
a72083f739 Avoid some more usize-to-u64 casts in prefix_slice_suffix 2026-01-14 18:10:55 +11:00
Zalathar
a9ce7503d5 Pull array length determination out of prefix_slice_suffix 2026-01-14 18:10:55 +11:00
Zalathar
414e00d350 Clarify the docs/examples for ProjectionElem::ConstantIndex 2026-01-14 18:10:23 +11:00
Jakub Beránek
0c57e8c832
Change bors build finished job to publish toolstate 2026-01-14 07:51:30 +01:00
Nicholas Nethercote
3aa31788b5 Remove Deref/DerefMut impl for Providers.
It's described as a "backwards compatibility hack to keep the diff
small". Removing it requires only a modest amount of churn, and the
resulting code is clearer without the invisible derefs.
2026-01-14 15:55:59 +11:00
bors
4931e09e3a Auto merge of #151087 - GuillaumeGomez:rollup-vIdiReJ, r=GuillaumeGomez
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#150587 (triagebot: add A-rustdoc-js autolabel)
 - rust-lang/rust#150677 (Improve std::path::Path::join documentation)
 - rust-lang/rust#150737 (diagnostics: make implicit Sized bounds explicit in E0277)
 - rust-lang/rust#150771 (Remove legacy homu `try` and `auto` branch mentions)
 - rust-lang/rust#150840 (Make `--print=check-cfg` output compatible `--check-cfg` arguments)
 - rust-lang/rust#150915 (Regression test for type params on eii)
 - rust-lang/rust#151017 (Port the rustc dump attributes to the attribute parser)
 - rust-lang/rust#151019 (Make `Type::of` support unsized types)
 - rust-lang/rust#151031 (Support arrays in type reflection)
 - rust-lang/rust#151043 (armv7-unknown-linux-uclibceabihf.md: Fix bootstrap.toml syntax)
 - rust-lang/rust#151052 (ui: add regression test for macro resolution ICE (issue rust-lang/rust#150711))
 - rust-lang/rust#151053 (Reduce flakyness for `tests/rustdoc-gui/notable-trait.goml`)
 - rust-lang/rust#151055 (Emit error instead of delayed bug when meeting mismatch type for const array)

r? @ghost
2026-01-14 03:26:31 +00:00
Guillaume Gomez
c8c7b5b449 Generate macro expansion for rust compiler crates docs 2026-01-14 00:58:35 +01:00
Esteban Küber
15d8e9ea66 Recognize potential impl<const N: usize> to impl<N> mistake
When encountering code like `impl<N> Bar<N> for [u8; N]`, suggest `impl<const N: Type> Bar<N> for [u8; N]` as a possibility.

```
error[E0423]: expected value, found type parameter `T`
  --> $DIR/issue-69654.rs:5:25
   |
LL | impl<T> Bar<T> for [u8; T] {}
   |      -                  ^ not a value
   |      |
   |      found this type parameter
   |
help: you might have meant to write a const parameter here
   |
LL | impl<const T: /* Type */> Bar<T> for [u8; T] {}
   |      +++++  ++++++++++++
```
2026-01-13 23:47:35 +00:00
mejrs
0ee43b16b6 Do not validate diagnostic::do_not_recommend args 2026-01-13 23:57:34 +01:00
Guillaume Gomez
3adbd3ae4e
Rollup merge of #151055 - mgca-arr, r=BoxyUwU
Emit error instead of delayed bug when meeting mismatch type for const array

r? BoxyUwU

resolve: rust-lang/rust#151024

cc: https://github.com/rust-lang/rust/pull/150869
2026-01-13 23:39:13 +01:00
Guillaume Gomez
860e60a786
Rollup merge of #151053 - reduce-gui-test-flakyness, r=jieyouxu
Reduce flakyness for `tests/rustdoc-gui/notable-trait.goml`

Fixes https://github.com/rust-lang/rust/issues/151006 (hopefully).

Instead of asserting right away, it waits for the element count to be the one expected.

r? @jieyouxu
2026-01-13 23:39:13 +01:00
Guillaume Gomez
5b7fc2fcc7
Rollup merge of #151052 - add-test-ice-in-resolve, r=Kivooeo
ui: add regression test for macro resolution ICE (issue #150711)

Added a new test in `test/ui/resolve` for a macro
resolution scenario that previously caused an ICE.

Files added:
- `tests/ui/resolve/decl-macro-use-no-ice.rs`
- `tests/ui/resolve/decl-macro-use-no-ice.stderr`

Fixes rust-lang/rust#150711

r? @matthiaskrgr
r? @petrochenkov
2026-01-13 23:39:12 +01:00
Guillaume Gomez
770919211f
Rollup merge of #151043 - patch-1, r=ehuss
armv7-unknown-linux-uclibceabihf.md: Fix bootstrap.toml syntax

With the suggested value we were getting instead:

```
ERROR: Failed to parse '/tmp/rust/bootstrap.toml': unknown field `stage`, expected one of `build`, `description`, `host`, `target`, `build-dir`, `cargo`, `rustc`, `rustfmt`, `cargo-clippy`, `docs`, `compiler-docs`, `library-docs-private-items`, `docs-minification`, `submodules`, `gdb`, `lldb`, `nodejs`, `npm`, `yarn`, `python`, `windows-rc`, `reuse`, `locked-deps`, `vendor`, `full-bootstrap`, `bootstrap-cache-path`, `extended`, `tools`, `tool`, `verbose`, `sanitizers`, `profiler`, `cargo-native-static`, `low-priority`, `configure-args`, `local-rebuild`, `print-step-timings`, `print-step-rusage`, `check-stage`, `doc-stage`, `build-stage`, `test-stage`, `install-stage`, `dist-stage`, `bench-stage`, `patch-binaries-for-nix`, `metrics`, `android-ndk`, `optimized-compiler-builtins`, `jobs`, `compiletest-diff-tool`, `compiletest-allow-stage0`, `compiletest-use-stage0-libtest`, `tidy-extra-checks`, `ccache`, `exclude` for key `build`
```
2026-01-13 23:39:12 +01:00
Guillaume Gomez
a8e3ce50b9
Rollup merge of #151031 - reflect-arrays, r=oli-obk
Support arrays in type reflection

Tracking issue: rust-lang/rust#146922

This PR adds support for inspecting arrays `[T; N]` through type reflection. It does so by adding `TypeKind::Array` and the `Array` struct:

```rust
pub struct Array {
    pub element_ty: TypeId,
    pub len: usize,
}
```

This can be used to inspect arrays like so:

```rust
match const { Type::of::<[u16; 4]>() }.kind {
    TypeKind::Array(array) => {
        assert_eq!(array.element_ty, TypeId::of::<u16>());
        assert_eq!(array.len, 4);
    }
    _ => unreachable!(),
}
```

r? @oli-obk
2026-01-13 23:39:11 +01:00
Guillaume Gomez
93dc648735
Rollup merge of #151019 - type-of-unsized, r=oli-obk
Make `Type::of` support unsized types

Tracking issue: rust-lang/rust#146922
Fixes rust-lang/rust#151018

`Type::of` is a utility function for getting type reflection information, and internally just calls `TypeId::of::<T>().info()`. `Type::of` does not support unsized types like `str` and `[u8]` because it is missing a `?Sized` bound. I believe this is an oversight rather than an intentional decision, as `TypeId::of` _does_ support unsized types and `Type::size` is an `Option` to support types without sizes.

This PR adds a `?Sized` bound to `Type::of` and extends the `dump.rs` test to ensure unsized types work in the future.

r? @oli-obk
2026-01-13 23:39:11 +01:00
Guillaume Gomez
3bbce8f20a
Rollup merge of #151017 - rustc_dump, r=jdonszelmann
Port the rustc dump attributes to the attribute parser

Tracking issue has been updated: https://github.com/rust-lang/rust/issues/131229
Five easy ones

r? @jdonszelmann
2026-01-13 23:39:10 +01:00
Guillaume Gomez
0d3692a437
Rollup merge of #150915 - eii-regression-test-149983, r=kivooeo
Regression test for type params on eii

Somewhere along the line I fixed this one with my other PRs. This just adds the regression tests

Closes rust-lang/rust#149983
2026-01-13 23:39:10 +01:00
Guillaume Gomez
080c7043c1
Rollup merge of #150840 - print-check-cfg-rework-output, r=nnethercote
Make `--print=check-cfg` output compatible `--check-cfg` arguments

This PR changes significantly the output of the unstable `--print=check-cfg` option.

Specifically it removes the ad-hoc resemblance with `--print=cfg` in order to output a simplified but still compatible `--check-cfg` arguments.

The goal is to future proof the output of `--print=check-cfg` like `--check-cfg` is, and the best way to do that is to use it's syntax.

This is particularly relevant for [RFC3905](https://github.com/rust-lang/rfcs/pull/3905) which wants to introduce a new predicate: `version(...)`.
2026-01-13 23:39:09 +01:00