aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/traits/chalk.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/traits/chalk.rs')
-rw-r--r--crates/hir_ty/src/traits/chalk.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs
index 57d0a32df..27f0ed628 100644
--- a/crates/hir_ty/src/traits/chalk.rs
+++ b/crates/hir_ty/src/traits/chalk.rs
@@ -23,7 +23,8 @@ use crate::{
23 ProjectionTy, Substs, TraitRef, Ty, TypeCtor, 23 ProjectionTy, Substs, TraitRef, Ty, TypeCtor,
24}; 24};
25use mapping::{ 25use mapping::{
26 convert_where_clauses, generic_predicate_to_inline_bound, make_binders, TypeAliasAsValue, 26 convert_where_clauses, generic_predicate_to_inline_bound, make_binders, TypeAliasAsAssocType,
27 TypeAliasAsValue,
27}; 28};
28 29
29pub use self::interner::*; 30pub use self::interner::*;
@@ -340,7 +341,7 @@ pub(crate) fn associated_ty_data_query(
340 id: AssocTypeId, 341 id: AssocTypeId,
341) -> Arc<AssociatedTyDatum> { 342) -> Arc<AssociatedTyDatum> {
342 debug!("associated_ty_data {:?}", id); 343 debug!("associated_ty_data {:?}", id);
343 let type_alias: TypeAliasId = from_chalk(db, id); 344 let type_alias: TypeAliasId = from_chalk::<TypeAliasAsAssocType, _>(db, id).0;
344 let trait_ = match type_alias.lookup(db.upcast()).container { 345 let trait_ = match type_alias.lookup(db.upcast()).container {
345 AssocContainerId::TraitId(t) => t, 346 AssocContainerId::TraitId(t) => t,
346 _ => panic!("associated type not in trait"), 347 _ => panic!("associated type not in trait"),
@@ -394,8 +395,10 @@ pub(crate) fn trait_datum_query(
394 fundamental: false, 395 fundamental: false,
395 }; 396 };
396 let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars); 397 let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars);
397 let associated_ty_ids = 398 let associated_ty_ids = trait_data
398 trait_data.associated_types().map(|type_alias| type_alias.to_chalk(db)).collect(); 399 .associated_types()
400 .map(|type_alias| TypeAliasAsAssocType(type_alias).to_chalk(db))
401 .collect();
399 let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses }; 402 let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses };
400 let well_known = 403 let well_known =
401 lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name)); 404 lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name));
@@ -433,6 +436,7 @@ fn lang_attr_from_well_known_trait(attr: WellKnownTrait) -> &'static str {
433 WellKnownTrait::FnMut => "fn_mut", 436 WellKnownTrait::FnMut => "fn_mut",
434 WellKnownTrait::Fn => "fn", 437 WellKnownTrait::Fn => "fn",
435 WellKnownTrait::Unsize => "unsize", 438 WellKnownTrait::Unsize => "unsize",
439 WellKnownTrait::Unpin => "unpin",
436 } 440 }
437} 441}
438 442
@@ -576,7 +580,7 @@ fn type_alias_associated_ty_value(
576 let value_bound = rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) }; 580 let value_bound = rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) };
577 let value = rust_ir::AssociatedTyValue { 581 let value = rust_ir::AssociatedTyValue {
578 impl_id: impl_id.to_chalk(db), 582 impl_id: impl_id.to_chalk(db),
579 associated_ty_id: assoc_ty.to_chalk(db), 583 associated_ty_id: TypeAliasAsAssocType(assoc_ty).to_chalk(db),
580 value: make_binders(value_bound, ty.num_binders), 584 value: make_binders(value_bound, ty.num_binders),
581 }; 585 };
582 Arc::new(value) 586 Arc::new(value)
@@ -611,9 +615,11 @@ pub(crate) fn fn_def_datum_query(
611 }; 615 };
612 let datum = FnDefDatum { 616 let datum = FnDefDatum {
613 id: fn_def_id, 617 id: fn_def_id,
614 abi: (), 618 sig: chalk_ir::FnSig {
615 safety: chalk_ir::Safety::Safe, 619 abi: (),
616 variadic: sig.value.is_varargs, 620 safety: chalk_ir::Safety::Safe,
621 variadic: sig.value.is_varargs,
622 },
617 binders: make_binders(bound, sig.num_binders), 623 binders: make_binders(bound, sig.num_binders),
618 }; 624 };
619 Arc::new(datum) 625 Arc::new(datum)