about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/infer
AgeCommit message (Collapse)AuthorLines
2025-10-02Auto merge of #147138 - jackh726:split-canonical-bound, r=lcnrbors-105/+46
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 #147199 - jdonszelmann:outdated-comment-infctx, r=lcnrStuart Cook-17/+0
remove outdated comment in (inner) `InferCtxt` This comment seems to have stopped being relevant around 3 years ago after https://github.com/rust-lang/rust/commit/9f95c605f83bcf4c158ea4b3fd5a7abb825a4178. A map? what map? :P r? `@lcnr`
2025-09-30remove outdated context (inner) infctxJana Dönszelmann-17/+0
2025-09-30clone region obligations instead of taking in implied bounds hackJana Dönszelmann-0/+4
2025-09-30Split Bound into Canonical and Boundjackh726-105/+46
2025-09-26reviewlcnr-7/+4
2025-09-26allow method calls on opaqueslcnr-1/+22
2025-09-18Auto merge of #145993 - lcnr:allow-calling-opaques, r=BoxyUwUbors-0/+57
`-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-18support calls on opaque types :<lcnr-0/+57
2025-09-17Remove ImplSubjectCameron Steffen-18/+1
2025-09-09erase_regions to erase_and_anonymize_regionsBoxy-3/+3
2025-09-08Auto merge of #140375 - lcnr:subrelations-infcx, r=BoxyUwUbors-86/+222
eagerly compute `sub_unification_table` again Previously called `sub_relations`. We still only using them for diagnostics right now. This mostly reverts rust-lang/rust#119989. Necessary for type inference guidance due to not-yet defined opaque types, cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/182. We could use them for cycle detection in generalization and it seems desirable to do so in the future. However, this is unsound with the old trait solver as its cache does not track these `sub_unification_table` in any way. We now properly track the `sub_unification_table` when canonicalizing so using them in the new solver is totally sound and the performance impact is far more manageable than I thought back in rust-lang/rust#119989. r? `@compiler-errors`
2025-09-08reviewlcnr-32/+42
2025-09-08optimize `CanonicalVarValues::instantiate`lcnr-37/+18
2025-09-08pass `sub_relations` into canonical querieslcnr-46/+73
2025-09-08inline `CanonicalTyVarKind`lcnr-21/+9
2025-09-08eagerly compute `sub_relations` againlcnr-1/+131
2025-09-08Move `rustc_middle::MaxUniverse` to `rustc_infer`.Nicholas Nethercote-2/+41
Because `rust_infer` is the only crate that uses it.
2025-09-05rustc_infer: change top-level doc comment to innerMarijn Schouten-1/+1
2025-09-01use defining uses of all bodies to constrain non-defining useslcnr-0/+4
support non-defining uses in closures
2025-08-22change HIR typeck unification handling approachlcnr-5/+2
2025-08-18nll-relate: improve hr opaque types supportlcnr-7/+15
2025-08-11remove `from_forall`lcnr-11/+0
2025-08-06Track names of existentialsAmanda Stjerna-0/+1
2025-08-03Auto merge of #144677 - nnethercote:bound-const-handling, r=lcnrbors-11/+13
Improve bound const handling A few changes to make const handling more similar to type handling. r? `@compiler-errors` -errors
2025-08-02Rollup merge of #144478 - joshtriplett:doc-code-formatting-prep, r=AmanieuSamuel Tardieu-1/+1
Improve formatting of doc code blocks We don't currently apply automatic formatting to doc comment code blocks. As a result, it has built up various idiosyncracies, which make such automatic formatting difficult. Some of those idiosyncracies also make things harder for human readers or other tools. This PR makes a few improvements to doc code formatting, in the hopes of making future automatic formatting easier, as well as in many cases providing net readability improvements. I would suggest reading each commit separately, as each commit contains one class of changes.
2025-08-01Auto merge of #144446 - nnethercote:opt-region-constraints, r=lcnrbors-180/+166
Optimize region constraints r? `@lcnr`
2025-07-31Overhaul `Constraint`.Nicholas Nethercote-180/+162
This commit changes it to store a `Region` instead of a `RegionVid` for the `Var` cases: - We avoid having to call `Region::new_var` to re-create `Region`s from `RegionVid`s in a few places, avoiding the interning process, giving a small perf win. (At the cost of the type allowing some invalid combinations of values.) - All the cases now store two `Region`s, so the commit also separates the `ConstraintKind` (a new type) from the `sub` and `sup` arguments in `Constraint`.
2025-07-31Avoid vacuous `Constraint::{VarSubVar,RegSubReg}` constraints.Nicholas Nethercote-2/+6
If the two regions are the same, we can skip it. This is a small perf win.
2025-07-31Make const bound handling more like types/regions.Nicholas Nethercote-11/+13
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-31Rollup merge of #144713 - nnethercote:rustc_middle-ty-cleanups, r=lcnrStuart Cook-11/+27
`rustc_middle::ty` cleanups r? `@davidtwco`
2025-07-31Remove `ParamEnvAnd::into_parts`.Nicholas Nethercote-1/+1
The fields are public, so this doesn't need a method, normal deconstruction and/or field access is good enough.
2025-07-31Move `TermVid` out of `rustc_middle`.Nicholas Nethercote-10/+26
It's only used in `rustc_infer`.
2025-07-30handle region dependent goals due to infer varslcnr-17/+49
2025-07-25Improve and regularize comment placement in doc codeJosh Triplett-1/+1
Because doc code does not get automatically formatted, some doc code has creative placements of comments that automatic formatting can't handle. Reformat those comments to make the resulting code support standard Rust formatting without breaking; this is generally an improvement to readability as well. Some comments are not indented to the prevailing indent, and are instead aligned under some bit of code. Indent them to the prevailing indent, and put spaces *inside* the comments to align them with code. Some comments span several lines of code (which aren't the line the comment is about) and expect alignment. Reformat them into one comment not broken up by unrelated intervening code. Some comments are placed on the same line as an opening brace, placing them effectively inside the subsequent block, such that formatting would typically format them like a line of that block. Move those comments to attach them to what they apply to. Some comments are placed on the same line as a one-line braced block, effectively attaching them to the closing brace, even though they're about the code inside the block. Reformat to make sure the comment will stay on the same line as the code it's commenting.
2025-07-25uniquify root goals during HIR typecklcnr-3/+41
2025-07-15Add alias for ArgOutlivesPredicateMichael Goulet-16/+9
2025-07-15Gate things properlyMichael Goulet-9/+12
2025-07-15Consider outlives assumptions when proving auto traits for coroutine interiorsMichael Goulet-6/+95
2025-07-13Simplify make_query_region_constraintsMichael Goulet-12/+10
2025-07-13Make sure that users don't take region obligations in a snapshotMichael Goulet-1/+4
2025-07-04Fix pretty printing of placeholder typesMichael Goulet-1/+1
2025-06-28Do not freshen ReErrorMichael Goulet-5/+4
2025-06-27Auto merge of #142223 - compiler-errors:perf-wf, r=lcnrbors-0/+7
Fast path for WF goals in new solver Hopefully self-explanatory.
2025-06-27Auto merge of #143074 - compiler-errors:rollup-cv64hdh, r=compiler-errorsbors-50/+47
Rollup of 18 pull requests Successful merges: - rust-lang/rust#137843 (make RefCell unstably const) - rust-lang/rust#140942 (const-eval: allow constants to refer to mutable/external memory, but reject such constants as patterns) - rust-lang/rust#142549 (small iter.intersperse.fold() optimization) - rust-lang/rust#142637 (Remove some glob imports from the type system) - rust-lang/rust#142647 ([perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation) - rust-lang/rust#142700 (Remove incorrect comments in `Weak`) - rust-lang/rust#142927 (Add note to `find_const_ty_from_env`) - rust-lang/rust#142967 (Fix RwLock::try_write documentation for WouldBlock condition) - rust-lang/rust#142986 (Port `#[export_name]` to the new attribute parsing infrastructure) - rust-lang/rust#143001 (Rename run always ) - rust-lang/rust#143010 (Update `browser-ui-test` version to `0.20.7`) - rust-lang/rust#143015 (Add `sym::macro_pin` diagnostic item for `core::pin::pin!()`) - rust-lang/rust#143033 (Expand const-stabilized API links in relnotes) - rust-lang/rust#143041 (Remove cache for citool) - rust-lang/rust#143056 (Move an ACE test out of the GCI directory) - rust-lang/rust#143059 (Fix 1.88 relnotes) - rust-lang/rust#143067 (Tracking issue number for `iter_macro`) - rust-lang/rust#143073 (Fix some fixmes that were waiting for let chains) Failed merges: - rust-lang/rust#143020 (codegen_fn_attrs: make comment more precise) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-26Simplify IfCauseMichael Goulet-7/+8
2025-06-25rename RegionVariableOrigin::MiscVariable to RegionVariableOrigin::MiscMichael Goulet-15/+9
2025-06-25Remove some glob imports from the type systemMichael Goulet-37/+40
2025-06-24Introduce trivial WF functions, use it in fast pathMichael Goulet-0/+7
2025-06-19Cache instantiation of canonical binderMichael Goulet-20/+169