about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-09-08Auto merge of #146333 - matthiaskrgr:rollup-ib80jyw, r=matthiaskrgrbors-0/+15
Rollup of 7 pull requests Successful merges: - rust-lang/rust#146111 (Migrate more things in the new solver to specific `DefId`s) - rust-lang/rust#146298 (GVN: Ensure indirect is first projection in try_as_place.) - rust-lang/rust#146299 (docs(std): add error docs for path canonicalize) - rust-lang/rust#146310 (Allow static regions in `type_name`.) - rust-lang/rust#146313 (Some `rustc_middle` cleanups) - rust-lang/rust#146319 (Fix typo in default.rs) - rust-lang/rust#146320 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-08Rollup merge of #146310 - nnethercote:fix-146249, r=lcnrMatthias Krüger-0/+15
Allow static regions in `type_name`. Fixes rust-lang/rust#146249. r? `@lcnr`
2025-09-08Auto merge of #146165 - folkertdev:c-variadic-errors-take-2, r=lcnrbors-69/+119
improve c-variadic error reporting tracking issue: https://github.com/rust-lang/rust/issues/44930 The parts of https://github.com/rust-lang/rust/pull/143546 that don't require any particular knowledge about c-variadic functions. This prepares the way for rejecting c-variadic functions that are also coroutines, safe functions, or associated functions.
2025-09-08Allow static regions in `type_name`.Nicholas Nethercote-0/+15
Fixes #146249.
2025-09-08Auto merge of #145910 - saethlin:ignore-intrinsic-calls, r=cjgillotbors-0/+15
Ignore intrinsic calls in cross-crate-inlining cost model I noticed in a side project that a function which just compares to `[u64; 2]` for equality is not cross-crate-inlinable. That was surprising to me because I didn't think that code contained a function call, but of course our array comparisons are lowered to an intrinsic. Intrinsic calls don't make a function no longer a leaf, so it makes sense to add this as an exception to the "only leaves" cross-crate-inline heuristic. This is the useful compare link: https://perf.rust-lang.org/compare.html?start=7cb1a81145a739c4fd858abe3c624ce8e6e5f9cd&end=c3f0a64dbf9fba4722dacf8e39d2fe00069c995e&stat=instructions%3Au because it disables CGU merging in both commits, so effects that cause changes in the sysroot to perturb partitioning downstream are excluded. Perturbations to what is and isn't cross-crate-inlinable in the sysroot has chaotic effects on what items are in which CGUs after merging. It looks like before this PR by sheer luck some of the CGUs dirtied by the patch in eza incr-unchanged happened to be merged together, and with this PR they are not. The perf runs on this PR point to a nice runtime performance improvement.
2025-09-07Auto merge of #145541 - cjgillot:dest-prop-live-range, r=Amanieubors-29/+31
Reimplement DestinationPropagation according to live ranges. This PR reimplements DestinationPropagation as a problem of merging live-ranges of locals. We merge locals that have disjoint live-ranges. This allows merging several locals in the same round by updating live range information. Live ranges are mainly computed using the `MaybeLiveLocals` analysis. The subtlety is that we split each statement and terminator in 2 positions. The first position is the regular statement. The second position is a shadow, which is always more live. It encodes partial writes and dead writes as a local being live for half a statement. This half statement ensures that writes conflict with another local's writes and regular liveness. r? `@Amanieu`
2025-09-07Auto merge of #146148 - Flakebi:global-addrspace-test, r=Mark-Simulacrumbors-2/+21
Add amdgpu test for addrspacecasting global vars and the gpu-kernel calling convention Add two tests that can now be added, as the amdgpu is merged. - Global variables are casted to the default address space since rust-lang/rust#135026 - gpu-kernel calling convention, translatos to amdgpu_kernel rust-lang/rust#135047 Tracking issue: rust-lang/rust#135024
2025-09-07Unify a source with all possible destinations.Camille Gillot-34/+36
2025-09-07Use regular MaybeLiveLocals.Camille Gillot-1/+5
2025-09-07Reimplement DestinationPropagation according to live ranges.Camille GILLOT-18/+14
2025-09-07Auto merge of #146289 - cjgillot:gvn-aggregate, r=dianqkbors-2/+73
GVN: Allow reusing aggregates if LHS is not a simple local. This resolves a FIXME in the code. I don't see a reason not to allow this.
2025-09-07Auto merge of #146271 - niacdoial:improperctypes-refactor1, r=tgross35bors-116/+106
lint ImproperCTypes: refactor linting architecture (part 1) This is the first PR in an effort to split rust-lang/rust#134697 into individually-mergeable parts. This one focuses on properly packaging the lint and its tests, as well as properly separate the "linting" and "type-checking" code. There is exactly one user-visible change: the safety of `Option<Box<FFISafePointee>>` is now the same in `extern` blocks and function definitions: it is safe. r? `@tgross35` because you are already looking at the original
2025-09-07Allow simplifying aggregates if LHS is not a simple local.Camille GILLOT-2/+73
2025-09-06Auto merge of #146282 - tgross35:rollup-0n5tjnm, r=tgross35bors-0/+61
Rollup of 5 pull requests Successful merges: - rust-lang/rust#139524 (Add socket extensions for cygwin) - rust-lang/rust#145940 (single buffer for exponent fmt of integers) - rust-lang/rust#146206 (identity uses are ok, even if there are no defining uses) - rust-lang/rust#146272 (Update comment for `-Werror` on LLVM builds) - rust-lang/rust#146280 (Make `LetChainsPolicy` public for rustfmt usage) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-06ImproperCTypes: more pre-emptive cleanupniacdoial-26/+16
Mainly, we realise that the non-null assumption on a Box<_> argument does not depend on what side of the FFI boundary the function is on. And anyway, this is not the way to deal with this assumption being maybe violated.
2025-09-06ImproperCTypes: move code and tests into proper directoriesniacdoial-90/+90
2025-09-06Rollup merge of #146206 - lcnr:fix-non-defining-uses, r=BoxyUwUTrevor Gross-0/+61
identity uses are ok, even if there are no defining uses fix rust-lang/rust#146191 I've tried moving the "is this an identity use" check to `fn clone_and_resolve_opaque_types` and this would allow the following code to compile as it now ignores `Opaque<'!a> = Opaque<'!a>` while they previously resulted in errors https://github.com/rust-lang/rust/blob/71289c378d0a406a4f537fe4001282d19362931f/tests/ui/type-alias-impl-trait/hkl_forbidden.rs#L42-L46 The closure signature gets inferred to `for<'a> fn(&'a ()) -> Inner<'a>`. The closure then has a defining use `Inner<'a_latbound> = &'a_latebound ()` while the parent function has a non-defining `Inner<'!a> = Inner<'!a>`. By eagerly discarding identity uses we don't error on the non-defining use in the parent. r? `@BoxyUwU`
2025-09-06Auto merge of #146233 - jieyouxu:run-make-fission, r=Kobzolbors-1/+1
Split `run-make` into two {`run-make`,`run-make-cargo`} test suites ## Summary Split `tests/run-make` into two test suites, to make it faster and more convenient for contributors to run run-make tests that do not need in-tree `cargo`. | New test suites | Explanation | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `tests/run-make` | The "fast path" test suite intended for run-make tests that do not need in-tree `cargo`. These tests may not use `cargo`. | | `tests/run-make-cargo` | The "slow path" test suite that requires checking out `cargo` submodule and building in-tree `cargo`, and thus will have access to in-tree `cargo`. In practice, these constitute a very small portion of the original `run-make` tests. | This PR carries out [MCP 847: Split run-make test suite into slower-building test suite with suitably-staged cargo and faster-building test suite without cargo](https://github.com/rust-lang/compiler-team/issues/847). Fixes rust-lang/rust#135573 (for the tests that do not need in-tree `cargo`). Fixes rust-lang/rust#134109. ## Remarks - I considered if we want to split by in-tree tools previously. However, as discussed rust-lang/rust#134109, in practice `rustdoc` is not very slow to build, but `cargo` takes a good few minutes. So, the partition boundary was determined to be along in-tree `cargo` availability. - The `run-make` tests previously that wanted to use `cargo` cannot just use the bootstrap `cargo`, otherwise they would run into situations where bootstrap `cargo` can significantly diverge from in-tree `cargo` (see https://github.com/rust-lang/rust/pull/130642). --- try-job: aarch64-msvc-1 try-job: test-various try-job: x86_64-gnu-debug try-job: aarch64-gnu-debug try-job: aarch64-apple try-job: dist-various-1
2025-09-06Auto merge of #146232 - bjorn3:lto_allocator_shim, r=lqdbors-0/+19
Make the allocator shim participate in LTO again This is likely the cause of the perf regression in https://github.com/rust-lang/rust/pull/145955. It also caused some functional regressions. Fixes https://github.com/rust-lang/rust/issues/146235 Fixes https://github.com/rust-lang/rust/issues/146239
2025-09-06identity uses are ok, even if there are no defining useslcnr-0/+61
2025-09-06Add test that __rg_oom doesn't get internalized during LTObjorn3-0/+19
Co-Authored-By: Rémy Rakic <remy.rakic+github@gmail.com>
2025-09-06Rollup merge of #146211 - Urgau:cfg-disallow-shebang, r=fmeaseMatthias Krüger-7/+33
Disallow shebang in `--cfg` and `--check-cfg` arguments This PR is similar to https://github.com/rust-lang/rust/issues/146130, where we disallowed frontmatter in `--cfg` and `--check-cfg` arguments. While fixing the other one we also discovered that shebang `#!/usr/bin/shebang` are currently also allowed in `--cfg` and `--check-cfg` arguments. Allowing shebang in them (which are just ignored) was never intended, this PR fixes that by not stripping shebang for `--cfg` and `--check-cfg` arguments. This is technically a breaking-change, although I don't expect anyone to actually rely on this unintended behavior. Fixes https://github.com/rust-lang/rust/issues/146130#issuecomment-3246299499 r? fmease
2025-09-06Rollup merge of #144801 - estebank:issue-144734, r=spastorinoMatthias Krüger-4/+68
Suggest bounds in more cases, accounting for type parameters referenced in predicate Use a `ty::Visitor` to see if the failed predicate references a type parameter. If it does, then we only suggest adding a bound to an (associated) item only if the referenced parameter is present in its generics. Provide adding bound suggestion in trait and impl associated functions in cases we previously weren't: ``` error[E0277]: `?` couldn't convert the error to `ApplicationError` --> $DIR/suggest-complex-bound-on-method.rs:18:16 | LL | t.run()?; | -----^ the trait `From<<T as Trait>::Error>` is not implemented for `ApplicationError` | | | this can't be annotated with `?` because it has type `Result<_, <T as Trait>::Error>` | note: `ApplicationError` needs to implement `From<<T as Trait>::Error>` --> $DIR/suggest-complex-bound-on-method.rs:12:1 | LL | enum ApplicationError { | ^^^^^^^^^^^^^^^^^^^^^ = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn thing<T: Trait>(&self, t: T) -> Result<(), ApplicationError> where ApplicationError: From<<T as Trait>::Error> { | +++++++++++++++++++++++++++++++++++++++++++++++++ ``` Fix rust-lang/rust#144734.
2025-09-06clean up some old const trait impl syntaxNathaniel McCallum-4/+4
2025-09-05Ignore intrinsic calls in cross-crate-inlining cost modelBen Kimock-0/+15
2025-09-06Disallow shebang in `--cfg` and `--check-cfg` argumentsUrgau-7/+33
2025-09-05Rollup merge of #146242 - GuillaumeGomez:rustdoc-gui-scrape, r=lolbinarycatLeón Orell Valerian Liehr-2/+4
Ensure that `--html-after-content` option is used to check `scrape_examples_ice` rustdoc GUI test Follow-up of https://github.com/rust-lang/rust/pull/146091. This test ensures that the spans are correctly handled when a "local source file" is not the first in the file list. To ensure it's actually what's tested, this test checks that the option is actually used by adding an element. r? `@lolbinarycat`
2025-09-05Rollup merge of #138944 - madsmtm:apple_os_version_check, r=tgross35León Orell Valerian Liehr-0/+43
Add `__isPlatformVersionAtLeast` and `__isOSVersionAtLeast` symbols ## Motivation When Objective-C code uses ```@available(...)`,`` Clang inserts a call to [`__isPlatformVersionAtLeast`](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/compiler-rt/lib/builtins/os_version_check.c#L276) (`__isOSVersionAtLeast` in older Clang versions). These symbols not being available sometimes ends up causing linker errors. See the new test `tests/run-make/apple-c-available-links` for a minimal reproducer. The workaround is to link `libclang_rt.osx.a`, see e.g. https://github.com/alexcrichton/curl-rust/issues/279. But that's very difficult for users to figure out (and the backreferences to that issue indicates that people are still running into this in their own projects every so often). For another recent example, this is preventing `rustc` from using LLVM assertions on macOS, see https://github.com/rust-lang/rust/pull/62592#issuecomment-510670657 and https://github.com/rust-lang/rust/pull/134275#issuecomment-2543067830. It is also a blocker for [setting the correct minimum OS version in `cc-rs`](https://github.com/rust-lang/rust/issues/136113), since fixing this in `cc-rs` might end up introducing linker errors in places where we weren't before (by default, if using e.g. ```@available(macos`` 10.15, *)`, the symbol usually happens to be left out, since `clang` defaults to compiling for the host macOS version, and thus things _seem_ to work - but the availability check actually compiles down to nothing, which is a huge correctness footgun for running on older OSes). (My super secret evil agenda is also to expose some variant of ```@available``` in Rust's `std` after https://github.com/rust-lang/rfcs/pull/3750 progresses further, will probably file an ACP for this later. But I believe this PR has value regardless of those future plans, since we'd be making C/Objective-C/Swift interop easier). ## Solution Implement `__isPlatformVersionAtLeast` and `__isOSVersionAtLeast` as part of the "public ABI" that `std` exposes. **This is insta-stable**, in the same sense that additions to `compiler-builtins` are insta-stable, though the availability of these symbols can probably be considered a "quality of implementation" detail rather than a stable promise. I originally proposed to implement this in `compiler-builtins`, see https://github.com/rust-lang/compiler-builtins/pull/794, but we discussed moving it to `std` instead ([Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Provide.20.60__isPlatformVersionAtLeast.60.20in.20.60std.60.3F/with/507880717)), which makes the implementation substantially simpler, and we avoid gnarly issues with requiring the user to link `libSystem.dylib` (since `std` unconditionally does that). Note that this does not solve the linker errors for (pure) `#![no_std]` users, but that's _probably_ fine, if you are using ```@available``` to test the OS version on Apple platforms, you're likely also using `std` (and it is still possible to work around by linking `libclang_rt.*.a`). A thing to note about the implementation, I've choosen to stray a bit from LLVM's upstream implementation, and not use `_availability_version_check` since [it has problems when compiling with an older SDK](https://github.com/llvm/llvm-project/issues/64227). Instead, we use `sysctl kern.osproductversion` when available to still avoid the costly PList lookup in most cases, but still with a fall back to the PList lookup when that is not available (with the PList fallback being is similar to LLVM's implementation). ## Testing Apple has a lot of different "modes" that they can run binaries in, which can be a bit difficult to find your bearings in, but I've tried to be as thorough as I could in testing them all. Tested using roughly the equivalent of `./x test library/std -- platform_version` on the following configurations: - macOS 14.7.3 on a Macbook Pro M2 - `aarch64-apple-darwin` - `x86_64-apple-darwin` (under Rosetta) - `aarch64-apple-ios-macabi` - `x86_64-apple-ios-macabi` (under Rosetta) - `aarch64-apple-ios` (using Xcode's "Designed for iPad" setting) - `aarch64-apple-ios-sim` (in iOS Simulator, as iPhone with iOS 17.5) - `aarch64-apple-ios-sim` (in iOS Simulator, as iPad with iOS 18.2) - `aarch64-apple-tvos-sim` (in tvOS Simulator) - `aarch64-apple-watchos-sim` (in watchOS Simulator) - `aarch64-apple-ios-sim` (in visionOS simulator, using Xcode's "Designed for iPad" setting) - `aarch64-apple-visionos-sim` (in visionOS Simulator) - macOS 15.3.1 VM - `aarch64-apple-darwin` - `aarch64-apple-ios-macabi` - macOS 10.12.6 on an Intel Macbook from 2013 - `x86_64-apple-darwin` - `i686-apple-darwin` - `x86_64-apple-ios` (in iOS Simulator) - iOS 9.3.6 on a 1st generation iPad Mini - `armv7-apple-ios` with an older compiler Along with manually inspecting the output of `version_from_sysctl()` and `version_from_plist()`, and verifying that they actually match what's expected. I believe the only real omissions here would be: - `aarch64-apple-ios` on a newer iPhone that has `sysctl` available (iOS 11.4 or above). - `aarch64-apple-ios` on a Vision Pro using Xcode's "Designed for iPad" setting. But I don't have the hardware available to test those. ``@rustbot`` label O-apple A-linkage -T-compiler -A-meta -A-run-make try-job: aarch64-apple
2025-09-05Add __isOSVersionAtLeast and __isPlatformVersionAtLeast symbolsMads Marquart-0/+43
Allows users to link to Objective-C code using `@available(...)`.
2025-09-05tests: update test instruction in `thumb-none-cortex-m`Jieyou Xu-1/+1
2025-09-05tests: move `run-make` tests requiring in-tree cargo to `run-make-cargo` ↵Jieyou Xu-0/+0
test suite
2025-09-05Ensure that `--html-after-content` option is used to check ↵Guillaume Gomez-2/+4
`scrape_examples_ice` rustdoc GUI test
2025-09-05Auto merge of #146044 - estebank:issue-88727, r=chenyukangbors-7/+270
Suggest parentheses when `match` or `if` expression in binop is parsed as statement ``` error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:81:5 | LL | match () { _ => true } && match () { _ => true }; | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool` | help: parentheses are required to parse this as an expression | LL | (match () { _ => true }) && match () { _ => true }; | + + ``` Address the common case from rust-lang/rust#88727. The original parse error is still outstanding, but the cases brought up in the thread are resolved.
2025-09-05Auto merge of #146224 - tgross35:rollup-1bgjms3, r=tgross35bors-12/+286
Rollup of 5 pull requests Successful merges: - rust-lang/rust#144342 (add exact bitshifts) - rust-lang/rust#145709 (Fix LoongArch C function ABI when passing/returning structs containing floats) - rust-lang/rust#146152 (Unify and deduplicate algebraic float tests) - rust-lang/rust#146207 (std: Implement WASIp2-specific stdio routines) - rust-lang/rust#146217 (fix ICE when suggesting `::new`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-05Rollup merge of #146217 - lukas-code:suggest-new-ice, r=compiler-errorsTrevor Gross-4/+64
fix ICE when suggesting `::new` fixes https://github.com/rust-lang/rust/issues/146174 This code suggests to write `Foo::new(...)` when the user writes `Foo(...)` or `Foo { ... }` and the constructor is private, where `new` is some associated function that returns `Self`. When checking that the return type of `new` is `Self`, we need to instantiate the parameters of `new` with infer vars, so we don't end up with a type like `Box<$param(0)>` in a context that doesn't have any parameters. But then we can't use `normalize_erasing_late_bound_regions` anymore because that goes though a query that can't deal with infer vars. Since this is diagnostic-only code that is supposed to check for exactly `-> Self`, I think it's fine to just skip normalizing here, especially since The Correct Way<sup>TM</sup> would involve a probe and make this code even more complicated. Also, the code here does almost the same thing, and these suggestions can probably be unified in the future: https://github.com/rust-lang/rust/blob/4ca8078d37c53ee4ff8fb32b4453b915116f25b8/compiler/rustc_hir_typeck/src/method/suggest.rs#L2123-L2129 r? ````@compiler-errors```` cc ````@Qelxiros```` -- this should unblock https://github.com/rust-lang/rust/pull/144420
2025-09-05Rollup merge of #145709 - heiher:issue-145692-1, r=jackh726Trevor Gross-8/+222
Fix LoongArch C function ABI when passing/returning structs containing floats Similar to RISC-V, LoongArch passes structs containing only one or two floats (or a float–integer pair) in registers, as long as each element fits into a single corresponding register. Before this PR, Rust did not check the actual offset of the second float or integer; instead, it assumed the standard offset based on the default alignment. However, since the offset can be affected by `#[repr(align(N))]` and `#[repr(packed)]`, this led to miscompilations (see rust-lang/rust#145692). This PR fixes the issue by explicitly specifying the offset for the remainder of the cast.
2025-09-05Auto merge of #144737 - petrochenkov:extprelcache, r=davidtwcobors-13/+1
resolve: Avoid finalizing extern prelude entries more than once
2025-09-04Auto merge of #138736 - azhogin:azhogin/sanitizers-target-modificators, ↵bors-61/+229
r=rcvalle Sanitizers target modificators Depends on bool flag fix: https://github.com/rust-lang/rust/pull/138483. Some sanitizers need to be target modifiers, and some do not. For now, we should mark all sanitizers as target modifiers except for these: AddressSanitizer, LeakSanitizer For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier. Many test errors was with sanizer flags inconsistent with std deps. Tests are fixed with `-C unsafe-allow-abi-mismatch`.
2025-09-04fix ICE when suggesting `::new`Lukas Markeffsky-4/+64
2025-09-04Rollup merge of #146150 - weihanglo:rustdoc-emit, r=aDotInTheVoidStuart Cook-0/+12
fix(rustdoc): match rustc `--emit` precedence Resolves rust-lang/rust#141664 This changes rustdoc's `--emit` to allow only one instance of each type, regardless of the actual data that `--emit` carries. This matches rustc's `--emit` behavior. As of the writing, only `dep-info` emit type carries extra data.
2025-09-04Rollup merge of #146137 - Urgau:cfg-disallow-frontmatter, r=fmeaseStuart Cook-0/+45
Disallow frontmatter in `--cfg` and `--check-cfg` arguments This PR disallows the frontmatter syntax in `--cfg` and `--check-cfg` arguments. Fixes https://github.com/rust-lang/rust/issues/146130 r? fmease
2025-09-04Rollup merge of #146131 - notriddle:rustdoc-search-load-itemtype-test, ↵Stuart Cook-0/+170
r=GuillaumeGomez rustdoc-search: add test case for indexing every item type Test case for https://github.com/rust-lang/rust/pull/146117
2025-09-04Rollup merge of #146112 - scrabsha:push-utkysktvulto, r=WaffleLapkinStuart Cook-233/+233
don't uppercase error messages
2025-09-04Rollup merge of #145962 - bjorn3:linkage_fixes, r=WaffleLapkinStuart Cook-0/+16
Ensure we emit an allocator shim when only some crate types need one Found this while trying to write a test for https://github.com/rust-lang/rust/pull/145955.
2025-09-04Rollup merge of #145932 - JamieCunliffe:target-feature-inlining, r=jackh726Stuart Cook-12/+154
Allow `inline(always)` with a target feature behind a unstable feature `target_feature_inline_always`. Rather than adding the inline always attribute to the function definition, we add it to the callsite. We can then check that the target features match and that the call would be safe to inline. If the function isn't inlined due to a mismatch, we emit a warning informing the user that the function can't be inlined due to the target feature mismatch. See tracking issue rust-lang/rust#145574
2025-09-04Rollup merge of #145827 - estebank:issue-51976, r=jackh726Stuart Cook-46/+639
On unused binding or binding not present in all patterns, suggest potential typo of unit struct/variant or const When encountering an or-pattern with a binding not available in all patterns, look for consts and unit struct/variants that have similar names as the binding to detect typos. ``` error[E0408]: variable `Ban` is not bound in all patterns --> $DIR/binding-typo.rs:22:9 | LL | (Foo, _) | (Ban, Foo) => {} | ^^^^^^^^ --- variable not in all patterns | | | pattern doesn't bind `Ban` | help: you might have meant to use the similarly named unit variant `Bar` | LL - (Foo, _) | (Ban, Foo) => {} LL + (Foo, _) | (Bar, Foo) => {} | ``` For items that are not in the immedate scope, suggest the full path for them: ``` error[E0408]: variable `Non` is not bound in all patterns --> $DIR/binding-typo-2.rs:51:16 | LL | (Non | Some(_))=> {} | --- ^^^^^^^ pattern doesn't bind `Non` | | | variable not in all patterns | help: you might have meant to use the similarly named unit variant `None` | LL - (Non | Some(_))=> {} LL + (core::option::Option::None | Some(_))=> {} | ``` When encountering a typo in a pattern that gets interpreted as an unused binding, look for unit struct/variant of the same type as the binding: ``` error: unused variable: `Non` --> $DIR/binding-typo-2.rs:36:9 | LL | Non => {} | ^^^ | help: if this is intentional, prefix it with an underscore | LL | _Non => {} | + help: you might have meant to pattern match on the similarly named variant `None` | LL - Non => {} LL + std::prelude::v1::None => {} | ``` Suggest constant on unused binding in a pattern ``` error: unused variable: `Batery` --> $DIR/binding-typo-2.rs:110:9 | LL | Batery => {} | ^^^^^^ | help: if this is intentional, prefix it with an underscore | LL | _Batery => {} | + help: you might have meant to pattern match on the similarly named constant `Battery` | LL | Battery => {} | + ``` Fix rust-lang/rust#51976.
2025-09-04Rollup merge of #145342 - dianne:if-let-super-let, r=nnethercoteStuart Cook-0/+112
fix drop scope for `super let` bindings within `if let` Fixes rust-lang/rust#145328 by making non-lifetime-extended `super let` reuse the logic used to compute drop scopes for non-lifetime-extended temporaries. Also fixes rust-lang/rust#145374, which regressed due to rust-lang/rust#143376 introducing `if let`-like scopes for match arms with guards. Tracking issue for `super let`: rust-lang/rust#139076 This is a regression fix / breaking change for macros stably exposing `super let`, including `pin!` and `format_args!`. Nominating to be discussed alongside rust-lang/rust#145328: ```@rustbot``` label +I-lang-nominated +I-libs-api-nominated
2025-09-03Auto merge of #146133 - rcvalle:rust-cfi-fix-145981, r=bjorn3bors-22/+0
Revert "Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins` This reverts commit cf8753e4f9c3597f04cd5d3aa261e4561d5378a6 (PR https://github.com/rust-lang/rust/pull/145368) and fix the regressions reported at rust-lang/rust#145981, rust-lang/rust#146109, and rust-lang/rust#146145.
2025-09-03simplify `check_c_variadic_type`Folkert de Vries-69/+90
2025-09-03test valid cases of c-variadic function definitionsFolkert de Vries-0/+29