about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/infer/resolve.rs
AgeCommit message (Collapse)AuthorLines
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>
2021-11-26Adapt `TypeFolder` implementors to return a `Result`LeSeulArtichaut-24/+33
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-08-26make unevaluated const substs optionallcnr-2/+2
2021-08-26require a `tcx` for `TypeVisitor`lcnr-0/+5
2021-03-31Add a new normalization query just for mir constantsOli Scherer-0/+5
2020-11-17Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obkbors-7/+4
Introduce `TypeVisitor::BreakTy` Implements MCP rust-lang/compiler-team#383. r? `@ghost` cc `@lcnr` `@oli-obk` ~~Blocked on FCP in rust-lang/compiler-team#383.~~
2020-11-16compiler: fold by valueBastian Kauschke-1/+1
2020-11-14Use `TypeVisitor::BreakTy` in `UnresolvedTypeFinder`LeSeulArtichaut-6/+3
2020-11-14Introduce `TypeVisitor::BreakTy`LeSeulArtichaut-1/+1
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-1/+1
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{infer,lint,trait_selection}LeSeulArtichaut-3/+5
2020-09-04Change ty.kind to a methodLeSeulArtichaut-2/+2
2020-08-30mv compiler to compiler/mark-0/+246