Commit graph

289943 commits

Author SHA1 Message Date
bors
bf64d66bd5 Auto merge of #141343 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

Out of cycle sync to fix an ICE that was reported twice already: https://github.com/rust-lang/rust-clippy/issues/14828

r? `@Manishearth`
2025-05-21 19:47:01 +00:00
bors
462cc099c9 Auto merge of #141345 - matthiaskrgr:rollup-vux7gok, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #141267 (only resolve top-level guard patterns' guards once)
 - #141280 (Use Docker cache from the current repository)
 - #141296 (Async drop fix for 'broken mir, place has deref as later projection')
 - #141328 (When AsyncDrop impl is empty, sync drop generated in elaborator)
 - #141332 (Do not eagerly fold consts in `normalize_param_env_or_error` if new solver)
 - #141333 (Use `DeepRejectCtxt` in `assemble_inherent_candidates_from_param`)
 - #141334 (eagerly check nested obligations when coercing fndefs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-21 16:42:18 +00:00
Matthias Krüger
9fd0ab6876
Rollup merge of #141334 - lcnr:coerce-nested-obligations, r=compiler-errors
eagerly check nested obligations when coercing fndefs

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/212

r? `@compiler-errors`
2025-05-21 15:38:12 +02:00
Matthias Krüger
ab9109ad19
Rollup merge of #141333 - compiler-errors:param-env-candidate-unnorm, r=lcnr
Use `DeepRejectCtxt` in `assemble_inherent_candidates_from_param`

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/214

We were not properly considering unnormalized param-env candidates in `assemble_inherent_candidates_from_param`.

r? lcnr
2025-05-21 15:38:12 +02:00
Matthias Krüger
6606fd9a14
Rollup merge of #141332 - compiler-errors:no-fold-const, r=lcnr
Do not eagerly fold consts in `normalize_param_env_or_error` if new solver

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/213

Given:

```
trait Trait: Deref<Target = [u8; { 1 + 1 }]> {}
```

when elaborating param env for `Trait`, we have `Self: Trait`, `Self: Deref<Target = [u8; {anon const}]>`.

Before this PR, we would fold the anon consts away *before* elaborating. However, we end up getting another *un-folded* copy of the anon const from elaborating `Self: Trait`. This leads to normalization ambiguity.

r? lcnr
2025-05-21 15:38:11 +02:00
Matthias Krüger
1461ca3f39
Rollup merge of #141328 - azhogin:azhogin/async-drop-ice-for-empty-impl-fix, r=oli-obk
When AsyncDrop impl is empty, sync drop generated in elaborator

Fixes #140974.
2025-05-21 15:38:10 +02:00
Matthias Krüger
ad6fb066dd
Rollup merge of #141296 - azhogin:azhogin/async-drop-broken-mir-place-deref-fix, r=oli-obk
Async drop fix for 'broken mir, place has deref as later projection'

fixes #140975

Problem in codegen fixed with an additional temporary local.
2025-05-21 15:38:10 +02:00
Matthias Krüger
7a53ef7af3
Rollup merge of #141280 - Kobzol:docker-rust-lang-cache, r=marcoieni
Use Docker cache from the current repository

This is needed to make the cache work after moving CI from the `rust-lang-ci` org to `rust-lang`. Shouldn't be merged until we actually move bors.

Context: https://github.com/rust-lang/infra-team/issues/188

r? `@marcoieni`
2025-05-21 15:38:09 +02:00
Matthias Krüger
af081a4247
Rollup merge of #141267 - dianne:fix-141265, r=oli-obk
only resolve top-level guard patterns' guards once

We resolve guard patterns' guards in `resolve_pattern_inner`, so to avoid resolving them multiple times, we must avoid doing so earlier. To accomplish this, `LateResolutionVisitor::visit_pat` contains a case for guard patterns that avoids visiting their guards while walking patterns.

This PR fixes #141265, which was due to `visit::walk_pat` being used instead; this meant guards at the top level of a pattern would be visited twice. e.g. it would ICE on `for x if x in [] {}`, but not `for (x if x) in [] {}`. `visit_pat` was already used for the guard pattern in the second example, on account of the top-level pattern being parens.
2025-05-21 15:38:08 +02:00
bors
356f2d0774 Auto merge of #140386 - oli-obk:match-on-lang-item-kind, r=compiler-errors
Match on lang item kind instead of using an if/else chain

Similar to how the new solver does this. Just noticed while I was adding a new entry to the chain 😆
2025-05-21 13:31:13 +00:00
Philipp Krones
0e203f3914
Update Cargo.lock 2025-05-21 15:20:26 +02:00
Philipp Krones
a0c1ed3b93
Merge commit 'cadf98bb7d' into clippy-subtree-update 2025-05-21 15:15:38 +02:00
Philipp Krones
cadf98bb7d
Rustup (#14860)
r? @ghost

Quick out-of cycle sync to fix an ICE that was already reported twice

changelog: none
2025-05-21 12:55:45 +00:00
Philipp Krones
8a28b797b8
Bump nightly version -> 2025-05-21 2025-05-21 14:50:25 +02:00
Philipp Krones
910e640f9b
Merge remote-tracking branch 'upstream/master' into rustup 2025-05-21 14:50:06 +02:00
Andrew Zhogin
7c38b6fd28 Async drop fix for 'broken mir in AsyncDropGlue, place has deref as a later projection' (#140975) 2025-05-21 18:29:13 +07:00
Andrew Zhogin
dc794f18a4 When AsyncDrop impl is empty, sync drop generated in elaborator (Fixes #140974) 2025-05-21 18:18:27 +07:00
lcnr
196c3b3ef4 eagerly check nested obligations when coercing fndefs 2025-05-21 11:09:48 +00:00
bors
c43786c9b7 Auto merge of #141331 - matthiaskrgr:rollup-k0loxj6, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #137759 (Add `std::os::unix::process::CommandExt::chroot` to safely chroot a child process)
 - #140994 (replace `cc_detect::cc2ar` with `cc::try_get_archiver`)
 - #141213 (Suggest use "{}", self.x instead of {self.x} when resolve x as field of `self`)
 - #141283 (Allow `x perf` to find rustc.exe on Windows)
 - #141284 (Allow trailing comma after argument in query definition)
 - #141317 (typeck: catch `continue`s pointing to blocks)
 - #141318 (Avoid creating an empty identifer in `Symbol::to_ident_string`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-21 10:19:04 +00:00
Michael Goulet
ad59f0b6e6 Use DeepRejectCtxt in assemble_inherent_candidates_from_param 2025-05-21 10:02:54 +00:00
Matthias Krüger
5b150e3122
Rollup merge of #141318 - nnethercote:fix-140884, r=compiler-errors
Avoid creating an empty identifer in `Symbol::to_ident_string`.

Because that causes an assertion failure in debug builds.

Fixes #140884.

r? `@oli-obk`
2025-05-21 11:28:47 +02:00
Matthias Krüger
aaa684fd1d
Rollup merge of #141317 - dianne:continue-liveness-ice-fix, r=compiler-errors
typeck: catch `continue`s pointing to blocks

This taints the typeck results with errors if a `continue` is found not pointing to a loop.

A few things were going wrong here. First, since this wasn't caught in typeck, we'd end up building the THIR and then running liveness lints on ill-formed HIR. Since liveness assumes all `continue`s point to loops, it wasn't setting a live node for the `continue`'s destination. There was a fallback for if it couldn't retrieve that live node, but it was faulty; it would create a new live node to represent an erroneous state after the analysis's RWU table had already been built. This would ICE if the new live node was used in operations, such as merging results from the arms of a match. I've removed this error-recovery since it was buggy, and we should really catch bad labels before liveness.

I've also replaced an outdated comment about when liveness lints are run. At this point, I think the call to `check_liveness` could be moved elsewhere, but if it can be run when the typeck results are tainted by errors, it'll need some slight refactoring so it can bail out in that case. In lieu of that, I've added an assert.

Fixes #113379
Fixes #121623
2025-05-21 11:28:46 +02:00
Matthias Krüger
e4836fbb89
Rollup merge of #141284 - compiler-errors:query-nit, r=oli-obk
Allow trailing comma after argument in query definition

Don't catastrophically fail the query macro if you put a comma after your query key!

r? oli-obk
2025-05-21 11:28:46 +02:00
Matthias Krüger
04a7c2c66d
Rollup merge of #141283 - Sol-Ell:fix-benchmarking-on-windows, r=Kobzol
Allow `x perf` to find rustc.exe on Windows

Related issue: #141281
2025-05-21 11:28:45 +02:00
Matthias Krüger
d30f0471c3
Rollup merge of #141213 - xizheyin:issue-141136, r=nnethercote
Suggest use "{}", self.x instead of {self.x} when resolve x as field of `self`

Fixes #141136

Changes can be seen in the second commit: 9de7fff0d8

r? compiler
2025-05-21 11:28:45 +02:00
Matthias Krüger
64a5a66666
Rollup merge of #140994 - onur-ozkan:cc2ar-removal, r=albertlarsan68
replace `cc_detect::cc2ar` with `cc::try_get_archiver`

~~Awaiting new release of [cc](https://crates.io/crates/cc) version with https://github.com/rust-lang/cc-rs/pull/1456 to bump the version.~~

~~Blocked by https://github.com/rust-lang/cc-rs/pull/1456.~~

Kind a self-explanatory.

try-job: dist-android
2025-05-21 11:28:44 +02:00
Matthias Krüger
7b4f7a376b
Rollup merge of #137759 - joshtriplett:command-chroot, r=Amanieu
Add `std::os::unix::process::CommandExt::chroot` to safely chroot a child process

This adds a `chroot` method to the `CommandExt` extension trait for the
`Command` builder, to set a directory to chroot into. This will chroot
the child process into that directory right before calling chdir for the
`Command`'s working directory.

To avoid allowing a process to have a working directory outside of the
chroot, if the `Command` does not yet have a working directory set,
`chroot` will set its working directory to "/".

---

ACP: https://github.com/rust-lang/libs-team/issues/551

This PR currently has the tracking issue set to "none"; if the ACP is approved,
I'll file a tracking issue and update the PR.
2025-05-21 11:28:44 +02:00
Michael Goulet
44a2af3068 Do not eagerly fold consts in normalize_param_env_or_error if new solver 2025-05-21 09:23:36 +00:00
Nicholas Nethercote
1cc0e38fdc Avoid creating an empty identifer in Symbol::to_ident_string.
Because that causes an assertion failure in debug builds.

Fixes #140884.
2025-05-21 18:59:04 +10:00
xizheyin
84f67a5e51
Downgrade the confident of suggestion available field in format string and optimize expression
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-21 16:23:52 +08:00
Ell
6ac8e51283 Allow x perf to find rustc.exe on Windows 2025-05-21 10:09:29 +03:00
bors
bbd3a5ada4 Auto merge of #141320 - matthiaskrgr:rollup-ag3vf3a, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #140981 (Add match guard let chain drop order and scoping tests)
 - #141042 (ci: split powerpc64le-linux job)
 - #141078 (ci: split dist-arm-linux job)
 - #141222 (Implement `ptr::try_cast_aligned` and `NonNull::try_cast_aligned`.)
 - #141308 (Do not call name() on rpitit assoc_item)
 - #141316 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-21 06:11:40 +00:00
Matthias Krüger
18f42dd500
Rollup merge of #141316 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/edition-guide

1 commits in 1b1bb49babd65c732468cfa515b0c009bd1d26bc..aa6ce337c0adf7a63e33960d184270f2a45ab9ef
2025-05-20 23:47:34 UTC to 2025-05-20 23:47:34 UTC

- Update references to the `missing_fragment_specifier` lint (rust-lang/edition-guide#376)

## rust-lang/reference

3 commits in acd0231ebc74849f6a8907b5e646ce86721aad76..118fd1f1f0854f50e3ae1fe4b64862aad23009ca
2025-05-20 22:52:38 UTC to 2025-05-20 21:45:13 UTC

- Explain why nested receivers are dyn-incompatible (rust-lang/reference#1822)
- Enable `[canonicalize-issue-links]` and `[no-mentions]` in triagebot (rust-lang/reference#1788)
- Mention the temporary scope of `while let`. (rust-lang/reference#1779)
2025-05-21 08:05:27 +02:00
Matthias Krüger
1b3159a4c0
Rollup merge of #141308 - spastorino:fix-rpitit-error-reporting-ice, r=nnethercote
Do not call name() on rpitit assoc_item

Fixes #141143

r? `@nnethercote`
2025-05-21 08:05:25 +02:00
Matthias Krüger
bb7291e71b
Rollup merge of #141222 - mathisbot:ptr_trycastaligned, r=tgross35
Implement `ptr::try_cast_aligned` and `NonNull::try_cast_aligned`.

Implement three common methods on raw pointers and `NonNull`s: `try_cast_aligned`.

## Related links

- Tracking Issue: https://github.com/rust-lang/rust/issues/141221

## About `#[inline]`

Since the result of a call to `align_of` is a power of two known at compile time, the compiler is able to reduce a call to `try_cast_aligned` to only test and sete (or test and jne if followed by `unwrap`), at least on every tier 1 target's arch. This seemed like a good reason to `#[inline]` the function.

- https://godbolt.org/z/ocehvPWMx (raw inlining)
- https://godbolt.org/z/3qa4j4Yrn (comparison with no inlining)
2025-05-21 08:05:21 +02:00
Matthias Krüger
c5920278d3
Rollup merge of #141078 - marcoieni:split-dist-arm-linux, r=Kobzol
ci: split dist-arm-linux job

try-job: `dist-arm-linux-*`
2025-05-21 08:05:18 +02:00
Matthias Krüger
f547636b7e
Rollup merge of #141042 - marcoieni:split-dist-powerpc64le-linux, r=Kobzol
ci: split powerpc64le-linux job

try-job: `dist-powerpc64le-linux-*`
2025-05-21 08:05:15 +02:00
Matthias Krüger
197898d003
Rollup merge of #140981 - est31:guard_let_chains_tests, r=petrochenkov
Add match guard let chain drop order and scoping tests

We have a bunch of tests for if let chain drop order, but those tests don't cover match guard chains to the same depth. This PR adds the following tests:

* match guard equivalents of the if let chains tests in the `drop-order-comparisons.rs` test, added by  #133605.
* match guard equivalent of the `mir_let_chains_drop_order.rs` test, added by #107251
* match guard equivalent of `temporary-early-drop.rs`, added by #133093

The added tests all have variants for 2021 and 2024, showing that the behavior on both editions matches that of if let chains on 2024.

tracking issue: https://github.com/rust-lang/rust/issues/51114
2025-05-21 08:05:11 +02:00
Josh Triplett
348c1b0d88 Apply suggestions from code review
Link `Command::current_dir`.

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2025-05-21 07:48:46 +02:00
onur-ozkan
5c4eb87dbe add missing PATH
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-21 06:18:17 +03:00
bors
87b4541569 Auto merge of #127721 - bvanjoi:issue-124273, r=petrochenkov
collect doc alias as tips during resolution

Close #124273

Collect the symbol in the doc alias attributes and provide a tip when a match is found.

r? `@estebank`
2025-05-21 02:21:28 +00:00
dianne
ed01a20514 typeck: catch continues pointing to blocks
This taints the typeck results with errors if a `continue` is found not
pointing to a loop, which fixes an ICE.

A few things were going wrong here. First, since this wasn't caught in
typeck, we'd end up building the THIR and then running liveness lints on
ill-formed HIR. Since liveness assumes all `continue`s point to loops,
it wasn't setting a live node for the `continue`'s destination. However,
the fallback for this was faulty; it would create a new live node to
represent the erroneous state after the analysis's RWU table had already
been built. This would ICE if the new live node was used in operations,
such as merging results from the arms of a match. I've removed this
error-recovery since it was buggy, and we should really catch bad labels
before liveness.

I've also replaced an outdated comment about when liveness lints are
run. At this point, I think the call to `check_liveness` could be moved
elsewhere, but if it can be run when the typeck results are tainted by
errors, it'll need some slight refactoring so it can bail out in that
case. In lieu of that, I've added an assertion.
2025-05-20 17:45:16 -07:00
rustbot
fc31437b4c Update books 2025-05-21 01:50:12 +02:00
bors
2b96ddca12 Auto merge of #141305 - matthiaskrgr:rollup-l6nwaht, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #140972 (Add TRACING_ENABLED to Machine and add enter_trace_span!())
 - #141282 (`core_float_math`: Move functions to `math` module)
 - #141288 (Get rid of unnecessary `BufDisplay` abstraction)
 - #141289 (use `Self` alias in self types rather than manually substituting it)
 - #141291 (link tracking issue in explicit-extern-abis.md)
 - #141294 (triagebot: ping me if rustdoc js is modified)
 - #141303 (Fix pagetoc inactive color in rustc book)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-20 23:18:26 +00:00
Timo
03ba508d0e
Fixes manual_slice_size_computation ICE and triggers in const context (#14804)
The first commit fixes rust-lang/rust-clippy#14802: when a slice is
directly present, it must be dereferenced (instead of referenced -1
times) before being passed to `mem::size_of_val()`.

The second commit triggers the lint in a `const` contact when MSRV ≥
1.85.

changelog: [`manual_slice_size_computation`]: fix ICE in suggestion to
efficiently compute the size of a slice, and trigger the lint in `const`
context as well
2025-05-20 22:35:15 +00:00
Timo
5687ed5aae
Various macro fixes for loop lints (#14631)
The `explicit_into_iter_loop`, `explicit_iter_loop` and `iter_next_loop`
will now:

- trigger only when the triggering expression is not located into macro
code;
- properly expose code rewrite proposal with code coming from the root
context.

changelog: [`explicit_into_iter_loop`, `explicit_iter_loop`,
`iter_next_loop`]: behave in macro context

Fixes rust-lang/rust-clippy#14630
2025-05-20 22:17:38 +00:00
Mathis Bottinelli
9d1cf125f8 Implement ptr::try_cast_aligned and NonNull::try_cast_aligned. 2025-05-20 22:51:31 +02:00
Santiago Pastorino
66d47c1687
Do not call name() on rpitit assoc_item 2025-05-20 17:30:08 -03:00
bors
bc82152863 Auto merge of #140757 - dpaoliello:llvm20, r=Kobzol
[win][ci] Update LLVM toolchain used to build LLVM to 20

While trying to get the aarch64-msvc build working correctly (#140136), I needed to update the version of LLVM used to build LLVM in Windows CI runners to 20 (as this has improved support for Arm64 and Arm64EC on Windows).

This catches Windows up to Linux which was updated to 20 by #137189

try-job: `x86_64-apple-*`
try-job: `aarch64-apple`
try-job: `x86_64-msvc-*`
try-job: `i686-msvc-*`
try-job: `x86_64-mingw-*`
2025-05-20 19:29:34 +00:00
Matthias Krüger
13f3f31840
Rollup merge of #141303 - Urgau:pagetoc-fix-color, r=ehuss
Fix pagetoc inactive color in rustc book

This PR fixes the color of inactive entry in rustc pagetoc, particularly with the "Rust" theme.

| Before | After |
|--------|-------|
| ![image](https://github.com/user-attachments/assets/c6c8fe9a-0016-46cb-a638-71a62787b629) | ![image](https://github.com/user-attachments/assets/7146be5b-6ac3-4c9b-8e5a-eedd6ce61314) |

Live preview at: http://urgau.rf.gd/book

Related to https://github.com/rust-lang/rust/pull/140113#issuecomment-2888615781
r? `@ehuss`
2025-05-20 20:57:30 +02:00