Commit graph

308340 commits

Author SHA1 Message Date
Samuel Tardieu
19343bf41d
fix(zero_repeat_side_effects): better identify exprs with side effects (#15814)
Fixes https://github.com/rust-lang/rust-clippy/issues/14681

changelog: [`zero_repeat_side_effects`]: better identify exprs with side
effects
2025-10-04 13:28:19 +00:00
Ada Alakbarova
adff9baeb3
fix(zero_repeat_side_effects): better identify exprs with side effects 2025-10-04 15:22:52 +02:00
Samuel Tardieu
0a7b3282af
Upgrade toml to 0.9.7 and remove the serde feature (#15806)
With this and rust-lang/rust-clippy#13084 our toml version will be
pushed to `0.9.7`. This is different from rustc's version, but the
changes in rust-lang/rust-clippy#13084 already require an incompatible
version.

The `serde` feature is also removed since it was only used in one spot
with a mostly trivial replacement.

changelog: none
2025-10-04 13:16:56 +00:00
Ada Alakbarova
24befed727
clean-up
- inline `array_span_lint`
- use `match` instead of `if-let`
- give a more descriptive help message
2025-10-04 15:16:54 +02:00
A4-Tacks
8607cfedc4
minor: Fix using make::ty for extract_type_alias 2025-10-04 19:33:29 +08: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
xizheyin
94d66016e4
Suppress suggest swapping the equality in extern macro
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-10-04 18:05:40 +08:00
xizheyin
19331daca8
Add test sugg-swap-equality-in-macro
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-10-04 17:54:33 +08:00
Jonathan Brouwer
1c85a1dc2e
Make #[link="dl"] a warning rather than an error 2025-10-04 11:22:56 +02:00
Jonathan Brouwer
5c95f8bea6
Add failing regression test for #[link="dl"] 2025-10-04 11:19:18 +02: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
Zalathar
f8c54d24e2 Remove inherent methods from llvm::CallConv::from_conv 2025-10-04 18:47:18 +10:00
Zalathar
3831b60ef3 Remove inherent methods from llvm::Type 2025-10-04 18:47:18 +10:00
Zalathar
0661a3d6fe Remove inherent methods from coverageinfo::ffi::Counter
This patch also moves `Regions` to a different module, since that type can stay
put when the FFI bindings move to another crate.
2025-10-04 18:46:15 +10:00
Zalathar
f955c76a5b Remove inherent methods from several LLVM FFI types
Using a helper trait allows the conversions to remain in `rustc_codegen_llvm`,
even if the FFI types are moved to a different crate.
2025-10-04 18:16:13 +10:00
许杰友 Jieyou Xu (Joe)
3f6f94e251
Merge pull request #2599 from rust-lang/tshepang-patch-5 2025-10-04 16:04:25 +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
Alejandra González
82297010ed
Fix let_unit_value suggests wrongly for field init shorthand (#15791)
Closes rust-lang/rust-clippy#15789

changelog: [`let_unit_value`] fix wrong suggestions for field init
shorthand
2025-10-03 22:35:31 +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
Jack Huey
283ad6699c Fix comment, change first_pass to error_on_missing_defining_use, remove the assert in favor over a comment, and change to & for &mut 2025-10-03 18:01:36 -04: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
Guillaume Gomez
58889457ca Display merged doctests times as expected depending on the format specified 2025-10-03 18:02:05 +02: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
Urgau
c1443e2591 Add regression test for -Zcrate-attr in rustdoc --test 2025-10-03 17:04:17 +02:00
Urgau
e914a1a6e0 Respect --error-format in rustdoc --test 2025-10-03 17:04:17 +02:00
bors
f437c86ef8 Auto merge of #143613 - Enselic:panic-abort-uwtables, r=petrochenkov
Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default

The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook.

Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work.

Closes https://github.com/rust-lang/rust/issues/81902 which is **regression-from-stable-to-stable**
Closes https://github.com/rust-lang/rust/issues/94815

### History

Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see https://github.com/rust-lang/rust/pull/45031 and https://github.com/rust-lang/rust/issues/81902#issuecomment-3046487084).

In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see https://github.com/rust-lang/rust/pull/69984).

`-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces.

Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact.

# Release Note Entry Draft:

## Compatibility Notes

* [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](https://github.com/rust-lang/rust/pull/143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.

try-job: aarch64-apple
try-job: armhf-gnu
try-job: aarch64-msvc-1
2025-10-03 15:02:37 +00:00
Michael Goulet
e3f104608c Don't normalize higher-ranked assumptions if they're not used 2025-10-03 10:32:23 -04:00
Fletcher Porter
1485e7887b Document fully-qualified syntax in as' keyword doc 2025-10-03 17:31:55 +03:00
Samuel Tardieu
87d2891e82
Cleanup should_implement_trait lint code 2025-10-03 16:30:55 +02:00
Tshepang Mbambo
d0417dd45f
Merge pull request #2601 from rust-lang/tshepang-patch-2
cg_gcc.md: add missing quote
2025-10-03 15:16:22 +02:00
Tshepang Mbambo
74caed9a45
cg_gcc.md: add missing quote 2025-10-03 15:15:45 +02:00
bors
8b6b15b877 Auto merge of #142771 - dianqk:mir-stmt-debuginfo, r=cjgillot
Introduce debuginfo to statements in MIR

The PR introduces support for debug information within dead statements. Currently, only the reference statement is supported, which is sufficient to fix rust-lang/rust#128081.

I don't modify Stable MIR, as I don't think we need debug information when using it.

This PR represents the debug information for the dead reference statement via `#dbg_value`. For example, `let _foo_b = &foo.b` becomes `#dbg_value(ptr %foo, !22, !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value), !26)`. You can see this here: https://rust.godbolt.org/z/d43js6adv.

The general principle for handling debug information is to never provide less debug information than the optimized LLVM IR.

The current rules for dropping debug information in this PR are:

- If the LLVM IR cannot represent a reference address, it's replaced with poison or simply dropped. For example, see: https://rust.godbolt.org/z/shGqPec8W. I'm using poison in all such cases now.
- All debuginfos is dropped when merging multiple successor BBs. An example is available here: https://rust.godbolt.org/z/TE1q3Wq6M.

I doesn't drop debuginfos in `MatchBranchSimplification`, because LLVM also pick one branch for it.
2025-10-03 11:49:42 +00:00
Nicholas Nethercote
3a287e6034 Remove some unnecessary locals.
They both have a single use. (They can't be united, though, because
`self.colors` might change between the two `get` calls.)
2025-10-03 20:36:21 +10:00
Nicholas Nethercote
cb0f969b62 Avoid getting dep_dep_node unnecessarily.
It's gotten on a hot path but only for use within `debug!`.
2025-10-03 20:34:56 +10:00
Urgau
3d5f54ad55 Respect -Z unstable options in rustdoc --test 2025-10-03 12:05:31 +02:00
bors
dd091003ac Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, r=GuillaumeGomez,notriddle
If a trait item appears in rustdoc search, hide the corrosponding impl items

fixes rust-lang/rust#138251

cc `@notriddle`
2025-10-03 08:43:43 +00:00