Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/binder.rs')
-rw-r--r--crates/hir-ty/src/next_solver/binder.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/crates/hir-ty/src/next_solver/binder.rs b/crates/hir-ty/src/next_solver/binder.rs
index 3645f8096c..84cfbf2767 100644
--- a/crates/hir-ty/src/next_solver/binder.rs
+++ b/crates/hir-ty/src/next_solver/binder.rs
@@ -1,8 +1,11 @@
+use hir_def::TraitId;
+use macros::{TypeFoldable, TypeVisitable};
+
use crate::{
FnAbi,
next_solver::{
- Binder, Clauses, EarlyBinder, FnSig, PolyFnSig, StoredBoundVarKinds, StoredClauses,
- StoredTy, StoredTys, Ty, abi::Safety,
+ Binder, Clauses, DbInterner, EarlyBinder, FnSig, PolyFnSig, StoredBoundVarKinds,
+ StoredClauses, StoredGenericArgs, StoredTy, StoredTys, TraitRef, Ty, abi::Safety,
},
};
@@ -81,3 +84,22 @@ impl StoredPolyFnSig {
)
}
}
+
+#[derive(Debug, Clone, PartialEq, Eq, Hash, TypeVisitable, TypeFoldable)]
+pub struct StoredTraitRef {
+ #[type_visitable(ignore)]
+ def_id: TraitId,
+ args: StoredGenericArgs,
+}
+
+impl StoredTraitRef {
+ #[inline]
+ pub fn new(trait_ref: TraitRef<'_>) -> Self {
+ Self { def_id: trait_ref.def_id.0, args: trait_ref.args.store() }
+ }
+
+ #[inline]
+ pub fn get<'db>(&'db self, interner: DbInterner<'db>) -> TraitRef<'db> {
+ TraitRef::new_from_args(interner, self.def_id.into(), self.args.as_ref())
+ }
+}