Add generic arg infer

This commit is contained in:
kadmin 2021-04-24 21:41:57 +00:00
parent 1b8fc8f13d
commit 00faed9f0c

View File

@ -885,7 +885,15 @@ pub fn hash_lifetime(&mut self, lifetime: Lifetime) {
pub fn hash_ty(&mut self, ty: &Ty<'_>) { pub fn hash_ty(&mut self, ty: &Ty<'_>) {
std::mem::discriminant(&ty.kind).hash(&mut self.s); std::mem::discriminant(&ty.kind).hash(&mut self.s);
match ty.kind { self.hash_tykind(&ty.kind);
}
pub fn hash_infer(&mut self) {
"_".hash(&mut self.s);
}
pub fn hash_tykind(&mut self, ty: &TyKind<'_>) {
match ty {
TyKind::Slice(ty) => { TyKind::Slice(ty) => {
self.hash_ty(ty); self.hash_ty(ty);
}, },
@ -949,6 +957,7 @@ fn hash_generic_args(&mut self, arg_list: &[GenericArg<'_>]) {
GenericArg::Lifetime(l) => self.hash_lifetime(l), GenericArg::Lifetime(l) => self.hash_lifetime(l),
GenericArg::Type(ref ty) => self.hash_ty(ty), GenericArg::Type(ref ty) => self.hash_ty(ty),
GenericArg::Const(ref ca) => self.hash_body(ca.value.body), GenericArg::Const(ref ca) => self.hash_body(ca.value.body),
GenericArg::Infer(ref _inf) => self.hash_infer(),
} }
} }
} }