Commit graph

307146 commits

Author SHA1 Message Date
Josh Triplett
efd76c910e unused_must_use: Add test for a method using an associated error type 2025-10-10 13:09:49 -07:00
Josh Triplett
6f89cecf37 unused_must_use: Don't warn on Result<(), Uninhabited>
This suppresses warnings on things like `Result<(), !>`, which helps
simplify code using the common pattern of having an `Error` associated
type: code will only have to check the error if there is a possibility
of error.
2025-10-10 13:09:46 -07:00
Josh Triplett
2997070be1 unused_must_use: Factor out a variable for the parent module DefId
This simplifies the initial conditional, and will allow reusing the
variable in subsequent checks.
2025-10-05 10:23:44 -07:00
bors
e2c96cc06b Auto merge of #147363 - Zalathar:rollup-d9kd06g, r=Zalathar
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting)
 - rust-lang/rust#147309 (Add documentation about unwinding to wasm targets)
 - rust-lang/rust#147310 (Mark `PatternTypo` suggestion as maybe incorrect)
 - rust-lang/rust#147320 (Avoid to suggest pattern match on the similarly named in fn signature)
 - rust-lang/rust#147328 (Implement non-poisoning `Mutex::with_mut`, `RwLock::with` and `RwLock::with_mut`)
 - rust-lang/rust#147337 (Make `fmt::Write` a diagnostic item)
 - rust-lang/rust#147349 (Improve the advice given by panic_immediate_abort)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-05 04:36:49 +00:00
Stuart Cook
a0a4905723
Rollup merge of #147349 - saethlin:panic-immediate-advice, r=Noratrieb
Improve the advice given by panic_immediate_abort

Now that https://github.com/rust-lang/rust/pull/147338 is merged, users should consider using the Cargo support for immediate-aborting panics.
2025-10-05 15:35:05 +11:00
Stuart Cook
80759350c7
Rollup merge of #147337 - ada4a:write-diag-item, r=fmease
Make `fmt::Write` a diagnostic item

I'm working on an enhancement to [`clippy::format_push_string`](https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string), which would suggest an autofix to replace `push_str`/`+=` with `write!`. But that could require importing `std::fmt::Write`, and so I need this diagnostic item to check if it's already in scope.

The reason I called it `FmtWrite` and not just `Write` is that there's already an `IoWrite` defined.
2025-10-05 15:35:04 +11:00
Stuart Cook
56c96aebfc
Rollup merge of #147328 - EFanZh:lock-with, r=joboet
Implement non-poisoning `Mutex::with_mut`, `RwLock::with` and `RwLock::with_mut`

ACP: https://github.com/rust-lang/libs-team/issues/497.
2025-10-05 15:35:04 +11:00
Stuart Cook
cae84c695a
Rollup merge of #147320 - chenyukang:yukang-fix-147303-fn-arg, r=jieyouxu
Avoid to suggest pattern match on the similarly named in fn signature

Fixes rust-lang/rust#147303
2025-10-05 15:35:03 +11:00
Stuart Cook
620ffe6595
Rollup merge of #147310 - Jules-Bertholet:maybe-incorrect-pattern-typo, r=chenyukang
Mark `PatternTypo` suggestion as maybe incorrect

Partial fix for https://github.com/rust-lang/rust/issues/147303.

`@rustbot` label A-diagnostics A-suggestion-diagnostics D-invalid-suggestion
2025-10-05 15:35:03 +11:00
Stuart Cook
ff86a7db83
Rollup merge of #147309 - alexcrichton:wasm-unwinding-docs, r=jieyouxu
Add documentation about unwinding to wasm targets

This commit adds some documentation about the state of `-Cpanic=unwind` for the following wasm targets:

* `wasm32-unknown-unknown`
* `wasm32-wasip1`
* `wasm32-wasip2`
* `wasm32v1-none`

Notably it's possible to use `-Cpanic=unwind` with `-Zbuild-std` and it's also mentioned that there are no concrete proposals at this time to adding a new set of targets which support unwinding. My hunch is that in a few years' time it would make sense to enable it by default on these targets (except for `wasm32v1-none`) but that's a problem for future folks to debate. For now this is an attempt to document the status quo.
2025-10-05 15:35:02 +11:00
Stuart Cook
59982f9a29
Rollup merge of #147288 - Zalathar:directive, r=jieyouxu
compiletest: Make `DirectiveLine` responsible for name/value splitting

- Follow-up to rust-lang/rust#147170.

---

Now that all of the directive-parsing functions have access to a `DirectiveLine`, we can move all of the ad-hoc name/value splitting code into `DirectiveLine` itself, making directive parsing simpler and more consistent.

The first commit is just moving code into a submodule, so the actual changes can be seen in the subsequent commits.

r? jieyouxu
2025-10-05 15:35:02 +11:00
Zalathar
33c99a0468 Use new DirectiveLine features in directive parsing 2025-10-05 10:47:21 +11:00
Zalathar
6783e9465b Allow easy extraction of name/value from a DirectiveLine 2025-10-05 10:47:21 +11:00
Zalathar
757d98ce2b Move DirectiveLine into its own submodule 2025-10-05 10:47:19 +11:00
bors
227ac7c3cd Auto merge of #147293 - nnethercote:avoid-dep_dep_node, r=saethlin
Avoid getting `dep_dep_node` unnecessarily.

It's gotten on a hot path but only for use within `debug!`.

r? `@saethlin`
2025-10-04 21:23:46 +00:00
Ben Kimock
b5fb01d67d Improve the advice given by panic_immediate_abort 2025-10-04 15:53:00 -04:00
bors
2cb4e7dce8 Auto merge of #147340 - matthiaskrgr:rollup-icymmsc, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#142670 (Document fully-qualified syntax in `as`' keyword doc)
 - rust-lang/rust#145685 (add CloneFromCell and Cell::get_cloned)
 - rust-lang/rust#146330 (Bump unicode_data and printables to version 17.0.0)
 - rust-lang/rust#146451 (Fix atan2 inaccuracy in documentation)
 - rust-lang/rust#146479 (add mem::conjure_zst)
 - rust-lang/rust#147117 (interpret `#[used]` as `#[used(compiler)]` on illumos)
 - rust-lang/rust#147190 (std: `sys::net` cleanups)
 - rust-lang/rust#147251 (Do not assert that a change in global cache only happens when concurrent)
 - rust-lang/rust#147280 (Return to needs-llvm-components being info-only)
 - rust-lang/rust#147315 (bless autodiff batching test)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-04 18:08:24 +00:00
Matthias Krüger
a84359c5a7
Rollup merge of #147315 - ZuseZ4:fix-ad-batching-test, r=jieyouxu
bless autodiff batching test

This pr blesses a broken test and unblocks running rust in the Enzyme CI: https://github.com/EnzymeAD/Enzyme/pull/2430
Enzyme is the plugin used by our std::autodiff and (future) std::batching modules, both of which are not build by default.
In the near future we also hope to enable std::autodiff in the Rust CI.

This test is the only one to combine two features, automatic differentiation and batching/vectorization. This combination is even more experimental than either feature on its own. I have a wip branch in which I enable more vectorization/batching and as part of that I'll think more about how to write those tests in a robust way (and likely change the interface). Until that lands, I don't care too much about what specific IR we generate here; it's just nice to track changes.

r? compiler
2025-10-04 17:11:13 +02:00
Matthias Krüger
6c24eeeb62
Rollup merge of #147280 - workingjubilee:you-can-put-your-gcc-in-my-llvm-components, r=Kobzol
Return to needs-llvm-components being info-only

Partially revert a535042e80

Even with non-LLVM codegen backends, we want to allow for annotations that express dependencies to LLVM-specific parts of the test suite. This includes `//@ needs-llvm-components`, which just allows checking that LLVM is built with relevant target support before the test is run. It does not assert the test cannot work with another codegen backend.
2025-10-04 17:11:12 +02:00
Matthias Krüger
dade9fe04b
Rollup merge of #147251 - jackh726:global-cache-non-concurrent-change, r=lcnr
Do not assert that a change in global cache only happens when concurrent

Fixes rust-lang/trait-system-refactor-initiative#234

I think it should just be safe to remove this assert (rather than delaying a bug). If the previous and current result are the same, I wouldn't expect issues.

r? lcnr
2025-10-04 17:11:12 +02:00
Matthias Krüger
c389e2ed9e
Rollup merge of #147190 - joboet:sys-net-cleanup, r=hkBst,tgross35
std: `sys::net` cleanups

This PR contains three improvements to the socket-based networking implementation (aa1263e768 is just to add the now missing `unsafe`). Best reviewed commit-by-commit.
2025-10-04 17:11:11 +02:00
Matthias Krüger
3f7b8c5198
Rollup merge of #147117 - iximeow:ixi/illumos-used-attr, r=Noratrieb
interpret `#[used]` as `#[used(compiler)]` on illumos

helps rust-lang/rust#146169 not be as painful: fixes the illumos regression in rust-lang/rust#140872, but `#[used(linker)]` is still erroneous on illumos generally.

illumos' `ld` does not support a flag like either SHF_GNU_RETAIN or SHF_SUNW_NODISCARD, so there is no way to communicate `#[used(linker)]` for that target. Setting `USED_LINKER` to try results in LLVM setting SHF_SUNW_NODISCARD for Solaris-like targets, which is an unknown section header flag for illumos `ld` and prevents sections from being merged that otherwise would.

As a motivating example, the `inventory` crate produces `#[used]` items to merge into `.init_array`. Because those items have an unknown section header flag they are not merged with the default `.init_array` with `frame_dummy`, and end up never executed.

Downgrading `#[used]` to `#[used(compiler)]` on illumos keeps so-attributed items as preserved as they had been before https://github.com/rust-lang/rust/pull/140872. As was the case before that change, because rustc passes `-z ignore` to illumos `ld`, it's possible that `used` sections are GC'd at link time. https://github.com/rust-lang/rust/issues/146169 describes this unfortunate circumstance.

----

as it turns out, `tests/ui/attributes/used_with_archive.rs` had broken on `x86_64-unknown-illumos`, and this patch fixes it. the trials and tribulations of tier 2 :(

r? ````@Noratrieb```` probably?
2025-10-04 17:11:11 +02:00
Matthias Krüger
18388b8420
Rollup merge of #146479 - Qelxiros:mem_conjure_zst, r=scottmcm,tgross35
add mem::conjure_zst

Tracking issue: rust-lang/rust#95383
2025-10-04 17:11:10 +02:00
Matthias Krüger
baea20ba44
Rollup merge of #146451 - DimitriiTrater:atan2_correctness_docs, r=tgross35
Fix atan2 inaccuracy in documentation

Fixes rust-lang/rust#136275
2025-10-04 17:11:09 +02:00
Matthias Krüger
dbc1e82f25
Rollup merge of #146330 - Marcondiro:unicode-17, r=Manishearth
Bump unicode_data and printables to version 17.0.0

Unicode 17 ~~is not stable yet (release planned for 2025-09-09).~~ [has been released!](https://www.unicode.org/versions/Unicode17.0.0/)

Update Unicode data and printables to [Unicode 17](https://www.unicode.org/versions/Unicode17.0.0/)
2025-10-04 17:11:09 +02:00
Matthias Krüger
47bd38c2f1
Rollup merge of #145685 - Qelxiros:cell_get_cloned, r=programmerjake,tgross35
add CloneFromCell and Cell::get_cloned

Tracking issue: rust-lang/rust#145329
2025-10-04 17:11:08 +02:00
Matthias Krüger
f837cfe5ac
Rollup merge of #142670 - fpdotmonkey:doc/as-fully-qualified-syntax, r=ibraheemdev,fmease
Document fully-qualified syntax in `as`' keyword doc
2025-10-04 17:11:08 +02:00
bors
99ca0ae87b Auto merge of #147338 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

3 commits in 2394ea6cea8b26d717aa67eb1663a2dbf2d26078..801d9b4981dd07e3aecdca1ab86834c13615737e
2025-10-03 14:13:01 +0000 to 2025-10-04 13:30:15 +0000
- chore: Disabled `reserved_windows_name` test temporaily (rust-lang/cargo#16048)
- Add panic=immediate-abort support to Cargo (rust-lang/cargo#16041)
- Accessing each build script's `OUT_DIR` (rust-lang/cargo#15891)
2025-10-04 14:57:32 +00:00
Weihang Lo
b4578775b4
Update cargo submodule 2025-10-04 10:22:41 -04:00
Ada Alakbarova
2688f601dd
Make fmt::Write a diagnostic item 2025-10-04 16:07:06 +02:00
bors
99b9a88503 Auto merge of #147323 - chenyukang:yukang-fix-tidy-check, r=jieyouxu
Fix top level ui tests check in tidy

I got an error when pushing code:

```console
fmt check
fmt: checked 6330 modified files
tidy check
tidy [ui_tests (tests)]: ui tests should be added under meaningful subdirectories: `/Users/yukang/rust/tests/ui/.DS_Store`
tidy [ui_tests (tests)]: FAIL
```

I think it's better to use `ignore::WalkBuilder` for checking the path.

r? `@jieyouxu`
2025-10-04 10:22:52 +00:00
EFanZh
ba42380142 Implement non-poisoning Mutex::with_mut, RwLock::with and RwLock::with_mut
ACP: https://github.com/rust-lang/libs-team/issues/497.
2025-10-04 17:16:00 +08:00
yukang
e9a45e6646 Avoid to suggest pattern match on the similarly named in fn signature 2025-10-04 17:12:41 +08:00
yukang
422b91443f Fix top level ui tests check in tidy 2025-10-04 15:18:16 +08:00
bors
a0f398e89d Auto merge of #147308 - matthiaskrgr:rollup-ov04tbi, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#147245 (only replace the intended comma in pattern suggestions)
 - rust-lang/rust#147269 (Add regression test for 123953)
 - rust-lang/rust#147277 (Extract common logic for iterating over features)
 - rust-lang/rust#147292 (Respect `-Z` unstable options in `rustdoc --test`)
 - rust-lang/rust#147300 (Add xtensa arch to object file creation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-04 06:19:58 +00:00
bors
7950f244e7 Auto merge of #147299 - compiler-errors:hr-norm, r=jackh726
Don't normalize higher-ranked assumptions if they're not used

See the comment in the code.

Normalizing these assumptions may cause us to register things like new placeholder outlives obligations that cause higher-ranked lifetime errors, and this is problematic if we're not even using these assumptions in borrowck.

Fixes rust-lang/rust#147244
Fixes rust-lang/rust#147285
2025-10-04 00:02:26 +00:00
Manuel Drehwald
12cfad9a8b update autodiff batching test 2025-10-03 18:12:22 -04:00
iximeow
c721fa2438 interpret #[used] as #[used(compiler)] on illumos
illumos' `ld` does not support a flag like either SHF_GNU_RETAIN or
SHF_SUNW_NODISCARD, so there is no way to communicate `#[used(linker)]`
for that target. Setting `USED_LINKER` to try results in LLVM setting
SHF_SUNW_NODISCARD for Solaris-like targets, which is an unknown section
header flag for illumos `ld` and prevents sections from being merged
that otherwise would.

As a motivating example, the `inventory` crate produces
`#[used]` items to merge into `.init_array`. Because those items have an
unknown section header flag they are not merged with the default
`.init_array` with `frame_dummy`, and end up never executed.

Downgrading `#[used]` to `#[used(compiler)]` on illumos keeps
so-attributed items as preserved as they had been before
https://github.com/rust-lang/rust/pull/140872. As was the case before
that change, because rustc passes `-z ignore` to illumos `ld`, it's
possible that `used` sections are GC'd at link time.
https://github.com/rust-lang/rust/issues/146169 describes this
unfortunate circumstance.
2025-10-03 22:03:24 +00:00
jackh726
55aeb1747d Do not assert that a change in global cache only happens when concurrent 2025-10-03 16:21:15 -04:00
Alex Crichton
fd96a78092 Add documentation about unwinding to wasm targets
This commit adds some documentation about the state of `-Cpanic=unwind`
for the following wasm targets:

* `wasm32-unknown-unknown`
* `wasm32-wasip1`
* `wasm32-wasip2`
* `wasm32v1-none`

Notably it's possible to use `-Cpanic=unwind` with `-Zbuild-std` and
it's also mentioned that there are no concrete proposals at this time to
adding a new set of targets which support unwinding. My hunch is that in
a few years' time it would make sense to enable it by default on these
targets (except for `wasm32v1-none`) but that's a problem for
future folks to debate. For now this is an attempt to document the
status quo.
2025-10-03 13:08:07 -07:00
Jules Bertholet
d5ba5c1c92
Mark PatternTypo suggestion as maybe incorrect 2025-10-03 16:00:15 -04:00
Matthias Krüger
30442dc496
Rollup merge of #147300 - esp-rs:xtensa-meta, r=saethlin
Add xtensa arch to object file creation

Just something that was missed in the xtensa target PRs.
2025-10-03 21:10:34 +02:00
Matthias Krüger
dbc5e72ea2
Rollup merge of #147292 - Urgau:rustdoc-test-unstable_opts, r=fmease
Respect `-Z` unstable options in `rustdoc --test`

This PR makes rustdoc respect `-Z` unstable options when collecting doctests (`rustdoc --test`).

In the process I also realized that `--error-format` wasn't respected as well, making UI annotations impossible to write so I fixed that as well.

Best reviewed commit by commit.

Fixes https://github.com/rust-lang/rust/issues/147276
Fixes https://github.com/rust-lang/rust/issues/143930
r? fmease
2025-10-03 21:10:33 +02:00
Matthias Krüger
9e477c4386
Rollup merge of #147277 - fee1-dead-contrib:featiter, r=Zalathar
Extract common logic for iterating over features

Two places doing the same thing is enough to motivate me to extract this to a method :)
2025-10-03 21:10:33 +02:00
Matthias Krüger
0d0b695b9f
Rollup merge of #147269 - reddevilmidzy:ice-fix, r=petrochenkov
Add regression test for 123953

close: rust-lang/rust#123953
2025-10-03 21:10:32 +02:00
Matthias Krüger
2e06dcdbeb
Rollup merge of #147245 - karolzwolak:only-replace-intended-bar-not-all-in-pattern, r=lcnr
only replace the intended comma in pattern suggestions

Only suggest to replace the intended comma, not all bars in the pattern.
Fixes rust-lang/rust#143330.
This continues rust-lang/rust#143331, the credit for making the fix goes to `@A4-Tacks.` I just blessed tests and added a regression test.
2025-10-03 21:10:31 +02:00
bors
595b9a498b Auto merge of #147301 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

24 commits in f2932725b045d361ff5f18ba02b1409dd1f44e71..2394ea6cea8b26d717aa67eb1663a2dbf2d26078
2025-09-24 11:31:26 +0000 to 2025-10-03 14:13:01 +0000
- Recommend `package.rust-version` in the Rust version section of `reference/semver.md`. (rust-lang/cargo#15806)
- fix(toml): Prevent non-script fields in Cargo scripts (rust-lang/cargo#16026)
- chore(ci): unpin libc (rust-lang/cargo#16044)
- chore: Update dependencies (rust-lang/cargo#16034)
- Fix FileLock path tracking after rename in package operation (rust-lang/cargo#16036)
- Lockfile schemas error cleanup (rust-lang/cargo#16039)
- Convert a multi-part diagnostic to a report (rust-lang/cargo#16035)
- fix(run): Override arg0 for cargo scripts  (rust-lang/cargo#16027)
- Public in private manifest errors (rust-lang/cargo#16002)
- chore(deps): update actions/checkout action to v5 (rust-lang/cargo#16031)
- fix: remove FIXME comment that's no longer a problem (rust-lang/cargo#16025)
- Add retry for `git fetch` failures in `CARGO_NET_GIT_FETCH_WITH_CLI` path (rust-lang/cargo#16016)
- Added better filesystem layout testing harness (rust-lang/cargo#15874)
- Small cleanup to normalize_dependencies (rust-lang/cargo#16022)
- fix: better error message for rust version incompatibility (rust-lang/cargo#16021)
- fix(shell): Use a distinct style for transient status (rust-lang/cargo#16019)
- chore(deps): Depend on `serde_core` in `cargo-platform` (rust-lang/cargo#15992)
- Remove package-workspace from unstable doc index (rust-lang/cargo#16014)
- fix(shell): Switch to annotate snippets for notes (rust-lang/cargo#15945)
- docs: update changelog (rust-lang/cargo#15986)
- chore(ci): add rustfmt for docs job (rust-lang/cargo#16013)
- chore: bump to 0.93.0 (rust-lang/cargo#16009)
- fix(config): combine key error context into one (rust-lang/cargo#16004)
- test(docker): openssh requires a newer libcrypto3 (rust-lang/cargo#16010)

r? ghost
2025-10-03 18:15:41 +00:00
Jeremy Smart
a9ab29cdb4
add mem::conjure_zst 2025-10-03 13:30:47 -04:00
Weihang Lo
e43a0b6bdb
Update cargo submodule 2025-10-03 11:58:30 -04:00
Scott Mabin
3f9c493da1 Add xtensa arch to object file creation 2025-10-03 16:10:26 +01:00