Commit graph

316885 commits

Author SHA1 Message Date
Erik
fd023cb122 Add uv to the list of possible python runners
I'm one of the rare cases that does have uv, but doesn't have python
installed globally
2026-02-02 13:01:40 +01:00
bors
c4dc07385e Auto merge of #151931 - sizmailov:patch-1, r=jdonszelmann
doc: Replace plain text link with md link to cargo-pgo repo

<img width="1324" height="304" alt="image" src="https://github.com/user-attachments/assets/1ee772e3-6880-4fe7-aa14-cfae4ee73b57" />

https://doc.rust-lang.org/beta/rustc/profile-guided-optimization.html#community-maintained-tools
2026-02-01 09:13:11 +00:00
bors
878374e07f Auto merge of #151937 - Zalathar:rollup-WdVeaxy, r=Zalathar
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151927 (typeck_root_def_id: improve doc comment)
 - rust-lang/rust#151907 (Rename `QueryResult` to `ActiveKeyStatus`)
 - rust-lang/rust#151928 (ty::context: clean some code a little)
2026-02-01 03:27:21 +00:00
Stuart Cook
191c915560
Rollup merge of #151928 - tshepang:patch-2, r=Kivooeo
ty::context: clean some code a little

The explicit `return` was not needed
2026-02-01 14:26:47 +11:00
Stuart Cook
0b8e9610a6
Rollup merge of #151907 - Zalathar:active-key-status, r=nnethercote
Rename `QueryResult` to `ActiveKeyStatus`

Long ago, this enum was also used to hold the cached result of a query evaluation that had completed successfully, so its name made some sense.

Nowadays, successful query evaluation is represented by an entry in the query's in-memory cache, which is a separate data structure.

So this enum only deals with “active” query keys, i.e. those for which query evaluation has started, but has not yet completed successfully.

---

The split between jobs and results was introduced by:
-  https://github.com/rust-lang/rust/pull/50102.

---

There should be no change to compiler behaviour.
2026-02-01 14:26:47 +11:00
Stuart Cook
394e519690
Rollup merge of #151927 - tshepang:patch-1, r=Kivooeo
typeck_root_def_id: improve doc comment

This was initially written to be exhaustive, but one more type that can only be type-checked with its containing item has since been added, and was not mentioned. So, make it future-proof by mentioning just the one example.

Also, a previous refactor left this less readable.
2026-02-01 14:26:46 +11:00
Zalathar
bf2536ae64 Rename QueryResult to ActiveKeyStatus 2026-02-01 14:20:20 +11:00
Sergei Izmailov
9b04184cbc
reword 2026-02-01 10:46:02 +09:00
Sergei Izmailov
e251fba475
Replace plain text link with md link to cargo-pgo repo 2026-02-01 10:42:57 +09:00
bors
a1db344c08 Auto merge of #151924 - JonathanBrouwer:rollup-Pqp8PIn, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151886 (Skip unused_allocation lint when method takes &Box<Self>)
 - rust-lang/rust#150300 (Constify `fmt::from_fn`)
 - rust-lang/rust#151102 (Feature-gate `mut ref` patterns in struct pattern field shorthand)
 - rust-lang/rust#151866 (Reorganizing `tests/ui/issues` 10 tests [4/N] )
 - rust-lang/rust#151890 (Re-export `hashbrown::hash_table` from `rustc_data_structures`)
2026-01-31 23:56:07 +00:00
Tshepang Mbambo
1684417326
ty::context: clean some code a little
The explicit `return` was not needed
2026-02-01 00:31:55 +02:00
Tshepang Mbambo
4e02b6db0a
typeck_root_def_id: improve doc comment
This was initially written to be exhaustive, but one more type that can only be type-checked with its containing item has since been added, and was not mentioned. So, make it future-proof by mentioning just the one example.

Also, a previous refactor left this less readable.
2026-02-01 00:00:26 +02:00
Jonathan Brouwer
d853e9e1d6
Rollup merge of #151890 - Zalathar:hash-table, r=Kivooeo
Re-export `hashbrown::hash_table` from `rustc_data_structures`

We don't always re-export shared dependencies, but for `hashbrown::hash_table` I think it makes sense, for a few reasons:

- The lower-level `HashTable` type is already part of the public API of `rustc_data_structures` via the `ShardedHashMap` type alias, and other compiler crates currently depend on being able to access its internal hash tables.
- The `Cargo.toml` entry for `hashbrown` is non-trivial, making it harder to keep in sync and harder to move between crates as needed.
  - [And we currently aren't using `[workspace.dependencies]` for various reasons.](https://github.com/rust-lang/rust/pull/146113)
- It's fine for other compiler crates to use `hash_table` specifically (with care), but they probably shouldn't be using the higher-level `hashbrown::HashMap` and `hashbrown::HashSet` types directly, because they should prefer the various map/set aliases defined by `rustc_data_structures`. Re-exporting only `hash_table` helps to discourage use of those other types.

There should be no change to compiler behaviour.
2026-01-31 21:42:47 +01:00
Jonathan Brouwer
3a54fe982f
Rollup merge of #151866 - zedddie:move-tests, r=Kivooeo
Reorganizing `tests/ui/issues` 10 tests [4/N]

part of https://github.com/rust-lang/rust/issues/133895

r? Kivooeo
2026-01-31 21:42:47 +01:00
Jonathan Brouwer
70f1120363
Rollup merge of #151102 - zachs18:mut-ref-in-struct-pattern-shorthand-gate, r=JonathanBrouwer
Feature-gate `mut ref` patterns in struct pattern field shorthand

Tracking issue for `mut_ref` (and other parts of Match Ergonomics 2024): https://github.com/rust-lang/rust/issues/123076

https://github.com/rust-lang/rust/pull/123080 introduced `mut ref`[^1] patterns (for by-reference bindings where the binding itself is mutable), feature-gated behind the `mut_ref` feature, except for in struct pattern shorthand, where the feature gating was missing. Thus, `mut ref` patterns in struct pattern shorthand has been unintentionally stable for ~18 months (since 1.79.0 ([compiler explorer](https://rust.godbolt.org/z/4WTrvhboT))).

This PR adds feature-gating for `mut ref` patterns in struct pattern shorthand. Since this is reverting an accidental stabilization, this probably needs a crater run and a T-lang FCP?

Some alternative possibilities:

* Do nothing (let the inconsistency exist until `feature(mut_ref)` is stabilized)
* Document the existing behavior
* Do a FCW instead of fully feature-gating
* Stabilize `feature(mut_ref)`

CC https://github.com/rust-lang/rust/pull/123080#issuecomment-3746793632

CC @Nadrieril

[^1]: everything in this description also applies analogously to `mut ref mut` patterns.
2026-01-31 21:42:46 +01:00
Jonathan Brouwer
f580ca88ee
Rollup merge of #150300 - EFanZh:patch-1, r=dtolnay,tgross35
Constify `fmt::from_fn`

See <https://github.com/rust-lang/rust/issues/117729#issuecomment-3683047620>.
2026-01-31 21:42:46 +01:00
Jonathan Brouwer
1c6f67f659
Rollup merge of #151886 - chenyukang:yukang-fix-151846-unused-allocation-box-ref, r=petrochenkov
Skip unused_allocation lint when method takes &Box<Self>

Fixes rust-lang/rust#151846
2026-01-31 21:42:45 +01:00
bors
905b926967 Auto merge of #151622 - scottmcm:elide-more-transmutes, r=cjgillot
GVN: Elide more intermediate transmutes

We already skipped intermediate steps like `u32` or `i32` that support any (initialized) value.

This extends that to also allow skipping intermediate steps whose values are a superset of either the source or destination type.  Most importantly, that means that `usize` → `NonZeroUsize` → `ptr::Alignment` and `ptr::Alignment` → `NonZeroUsize` → `usize` can skip the middle because `NonZeroUsize` is a superset of `Alignment`.

Then `Alignment::as_usize` is updated to take advantage of that and let us remove some more locals in a few places.

r? cjgillot
2026-01-31 20:42:37 +00:00
bors
8afe9ff1ca Auto merge of #151911 - JonathanBrouwer:rollup-ACi3J2a, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#151908 (Remove unused method `DroplessArena::contains_slice`)
 - rust-lang/rust#151850 (refactor: add an `enum DerefAdjustKind` in favor of `Option<OverloadedDeref>`)
 - rust-lang/rust#151889 (Fix ICE when parsing frontmatter without newline)
2026-01-31 16:24:16 +00:00
Jonathan Brouwer
874c5d2275
Rollup merge of #151889 - chenyukang:yukang-fix-151882-frontmatter-ice, r=Kivooeo
Fix ICE when parsing frontmatter without newline

Fixes rust-lang/rust#151882

we can not add a normal test case for it:
- no newline at the end of file, we can bypass this with change test file name with `ignore-tidy`
- multiple errors in stderr, this conflicts with the previous bypass, seems we can not add multiple error annotations in one line

anyway, I added a `run-make` test for it.
2026-01-31 15:17:05 +01:00
Jonathan Brouwer
1b7a7c7514
Rollup merge of #151850 - frank-king:refactor/pin-coerce-2, r=jackh726
refactor: add an `enum DerefAdjustKind` in favor of `Option<OverloadedDeref>`

Part of rust-lang/rust#149130.

r? jackh726
2026-01-31 15:17:05 +01:00
Jonathan Brouwer
5d166b7095
Rollup merge of #151908 - Zalathar:contains-slice, r=chenyukang
Remove unused method `DroplessArena::contains_slice`

- This method was added for https://github.com/rust-lang/rust/pull/120128.
- It became unused in https://github.com/rust-lang/rust/pull/136593.

Checking whether a particular slice is within an arena is a bit of a sketchy operation, so if there's no pressing need for it then I think we're better off not having it lying around.
2026-01-31 15:17:04 +01:00
zedddie
086dc0258b
clean up some tests 2026-01-31 14:01:54 +01:00
zedddie
4df307acc1
move some tests 2026-01-31 14:00:12 +01:00
bors
78865ca937 Auto merge of #151897 - matthiaskrgr:rollup-eTQjYr5, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151262 (Introducing clap on tidy)
 - rust-lang/rust#151896 (Revert enabling `outline-atomics` on various platforms)
 - rust-lang/rust#151849 (refactor: remove `Ty::pinned_ref` in favor of `Ty::maybe_pinned_ref`)
 - rust-lang/rust#151892 (Document enum types used as values for E0423)
2026-01-31 12:59:26 +00:00
Zalathar
e60c475471 Remove unused method DroplessArena::contains_slice 2026-01-31 22:56:49 +11:00
bors
271951ba18 Auto merge of #151881 - Zoxc:index_to_node_ptr, r=eholk
Pass `DepNode` by reference more places

Pass `DepNode` by reference more places as it would typically need 3 registers.
2026-01-31 09:45:26 +00:00
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
yukang
dc48704f98 Fix ICE when parsing frontmatter without newline 2026-01-31 08:51:40 +00:00
Frank King
996425b295 refactor: add an enum DerefAdjustKind in favor of Option<OverloadedDeref> 2026-01-31 16:25:32 +08: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
bors
1e9be1b77f Auto merge of #151891 - jhpratt:rollup-cG0AjgK, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#143650 (core: add Option::get_or_try_insert_with)
 - rust-lang/rust#151726 (Remove duplicated code in `slice/index.rs`)
 - rust-lang/rust#151812 (Add `shift_{left,right}` on slices)
 - rust-lang/rust#151829 (Implement `BinaryHeap::pop_if()`)
 - rust-lang/rust#151838 (Fix typo for Maybe dangling docs)
2026-01-31 06:37:16 +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
Jacob Pratt
4b850fa94e
Rollup merge of #151838 - ionicmc-rs:patch-1, r=jhpratt
Fix typo for Maybe dangling docs

Boxe's -> Box's
2026-01-30 22:52:22 -05:00
Jacob Pratt
f4c28167eb
Rollup merge of #151829 - max-heller:binary-heap-pop-if, r=jhpratt,joboet
Implement `BinaryHeap::pop_if()`

Implementation of https://github.com/rust-lang/rust/issues/151828
2026-01-30 22:52:22 -05:00
Jacob Pratt
4e21b69e5a
Rollup merge of #151812 - scottmcm:slice-shift, r=jhpratt
Add `shift_{left,right}` on slices

ACP approval: https://github.com/rust-lang/libs-team/issues/717#issuecomment-3807205664
cc tracking issue rust-lang/rust#151772
2026-01-30 22:52:21 -05:00
Jacob Pratt
b60d3d9f1d
Rollup merge of #151726 - scottmcm:delete-duplicated-code, r=jhpratt
Remove duplicated code in `slice/index.rs`

Looks like `const fn` is far enough along now that we can just not have these two copies any more, and have one call the other.
2026-01-30 22:52:20 -05:00
Jacob Pratt
e1424588bd
Rollup merge of #143650 - lolbinarycat:core-option_get_or_try_insert_with-143648, r=jhpratt
core: add Option::get_or_try_insert_with

Implementation for https://github.com/rust-lang/rust/issues/143648
2026-01-30 22:52:19 -05:00
Zalathar
04e6afe20a Re-export hashbrown::hash_table from rustc_data_structures 2026-01-31 14:48:50 +11:00
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
John Kåre Alsaker
8869b7b356 Pass DepNode by reference more places 2026-01-31 00:29:30 +01:00