Commit graph

316834 commits

Author SHA1 Message Date
Matthias Krüger
72f163cb48
Rollup merge of #151892 - chahar-ritik:e0423-enum-doc, r=Kivooeo
Document enum types used as values for E0423

### Problem

The E0423 error explanation did not include an example for enum types being used
as values, which is a common source of confusion for users.

For example, the following code:

```rust
fn main() {
    let x = Option::<i32>;
}
```
2026-01-31 10:41:53 +01:00
Matthias Krüger
29fcd639b7
Rollup merge of #151849 - frank-king:refactor/pin-coerce-1, r=jackh726
refactor: remove `Ty::pinned_ref` in favor of `Ty::maybe_pinned_ref`

Also returns the `Region` of the reference type in `Ty::maybe_pinned_Ref`.

Part of rust-lang/rust#149130.

r? jackh726
2026-01-31 10:41:53 +01:00
Matthias Krüger
41be336130
Rollup merge of #151896 - tgross35:revert-outline-atomics, r=lqd
Revert enabling `outline-atomics` on various platforms

Our implementations in `compiler-builtins` do not yet have BTI landing pads, so platforms using a custom-built std with unstable `-Zbranch-protection=bti` may run into issues. This should resolve https://github.com/rust-lang/rust/issues/151486. There is a PR in progress to add BTI support to compiler-builtins [1], after which this can be re-enabled.

Linux has had `outline-atomics` enabled for years [2] with no known problems, so it is not changed here.

Partially reverts https://github.com/rust-lang/rust/pull/144938
Reverts https://github.com/rust-lang/rust/pull/149633
Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/245100-t-compiler.2Fprioritization.2Falerts/topic/.23151486.20Chromium.20hitting.20SIGILL.20crashes.20on.20aarch64.20after.20.231.E2.80.A6/with/571170956

[1]: https://github.com/rust-lang/compiler-builtins/pull/1063
[2]: 0f9f241aac
2026-01-31 10:41:52 +01:00
Matthias Krüger
df7d12a24d
Rollup merge of #151262 - Shunpoco:tidy-clap, r=Zalathar
Introducing clap on tidy

### Context
Currently tidy parses paths/flags from args_os manually, and the extraction is spreading multiple files. It may be a breeding ground for bugs.

ref: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/How.20--ci.3Dtrue.20interact.20with.20CiEnv.3F/near/543171560
(N.B. We've talked about introducing a ci flag in tidy in that thread, but I don't do it in this PR as I don't want to put multiple changes into a PR. I will introduce the flag in a coming PR.)

### Changes
This PR replaces current parsing logic with clap. To confirm the new parser works fine, I introduce an unit test for it.

### Build time
We've concerned about how clap increases the build time. In order to confirm the increment is acceptable, I did an experiment on CI:
- Run cargo build without cache for tidy 50 times in each environment on CI
- Calculate an average and a standard deviation from the result, and plot them

Here is the graph:
<img width="943" height="530" alt="rust_tidy_build_time" src="https://github.com/user-attachments/assets/c7deee69-9f38-4044-87dc-76d6e7384f76" />

- Clap tends to increase build time ~2s. We think this is not a big problem
- Build time differs in each environment
- In some cases standard deviation are high, I suppose that busyness of CI instances affect build time
2026-01-31 10:41:52 +01:00
Trevor Gross
9fb68d60ef Revert "Enable outline-atomics by default on AArch64 Windows platforms"
This reverts commit 1ed1b6e267.
2026-01-31 07:08:17 +00:00
Trevor Gross
1173034b7b Revert "Enable outline-atomics by default on AArch64 Android"
This reverts commit c455903978.
2026-01-31 07:08:11 +00:00
Trevor Gross
a9da102e20 Revert "Enable outline-atomics by default on AArch64 Fuchsia"
This reverts commit 21525f862d.
2026-01-31 07:08:05 +00:00
Trevor Gross
63e16520a2 Revert "Enable outline-atomics by default on AArch64 OpenBSD"
This reverts commit 66c150c1fa.
2026-01-31 07:07:59 +00:00
Trevor Gross
54f88be3cd Revert "Enable outline-atomics by default on AArch64 FreeBSD"
This reverts commit 383053e016.
2026-01-31 07:07:53 +00:00
ritik chahar
daaff44cbc Fix tidy formatting manually for E0423.md 2026-01-31 10:46:58 +05:30
ritik chahar
9cdcd0c3fa Document enum types used as values for E0423 2026-01-31 10:15:19 +05:30
bors
310ae8ca77 Auto merge of #151764 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

18 commits in efcd9f58636c1990393d495159045d9c35e43b8f..fe2f314aef06e688a9517da1ac0577bb1854d01f
2026-01-23 13:50:59 +0000 to 2026-01-30 21:52:01 +0000
- feat(lints): Add unused workspace dependency lint (rust-lang/cargo#16571)
- docs: Remove redundant homepage link (rust-lang/cargo#16572)
- refactor: Remove unused workspace dependencies (rust-lang/cargo#16573)
- Re-downgrade curl-sys (rust-lang/cargo#16570)
- docs(report): enhance man pages for `cargo report *` (rust-lang/cargo#16430)
- fix(lints): Refine redundant metadata lints (rust-lang/cargo#16564)
- Prevent `cargo init` in home directory (rust-lang/cargo#16566)
- feat(lints): Add redundant_homepage lint  (rust-lang/cargo#16561)
- feat(lints): Add `non_*_case_features` (rust-lang/cargo#16560)
- Update build_std::basic test to ensure index doesn't update (rust-lang/cargo#16559)
- feat(lints): Add mutually exclusive `non_{kebab,snake}_case_packages` (rust-lang/cargo#16554)
- fix(lints): Pluralize non_kebab_case_bins (rust-lang/cargo#16553)
- Add -Z json-target-spec (rust-lang/cargo#16557)
- feat(lint): Add redundant_readme lint  (rust-lang/cargo#16552)
- chore(deps): update msrv (rust-lang/cargo#16387)
- tests: add regression test for --artifact-dir on stable (rust-lang/cargo#16541)
- Don't check the specific build-std output (rust-lang/cargo#16551)
- Fix build-std lto test to run on other platforms (rust-lang/cargo#16550)
2026-01-31 03:29:31 +00:00
Weihang Lo
f7ffe31390
Update cargo submodule
also fixed tests/run-make-cargo/apple-slow-tls/rmake.rs
accordingly for the new `-Zjson-target-spec` requirement
2026-01-30 19:15:24 -05:00
bors
44e34e1ac6 Auto merge of #151875 - JonathanBrouwer:rollup-OPCJQtC, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#151281 (constify `Iterator`, take IV)
 - rust-lang/rust#151873 (resolve: Remove `force` parameter from `resolve_ident_in_scope`)
2026-01-30 22:15:51 +00:00
Jonathan Brouwer
4884de4452
Rollup merge of #151873 - petrochenkov:resrefact, r=lqd,estebank
resolve: Remove `force` parameter from `resolve_ident_in_scope`

`force == true` is used for turning `Determinacy::Undetermined` into `Determinacy::Determined` during error recovery.
It's only needed in two places:
- `resolve_macro_or_delegation_path` - the normal case
- `resolve_path_with_ribs` - obscure case, only when resolving visibilities and only for improving diagnostics in `tests\ui\resolve\visibility-indeterminate.rs`, I'm not actually sure if we should keep it

In other cases `Determinacy::Undetermined` is just ignored or can be propagated.
2026-01-30 21:33:11 +01:00
Jonathan Brouwer
58f03f5fe5
Rollup merge of #151281 - fee1-dead-contrib:push-zmqtzvuvlmuk, r=oli-obk
constify `Iterator`, take IV

Like its predecessors (rust-lang/rust#92433, rust-lang/rust#102225, rust-lang/rust#106541), this PR allows one to make `Iterator` implementations `const`, and thus enables the ability to have `for` loops in `const` contexts. I've also included constifying `Option as IntoIterator`, `option::IntoIter as Iterator` as a minimal dogfooding example.

But unlike its predecessors, it uses a new attribute (not unsound anymore!) that prevents any `Iterator` extension methods from being called. This is intentionally made minimal for an initial approval, the fun stuff like `.fold`, `Range as Iterator` could be done later.

cc @rust-lang/wg-const-eval, cc @oli-obk to review the compiler parts

cc rust-lang/rust#92476
2026-01-30 21:33:11 +01:00
bors
a293cc4af8 Auto merge of #151679 - clubby789:lockfile-fix, r=Mark-Simulacrum
Fix lockfile update script

Fixes https://github.com/rust-lang/rust/pull/151354#issuecomment-3795764510

Now passes `shellcheck`

cc @ehuss
2026-01-30 18:57:41 +00:00
Vadim Petrochenkov
ea0ee492bd resolve: Remove force parameter from resolve_ident_in_scope 2026-01-30 21:32:37 +03:00
Deadbeef
02e10b2d90 fix issues and ui tests, address reviews 2026-01-30 15:59:34 +00:00
Deadbeef
6147a3fc88 constify Iterator 2026-01-30 15:52:40 +00:00
Deadbeef
38ee80d48e add #[rustc_non_const_trait_method] 2026-01-30 15:52:38 +00:00
bors
36e2b8a3a7 Auto merge of #151860 - JonathanBrouwer:rollup-FqYVDlY, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151376 (Fix performance issue in liveness checking)
 - rust-lang/rust#151851 (Remove redundant `IntoQueryParam` calls from query plumbing)
 - rust-lang/rust#151854 (Show break type expectation cause for let-else)
 - rust-lang/rust#151859 (Disable append-elements.rs test with debug assertions)
2026-01-30 15:41:56 +00:00
Jonathan Brouwer
a93e9ebe39
Rollup merge of #151859 - nikic:append-elements-test, r=the8472
Disable append-elements.rs test with debug assertions

The IR is a bit different (in particular wrt naming) if debug-assertions-std is enabled. Peculiarly, the issue goes away if overflow-check-std is also enabled, which is why CI did not catch this.

r? @the8472
2026-01-30 13:20:25 +01:00
Jonathan Brouwer
b243d015f4
Rollup merge of #151854 - chenyukang:yukang-fix-142602-let-else-break-diag, r=Kivooeo
Show break type expectation cause for let-else

Fixes rust-lang/rust#142602
2026-01-30 13:20:25 +01:00
Jonathan Brouwer
cfadcbe3ea
Rollup merge of #151851 - Zalathar:into-query-param, r=lqd
Remove redundant `IntoQueryParam` calls from query plumbing

In each of these contexts, the key must have already been converted by the caller, since otherwise it wouldn't have type `Cache::Key`.

There should be no change to compiler behaviour.
2026-01-30 13:20:24 +01:00
Jonathan Brouwer
a4b553804b
Rollup merge of #151376 - chenyukang:yukang-fix-perf, r=lqd
Fix performance issue in liveness checking

r? @ghost

from https://github.com/rust-lang/rust/pull/150955#issuecomment-3769274223
2026-01-30 13:20:23 +01:00
bors
e823167aa6 Auto merge of #151858 - JonathanBrouwer:rollup-0eagSST, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151736 (Make some load-from-disk function pointers optional in query vtables)
 - rust-lang/rust#151831 (Port `rustc_layout` to attribute parser)
 - rust-lang/rust#151856 (Fix flakyness issue with `tests/rustdoc-gui/globals.goml` test)
2026-01-30 12:11:07 +00:00
Nikita Popov
acb5ee2f84 Disable append-elements.rs test with debug assertions
The IR is a bit different (in particular wrt naming) if
debug-assertions-std is enabled. Peculiarly, the issue goes away
if overflow-check-std is also enabled, which is why CI did not
catch this.
2026-01-30 13:01:22 +01:00
Jonathan Brouwer
6d01651dff
Rollup merge of #151856 - GuillaumeGomez:fix-gui-flakyness, r=GuillaumeGomez
Fix flakyness issue with `tests/rustdoc-gui/globals.goml` test

Just realized that when the search input is wrong, sometime we don't even load the search index (which is logical). Since we want to check that the search index is loaded, turned the query into something that works.

r? ghost
2026-01-30 12:12:06 +01:00
Jonathan Brouwer
e19cb30813
Rollup merge of #151831 - clubby789:port-rustc-layout, r=JonathanBrouwer
Port `rustc_layout` to attribute parser

Tracking issue: rust-lang/rust#131229

Uses rust-lang/rust#151827

r? jdonszelmann
2026-01-30 12:12:05 +01:00
Jonathan Brouwer
cc2d6f8fee
Rollup merge of #151736 - Zalathar:can-load-from-disk, r=nnethercote
Make some load-from-disk function pointers optional in query vtables

For queries that never incremental-cache to disk, we can represent that fact with None (i.e. a null function pointer) in their vtables, and avoid having to generate stub functions that do nothing.

(There is no decrease in vtable size; we just go from 3/8 padding bytes to 4/8 padding bytes.)

There should be no change to compiler output.
2026-01-30 12:12:05 +01:00
Guillaume Gomez
9e5820379d Fix flakyness issue with tests/rustdoc-gui/globals.goml test 2026-01-30 11:22:19 +01:00
Zalathar
e044220de5 Make will_cache_on_disk_for_key_fn optional in query vtables 2026-01-30 21:18:29 +11:00
Zalathar
d39609b719 Make is_loadable_from_disk_fn optional in query vtables 2026-01-30 21:16:25 +11:00
Zalathar
d5e80aa714 Make try_load_from_disk_fn optional in query vtables 2026-01-30 21:16:25 +11:00
yukang
9c135ad1e0 Show break type expectation cause for let-else 2026-01-30 08:42:12 +00:00
bors
7d8ebe3128 Auto merge of #151852 - Zalathar:rollup-jdJCcDh, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151777 (    Reduce generics use in the query system.)
 - rust-lang/rust#151808 (Document a safety condition for `TypedArena::alloc_raw_slice`)
 - rust-lang/rust#151811 (Fix false positive in unused_parens caused by break)
 - rust-lang/rust#151817 (Fix missing syntax context in lifetime hygiene debug output)
 - rust-lang/rust#151844 (rustc-dev-guide subtree update)
2026-01-30 06:41:46 +00:00
Stuart Cook
5b542088ae
Rollup merge of #151844 - tshepang:rdg-sync, r=tshepang
rustc-dev-guide subtree update

Subtree update of `rustc-dev-guide` to e03697d813.

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

r? @ghost
2026-01-30 17:41:08 +11:00
Stuart Cook
dcc74dd6e3
Rollup merge of #151817 - aytey:fix_lifetime_unpretty_hygiene, r=jdonszelmann
Fix missing syntax context in lifetime hygiene debug output

`-Zunpretty=expanded,hygiene` was not printing the syntax context for lifetimes. For example, two macro-generated lifetimes `'a` with different hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and `/* 2538#1 */`, making it impossible to distinguish them.

This was fixed by changing `print_lifetime` to call `ann_post()` with the full `Ident`, matching how regular identifiers are handled in `print_ident`.

Closes: rust-lang/rust#151797
2026-01-30 17:41:07 +11:00
Stuart Cook
45009749b5
Rollup merge of #151811 - chenyukang:yukang-fix-143256-unused-parens-labeled-loops, r=Kivooeo
Fix false positive in unused_parens caused by break

Fixes rust-lang/rust#143256
2026-01-30 17:41:07 +11:00
Stuart Cook
611ebade75
Rollup merge of #151808 - Zalathar:alloc-raw-slice, r=Kivooeo
Document a safety condition for `TypedArena::alloc_raw_slice`

This method was marked safe in https://github.com/rust-lang/rust/pull/116224/commits/51edc219906f0973dd66b4b6ff5ff0ac857a4cc6, because there was no apparent reason for it to be unsafe.

However, I believe that `alloc_raw_slice` does actually impose a significant safety obligation on its caller, because the caller must ensure that each slot in the slice is properly initialized before the arena is dropped.

This is because the arena's Drop impl will unconditionally drop every storage slot that has been handed out, so it has no way to handle slots that were accidentally left uninitialized because a hypothetical caller of `alloc_raw_slice` panicked before initializing them.
2026-01-30 17:41:06 +11:00
Stuart Cook
0af845db6b
Rollup merge of #151777 - nnethercote:query-stack-3, r=nnethercote
Reduce generics use in the query system.

In rust-lang/rust#151203 I tried and failed to simplify `QueryStackFrame`. This is an alternative approach. There is no functional change, just tweaking of some names and types to make things clearer. Best reviewed one commit at a time.

r? @oli-obk
2026-01-30 17:41:06 +11:00
Frank King
4ae5b43b0f refactor: remove Ty::pinned_ref in favor of Ty::maybe_pinned_ref
Also returns the `Region` of the reference type.
2026-01-30 14:22:41 +08:00
Zalathar
cf6796a2b0 Remove redundant IntoQueryParam calls from query plumbing
In each of these contexts, the key must have already been converted by the
caller, since otherwise it wouldn't have type `Cache::Key`.
2026-01-30 15:01:49 +11:00
yukang
d2aa64fa2d Fix performance issue in liveness checking 2026-01-30 01:54:39 +00:00
bors
ef2657cbaf Auto merge of #151168 - petrochenkov:rprivtit, r=eholk
privacy: Fix privacy lints in RPITITs

Visit RPITITs and report `private_interfaces`, `private_bounds` and `exported_private_dependencies` in them (these are regular, non-deprecation lints).
New hard errors are not reported, https://github.com/rust-lang/rust/pull/146470 is for hard errors.
So this PR doesn't contain any breakage or language changes.
2026-01-30 01:45:52 +00:00
Nicholas Nethercote
1c3d9abbad Reduce generics use in the query system.
`QueryStackFrame<I>` is a generic type, and the `I` parameter leaks out
to many other related types. However, it only has two instantiations in
practice:
- `QueryStackFrame<QueryStackFrameExtra>`
- `QueryStackFrame<QueryStackDeferred<'tcx>>`

And most of the places that currently use `QueryStackFrame<I>` are
actually specific to one of the instantiations. This commit removes the
unneeded genericity.

The following types are only ever used with `QueryStackDeferred<'tcx>`:
- QueryMap
- QueryJobInfo
- QueryJob
- QueryWaiter
- QueryLatchInfo
- QueryLatch
- QueryState
- QueryResult
and their `<I>` parameter is changed to `<'tcx>`.

Also, the `QueryContext::QueryInfo` associated type is removed.

`CycleError<I>` and `QueryInfo<I>` are still generic over type, because
they are used with both instantiations.

This required also adding a `<'tcx>` parameter to the traits
`QueryDispatcher` and `QueryContext`, which is annoying but I can't see
how to avoid it.
2026-01-30 10:54:28 +11:00
Tshepang Mbambo
6ea1809c5e
Merge pull request #2748 from rust-lang/tshepang/sembr
sembr
2026-01-30 01:05:28 +02:00
Tshepang Mbambo
62dbe9fbab whitespace 2026-01-30 00:59:05 +02:00
Tshepang Mbambo
31eab45e4a fix sembr tool corner case 2026-01-30 00:58:42 +02:00