Commit Graph

329699 Commits

Author SHA1 Message Date
Guillaume Gomez
93d56ce32e Rename rustc_trait_selection/src/errors.rs into rustc_trait_selection/src/diagnostics.rs 2026-06-14 10:52:57 +02:00
bors
9ae5f52318 Auto merge of #157882 - jhpratt:rollup-0Jd14n0, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#157837 ([tiny] Remove some unecessary `.into()` calls)
 - rust-lang/rust#157538 (std: move `PidFd` to `sys::process`)
 - rust-lang/rust#157791 (Add regression test for pclmulqdq inlining across target feature)
 - rust-lang/rust#157867 (std: sys: xous: clamp condvar wait_timeout instead of truncating)
 - rust-lang/rust#157876 (Stabilize `#![feature(box_as_ptr)]`)
2026-06-14 03:57:23 +00:00
Jacob Pratt
001c6b12a2 Rollup merge of #157876 - jhpratt:stabilize-box-as-ptr, r=Mark-Simulacrum
Stabilize `#![feature(box_as_ptr)]`

Tracking issue: rust-lang/rust#129090

Completed FCP: https://github.com/rust-lang/rust/issues/129090#issuecomment-4692552170
2026-06-13 23:56:21 -04:00
Jacob Pratt
4ffea22446 Rollup merge of #157867 - devnexen:condvar_xous_timeout_fix, r=clarfonthey
std: sys: xous: clamp condvar wait_timeout instead of truncating

dur.as_millis() (u128) was cast straight to usize, so on 32-bit xous any timeout over ~49 days truncated, and an exact multiple of 2^32 ms became 0 and then 1ms via the "don't wait forever" guard. Saturate the conversion, matching sys/sync/thread_parking/xous.rs.
2026-06-13 23:56:20 -04:00
Jacob Pratt
4532a3ab71 Rollup merge of #157791 - kohsine:pclmulqdq-inlining, r=folkertdev
Add regression test for pclmulqdq inlining across target feature

Regression test for https://github.com/rust-lang/rust/issues/139029.

Checks that pclmulqdq intrinsics inline across target_feature.
2026-06-13 23:56:19 -04:00
Jacob Pratt
9f4c35e5ed Rollup merge of #157538 - joboet:move_pal_pidfd, r=jhpratt
std: move `PidFd` to `sys::process`

Part of https://github.com/rust-lang/rust/issues/117276.

I believe this is the last item in `sys::pal` that is used outside of `sys`, hence we should be able to get rid of the `use pal::*` import quite easily after this.
2026-06-13 23:56:19 -04:00
Jacob Pratt
5037b4488a Rollup merge of #157837 - estebank:useless-into-in-rustc, r=lcnr
[tiny] Remove some unecessary `.into()` calls
2026-06-13 23:56:18 -04:00
Jacob Pratt
416176fec4 Stabilize #![feature(box_as_ptr)] 2026-06-13 17:16:41 -04:00
Esteban Küber
5846d998dc Remove some unecessary .into() calls 2026-06-13 19:41:28 +00:00
bors
1f087276ba Auto merge of #157866 - JonathanBrouwer:rollup-XfF1OYf, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#157201 (Move logic for emitting UNSAFE_CODE for unsafe attributes to attr parsing)
 - rust-lang/rust#157613 (Improve invalid cfg predicate error)
 - rust-lang/rust#157838 (rustdoc: Don't strip hidden items in `AliasedNonLocalStripper`)
2026-06-13 18:04:28 +00:00
David Carlier
5f65b74855 std: sys: xous: clamp condvar wait_timeout instead of truncating
dur.as_millis() (u128) was cast straight to usize, so on 32-bit xous any
timeout over ~49 days truncated, and an exact multiple of 2^32 ms became
0 and then 1ms via the "don't wait forever" guard. Saturate the
conversion, matching sys/sync/thread_parking/xous.rs.
2026-06-13 18:35:54 +01:00
Jonathan Brouwer
7b39994264 Rollup merge of #157838 - qaijuang:rustdoc-hidden-aliased-fields, r=GuillaumeGomez,Urgau
rustdoc: Don't strip hidden items in `AliasedNonLocalStripper`

`AliasedNonLocalStripper` currently strips non-local aliased items that are either non-public or `#[doc(hidden)]`.

The hidden items are subsequently processed by the `strip-hidden` pass. Because they have already been wrapped as stripped items, that pass removes them instead of retaining them as placeholders. As a result, cross-crate aliased types omit `/* private fields */` and `// some variants omitted`.

Handling `#[doc(hidden)]` in `AliasedNonLocalStripper` also means that `--document-hidden-items` cannot display those public fields and variants.

This PR leaves hidden-item handling to `strip-hidden`, while `AliasedNonLocalStripper` continues to unconditionally hide non-public items from external types.

Fixes rust-lang/rust#144969.

r? @GuillaumeGomez
2026-06-13 19:27:11 +02:00
Jonathan Brouwer
d1a2046559 Rollup merge of #157613 - evavh:invalid-predicate-error, r=JonathanBrouwer
Improve invalid cfg predicate error

I have improved the error that is emitted when a non-existant cfg attribute is used. I removed the InvalidPredicate diagnostic, which does not provide much information, and used the function `expected_specific_argument` instead. This provides a nice link to the documentation. I have also blessed and updated the ui tests that broke because of this change.

Before:
```
error[E0537]: invalid predicate `does_not_exist`
 --> bad_error.rs:2:7
  |
2 | #[cfg(does_not_exist())]
  |       ^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error
```

After:
```
error[E0539]: malformed `cfg` attribute input
 --> bad_error.rs:2:1
  |
2 | #[cfg(does_not_exist())]
  | ^^^^^^----------------^^
  |       |
  |       valid arguments are `any`, `all`, `not`, `target` or `version`
  |
  = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
help: must be of the form
  |
2 - #[cfg(does_not_exist())]
2 + #[cfg(predicate)]
  |
```

r? @JonathanBrouwer
2026-06-13 19:27:10 +02:00
Jonathan Brouwer
a20b9df2a0 Rollup merge of #157201 - JonathanBrouwer:unsafe-code-attribute, r=mati865
Move logic for emitting UNSAFE_CODE for unsafe attributes to attr parsing

Fixes https://github.com/rust-lang/rust/issues/131801

This moves the emitting of `UNSAFE_CODE` for unsafe attributes to attr parsing.
Because it is now implemented generically for all unsafe attributes, we don't have to manually list all attributes anymore, and we can't miss adding support for new unsafe attributes in the future.

This adds support for detecting `UNSAFE_CODE` for the following attributes:
* `#[naked]` **(stable attribute!)**
* `#[ffi_pure]`
* `#[ffi_const]`
* `#[force_target_feature]`
2026-06-13 19:27:10 +02:00
Jonathan Brouwer
56810797ee Fix incremental tests 2026-06-13 18:26:48 +02:00
Jonathan Brouwer
7ff784f7ed Add support for #[unsafe(force_target_feature)] to the UNSAFE_CODE lint 2026-06-13 18:26:48 +02:00
Jonathan Brouwer
bce1306af2 Add support for #[ffi_pure] and #[ffi_const] to the UNSAFE_CODE lint 2026-06-13 18:26:48 +02:00
Jonathan Brouwer
3cdf037967 Add support for #[unsafe(naked)] to the UNSAFE_CODE lint 2026-06-13 18:26:48 +02:00
Jonathan Brouwer
765c5f5fb8 Move logic for emitting UNSAFE_CODE for unsafe attributes to attr parsing 2026-06-13 18:26:47 +02:00
Jonathan Brouwer
b5e7310a44 Move declaration of UNSAFE_CODE to rustc_lint_defs 2026-06-13 18:21:33 +02:00
kohsine
59902d528d remove comment 2026-06-13 11:06:59 -04:00
Kevin Oh
2bed3cc40c update comment
Co-authored-by: Folkert de Vries <flokkievids@gmail.com>
2026-06-13 10:59:55 -04:00
kohsine
bf8a123858 use next and count directives to check calls are happening inside function body 2026-06-13 10:57:36 -04:00
bors
e7ef22d23f Auto merge of #157863 - JonathanBrouwer:rollup-YNzUbyz, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#157518 (Add xdg_basedir API)
 - rust-lang/rust#157752 (Rename `errors.rs` file to `diagnostics.rs` (6/N))
 - rust-lang/rust#157769 (Match expressions had not been updated to also show the match_source,…)
 - rust-lang/rust#157825 (Emit retags in codegen to support BorrowSanitizer (part 3))
 - rust-lang/rust#157861 (Rename `errors.rs` file to `diagnostics.rs` (7/N))
2026-06-13 14:51:23 +00:00
Jonathan Brouwer
6b8ad08aec Rollup merge of #157861 - GuillaumeGomez:rename-err-to-diag, r=JonathanBrouwer
Rename `errors.rs` file to `diagnostics.rs` (7/N)

Follow-up of https://github.com/rust-lang/rust/pull/157485.

r? @JonathanBrouwer
2026-06-13 16:50:27 +02:00
Jonathan Brouwer
fafa5b2e6b Rollup merge of #157825 - BorrowSanitizer:codegen-emit-retag-3, r=saethlin
Emit retags in codegen to support BorrowSanitizer (part 3)

Tracking issue: https://github.com/rust-lang/rust/issues/154760
[Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012)

This is one of several PRs that will add experimental support for emitting retags as function calls in codegen.

This PR adds `RetagPlan`, which describes where the pointers that need to be retagged live within the layout of a type. We create a `RetagPlan` ahead of time because only a subset of the variants of a type might contain retagable values. We only want to branch to these variants, and ignore all of the others. If a type can generate a `RetagPlan`, then we will use it as a guide for inserting calls to our retag intrinsics. If a type does not generate a `RetagPlan`, then it does not need to be retagged, and we can skip it.

This does not emit a `RetagPlan::EmitRetag` yet. That will come in a subsequent PR.

Previous parts: rust-lang/rust#156208, rust-lang/rust#156210

cc: @RalfJung
r? @saethlin
2026-06-13 16:50:26 +02:00
Jonathan Brouwer
f889de2bb4 Rollup merge of #157769 - AlexCeleste:thir-missing-match-source, r=Nadrieril
Match expressions had not been updated to also show the match_source,…

… since the time that was added
2026-06-13 16:50:25 +02:00
Jonathan Brouwer
04724ff90a Rollup merge of #157752 - GuillaumeGomez:rename-err-to-diag-3, r=JonathanBrouwer
Rename `errors.rs` file to `diagnostics.rs` (6/N)

Follow-up of https://github.com/rust-lang/rust/pull/157485.

r? @JonathanBrouwer
2026-06-13 16:50:24 +02:00
Jonathan Brouwer
ac8006482d Rollup merge of #157518 - CAD97:xdg_basedir, r=aapoalas
Add xdg_basedir API

Implements an API providing easy access to the XDG Base Directories.

I chose to defer `runtime_dir` (`XDG_RUNTIME_DIR`) since the lack of a specified default (but specified expectation for applications to determine an alternative option somehow) makes the correct usage (and thus ideal API) less obvious.

- Accepted ACP: https://github.com/rust-lang/libs-team/issues/805
- Tracking issue: https://github.com/rust-lang/rust/issues/157515
2026-06-13 16:50:24 +02:00
Eva van Houten
851ab7aecc Fix error-index test (and remove accidentally committed file) 2026-06-13 16:19:40 +02:00
Eva van Houten
34cb96a41f Fix ui tests with bless 2026-06-13 16:19:40 +02:00
Eva van Houten
57c762e4c0 Add feature check for cfg_version 2026-06-13 16:19:40 +02:00
Eva van Houten
91b5e6b3f3 Improve invalid cfg predicate error 2026-06-13 16:19:39 +02:00
Guillaume Gomez
190a22ddf3 Rename rustc_hir_typeck/src/errors.rs into rustc_hir_typeck/src/diagnostics.rs 2026-06-13 14:56:19 +02:00
Guillaume Gomez
d4b2610172 Rename rustc_interface/src/errors.rs into rustc_interface/src/diagnostics.rs 2026-06-13 14:51:05 +02:00
Guillaume Gomez
579cac249f Rename rustc_infer/src/errors.rs into rustc_infer/src/diagnostics.rs 2026-06-13 14:43:13 +02:00
Guillaume Gomez
f6e99c16a5 Rename rustc_hir_analysis/src/errors.rs into rustc_hir_analysis/src/diagnostics.rs 2026-06-13 14:36:07 +02:00
Alex Celeste
d050769aa8 Match expressions had not been updated to also show the match_source, since the time that was added
update existing match tests as well

remove hashes from output

remove specific DefIds for core from output

remove additional specifics that can vary and which are not relevant to the test
2026-06-13 12:36:26 +01:00
bors
8d6b38095e Auto merge of #157858 - JonathanBrouwer:rollup-TnNKRa4, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#157793 (Refactor libproc_macro: remove * imports)
 - rust-lang/rust#156787 (alloc: clarify comment on ArcInner::weak lock sentinel)
2026-06-13 11:32:33 +00:00
qaijuang
edad2648fa test without --document-hidden-items 2026-06-13 07:26:22 -04:00
Jonathan Brouwer
1939d61deb Rollup merge of #156787 - LeSingh1:fix-arc-inner-weak-comment, r=joboet
alloc: clarify comment on ArcInner::weak lock sentinel

The comment on the `weak` field of `ArcInner` currently states that the `usize::MAX` sentinel locks "the ability to upgrade weak pointers or downgrade strong ones", and that this is used to avoid races in `make_mut` and `get_mut`. Both halves of that description are inaccurate.

`Weak::upgrade` never inspects the weak count, so the lock has no effect on it. The operation only CASes on the strong count and is happy to succeed while the weak count is locked. `Arc::make_mut` also does not participate in the locking protocol, and the function body already contains a comment noting that observing `usize::MAX` for the weak count there is impossible because only a thread holding a strong reference can take the lock.

The lock is actually only taken in `Arc::is_unique` (which backs `Arc::get_mut`), and the only operation that observes and waits on it is `Arc::downgrade`, which spins while `weak == usize::MAX` before attempting its CAS to create a new `Weak`.

This PR rewrites the comment to describe what the lock is and what it actually prevents.

Closes rust-lang/rust#144296
2026-06-13 12:55:27 +02:00
Jonathan Brouwer
c0613690df Rollup merge of #157793 - Mark-Simulacrum:proc-macro-refactor, r=lqd,bjorn3
Refactor libproc_macro: remove * imports

This factors out (and goes a bit further) some of the work from https://github.com/rust-lang/rust/pull/157590 which I think can/should be merged independently of the wasm proc macros strategy, since it just makes it easier to read code in the bridge. It was confusing to get warnings/errors when commenting code that looked unused but was actually pulled in due to the `*` imports from other modules.

This also factors the panic message into a separate module since it's not really related to `rpc` in a direct sense.

Best reviewed by-commit.

r? bjorn3 since you've probably at least glanced at this code recently, but happy to re-roll if you'd prefer.
2026-06-13 12:55:26 +02:00
bors
edff07ce1a Auto merge of #157852 - jhpratt:rollup-DcP4hvf, r=jhpratt
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#157714 (Improve polymorphization of raw pointer formatting)
 - rust-lang/rust#157653 (remove AliasTerm::def_id())
 - rust-lang/rust#157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - rust-lang/rust#157846 (Avoid ICE in unconstrained generic parameter suggestion for enums)
 - rust-lang/rust#157594 (note which target a missing target_feature belongs to)
 - rust-lang/rust#157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - rust-lang/rust#157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - rust-lang/rust#157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - rust-lang/rust#157812 (rustc_public: implement `ty::Alias` conversion)
 - rust-lang/rust#157833 (Update wasm-component-ld to 0.5.25)
2026-06-13 08:14:18 +00:00
Jacob Pratt
794ef380a4 Rollup merge of #157833 - alexcrichton:update-wasm-component-ld, r=Mark-Simulacrum
Update wasm-component-ld to 0.5.25

Same as rust-lang/rust#147495, just keeping it up-to-date.
2026-06-13 04:06:06 -04:00
Jacob Pratt
e8a16bc54a Rollup merge of #157812 - makai410:alias-ty, r=scottmcm
rustc_public: implement `ty::Alias` conversion

I don't know why there is a `todo!()` here. Am I overlooking anything?
2026-06-13 04:06:06 -04:00
Jacob Pratt
c5ed1a7f73 Rollup merge of #157802 - veluca93:optimize-attr-closure, r=mejrs,wesleywiser
Ensure that optimize attributes on closures are inherited by the shim.

Tracking issue: https://github.com/rust-lang/rust/issues/54882
Stabilization PR: https://github.com/rust-lang/rust/pull/157273
2026-06-13 04:06:05 -04:00
Jacob Pratt
5f2c872a92 Rollup merge of #157782 - asder8215:phantom_pinned_dead_code, r=BoxyUwU,samueltardieu
Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`

This PR closes rust-lang/rust#154888. See rust-lang/rust#154978 and in [clippy#17056](https://github.com/rust-lang/rust-clippy/pull/17056) for prior history on working on this issue.

From discussing with clippy team, we thought it'd be appropriate to use a diagnostic item attribute to mark `PhantomPinned` and prevent dead field warnings from being emitted in `missing_fields_in_debug.rs` and `pub_underscore_fields.rs`.

If you want me to do the clippy changes separately within the clippy repository, I can do that.
2026-06-13 04:06:04 -04:00
Jacob Pratt
862f780953 Rollup merge of #157740 - pbkx:issue-157371-rustdoc-doctest-span, r=lolbinarycat
rustdoc: correct doctest span for trailing semicolon after item

Fixes rust-lang/rust#157371.

When a doctest contains a trailing semicolon after an item, rustdoc can map the
resulting warning to unrelated source following the documentation block rather
than to the semicolon inside the doctest.

Changes only diagnostic span reporting.
2026-06-13 04:06:04 -04:00
Jacob Pratt
85bbfba826 Rollup merge of #157594 - rohaquinlop:issue-109531-diagnostic-improvements, r=folkertdev
note which target a missing target_feature belongs to

This PR attempts to improve diagnostics for invalid `target_feature` error, many years ago I experienced that [error](https://github.com/rust-lang/rust/issues/108680#issuecomment-1479473303)

Closes: rust-lang/rust#109531
2026-06-13 04:06:03 -04:00
Jacob Pratt
7cf580c153 Rollup merge of #157846 - TaKO8Ki:unconstrained-param-adt-suggestion, r=mu001999
Avoid ICE in unconstrained generic parameter suggestion for enums

Fixes rust-lang/rust#156701

`remove_or_use_generic` accepted structs, enums, and unions as ADT self types, but later used a local HIR lookup with `expect_struct()` when building the type-definition suggestion. That caused an ICE when the self type was an enum.
2026-06-13 04:06:02 -04:00