Commit Graph

291081 Commits

Author SHA1 Message Date
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
Marcelo Domínguez
8917ff6024 Update generic tests 2025-05-21 07:24:43 +00:00
Marcelo Domínguez
8dd62e8188 Update UI tests 2025-05-21 07:24:43 +00:00
Marcelo Domínguez
f92d84cc6e Initial naive implementation using Symbols to represent autodiff modes (Forward, Reverse)
Since the mode is no longer part of `meta_item`, we must insert it manually (otherwise macro expansion with `#[rustc_autodiff]` won't work).

This can be revised later if a more structured representation becomes necessary (using enums, annotated structs, etc).

Some tests are currently failing. I'll address them next.
2025-05-21 07:24:42 +00:00
Marcelo Domínguez
2041de7083 Update codegen and pretty tests
UI tests are pending, will depend on error messages change.
2025-05-21 07:24:42 +00:00
Marcelo Domínguez
b725cf6af8 Disable autodiff bootstrapping 2025-05-21 07:24:33 +00:00
Ell
6ac8e51283 Allow x perf to find rustc.exe on Windows 2025-05-21 10:09:29 +03:00
Ralf Jung
05235541a8 FileDescription: improve read/write docs 2025-05-21 08:48:36 +02:00
Ralf Jung
fe5119375c Merge pull request #4337 from RalfJung/io
test direct usage of io::{stdout,stderr,stdin}
2025-05-21 06:38:23 +00:00
Ralf Jung
e12f911e3e Merge pull request #4336 from rust-lang/rustup-2025-05-21
Automatic Rustup
2025-05-21 06:31:59 +00: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
Ralf Jung
2f34354e66 test direct usage of io::{stdout,stderr,stdin} 2025-05-21 08:10:37 +02:00
Jonas Platte
20589bd605 Add ReentrantLock::data_ptr 2025-05-21 08:07:43 +02:00
Jonas Platte
9d6c5a88a1 Add more docs to new data_ptr methods 2025-05-21 08:07:43 +02:00
Jonas Platte
9efad3a87b Add data_ptr method to Mutex and RwLock 2025-05-21 08:07:43 +02: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
The Miri Cronjob Bot
b5688fba84 Merge from rustc 2025-05-21 05:01:00 +00:00
The Miri Cronjob Bot
293b0ac752 Preparing for merge from rustc 2025-05-21 04:53:50 +00: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
Trevor Gross
ff1a5ab4c3 Rename cfg_match! to cfg_select!
At [1] it was pointed out that `cfg_match!` syntax does not actually
align well with match syntax, which is a possible source of confusion.
The comment points out that usage is instead more similar to ecosystem
`select!` macros. Rename `cfg_match!` to `cfg_select!` to match this.

Tracking issue: https://github.com/rust-lang/rust/issues/115585

[1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-20 21:16:23 +00:00
Trevor Gross
999967a57d Rename cfg_match! to cfg_select!
At [1] it was pointed out that `cfg_match!` syntax does not actually
align well with match syntax, which is a possible source of confusion.
The comment points out that usage is instead more similar to ecosystem
`select!` macros. Rename `cfg_match!` to `cfg_select!` to match this.

Tracking issue: https://github.com/rust-lang/rust/issues/115585

[1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-20 21:16:23 +00:00
Christopher Berner
fd260d530b Add From<TryLockError> for io::Error
This makes error propagation from try_lock() and try_lock_shared()
more convenient
2025-05-20 14:09:27 -07:00
Christopher Berner
9febbf8270 Remove unnecessary handling of ERROR_IO_PENDING
try_lock() and try_lock_shared() do not need to handle these per the discussion in https://github.com/rust-lang/rust/pull/140718#discussion_r2076678485
2025-05-20 14:09:27 -07: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
Matthias Krüger
74636b0ff5 Rollup merge of #141294 - lolbinarycat:triagebot-js-ping, r=aDotInTheVoid
triagebot: ping me if rustdoc js is modified

r? `@aDotInTheVoid`
2025-05-20 20:57:29 +02:00
Matthias Krüger
a4a398d18d Rollup merge of #141291 - ComputerDruid:patch-1, r=workingjubilee
link tracking issue in explicit-extern-abis.md
2025-05-20 20:57:29 +02:00
Matthias Krüger
c052d263d0 Rollup merge of #141289 - compiler-errors:more-self, r=jhpratt
use `Self` alias in self types rather than manually substituting it

Of the rougly 145 uses of `self: Ty` in the standard library, 5 of them don't use `Self` but instead choose to manually "substitute" the `impl`'s self type into the type.

This leads to weird behavior sometimes (https://github.com/rust-lang/rust/issues/140611#issuecomment-2883761300) -- **to be clear**, none of these usages actually trigger any bugs, but it's possible that they may break in the future (or at least lead to lints), so let's just "fix" them proactively.
2025-05-20 20:57:28 +02:00