about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-03-26Don't set cx.parent to None; it seems unnecessary.Mara Bos-2/+1
2025-03-26Simplify RvalueCandidateType.Mara Bos-34/+19
There is no difference between the Patternand Borrow cases. Reduce it to a simple struct.
2025-03-26Don't record child scopes for patterns.Mara Bos-2/+0
They are unused.
2025-03-26Auto merge of #138956 - jhpratt:rollup-6g7ppwd, r=jhprattbors-413/+632
Rollup of 11 pull requests Successful merges: - #138128 (Stabilize `#![feature(precise_capturing_in_traits)]`) - #138834 (Group test diffs by stage in post-merge analysis) - #138867 (linker: Fix staticlib naming for UEFI) - #138874 (Batch mark waiters as unblocked when resuming in the deadlock handler) - #138875 (Trusty: Fix build for anonymous pipes and std::sys::process) - #138877 (Ignore doctests only in specified targets) - #138885 (Fix ui pattern_types test for big-endian platforms) - #138905 (Add target maintainer information for powerpc64-unknown-linux-musl) - #138911 (Allow defining opaques in statics and consts) - #138917 (rustdoc: remove useless `Symbol::is_empty` checks.) - #138945 (Override PartialOrd methods for bool) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-25Rollup merge of #138945 - DaniPopes:override-partialord-bool, r=scottmcmJacob Pratt-27/+23
Override PartialOrd methods for bool I noticed that `PartialOrd` implementation for `bool` does not override the individual operator methods, unlike the other primitive types like `char` and integers. This commit extracts these `PartialOrd` overrides shared by the other primitive types into a macro and calls it on `bool` too. CC `@scottmcm` for our recent adventures in `PartialOrd` land
2025-03-25Rollup merge of #138917 - nnethercote:rustdoc-remove-useless, r=GuillaumeGomezJacob Pratt-38/+38
rustdoc: remove useless `Symbol::is_empty` checks. There are a number of `is_empty` checks that can never fail. This commit removes them, in support of #137978. r? `@GuillaumeGomez`
2025-03-25Rollup merge of #138911 - compiler-errors:define-opaque, r=oli-obkJacob Pratt-166/+363
Allow defining opaques in statics and consts r? oli-obk Fixes https://github.com/rust-lang/rust/issues/138902
2025-03-25Rollup merge of #138905 - Gelbpunkt:powerpc64-unknown-linux-musl-maintainer, ↵Jacob Pratt-1/+59
r=compiler-errors Add target maintainer information for powerpc64-unknown-linux-musl We intend to fix the outstanding issues on the target and eventually promote it to tier 2. We have the capacity to maintain this target in the future and already perform regular builds of rustc for this target. Currently, all host tools except miri build fine, but I have a patch for libffi-sys to make miri also compile fine for this target that is [pending review](https://github.com/tov/libffi-rs/pull/100). While at it, add an option for the musl root for this target. I also added a kernel version requirement, which is rather arbitrarily chosen, but it matches our tier 2 powerpc64le-unknown-linux-musl target so I think it is a good fit.
2025-03-25Rollup merge of #138885 - fneddy:fix_pattern_types_tests, r=compiler-errorsJacob Pratt-13/+15
Fix ui pattern_types test for big-endian platforms The newly added pattern types validity tests fail on s390x and presumably other big-endian systems, due to print of raw values with padding bytes. To fix the tests remove the raw output values in the error note by `normalize-stderr`.
2025-03-25Rollup merge of #138877 - TaKO8Ki:enable-per-target-ignores-for-doctests, ↵Jacob Pratt-4/+25
r=notriddle Ignore doctests only in specified targets Quick fix for #138863 FIxes #138863 cc `@yotamofek` `@notriddle`
2025-03-25Rollup merge of #138875 - thaliaarchi:trusty-build, r=randomPoison,saethlinJacob Pratt-6/+14
Trusty: Fix build for anonymous pipes and std::sys::process PRs #136842 (Add libstd support for Trusty targets), #137793 (Stablize anonymous pipe), and #136929 (std: move process implementations to `sys`) merged around the same time, so update Trusty to take them into account. cc `@randomPoison`
2025-03-25Rollup merge of #138874 - Zoxc:waiter-race, r=SparrowLii,davidtwcoJacob Pratt-25/+12
Batch mark waiters as unblocked when resuming in the deadlock handler This fixes a race when resuming multiple threads to resolve query cycles. This now marks all threads as unblocked before resuming any of them. Previously if one was resumed and marked as unblocked at a time. The first thread resumed could fall asleep then Rayon would detect a second false deadlock. Later the initial deadlock handler thread would resume further threads. This also reverts the workaround added in https://github.com/rust-lang/rust/pull/137731. cc `@SparrowLii` `@lqd`
2025-03-25Rollup merge of #138867 - petrochenkov:linkfix, r=nnethercoteJacob Pratt-24/+36
linker: Fix staticlib naming for UEFI And one minor refactoring in the second commit.
2025-03-25Rollup merge of #138834 - Kobzol:test-diff-group-by-stage, r=marcoieniJacob Pratt-18/+25
Group test diffs by stage in post-merge analysis I think that this is clearer than including the stage in the test name. To test e.g. on [this PR](https://github.com/rust-lang/rust/pull/138523): ```bash $ curl https://ci-artifacts.rust-lang.org/rustc-builds/282865097d138c7f0f7a7566db5b761312dd145c/metrics-aarch64-gnu.json > metrics.json $ cargo run --manifest-path src/ci/citool/Cargo.toml postprocess-metrics metrics.json --job-name aarch64-gnu --parent d9e5539a39192028a7b15ae596a8685017faecee > out.md ``` r? `@marcoieni`
2025-03-25Rollup merge of #138128 - compiler-errors:precise-capturing-in-traits, ↵Jacob Pratt-91/+22
r=oli-obk,traviscross Stabilize `#![feature(precise_capturing_in_traits)]` # Precise capturing (`+ use<>` bounds) in traits - Stabilization Report Fixes https://github.com/rust-lang/rust/issues/130044. ## Stabilization summary This report proposes the stabilization of `use<>` precise capturing bounds in return-position impl traits in traits (RPITITs). This completes a missing part of [RFC 3617 "Precise capturing"]. Precise capturing in traits was not ready for stabilization when the first subset was proposed for stabilization (namely, RPITs on free and inherent functions - https://github.com/rust-lang/rust/pull/127672) since this feature has a slightly different implementation, and it hadn't yet been implemented or tested at the time. It is now complete, and the type system implications of this stabilization are detailed below. ## Motivation Currently, RPITITs capture all in-scope lifetimes, according to the decision made in the ["lifetime capture rules 2024" RFC](https://rust-lang.github.io/rfcs/3498-lifetime-capture-rules-2024.html#return-position-impl-trait-in-trait-rpitit). However, traits can be designed such that some lifetimes in arguments may not want to be captured. There is currently no way to express this. ## Major design decisions since the RFC No major decisions were made. This is simply an extension to the RFC that was understood as a follow-up from the original stabilization. ## What is stabilized? Users may write `+ use<'a, T>` bounds on their RPITITs. This conceptually modifies the desugaring of the RPITIT to omit the lifetimes that we would copy over from the method. For example, ```rust trait Foo { fn method<'a>(&'a self) -> impl Sized; // ... desugars to something like: type RPITIT_1<'a>: Sized; fn method_desugared<'a>(&'a self) -> Self::RPITIT_1<'a>; // ... whereas with precise capturing ... fn precise<'a>(&'a self) -> impl Sized + use<Self>; // ... desugars to something like: type RPITIT_2: Sized; fn precise_desugared<'a>(&'a self) -> Self::RPITIT_2; } ``` And thus the GAT doesn't name `'a`. In the compiler internals, it's not implemented exactly like this, but not in a way that users should expect to be able to observe. #### Limitations on what generics must be captured Currently, we require that all generics from the trait (including the `Self`) type are captured. This is because the generics from the trait are required to be *invariant* in order to do associated type normalization. And like regular precise capturing bounds, all type and const generics in scope must be captured. Thus, only the in-scope method lifetimes may be relaxed with this syntax today. ## What isn't stabilized? (a.k.a. potential future work) See section above. Relaxing the requirement to capture all type and const generics in scope may be relaxed when https://github.com/rust-lang/rust/issues/130043 is implemented, however it currently interacts with some underexplored corners of the type system (e.g. unconstrained type bivariance) so I don't expect it to come soon after. ## Implementation summary This functionality is implemented analogously to the way that *opaque type* precise capturing works. Namely, we currently use *variance* to model the capturedness of lifetimes. However, since RPITITs are anonymous GATs instead of opaque types, we instead modify the type relation of GATs to consider variances for RPITITs (along with opaque types which it has done since https://github.com/rust-lang/rust/pull/103491). https://github.com/rust-lang/rust/blob/30f168ef811aec63124eac677e14699baa9395bd/compiler/rustc_middle/src/ty/util.rs#L954-L976 https://github.com/rust-lang/rust/blob/30f168ef811aec63124eac677e14699baa9395bd/compiler/rustc_type_ir/src/relate.rs#L240-L244 Using variance to model capturedness is an implementation detail, and in the future it would be desirable if opaques and RPITITs simply did not include the uncaptured lifetimes in their generics. This can be changed in a forwards-compatible way, and almost certainly would not be observable by users (at least not negatively, since it may indeed fix some bugs along the way). ## Tests * Test that the lifetime isn't actually captured: `tests/ui/impl-trait/precise-capturing/rpitit.rs` and `tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs` and `tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs`. * Technical test for variance computation: `tests/ui/impl-trait/in-trait/variance.rs`. * Test that you must capture all trait generics: `tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs`. * Test that you cannot capture more than what the trait specifies: `tests/ui/impl-trait/precise-capturing/rpitit-captures-more-method-lifetimes.rs` and `tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs`. * Undercapturing (refinement) lint: `tests/ui/impl-trait/in-trait/refine-captures.rs`. ### What other unstable features may be exposed by this feature? I don't believe that this exposes any new unstable features indirectly. ## Remaining bugs and open issues Not aware of any open issues or bugs. ## Tooling support Rustfmt: :white_check_mark: Supports formatting `+ use<>` everywhere. Clippy: :white_check_mark: No support needed, unless specific clippy lints are impl'd to care for precise capturing itself. Rustdoc: :white_check_mark: Rendering `+ use<>` precise capturing bounds is supported. Rust-analyzer: :white_check_mark: Parser support, and then lifetime support isn't needed https://github.com/rust-lang/rust/pull/138128#issuecomment-2705292494 (previous: ~~:question: There is parser support, but I am unsure of rust-analyzer's level of support for RPITITs in general.~~) ## History Tracking issue: https://github.com/rust-lang/rust/issues/130044 * https://github.com/rust-lang/rust/pull/131033 * https://github.com/rust-lang/rust/pull/132795 * https://github.com/rust-lang/rust/pull/136554
2025-03-26Auto merge of #138601 - RalfJung:wasm-abi-fcw, r=alexcrichtonbors-29/+302
add FCW to warn about wasm ABI transition See https://github.com/rust-lang/rust/issues/122532 for context: the "C" ABI on wasm32-unk-unk will change. The goal of this lint is to warn about any function definition and calls whose behavior will be affected by the change. My understanding is the following: - scalar arguments are fine - including 128 bit types, they get passed as two `i64` arguments in both ABIs - `repr(C)` structs (recursively) wrapping a single scalar argument are fine (unless they have extra padding due to over-alignment attributes) - all return values are fine `@bjorn3` `@alexcrichton` `@Manishearth` is that correct? I am making this a "show up in future compat reports" lint to maximize the chances people become aware of this. OTOH this likely means warnings for most users of Diplomat so maybe we shouldn't do this? IIUC, wasm-bindgen should be unaffected by this lint as they only pass scalar types as arguments. Tracking issue: https://github.com/rust-lang/rust/issues/138762 Transition plan blog post: https://github.com/rust-lang/blog.rust-lang.org/pull/1531 try-job: dist-various-2
2025-03-25Override PartialOrd methods for boolDaniPopes-27/+23
I noticed that `PartialOrd` implementation for `bool` does not override the individual operator methods, unlike the other primitive types like `char` and integers. This commit extracts these `PartialOrd` overrides shared by the other primitive types into a macro and calls it on `bool` too.
2025-03-25Auto merge of #138933 - matthiaskrgr:rollup-sjtqkoq, r=matthiaskrgrbors-395/+683
Rollup of 8 pull requests Successful merges: - #135745 (Recognise new IPv6 non-global range from IETF RFC 9602) - #137247 (cg_llvm: Reduce the visibility of types, modules and using declarations in `rustc_codegen_llvm`.) - #138317 (privacy: Visit types and traits in impls in type privacy lints) - #138581 (Abort in deadlock handler if we fail to get a query map) - #138776 (coverage: Separate span-extraction from unexpansion) - #138886 (Fix autofix for `self` and `self as …` in `unused_imports` lint) - #138924 (Reduce `kw::Empty` usage, part 3) - #138929 (Visitors track whether an assoc item is in a trait impl or an inherent impl) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-25Rollup merge of #138929 - oli-obk:assoc-ctxt-of-trait, r=compiler-errorsMatthias Krüger-96/+185
Visitors track whether an assoc item is in a trait impl or an inherent impl `AssocCtxt::Impl` now contains an `of_trait` field. This allows ast lowering and nameres to not have to track whether we're in a trait impl or an inherent impl.
2025-03-25Rollup merge of #138924 - nnethercote:less-kw-Empty-3, r=compiler-errorsMatthias Krüger-46/+66
Reduce `kw::Empty` usage, part 3 Remove some more `kw::Empty` uses, in support of #137978. r? `@davidtwco`
2025-03-25Rollup merge of #138886 - samueltardieu:push-xxkzmupznoky, r=jieyouxuMatthias Krüger-1/+105
Fix autofix for `self` and `self as …` in `unused_imports` lint This fixes two problems with the autofixes for the `unused_imports` lint: - `use std::collections::{HashMap, self as coll};` would suggest, when `HashMap` is unused, the incorrect `use std::collections::self as coll;` which does not compile. - `use std::borrow::{self, Cow};` would suggest, when `self` is unused, `use std::borrow::{Cow};`, which contains unnecessary brackets. The first problem was reported in rust-lang/rust-clippy#14450, the second found while fixing the first one. Fix #133750 (thanks to `@richardsamuels` for spotting the duplicate)
2025-03-25Rollup merge of #138776 - Zalathar:unexpand, r=oli-obkMatthias Krüger-90/+81
coverage: Separate span-extraction from unexpansion Historically, coverage instrumentation has relied on eagerly “unexpanding” MIR spans back to ancestor spans that have the same context as the function body, and lie within that body. Doing so makes several subsequent operations more straightforward. In order to support expansion regions, we need to stop doing that, and handle layers of macro-expansion more explicitly. This PR takes a step in that direction, by deferring some of the unexpansion steps, and concentrating them in one place (`spans::extract_refined_covspans`). Unexpansion still takes place as before, but these changes will make it easier to experiment with expansion-aware coverage instrumentation.
2025-03-25Rollup merge of #138581 - Zoxc:abort-handler-if-locked, r=SparrowLiiMatthias Krüger-12/+43
Abort in deadlock handler if we fail to get a query map Resolving query cycles requires the complete active query map, or it may miss query cycles. We did not check that the map is completely constructed before. If there is some error collecting the map, something has gone wrong already. This adds a check to abort/panic if we fail to construct the complete map. This can help differentiate errors from the `deadlock detected` case if constructing query map has errors in practice. An `Option` is not used for `collect_active_jobs` as the panic handler can still make use of a partial map.
2025-03-25Rollup merge of #138317 - petrochenkov:libsearch3, r=compiler-errorsMatthias Krüger-14/+55
privacy: Visit types and traits in impls in type privacy lints With one exception to avoid false positives. Fixes the same issue as https://github.com/rust-lang/rust/pull/134176.
2025-03-25Rollup merge of #137247 - dpaoliello:cleanllvm, r=ZalatharMatthias Krüger-136/+144
cg_llvm: Reduce the visibility of types, modules and using declarations in `rustc_codegen_llvm`. Final part of #135502 Reduces the visibility of types, modules and using declarations in the `rustc_codegen_llvm` to private or `pub(crate)` where possible, and marks unused fields and enum entries with `#[expect(dead_code)]`. r? Zalathar
2025-03-25Rollup merge of #135745 - bardiharborow:std/net/rfc9602, r=cuviperMatthias Krüger-0/+4
Recognise new IPv6 non-global range from IETF RFC 9602 This PR adds the `5f00::/16` range defined by [IETF RFC 9602](https://datatracker.ietf.org/doc/rfc9602/) to those ranges which `Ipv6Addr::is_global` recognises as a non-global IP. This range is used for Segment Routing (SRv6) SIDs. See also: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml Unstable tracking issue: #27709
2025-03-25Test define opaques in extern itemsMichael Goulet-1/+34
2025-03-25Allow defining opaques in statics and constsMichael Goulet-163/+315
2025-03-25Make printing define_opaque less goofyMichael Goulet-7/+19
2025-03-25Auto merge of #138865 - petrochenkov:errwhere, r=jieyouxubors-105/+371
compiletest: Support matching on diagnostics without a span Using `//~? ERROR my message` on any line of the test. The new checks are exhaustive, like all other `//~` checks, and unlike the `error-pattern` directive that is sometimes used now to check for span-less diagnostics. This will allow to eliminate most on `error-pattern` directives in compile-fail tests (except those that are intentionally imprecise due to platform-specific diagnostics). I didn't migrate any of `error-pattern`s in this PR though, except those where the migration was necessary for the tests to pass.
2025-03-25compiletest: Support matching on diagnostics without a spanVadim Petrochenkov-105/+371
2025-03-25Auto merge of #138923 - TaKO8Ki:rollup-f3hkmqj, r=TaKO8Kibors-155/+214
Rollup of 9 pull requests Successful merges: - #138385 (Keyword tweaks) - #138580 (resolve: Avoid some unstable iteration 2) - #138652 (Reintroduce remote-test support in run-make tests) - #138701 (Make default_codegen_backend serializable) - #138755 ([rustdoc] Remove duplicated loop when computing doc cfgs) - #138829 (Slightly reword triagebot ping message for `relnotes-interest-group`) - #138837 (resolve: Avoid remaining unstable iteration) - #138838 (Fix/tweak some tests in new solver) - #138895 (Add a helper for building an owner id in ast lowering) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-25rustdoc: remove useless `Symbol::is_empty` checks.Nicholas Nethercote-38/+38
There are a number of `is_empty` checks that can never fail. This commit removes them.
2025-03-25Avoid some more global stateOli Scherer-22/+35
2025-03-25acquire more accurate HirId for ABI check lintsRalf Jung-19/+37
2025-03-25Track whether an assoc item is in a trait impl or an inherent implOli Scherer-68/+151
2025-03-25Deduplicate assoc item cfg handlingOli Scherer-10/+3
2025-03-25privacy: Visit types and traits in impls in type privacy lintsVadim Petrochenkov-14/+55
2025-03-25allow wasm_c_abi in proc_macro bridgeRalf Jung-0/+4
2025-03-25make -Zwasm-c-abi=legacy suppress the lintRalf Jung-10/+15
2025-03-25add FCW to warn about wasm ABI transitionRalf Jung-13/+259
2025-03-25Use `sym::dummy` for a dummy arg in `parse_fn_params`.Nicholas Nethercote-1/+1
2025-03-25ignore doctests only in specified targetsTakayuki Maeda-4/+25
add necessary lines fix ui test error
2025-03-25Auto merge of #136410 - saethlin:clean-up-cgu-internal-copy, r=compiler-errorsbors-64/+68
Remove InstanceKind::generates_cgu_internal_copy This PR should not contain any behavior changes. Before this PR, the logic for selecting instantiation mode is spread across all of * `instantiation_mode` * `cross_crate_inlinable` * `generates_cgu_internal_copy` * `requires_inline` The last two of those functions are not well-designed. The function that actually decides if we generate a CGU-internal copy is `instantiation_mode`, _not_ `generates_cgu_internal_copy`. The function `requires_inline` documents that it is about the LLVM `inline` attribute and that it is a hint. The LLVM attribute is called `inlinehint`, this function is also used by other codegen backends, and since it is part of instantiation mode selection it is *not* a hint. The goal of this PR is to start cleaning up the logic into a sequence of checks that have a more logical flow and are easier to customize in the future (to do things like improve incrementality or improve optimizations without causing obscure linker errors because you forgot to update another part of the compiler).
2025-03-25Rollup merge of #138895 - oli-obk:dedup-owner-id-creation, r=compiler-errorsTakayuki Maeda-16/+17
Add a helper for building an owner id in ast lowering Just some deduplication of owner-id creations. Will also help me later split up ast lowering into per-owner queries, as it won't be possible anymore to go from a NodeId to a DefId of an owner without doing extra work to check whether we have an owner id. So I'd just do that in the new `owner_id` function and keep the `local_def_id` function free of that logic
2025-03-25Rollup merge of #138838 - compiler-errors:new-solver-crashes-tweaks, r=lcnrTakayuki Maeda-35/+99
Fix/tweak some tests in new solver Bunch of miscellaneous new solver tweaks that I found from the failing tests. Can split these out, but they all seemed small enough to not warrant separate PRs. r? lcnr
2025-03-25Rollup merge of #138837 - petrochenkov:resinstab2, r=jieyouxuTakayuki Maeda-12/+6
resolve: Avoid remaining unstable iteration Continuation of #138580. This should be the performance sensitive part.
2025-03-25Rollup merge of #138829 - jieyouxu:adjust-relnotes-interest-group-desc, ↵Takayuki Maeda-2/+2
r=cuviper Slightly reword triagebot ping message for `relnotes-interest-group` Now that there's also a meta relnotes tracking issue. r? ```@cuviper``` (or release)
2025-03-25Rollup merge of #138755 - GuillaumeGomez:rm-duplicated-loop, r=camelidTakayuki Maeda-38/+21
[rustdoc] Remove duplicated loop when computing doc cfgs Working on implementing https://github.com/rust-lang/rfcs/blob/master/text/3631-rustdoc-cfgs-handling.md and found this weird case where the first loop was actually not doing anything since we were passing `cfg(...)` to `Cfg::parse` instead of `cfg(...)` items. Well, that should be a first nice cleanup before the rest comes in. cc ```@notriddle``` r? ```@camelid```
2025-03-25Rollup merge of #138701 - tvladyslav:serializable_default_codegen_backend, ↵Takayuki Maeda-0/+8
r=workingjubilee Make default_codegen_backend serializable This PR makes default_codegen_backend serializable.