This test, which checks that we do not define new profiles directly in
Clippy's multiple `Cargo.toml` files, must not look inside `target` as
`lintcheck` might place some third-party sources there. Of course those
third-party sources are allowed to define profiles in their `Cargo.toml`.
Fix `unnecessary_unwrap` false negative when unwrapping a known value
inside a macro call
Fixesrust-lang/rust-clippy#12295
Produces no changes to `lintcheck`
changelog: [`unnecessary_unwrap`]: Fix false negative when unwrapping a
known value inside a macro call
I made sue to run `cargo dev fmt`.
I also ran the following checks (in order) on a fresh clone of mi fork:
1. `cargo build`
2. `cargo test`
3. `cargo lintcheck`
Running `cargo test` after `lintcheck` causes a test to fail, but this
also happens on a clean fork without my changes
interpret: copy_provenance: avoid large intermediate buffer for large repeat counts
Copying provenance worked in this odd way where the "preparation" phase (which is supposed to just extract the necessary information from the source range) already did all the work of repeating the result N times for the target range. This was needed to use the existing `insert_presorted` function on `SortedMap`.
This PR generalizes `insert_presorted` so that we can avoid this odd structure on copy-provenance, and maybe even improve performance.
Fixes https://github.com/rust-lang/rust-clippy/issues/13357
Determining the exact placement of the `if !to_ref_ty.is_sized()`s
required meticulously constructing the suggestion/truth table of
`is_sized`, `msrv.meets` and `has_erased_regions`. The test cases should
hopefully cover all the new combinations.
changelog: [`transmute_ptr_to_ref`]: don't suggest `.cast` when to-type
is DST
This commit simplifies construction of `arch` from `sess.target.arch`.
It also preserves a reference to `sess.target.arch` as `raw_arch`
to make this function future proof.
Enable DestinationPropagation by default
This PR proposes to perform destination propagation on MIR. Most of the pass was fully rewritten by `@JakobDegen` in rust-lang/rust#96451.
This pass is quite heavy, as it needs to perform and save the results of a full liveness dataflow analysis. This accounts for ~50% of the pass' runtime.
Perf sees a few decent savings in later llvm passes, but also sizeable régressions when there are no savings to balance this pass' runtime.
cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 3)
- Part of rust-lang/rust#134001
- Follow-up to rust-lang/rust#136375
- Follow-up to rust-lang/rust#136632
---
This is another batch of LLVMDIBuilder binding migrations, replacing some our own LLVMRust bindings with bindings to upstream LLVM-C APIs.
This PR migrates all of the bindings that were touched by rust-lang/rust#136632, plus `LLVMDIBuilderCreateStructType`.
tests/run-make: Update list of statically linked musl targets
All of the tier 3 targets in the list now link dynamically by default (except `mips64el-unknown-linux-muslabi64`, I apparently overlooked that one in my PR that changed this).
Adjust the list of targets expected to link statically accordingly.
See also https://github.com/rust-lang/rust/pull/144410, which changed these targets.
Target by target:
- `mips64-unknown-linux-musl`: this target does not exist AFAICT
- `mips64-unknown-linux-muslabi64`: updated in the linked PR
- `powerpc-unknown-linux-musl`: updated in the linked PR
- `powerpc-unknown-linux-muslspe`: updated in the linked PR
- `powerpc64-unknown-linux-musl`: updated in the linked PR
- `riscv32gc-unknown-linux-musl`: updated in the linked PR
- `s390x-unknown-linux-musl`: updated in the linked PR
- `thumbv7neon-unknown-linux-musleabihf`: updated in the linked PR
Detect attempt to use var-args in closure
```
error: unexpected `...`
--> $DIR/no-closure.rs:11:14
|
LL | let f = |...| {};
| ^^^ not a valid pattern
|
= note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
error: unexpected `...`
--> $DIR/no-closure.rs:16:17
|
LL | let f = |_: ...| {};
| ^^^
|
= note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
```
Fixrust-lang/rust#146489, when trying to use c-style var-args in a closure. We emit a more targeted message. We also silence inference errors when the pattern is `PatKind::Err`.
Remove Rvalue::Len again.
Now that we have `RawPtrKind::FakeForPtrMetadata`, we can reimplement `Rvalue::Len` using `PtrMetadata(&raw const (fake) place)`.
r? ``@scottmcm``
StateTransform: Do not renumber resume local.
MIR parameters are not explicitly assigned-to when entering the MIR body. If we want to save their values inside the coroutine state, we need to do so explicitly.
This was done by renaming the `_2` local, and introducing an explicit assignment pre-transform. This particular trick confuses me.
This version makes explicit that we are assigning parameters to saved locals.
r? ``@dingxiangfei2009``
Add tidy readme
This PR adds a Readme to `src/tools/tidy`. Basically just explains how `tidy` works and covers all of tidy's checks, directives, and how to use tidy. I tried to add a bit more detail on some of the options like `--extra-checks` and the style directives that aren't really documented well elsewhere.
Planning to link to this in the dev guide.
Closes: rust-lang/rust#129368
don't apply temporary lifetime extension rules to non-extended `super let`
Reference PR: rust-lang/reference#1980
This changes the semantics for `super let` (and macros implemented in terms of it, such as `pin!`, `format_args!`, `write!`, and `println!`) as suggested by ````@theemathas```` in https://github.com/rust-lang/rust/issues/145784#issuecomment-3218658335, making `super let` initializers only count as [extending expressions](https://doc.rust-lang.org/nightly/reference/destructors.html#extending-based-on-expressions) when the `super let` itself is within an extending block. Since `super let` initializers aren't temporary drop scopes, their temporaries outside of inner temporary scopes are effectively always extended, even when not in extending positions; this only affects two cases as far as I can tell:
- Block tail expressions in Rust 2024. This PR makes `f(pin!({ &temp() }))` drop `temp()` at the end of the block in Rust 2024, whereas previously it would live until after the call to `f` because syntactically the `temp()` was in an extending position as a result of `super let` in `pin!`'s expansion.
- `super let` nested within a non-extended `super let` is no longer extended. i.e. a normal `let` is required to treat `super let`s as extending (in which case nested `super let`s will also be extending).
Closesrust-lang/rust#145784
This is a breaking change. Both static and dynamic semantics are affected. The most likely breakage is for programs to stop compiling, but it's technically possible for drop order to silently change as well (as in rust-lang/rust#145784). Since this affects stable macros, it probably would need a crater run.
Nominating for discussion alongside rust-lang/rust#145784: ````@rustbot```` label +I-lang-nominated +I-libs-api-nominated
Tracking issue for `super let`: rust-lang/rust#139076
initial implementation of the darwin_objc unstable feature
Tracking issue: https://github.com/rust-lang/rust/issues/145496
This feature makes it possible to reference Objective-C classes and selectors using the same ABI used by native Objective-C on Apple/Darwin platforms. Without it, Rust code interacting with Objective-C must resort to loading classes and selectors using costly string-based lookups at runtime. With it, these references can be loaded efficiently at dynamic load time.
r? ```@tmandry```
try-job: `*apple*`
try-job: `x86_64-gnu-nopt`
remove FIXME block from `has_significant_drop`, it never encounters inference variables
The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.
321a89bec5/compiler/rustc_middle/src/ty/util.rs (L1378-L1389)Closesrust-lang/rust#86868 (other places mentioned in the issue have been resolved, or moved to other issues)
r? types
Update the minimum external LLVM to 20
With this change, we'll have stable support for LLVM 20 and 21.
For reference, the previous increase to LLVM 19 was rust-lang/rust#139275.
cc ```@rust-lang/wg-llvm```
r? nikic
Stabilize `btree_entry_insert` feature
This stabilises `btree_map::VacantEntry::insert_entry` and `btree_map::Entry::insert_entry`, following the FCP in [tracking issue](https://github.com/rust-lang/rust/issues/65225).
New stable API:
```rust
impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> {
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, A>;
}
impl<'a, K: Ord, V, A: Allocator + Clone> VacantEntry<'a, K, V, A> {
pub fn insert_entry(mut self, value: V) -> OccupiedEntry<'a, K, V, A>;
}
```
(FCP ended almost a year ago, so if it's needed for process we could rerun it)
Closes: https://github.com/rust-lang/rust/issues/65225
libtest: expose --fail-fast as an unstable command-line option
This exposes the `fail_fast` option added in rust-lang/rust#105153 on the test harness command line, so that workflows that only want to know if any test fails can find out without waiting for everything to run. For example, cargo-mutants just needs to know if any tests fails. It only works with `-Zunstable-options`.
Tracking issue: rust-lang/rust#142859
Update cargo submodule
19 commits in 24bb93c388fb8c211a37986539f24a819dc669d3..966f94733bbc94ca51ff9f1e4c49ad250ebbdc50
2025-09-10 23:16:07 +0000 to 2025-09-16 17:24:45 +0000
- fix(frontmatter): Improve error quality (rust-lang/cargo#15972)
- fix: wrong variable name in documentation (rust-lang/cargo#15968)
- Add "Optimizing Build Performance" section to the Cargo book (rust-lang/cargo#15924)
- Remove extra apostrophe in environment-variables.md (rust-lang/cargo#15963)
- Clarify warning for using `features` or `default-features` in `patch` (rust-lang/cargo#15953)
- fix(frontmatter): Try alternative len code fences (rust-lang/cargo#15952)
- feat(cli): Allow completions for third-party subcommand names (rust-lang/cargo#15961)
- docs(index): Clarify what we mean by omitting features (rust-lang/cargo#15957)
- fix(future): Report all content as a single Report (rust-lang/cargo#15943)
- fix(complete): Show local crates/features over other members (rust-lang/cargo#15956)
- docs(resolver): Describe the role of the lockfile (rust-lang/cargo#15958)
- chore: Skip check-version-bump ci job in forks (rust-lang/cargo#15959)
- Eliminate the last three "did you mean" warning phrasings (rust-lang/cargo#15356)
- fix(info): Suggest a more universal `cargo tree` command (rust-lang/cargo#15954)
- feat(cli): Use ellipses when truncating progress (rust-lang/cargo#15955)
- feat(completer): Added completion for `--features` flag (rust-lang/cargo#15309)
- fix(publish): Switch the 'ctrl-c on wait' line to a help message (rust-lang/cargo#15942)
- docs: move docs building process to contributor guide (rust-lang/cargo#15854)
- fix(manifest): Show error source to users (rust-lang/cargo#15939)
r? ghost