about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2025-10-02Auto merge of #147138 - jackh726:split-canonical-bound, r=lcnrbors-9/+13
Split Bound index into Canonical and Bound See [#t-types/trait-system-refactor > perf `async-closures/post-mono-higher-ranked-hang.rs`](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/perf.20.60async-closures.2Fpost-mono-higher-ranked-hang.2Ers.60/with/541535613) for context Things compile and tests pass, but not sure if this actually solves the perf issue (edit: it does). Opening up this to do a perf (and maybe crater) run. r? lcnr
2025-10-01Auto merge of #147235 - matthiaskrgr:rollup-a0es1x9, r=matthiaskrgrbors-34/+83
Rollup of 8 pull requests Successful merges: - rust-lang/rust#146593 (Allow specifying multiple bounds for same associated item, except in trait objects) - rust-lang/rust#147177 ([DebugInfo] Fix MSVC tuple child creation) - rust-lang/rust#147195 (iter repeat: add tests for new count and last behavior) - rust-lang/rust#147202 (Swap order of `resolve_coroutine_interiors` and `handle_opaque_type_uses`) - rust-lang/rust#147204 (Refactor ArrayWindows to use a slice) - rust-lang/rust#147219 (Add proper error handling for closure in impl) - rust-lang/rust#147226 (include `outer_inclusive_binder` of pattern types) - rust-lang/rust#147230 (Fix typo in 'unfulfilled_lint_expectation' to plural) r? `@ghost` `@rustbot` modify labels: rollup
2025-10-01Rollup merge of #147219 - Kivooeo:typeof-is-imposter, r=jdonszelmannMatthias Krüger-9/+10
Add proper error handling for closure in impl Fixes https://github.com/rust-lang/rust/issues/147146 Fixes https://github.com/rust-lang/rust/issues/146620 Not sure if it can cause any regressions or anything, as for test also have no idea where to store this one cc ```@theemathas``` r? compiler
2025-10-01Rollup merge of #146593 - Jules-Bertholet:restrict-e0719, r=BoxyUwUMatthias Krüger-25/+73
Allow specifying multiple bounds for same associated item, except in trait objects Supersedes https://github.com/rust-lang/rust/pull/143146, fixes https://github.com/rust-lang/rust/issues/143143. This PR proposes to stop enforcing E0719 in all contexts other than trait object types. E0719 forbids constraining the same associated item twice within the same angle-bracket delimited associated item bound list (the `…` inside `T: Trait<…>`). For example, the following are forbidden: | Forbidden | Working alternative | |--------------------------------------------|--------------------------------------------------------------------| | `T: Trait<Gat<u32> = u32, Gat<u64> = u64>` | `T: Trait<Gat<u32> = u32> + Trait<Gat<u64> = u64>` | | `T: Iterator<Item = u32, Item = i32>` | `T: Iterator<Item = u32> + Iterator<Item = i32>` (trivially false) | | `T: Iterator<Item = u32, Item = u32>` | `T: Iterator<Item = u32>` | | `T: Iterator<Item: Send, Item: Sync>` | `T: Iterator<Item: Send + Sync>` | | `T: Trait<ASSOC = 3, ASSOC = 4>` | `T: Trait<ASSOC = 3> + Trait<ASSOC = 4>` (trivially false) | | `T: Trait<ASSOC = 3, ASSOC = 3>` | `T: Trait<ASSOC = 3>` | With this PR, all those previously forbidden examples would start working, as well as their APIT and RPIT equivalents. Types like `dyn Iterator<Item = u32, Item = u32>` will continue to be rejected, however. See https://github.com/rust-lang/rust/pull/143146#issuecomment-3274421752 for the reason why. ```@rustbot``` label T-lang T-types needs-fcp
2025-10-01added error for closures case in implKivooeo-9/+10
2025-10-01Rollup merge of #146980 - hkBst:hir-analysis-1, r=jdonszelmannStuart Cook-28/+25
simplify setup_constraining_predicates, and note it is potentially cubic
2025-09-30Split Bound into Canonical and Boundjackh726-9/+13
2025-09-30Rollup merge of #147109 - BoxyUwU:rename_concrete_opaques, r=lcnrStuart Cook-8/+8
Rename various "concrete opaque type" things to say "hidden type" r? lcnr I've found "concrete opaque type" terminology to be somewhat confusing as in conversation and when explaining opaque type stuff to people I always just talk about things in terms of hidden types. Also the hidden types of opaques are very much not *concrete* in the same sense that a type without any generic parameters is concrete which is an unfortunate overlap in terminology. I've tried to update comments to also stop referring to things as concrete opaque types but this is mostly best effort as it difficult to find all such cases amongst the massive amounts of uses of "concrete" or "hidden" across the whole compiler.
2025-09-30Rollup merge of #146649 - folkertdev:cmse-call-erase-regions, r=lcnrStuart Cook-0/+1
cmse: fix 'region variables should not be hashed' tracking issue: https://github.com/rust-lang/rust/issues/81391 fixes https://github.com/rust-lang/rust/issues/131639 Some background: the `cmse-nonsecure-call` calling convention is used for a call from "secure" to "non-secure" code. To make sure that "non-secure" cannot read any secrets, restrictions are put on the signatures of functions with this calling convention: they can only use 4 arguments for passing arguments, and one register for passing a result. No arguments are passed via the stack, and all other registers are cleared before the call. We check during `hir_ty_lowering` that the signature follows these rules. We do that by determining and then inspecting the layout of the type. That works well overall, but can run into asserts when the type itself is ill-formed. This PR fixes one such case. I believe that the fix here, just erasing the regions, is the right shape, but there may be some nuance that I'm missing. r? types
2025-09-30Auto merge of #147143 - estebank:verbose-ret-type, r=fee1-deadbors-2/+2
Make replacement suggestion `_` in type verbose ``` error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/in-signature.rs:6:21 | LL | fn arr_fn() -> [u8; _] { | ^ not allowed in type signatures | help: replace with the correct return type | LL - fn arr_fn() -> [u8; _] { LL + fn arr_fn() -> [u8; 3] { | ```
2025-09-29flatten conditional blockMarijn Schouten-4/+1
2025-09-29Add `overlapping_assoc_constraints` param to `lower_bounds`Jules Bertholet-6/+37
2025-09-29Auto merge of #147151 - Zalathar:rollup-w81rn0j, r=Zalatharbors-2/+2
Rollup of 5 pull requests Successful merges: - rust-lang/rust#146653 (improve diagnostics for empty attributes) - rust-lang/rust#146987 (impl Ord for params and use unstable sort) - rust-lang/rust#147101 (Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library ) - rust-lang/rust#147123 (Fix removed version numbers of `doc_auto_cfg` and `doc_cfg_hide`) - rust-lang/rust#147149 (add joboet to library review rotation) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-29Rollup merge of #146987 - hkBst:sort-params-1, r=nnethercoteStuart Cook-2/+2
impl Ord for params and use unstable sort AFAICT we are only sorting to find duplicates, so unstable sort should work fine, and maybe is a tiny bit faster?
2025-09-29Make replacement suggestion `_` in type verboseEsteban Küber-2/+2
``` error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/in-signature.rs:6:21 | LL | fn arr_fn() -> [u8; _] { | ^ not allowed in type signatures | help: replace with the correct return type | LL - fn arr_fn() -> [u8; _] { LL + fn arr_fn() -> [u8; 3] { | ```
2025-09-28remove explicit deref of AbiAlign for most methodsJubilee Young-1/+1
Much of the compiler calls functions on Align projected from AbiAlign. AbiAlign impls Deref to its inner Align, so we can simplify these away. Also, it will minimize disruption when AbiAlign is removed. For now, preserve usages that might resolve to PartialOrd or PartialEq, as those have odd inference.
2025-09-27Rename various "concrete opaque type" terminology to say "hidden type"Boxy Uwu-8/+8
2025-09-25Rollup merge of #146667 - calebzulawski:simd-mono-lane-limit, r=lcnr,RalfJungStuart Cook-0/+1
Add an attribute to check the number of lanes in a SIMD vector after monomorphization Allows std::simd to drop the `LaneCount<N>: SupportedLaneCount` trait and maintain good error messages. Also, extends rust-lang/rust#145967 by including spans in layout errors for all ADTs. r? ``@RalfJung`` cc ``@workingjubilee`` ``@programmerjake``
2025-09-24Address review commentsJules Bertholet-7/+22
2025-09-24impl Ord for params and use unstable sortMarijn Schouten-2/+2
2025-09-24simplify setup_constraining_predicates, and note it is potentially cubicMarijn Schouten-26/+26
2025-09-23Add an attribute to check the number of lanes in a SIMD vector after ↵Caleb Zulawski-0/+1
monomorphization Unify zero-length and oversized SIMD errors
2025-09-23Make missed precondition-free float intrinsics safeltdk-0/+8
2025-09-22Auto merge of #146683 - clarfonthey:safe-intrinsics, r=RalfJung,Amanieubors-58/+126
Mark float intrinsics with no preconditions as safe Note: for ease of reviewing, the list of safe intrinsics is sorted in the first commit, and then safe intrinsics are added in the second commit. All *recently added* float intrinsics have been correctly marked as safe to call due to the fact that they have no preconditions. This adds the remaining float intrinsics which are safe to call to the safe intrinsic list, and removes the unsafe blocks around their calls. --- Side note: this may want a try run before being added to the queue, since I'm not sure if there's any tier-2 code that uses these intrinsics that might not be tested on the usual PR flow. We've already uncovered a few places in subtrees that do this, and it's worth double-checking before clogging up the queue.
2025-09-21Mark float intrinsics with no preconditions as safeltdk-0/+64
2025-09-21Rollup merge of #146551 - folkertdev:cmse-entry-c-variadic, r=workingjubileeStuart Cook-0/+6
fix issue with `cmse-nonsecure-entry` ABI being both async and c-variadic tracking issue: https://github.com/rust-lang/rust/issues/75835 fixes https://github.com/rust-lang/rust/issues/132142 An `extern "cmse-nonsecure-entry"` function cannot be c-variadic (or, in any case, clang/LLVM does not support it, see https://godbolt.org/z/MaPjzGcE1). So just stop looking at the type if we know it'll be invalid anyway. I'm not entirely sure how to test this. The ICE is only possible on the `thumbv8m.main-none-eabi` and some related targets. I think using `minicore` is the most convenient, but use of `async` requires quite a long list of lang items to be present. Maybe we want that anyway though? On the other hand, it's extra `minicore` surface that might go out of date. An alternative is `run-make`, that should work, but is much less convenient. See also [#t-compiler/help > &#96;async fn&#96; and &#96;minicore&#96;](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.60async.20fn.60.20and.20.60minicore.60/with/539427262). r? `@ghost`
2025-09-18Auto merge of #145993 - lcnr:allow-calling-opaques, r=BoxyUwUbors-2/+13
`-Znext-solver` allow `ExprKind::Call` for not-yet defined opaques Based on https://github.com/rust-lang/rust/pull/146329. Revival of rust-lang/rust#140496. See the comment on `OpaqueTypesJank`. I've used the following document while working on this https://hackmd.io/Js61f8PRTcyaiyqS-fH9iQ. Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/181. It does introduce one subtle footgun we may want to handle before stabilization, opened https://github.com/rust-lang/trait-system-refactor-initiative/issues/230 for that. Also cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/231 for deref and index operations r? `@BoxyUwU`
2025-09-18Enforce E0719 only for trait aliasesJules Bertholet-17/+19
2025-09-18support calls on opaque types :<lcnr-2/+13
2025-09-18Rollup merge of #146664 - fmease:clean-up-dyn, r=jdonszelmannStuart Cook-561/+555
Clean up `ty::Dynamic` 1. As a follow-up to PR rust-lang/rust#143036, remove `DynKind` entirely. 2. Inside HIR ty lowering, consolidate modules `dyn_compatibility` and `lint` into `dyn_trait` * `dyn_compatibility` wasn't about dyn compatibility itself, it's about lowering trait object types * `lint` contained dyn-Trait-specific diagnostics+lints only
2025-09-17Sort safe intrinsic listltdk-58/+62
2025-09-17Rollup merge of #145838 - dianne:non-extending-super-let, r=jackh726,traviscrossStuart Cook-5/+19
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). Closes rust-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
2025-09-17Merge modules dyn_compatibility and lint into dyn_traitLeón Orell Valerian Liehr-550/+550
2025-09-17Remove `DynKind`León Orell Valerian Liehr-12/+6
2025-09-16Rollup merge of #146442 - Qelxiros:trait-suggestion-generics, r=BoxyUwUMatthias Krüger-11/+33
Display ?Sized, const, and lifetime parameters in trait item suggestions across a crate boundary context: rust-lang/rust#145929 This fixes the MetaSized issue and adds const generics and early bound lifetimes. Late bound lifetimes are harder because they aren't returned by `generics_of`. I'm going to look into it, but there's no guarantee I'll be successful. Fixes https://github.com/rust-lang/rust/issues/146404. r? `@BoxyUwu`
2025-09-16cmse: fix 'region variables should not be hashed'Folkert de Vries-0/+1
2025-09-16handle const generics, ?Sized, early bound lifetimesJeremy Smart-11/+33
2025-09-16fix issue with `cmse-nonsecure-entry` ABI being both async and c-variadicFolkert de Vries-0/+6
2025-09-16Rollup merge of #145095 - tiif:unstable_const_param, r=BoxyUwUStuart Cook-24/+4
Migrate `UnsizedConstParamTy` to unstable impl of `ConstParamTy_` Now that we have ``#[unstable_feature_bound]``, we can remove ``UnsizedConstParamTy`` that was meant to be an unstable impl of stable type and ``ConstParamTy_`` trait. r? `@BoxyUwU`
2025-09-15Remove UnsizedConstParamTy trait and make it into an unstable impltiif-24/+4
2025-09-13Auto merge of #146491 - ↵bors-8/+3
jdonszelmann:update-fixme-compare_method_predicate_entailment, r=lcnr update fixme in compare_method_predicate_entailment resulting from review of EII r? `@lcnr` Just the comment update separately from https://github.com/rust-lang/rust/pull/146348/files since it doesn't really belong in that PR. Should be trivial
2025-09-13update fixme in compare_method_predicate_entailment resulting from review of EIIJana Dönszelmann-8/+3
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-16/+20
2025-09-12Introduce hir::ImplItemImplKindCameron Steffen-1/+1
2025-09-12Rename AssocItemContainer -> AssocContainerCameron Steffen-15/+13
2025-09-12Introduce trait_item_ofCameron Steffen-5/+4
2025-09-12Auto merge of #146328 - zetanumbers:fix-141951, r=lcnrbors-1/+2
Skip typeck for items w/o their own typeck context Skip items which forward typeck to their ancestor. Should remove some potential but unnecessary typeck query waits, hence might improve performance for the parallel frontend. Thanks to `@ywxt` for a fix suggestion Fixes rust-lang/rust#141951
2025-09-10Default auto traits: revert to the default supertraitsBryanskiy-135/+15
2025-09-09Auto merge of #146375 - matthiaskrgr:rollup-utik9zj, r=matthiaskrgrbors-27/+46
Rollup of 6 pull requests Successful merges: - rust-lang/rust#145463 (Reject invalid literal suffixes in tuple indexing, tuple struct indexing, and struct field name position) - rust-lang/rust#145929 (fix APITIT being treated as a normal generic parameter in suggestions) - rust-lang/rust#146001 (Update getopts to remove unicode-width dependency) - rust-lang/rust#146365 (triagebot: warn about #[rustc_intrinsic_const_stable_indirect]) - rust-lang/rust#146366 (add approx_delta to all gamma tests) - rust-lang/rust#146373 (fix comments about trait solver cycle heads) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-09Rollup merge of #145929 - Qelxiros:apitit-suggestion, r=BoxyUwUMatthias Krüger-27/+46
fix APITIT being treated as a normal generic parameter in suggestions closes rust-lang/rust#126395