diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-04 12:30:07 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-04 12:30:07 +0100 |
commit | 082996032054031bd1b68ee45ab04293f4877e91 (patch) | |
tree | ccf4586bbb70ef9ebf429a2c79a5f409549ebf73 /crates/hir_ty/src/tests/traits.rs | |
parent | c9bcbf9a43eb0bf1a5255f704080305e568f0a36 (diff) | |
parent | cde3857897955558ed0e60cf8158e18d5c75d188 (diff) |
Merge #8327
8327: Move `Ty` creation methods out of `Ty` (Chalk move preparation) r=flodiebold a=flodiebold
When we'll move to using `chalk_ir::Ty` (#8313), we won't be able to have our own inherent methods on `Ty` anymore, so we need to move the helpers elsewhere.
This adds a `TyBuilder` that allows easily constructing `Ty` and related types (`TraitRef`, `ProjectionTy`, `Substitution`). It also replaces `SubstsBuilder`. `TyBuilder` can construct different things based on its type parameter; e.g. if it has an `AdtId`, we're constructing an ADT type, but if it has a `TraitId`, we're constructing a `TraitRef`. The common thing for all of them is that we need to build a `Substitution`, so the API stays the same for all of them except at the beginning and end.
We also use `TyBuilder` to house various one-shot methods for constructing types, e.g. `TyBuilder::unit()`.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests/traits.rs')
0 files changed, 0 insertions, 0 deletions