about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
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-07Remove unused allow attrsYotam Ofek-2/+0
2025-07-04Fix pretty printing of placeholder typesMichael Goulet-1/+1
2025-07-01Update `cfg(bootstrap)`Josh Stone-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-53/+49
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-26Rollup merge of #142647 - compiler-errors:less-work-in-coherence, r=lcnrMichael Goulet-1/+2
[perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation First compute hard errors without diagnostics, then ambiguities with diagnostics since we need to know if any of them overflowed.
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-39/+40
2025-06-25Compute hard errors without diagnostics in ↵Michael Goulet-1/+2
impl_intersection_has_impossible_obligation
2025-06-24Introduce trivial WF functions, use it in fast pathMichael Goulet-0/+7
2025-06-19Cache instantiation of canonical binderMichael Goulet-20/+169
2025-06-18Implement lint against direct uses of rustc_type_ir in compiler cratesRomain Perier-0/+1
This commit adds a lint to prevent the use of rustc_type_ir in random compiler crates, except for type system internals traits, which are explicitly allowed. Moreover, this fixes diagnostic_items() to include the CRATE_OWNER_ID, otherwise rustc_diagnostic_item attribute is ignored on the crate root.
2025-06-11Auto merge of #141763 - lcnr:fixme-gamer, r=BoxyUwUbors-1/+4
`FIXME(-Znext-solver)` triage r? `@BoxyUwU`
2025-06-11Auto merge of #142090 - compiler-errors:perf-stable-root-var, r=lcnrbors-0/+6
Make root vars more stable Never resolve a ty/ct vid to a higher vid as its root. This should make the optimization in rust-lang/rust#141500 more "stable" when there are a lot of vars flying around. r? `@ghost`
2025-06-08Remove all unused feature gates from the compilerbjorn3-1/+0
2025-06-07Rollup merge of #142126 - compiler-errors:normalize-uv-via-relate, r=BoxyUwUGuillaume Gomez-0/+7
Treat normalizing consts like normalizing types in deeply normalize ...so that we don't end up putting a top-level normalizes-to goal in the fulfillment context, which ICEs. This basically just models the normalize-const code off of the normalize-ty code above it, which uses an alias-relate goal instead. Fixes rust-lang/rust#140571 r? lcnr
2025-06-07Unify normalization of terms in deeply normalizeMichael Goulet-0/+7
2025-06-05Make root vars more stableMichael Goulet-0/+6
2025-06-03`FIXME(-Znext-solver)` triagelcnr-1/+4
Co-authored-by: Michael Goulet <michael@errs.io>
2025-06-02Fast path for stalled obligations on self tyMichael Goulet-1/+1
2025-05-29Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errorsbors-0/+12
add additional `TypeFlags` fast paths Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial. This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s. Split out from rust-lang/rust#141451, depends on rust-lang/rust#141442. r? `@compiler-errors`
2025-05-27Fix some var namesMichael Goulet-2/+2
2025-05-27Rename unpack to kindMichael Goulet-13/+13
2025-05-26Auto merge of #141605 - jieyouxu:rollup-3gjqh5l, r=jieyouxubors-80/+58
Rollup of 10 pull requests Successful merges: - rust-lang/rust#140898 (minor improvements on running miri) - rust-lang/rust#141392 (Avoid obligation construction dance with query region constraints) - rust-lang/rust#141431 (Emit dummy open drop for unsafe binder) - rust-lang/rust#141433 (Properly analyze captures from unsafe binders) - rust-lang/rust#141439 (Deduplicate dyn compatibility violations due to coercion) - rust-lang/rust#141449 (further deduplicate ast visitor code) - rust-lang/rust#141513 (interpret: add allocation parameters to `AllocBytes`) - rust-lang/rust#141516 (speed up charsearcher for ascii chars) - rust-lang/rust#141526 (add a dedicated section for compiler environment variables in the unstable book) - rust-lang/rust#141550 (Fix `unused_braces` lint suggestion when encountering attributes) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-26add additional `TypeFlags` fast pathslcnr-0/+12
2025-05-27Rollup merge of #141392 - compiler-errors:query-outlives, r=lcnr许杰友 Jieyou Xu (Joe)-80/+58
Avoid obligation construction dance with query region constraints And some renaming...
2025-05-26Auto merge of #141500 - compiler-errors:rerun-cache-2, r=lcnrbors-0/+57
Don't rerun goals if none of their vars have changed r? `@ghost` Alternative to rust-lang/rust#141488. I'm pretty sure that we don't need to re-run the goal at all if the inputs don't change... 🤔
2025-05-26Auto merge of #141442 - compiler-errors:fast-path-pred, r=lcnrbors-0/+4
Fold predicate fast path in canonicalizer and eager resolver See individual commits. r? lcnr