about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/collect
AgeCommit message (Collapse)AuthorLines
2025-10-02Auto merge of #147138 - jackh726:split-canonical-bound, r=lcnrbors-6/+10
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-01Rollup merge of #146593 - Jules-Bertholet:restrict-e0719, r=BoxyUwUMatthias Krüger-5/+33
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-09-30Split Bound into Canonical and Boundjackh726-6/+10
2025-09-29Add `overlapping_assoc_constraints` param to `lower_bounds`Jules Bertholet-5/+33
2025-09-27Rename various "concrete opaque type" terminology to say "hidden type"Boxy Uwu-6/+6
2025-09-17Remove `DynKind`León Orell Valerian Liehr-1/+1
2025-09-12Introduce hir::ImplItemImplKindCameron Steffen-1/+1
2025-09-12Introduce trait_item_ofCameron Steffen-5/+4
2025-09-10Default auto traits: revert to the default supertraitsBryanskiy-6/+0
2025-09-01Remove dead code stemming from an old effects desugaringLeón Orell Valerian Liehr-3/+3
2025-08-25change non-defining use error messagelcnr-9/+3
2025-08-25support non-defining uses in HIR typecklcnr-3/+6
2025-08-11Propagate TraitImplHeader to hirCameron Steffen-12/+11
2025-08-08Reduce indirect assoc parent queriesCameron Steffen-2/+1
2025-08-06Fortify generic param default checksLeón Orell Valerian Liehr-99/+101
2025-08-03Auto merge of #144677 - nnethercote:bound-const-handling, r=lcnrbors-5/+5
Improve bound const handling A few changes to make const handling more similar to type handling. r? `@compiler-errors` -errors
2025-08-01Auto merge of #144458 - compiler-errors:no-witness-mini, r=lcnrbors-9/+3
Remove the witness type from coroutine *args* (without actually removing the type) This does as much of rust-lang/rust#144157 as we can without having to break rust-lang/rust#143545 and/or introduce some better way of handling higher ranked assumptions. Namely, it: * Stalls coroutines based off of the *coroutine* type rather than the witness type. * Reworks the dtorck constraint hack to not rely on the witness type. * Removes the witness type from the args of the coroutine, eagerly creating the type for nested obligations when needed (auto/clone impls). I'll experiment with actually removing the witness type in a follow-up. r? lcnr
2025-07-31Remove the witness type from coroutine argsMichael Goulet-9/+3
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-1/+2
2025-07-31Make const bound handling more like types/regions.Nicholas Nethercote-5/+5
Currently there is `Ty` and `BoundTy`, and `Region` and `BoundRegion`, and `Const` and... `BoundVar`. An annoying inconsistency. This commit repurposes the existing `BoundConst`, which was barely used, so it's the partner to `Const`. Unlike `BoundTy`/`BoundRegion` it lacks a `kind` field but it's still nice to have because it makes the const code more similar to the ty/region code everywhere. The commit also removes `impl From<BoundVar> for BoundTy`, which has a single use and doesn't seem worth it. These changes fix the "FIXME: We really should have a separate `BoundConst` for consts".
2025-07-27check_static_item: explain should_check_for_sync choicesRalf Jung-2/+6
2025-07-26Do not check Sync during type_of.Camille GILLOT-2/+2
2025-07-25Check statics' type in type_of.Camille GILLOT-2/+17
2025-07-19Auto merge of #144166 - matthiaskrgr:rollup-wccepuo, r=matthiaskrgrbors-1/+1
Rollup of 10 pull requests Successful merges: - rust-lang/rust#141076 (fix Zip unsoundness (again)) - rust-lang/rust#142444 (adding run-make test to autodiff) - rust-lang/rust#143704 (Be a bit more careful around exotic cycles in in the inliner) - rust-lang/rust#144073 (Don't test panic=unwind in panic_main.rs on Fuchsia) - rust-lang/rust#144083 (miri sleep tests: increase slack) - rust-lang/rust#144092 (bootstrap: Detect musl hosts) - rust-lang/rust#144098 (Do not lint private-in-public for RPITIT) - rust-lang/rust#144103 (Rename `emit_unless` to `emit_unless_delay`) - rust-lang/rust#144108 (Ignore tests/run-make/link-eh-frame-terminator/rmake.rs when cross-compiling) - rust-lang/rust#144115 (fix outdated comment) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-19rename `emit_unless` to `emit_unless_delay`xizheyin-1/+1
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-18Update comment about `where Ty:`León Orell Valerian Liehr-10/+6
We no longer move trait predicates where the self ty is a ty param to "the bounds of a ty param".
2025-07-17parse `const trait Trait`Deadbeef-3/+3
2025-07-17Auto merge of #144044 - fmease:rollup-kg413pt, r=fmeasebors-22/+35
Rollup of 15 pull requests Successful merges: - rust-lang/rust#142304 (tests: Add `RUST_BACKTRACE` and `-Cpanic` revisions to `panic-main.rs` test) - rust-lang/rust#143388 (Various refactors to the LTO handling code) - rust-lang/rust#143409 (Enable xgot feature for mips64 musl targets) - rust-lang/rust#143592 (UWP: link ntdll functions using raw-dylib) - rust-lang/rust#143595 (add `const_make_global`; err for `const_allocate` ptrs if didn't call) - rust-lang/rust#143678 (Added error for invalid char cast) - rust-lang/rust#143820 (Fixed a core crate compilation failure when enabling the `optimize_for_size` feature on some targets) - rust-lang/rust#143829 (Trim `BorrowedCursor` API) - rust-lang/rust#143851 (ci cleanup: rustdoc-gui-test now installs browser-ui-test) - rust-lang/rust#143856 (Linting public reexport of private dependencies) - rust-lang/rust#143895 (Dont collect assoc ty item bounds from trait where clause for host effect predicates) - rust-lang/rust#143922 (Improve path segment joining) - rust-lang/rust#143964 (Fix handling of SCRIPT_ARG in docker images) - rust-lang/rust#144002 (Update poison.rs) - rust-lang/rust#144016 (trait_sel: `MetaSized` always holds temporarily) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-15Implement other logicstiif-0/+2
2025-07-15Lower the UnstableFeatureBound predicate to UnstableFeature predicatetiif-0/+14
2025-07-13Imply always-const host effects the same as any other item boundMichael Goulet-0/+1
2025-07-13Dont collect assoc ty item bounds from trait where clause for host effect ↵Michael Goulet-22/+34
predicates
2025-07-06compiler: rename {ast,hir}::BareFn* to FnPtr*Jubilee Young-7/+5
Fix some comments and related types and locals where it is obvious, e.g. - bare_fn -> fn_ptr - LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-07-04Same for typesMichael Goulet-15/+9
2025-07-04Remove Symbol for Named LateParam/Bound variantsMichael Goulet-2/+2
2025-07-04Rollup merge of #143394 - workingjubilee:reorganize-hir-analysis-provide-fn, ↵Jacob Pratt-0/+1
r=compiler-errors compiler: Document and reduce `fn provide`s in hir crates I found it hard to follow all these tiny micro-indirections. Much like you shouldn't pass around `&u32` if you can help it, you probably shouldn't use an indirection if the indirection overhead itself is literally bigger than the amount of data you are organizing. Generally a new `fn provide` amounts to around 3 LOC: - the signature with opening brace - the `rustc_middle::query::Providers` import - an end brace I am not even counting the cost in time and thought to go find the other `provide`, read it, understand, "Ah, yes, these functions", and then go to those. Thus I say we should collapse indirections of `provide` for modules that only export 1~2 queries. For higher-count indirections, I left them as-is, as I don't understand the crate well enough to judge their worth. Then I dropped a pointer to the actual module of interest for all these instances of the same function. I think documenting them is important because the comment that it relates to the query system makes it obvious that they have **nothing** to do with the rest of the module's logic and I can carry on ignoring them. Actively doing so is another cognitive cost, but much more minimal. There is also a small correctness issue in that all of these functions are technically mutating state. It's not a huge deal, but it's still easier to check all these mutations do not overlap if we have less instances of `fn provide` to check.
2025-07-03compiler: document all provide fn in hir_analysis and hir_typeckJubilee Young-0/+1
2025-07-02Explicitly handle all nodes in generics_of when computing parentMichael Goulet-5/+16
2025-06-27Rollup merge of #143106 - yotamofek:pr/gce/non-local-ice, r=BoxyUwUMatthias Krüger-1/+3
gce: don't ICE on non-local const Fixes rust-lang/rust#133808 I have absolutely no idea what I'm doing here, but I followed `@BoxyUwU` 's [instructions](https://github.com/rust-lang/rust/issues/133808#issuecomment-3009122957), and turns out this small change fixes rust-lang/rust#133808, and doesn't seem to break anything else. (This code path is only reachable when the GCE feature gate is enabled, so even if it does break in a way that is not caught by current test coverage, I guess it's not as bad as breaking stable or non-incomplete features?) Anyways, r? `@BoxyUwU` , if you don't mind.
2025-06-27gce: don't ICE on non-local constYotam Ofek-1/+3
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-5/+5
2025-06-20Use gen blocks in the compiler instead of from_coroutineMichael Goulet-68/+64
2025-06-18Rollup merge of #141610 - BoxyUwU:stabilize_generic_arg_infer, ↵Jakub Beránek-16/+1
r=lcnr,traviscross Stabilize `feature(generic_arg_infer)` Fixes rust-lang/rust#85077 r? lcnr cc ````@rust-lang/project-const-generics````
2025-06-16hir_analysis: add `{Meta,Pointee}Sized` boundsDavid Wood-5/+36
Opting-out of `Sized` with `?Sized` is now equivalent to adding a `MetaSized` bound, and adding a `MetaSized` or `PointeeSized` bound is equivalent to removing the default `Sized` bound - this commit implements this change in `rustc_hir_analysis::hir_ty_lowering`. `MetaSized` is also added as a supertrait of all traits, as this is necessary to preserve backwards compatibility. Unfortunately, non-global where clauses being preferred over item bounds (where `PointeeSized` bounds would be proven) - which can result in errors when a `PointeeSized` supertrait/bound/predicate is added to some items. Rather than `PointeeSized` being a bound on everything, it can be the absence of a bound on everything, as `?Sized` was.
2025-06-11stabilize gaiBoxy-16/+1
2025-05-30Reorder fields in `hir::ItemKind` variants.Nicholas Nethercote-9/+9
Specifically `TyAlias`, `Enum`, `Struct`, `Union`. So the fields match the textual order in the source code. The interesting part of the change is in `compiler/rustc_hir/src/hir.rs`. The rest is extremely mechanical refactoring.
2025-05-27Rename unpack to kindMichael Goulet-1/+1
2025-05-22Review CommentsBoxy-4/+4
2025-05-21Introduce `tcx.anon_const_kind` queryBoxy-41/+30
2025-05-07Add `DefPathData::OpaqueLifetime` to avoid conflicts for remapped opaque ↵John Kåre Alsaker-5/+5
lifetimes