summaryrefslogtreecommitdiff
path: root/compiler/rustc_infer/src/infer/resolve.rs
Commit message (Collapse)AuthorAgeFilesLines
* rename `needs_infer` to `has_infer`Boxy2023-04-271-2/+2
|
* resolve to universal regions when possibleAli MJ Al-Nasrawy2023-03-051-9/+6
|
* Remove type-traversal trait aliasesAlan Egerton2023-02-221-6/+3
|
* Add specialized variants of `mk_region`.Nicholas Nethercote2023-02-151-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.
* Remove `reuse_or_mk_region`.Nicholas Nethercote2023-02-151-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.
* Rename folder traits' `tcx` method to `interner`Alan Egerton2023-02-131-5/+5
|
* Make folding traits generic over the InternerAlan Egerton2023-02-131-3/+3
|
* Make visiting traits generic over the InternerAlan Egerton2023-02-131-1/+1
|
* Alias folding/visiting traits instead of re-exportAlan Egerton2023-02-131-3/+6
|
* Inline `OpportunisticVarResolver::fold_ty`.Nicholas Nethercote2023-02-061-0/+1
|
* Put a `ShallowResolver` within `OpportunisticVarResolver`.Nicholas Nethercote2023-02-061-5/+7
| | | | So one doesn't have to be constructed every time.
* Stop using `BREAK` & `CONTINUE` in compilerScott McMurray2023-01-171-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.
* Do not record unresolved const vars in generator interiorMichael Goulet2022-11-261-28/+58
|
* mir constants: type traversing bye byelcnr2022-10-171-5/+0
|
* Remove TypeckResults from InferCtxtCameron Steffen2022-10-071-8/+8
|
* It's not about types or consts, but the lack of regionsOli Scherer2022-10-041-2/+2
|
* Move is_free and is_free_or_static to Region, change resolve_var to ↵Jack Huey2022-07-071-2/+2
| | | | resolve_region, and remove RootEmptyRegion
* Update TypeVisitor pathsAlan Egerton2022-07-061-2/+3
|
* Reverse folder hierarchyAlan Egerton2022-06-211-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
* Rename the `ConstS::val` field as `kind`.Nicholas Nethercote2022-06-141-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.
* Folding revamp.Nicholas Nethercote2022-06-081-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.
* Spellchecking compiler commentsYuri Astrakhan2022-03-301-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.
* Overhaul `Const`.Nicholas Nethercote2022-02-151-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.
* initial revertEllen2022-01-151-5/+0
|
* Rename TypeFolderFallible to FallibleTypeFolderAlan Egerton2021-12-021-2/+2
|
* Reduce boilerplate around infallible foldersAlan Egerton2021-12-021-25/+21
|
* Use `TypeFolder::Error` for `FullTypeResolver` and `QueryNormalizer`LeSeulArtichaut2021-11-261-21/+7
| | | | Co-authored-by: Alan Egerton <eggyal@gmail.com>
* Unwrap the results of type foldersLeSeulArtichaut2021-11-261-1/+1
| | | | Co-authored-by: Alan Egerton <eggyal@gmail.com>
* Adapt `TypeFolder` implementors to return a `Result`LeSeulArtichaut2021-11-261-24/+33
| | | | Co-authored-by: Alan Egerton <eggyal@gmail.com>
* make unevaluated const substs optionallcnr2021-08-261-2/+2
|
* require a `tcx` for `TypeVisitor`lcnr2021-08-261-0/+5
|
* Add a new normalization query just for mir constantsOli Scherer2021-03-311-0/+5
|
* Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obkbors2020-11-171-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.~~
| * Use `TypeVisitor::BreakTy` in `UnresolvedTypeFinder`LeSeulArtichaut2020-11-141-6/+3
| |
| * Introduce `TypeVisitor::BreakTy`LeSeulArtichaut2020-11-141-1/+1
| |
* | compiler: fold by valueBastian Kauschke2020-11-161-1/+1
|/
* Remove implicit `Continue` typeLeSeulArtichaut2020-10-301-1/+1
|
* TypeVisitor: use `ControlFlow` in rustc_{infer,lint,trait_selection}LeSeulArtichaut2020-10-301-3/+5
|
* Change ty.kind to a methodLeSeulArtichaut2020-09-041-2/+2
|
* mv compiler to compiler/mark2020-08-301-0/+246