aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-05 21:23:16 +0100
committerFlorian Diebold <[email protected]>2021-04-05 21:23:30 +0100
commitedc59d897d56815e8b9814cdc4ff084100e4f3b4 (patch)
tree054c1874844107ba3f5ae0e17736213a6cb974ce /crates/hir_ty/src/lib.rs
parentf25c1e7c6a119a1035ba226f0735a0d6667a5db8 (diff)
Align FnPointer with Chalk
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index f74b22b58..c3ec12352 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -142,10 +142,11 @@ impl CallableSig {
142 CallableSig { 142 CallableSig {
143 // FIXME: what to do about lifetime params? -> return PolyFnSig 143 // FIXME: what to do about lifetime params? -> return PolyFnSig
144 params_and_return: fn_ptr 144 params_and_return: fn_ptr
145 .substs 145 .substitution
146 .clone() 146 .clone()
147 .shifted_out_to(DebruijnIndex::ONE) 147 .shifted_out_to(DebruijnIndex::ONE)
148 .expect("unexpected lifetime vars in fn ptr") 148 .expect("unexpected lifetime vars in fn ptr")
149 .0
149 .interned() 150 .interned()
150 .iter() 151 .iter()
151 .map(|arg| arg.assert_ty_ref(&Interner).clone()) 152 .map(|arg| arg.assert_ty_ref(&Interner).clone())
@@ -239,9 +240,9 @@ impl Ty {
239 mutability == mutability2 240 mutability == mutability2
240 } 241 }
241 ( 242 (
242 TyKind::Function(FnPointer { num_args, sig, .. }), 243 TyKind::Function(FnPointer { num_binders, sig, .. }),
243 TyKind::Function(FnPointer { num_args: num_args2, sig: sig2, .. }), 244 TyKind::Function(FnPointer { num_binders: num_binders2, sig: sig2, .. }),
244 ) => num_args == num_args2 && sig == sig2, 245 ) => num_binders == num_binders2 && sig == sig2,
245 (TyKind::Tuple(cardinality, _), TyKind::Tuple(cardinality2, _)) => { 246 (TyKind::Tuple(cardinality, _), TyKind::Tuple(cardinality2, _)) => {
246 cardinality == cardinality2 247 cardinality == cardinality2
247 } 248 }
@@ -314,11 +315,11 @@ impl Ty {
314 match self.kind(&Interner) { 315 match self.kind(&Interner) {
315 TyKind::Adt(_, substs) 316 TyKind::Adt(_, substs)
316 | TyKind::FnDef(_, substs) 317 | TyKind::FnDef(_, substs)
317 | TyKind::Function(FnPointer { substs, .. })
318 | TyKind::Tuple(_, substs) 318 | TyKind::Tuple(_, substs)
319 | TyKind::OpaqueType(_, substs) 319 | TyKind::OpaqueType(_, substs)
320 | TyKind::AssociatedType(_, substs) 320 | TyKind::AssociatedType(_, substs)
321 | TyKind::Closure(.., substs) => Some(substs), 321 | TyKind::Closure(.., substs) => Some(substs),
322 TyKind::Function(FnPointer { substitution: substs, .. }) => Some(&substs.0),
322 _ => None, 323 _ => None,
323 } 324 }
324 } 325 }
@@ -327,11 +328,11 @@ impl Ty {
327 match self.interned_mut() { 328 match self.interned_mut() {
328 TyKind::Adt(_, substs) 329 TyKind::Adt(_, substs)
329 | TyKind::FnDef(_, substs) 330 | TyKind::FnDef(_, substs)
330 | TyKind::Function(FnPointer { substs, .. })
331 | TyKind::Tuple(_, substs) 331 | TyKind::Tuple(_, substs)
332 | TyKind::OpaqueType(_, substs) 332 | TyKind::OpaqueType(_, substs)
333 | TyKind::AssociatedType(_, substs) 333 | TyKind::AssociatedType(_, substs)
334 | TyKind::Closure(.., substs) => Some(substs), 334 | TyKind::Closure(.., substs) => Some(substs),
335 TyKind::Function(FnPointer { substitution: substs, .. }) => Some(&mut substs.0),
335 _ => None, 336 _ => None,
336 } 337 }
337 } 338 }