about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/infer/resolve.rs
AgeCommit message (Collapse)AuthorLines
2025-06-25Remove some glob imports from the type systemMichael Goulet-5/+10
2025-05-26add additional `TypeFlags` fast pathslcnr-0/+8
2025-05-02Use less rustc_type_ir in the compiler codebaseRomain Perier-2/+1
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle in rustc_infer. - The DelayedMap type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner. - API-layer traits, like InferCtxtLike, Interner or inherent::* must be accessed via rustc_type_ir, not rustc_middle::ty. For this reason these are not reexported by rustc_middle::ty. - Replaces use of ty::Interner by rustc_type_ir::Interner in rustc_trait_selection
2025-04-08clean code: remove Deref<Target=RegionKind> impl for Region and use `.kind()`xizheyin-2/+2
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-15Fold visit into tyMichael Goulet-2/+1
2025-03-15Squash fold into tyMichael Goulet-2/+4
2024-10-24Remove associated type based effects logicMichael Goulet-3/+0
2024-10-08Remove unnecessary `return` keyword.Nicholas Nethercote-1/+1
2024-10-07Remove out-of-date comment.Nicholas Nethercote-2/+0
2024-10-07Fix `FIXME` comment on `FixupError`.Nicholas Nethercote-5/+7
`FixupError` is isomorphic with `TyOrConstInferVar`, so this commit changes it to just be a wrapper around `TyOrConstInferVar`. Also, move the `Display` impl for `FixupError` next to `FixupError`.
2024-10-01add caches to multiple type folderslcnr-3/+11
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-21Rename a bunch of thingsMichael Goulet-4/+4
2024-06-03Fix ICE caused by ignoring EffectVars in type inferenceAndrew Wock-0/+3
Signed-off-by: Andrew Wock <ajwock@gmail.com>
2024-05-20Rework var resolution in InferCtxtLike, uplift EagerResolverMichael Goulet-81/+0
2024-05-13Remove `extern crate rustc_middle` from `rustc_infer`.Nicholas Nethercote-0/+1
2024-04-15Simplify shallow resolver to just fold ty/constsMichael Goulet-8/+6
2024-02-05cleanup effect var handlinglcnr-5/+4
2024-01-16don't store const var origins for known varslcnr-88/+2
2023-12-08cleanup type variable storagelcnr-1/+1
2023-11-24Move EagerResolution to rustc_infer::infer::resolveSantiago Pastorino-0/+82
2023-10-24Get rid of 'tcx on ConstVid, EffectVidMichael Goulet-2/+2
2023-04-27rename `needs_infer` to `has_infer`Boxy-2/+2
2023-03-05resolve to universal regions when possibleAli MJ Al-Nasrawy-9/+6
2023-02-22Remove type-traversal trait aliasesAlan Egerton-6/+3
2023-02-15Add specialized variants of `mk_region`.Nicholas Nethercote-1/+1
Much like there are specialized variants of `mk_ty`. This will enable some optimization in the next commit. Also rename the existing `re_error*` functions as `mk_re_error*`, for consistency.
2023-02-15Remove `reuse_or_mk_region`.Nicholas Nethercote-1/+1
It's not used on any hot paths, and so has little perf benefit, and it interferes with the optimizations in the following commits.
2023-02-13Rename folder traits' `tcx` method to `interner`Alan Egerton-5/+5
2023-02-13Make folding traits generic over the InternerAlan Egerton-3/+3
2023-02-13Make visiting traits generic over the InternerAlan Egerton-1/+1
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-3/+6
2023-02-06Inline `OpportunisticVarResolver::fold_ty`.Nicholas Nethercote-0/+1
2023-02-06Put a `ShallowResolver` within `OpportunisticVarResolver`.Nicholas Nethercote-5/+7
So one doesn't have to be constructed every time.
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-2/+2
Switching them to `Break(())` and `Continue(())` instead. libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2022-11-26Do not record unresolved const vars in generator interiorMichael Goulet-28/+58
2022-10-17mir constants: type traversing bye byelcnr-5/+0
2022-10-07Remove TypeckResults from InferCtxtCameron Steffen-8/+8
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-2/+2
2022-07-07Move is_free and is_free_or_static to Region, change resolve_var to ↵Jack Huey-2/+2
resolve_region, and remove RootEmptyRegion
2022-07-06Update TypeVisitor pathsAlan Egerton-2/+3
2022-06-21Reverse folder hierarchyAlan Egerton-4/+2
#91318 introduced a trait for infallible folders distinct from the fallible version. For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible. Moreover the `Error` associated type was defined on the infallible trait! It's so absurd that it has me questioning whether I was entirely sane. This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation). This of course makes much more sense! It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs. There is one downside however: folders expose a `tcx` accessor method. Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate. Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate. If desired, I can submit that as a separate PR. r? @jackh726
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-1/+1
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-08Folding revamp.Nicholas Nethercote-1/+1
This commit makes type folding more like the way chalk does it. Currently, `TypeFoldable` has `fold_with` and `super_fold_with` methods. - `fold_with` is the standard entry point, and defaults to calling `super_fold_with`. - `super_fold_with` does the actual work of traversing a type. - For a few types of interest (`Ty`, `Region`, etc.) `fold_with` instead calls into a `TypeFolder`, which can then call back into `super_fold_with`. With the new approach, `TypeFoldable` has `fold_with` and `TypeSuperFoldable` has `super_fold_with`. - `fold_with` is still the standard entry point, *and* it does the actual work of traversing a type, for all types except types of interest. - `super_fold_with` is only implemented for the types of interest. Benefits of the new model. - I find it easier to understand. The distinction between types of interest and other types is clearer, and `super_fold_with` doesn't exist for most types. - With the current model is easy to get confused and implement a `super_fold_with` method that should be left defaulted. (Some of the precursor commits fixed such cases.) - With the current model it's easy to call `super_fold_with` within `TypeFolder` impls where `fold_with` should be called. The new approach makes this mistake impossible, and this commit fixes a number of such cases. - It's potentially faster, because it avoids the `fold_with` -> `super_fold_with` call in all cases except types of interest. A lot of the time the compile would inline those away, but not necessarily always.
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-02-15Overhaul `Const`.Nicholas Nethercote-7/+4
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as this: ``` pub struct Const<'tcx>(&'tcx Interned<ConstS>); ``` This now matches `Ty` and `Predicate` more closely, including using pointer-based `eq` and `hash`. Notable changes: - `mk_const` now takes a `ConstS`. - `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a we need separate arena for it, because we can't use the `Dropless` one any more. - Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes - Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes. - Lots of tedious sigil fiddling.
2022-01-15initial revertEllen-5/+0
2021-12-02Rename TypeFolderFallible to FallibleTypeFolderAlan Egerton-2/+2
2021-12-02Reduce boilerplate around infallible foldersAlan Egerton-25/+21
2021-11-26Use `TypeFolder::Error` for `FullTypeResolver` and `QueryNormalizer`LeSeulArtichaut-21/+7
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26Unwrap the results of type foldersLeSeulArtichaut-1/+1
Co-authored-by: Alan Egerton <eggyal@gmail.com>