aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/lower.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs
index 6a2aded02..c2a3703fa 100644
--- a/crates/ra_hir_ty/src/lower.rs
+++ b/crates/ra_hir_ty/src/lower.rs
@@ -9,6 +9,7 @@ use std::iter;
9use std::sync::Arc; 9use std::sync::Arc;
10 10
11use hir_def::{ 11use hir_def::{
12 adt::StructKind,
12 builtin_type::BuiltinType, 13 builtin_type::BuiltinType,
13 generics::{TypeParamProvenance, WherePredicate, WherePredicateTarget}, 14 generics::{TypeParamProvenance, WherePredicate, WherePredicateTarget},
14 path::{GenericArg, Path, PathSegment, PathSegments}, 15 path::{GenericArg, Path, PathSegment, PathSegments},
@@ -805,8 +806,8 @@ fn fn_sig_for_struct_constructor(db: &impl HirDatabase, def: StructId) -> PolyFn
805/// Build the type of a tuple struct constructor. 806/// Build the type of a tuple struct constructor.
806fn type_for_struct_constructor(db: &impl HirDatabase, def: StructId) -> Binders<Ty> { 807fn type_for_struct_constructor(db: &impl HirDatabase, def: StructId) -> Binders<Ty> {
807 let struct_data = db.struct_data(def.into()); 808 let struct_data = db.struct_data(def.into());
808 if struct_data.variant_data.is_unit() { 809 if let StructKind::Unit = struct_data.variant_data.kind() {
809 return type_for_adt(db, def.into()); // Unit struct 810 return type_for_adt(db, def.into());
810 } 811 }
811 let generics = generics(db, def.into()); 812 let generics = generics(db, def.into());
812 let substs = Substs::bound_vars(&generics); 813 let substs = Substs::bound_vars(&generics);
@@ -830,8 +831,8 @@ fn fn_sig_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId
830fn type_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId) -> Binders<Ty> { 831fn type_for_enum_variant_constructor(db: &impl HirDatabase, def: EnumVariantId) -> Binders<Ty> {
831 let enum_data = db.enum_data(def.parent); 832 let enum_data = db.enum_data(def.parent);
832 let var_data = &enum_data.variants[def.local_id].variant_data; 833 let var_data = &enum_data.variants[def.local_id].variant_data;
833 if var_data.is_unit() { 834 if let StructKind::Unit = var_data.kind() {
834 return type_for_adt(db, def.parent.into()); // Unit variant 835 return type_for_adt(db, def.parent.into());
835 } 836 }
836 let generics = generics(db, def.parent.into()); 837 let generics = generics(db, def.parent.into());
837 let substs = Substs::bound_vars(&generics); 838 let substs = Substs::bound_vars(&generics);