diff options
author | Aleksey Kladov <[email protected]> | 2019-11-25 12:41:53 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-25 12:54:03 +0000 |
commit | 5f39c5794ec2521e9bb4c108771a1644269859ab (patch) | |
tree | 6dd5653f77a3eabb015c5a9172e32e83eb0e6039 | |
parent | c2a16632d0773dec707acb215297ef55b5c880fe (diff) |
Use GenericDefIdMore
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 18 | ||||
-rw-r--r-- | crates/ra_hir/src/db.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/from_id.rs | 24 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/ty.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/path.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 32 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 2 |
10 files changed, 44 insertions, 56 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 3f44a50c4..534f1f8e9 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -11,9 +11,9 @@ use hir_def::{ | |||
11 | per_ns::PerNs, | 11 | per_ns::PerNs, |
12 | resolver::{HasResolver, TypeNs}, | 12 | resolver::{HasResolver, TypeNs}, |
13 | type_ref::TypeRef, | 13 | type_ref::TypeRef, |
14 | AstItemDef, ConstId, ContainerId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId, | 14 | AstItemDef, ConstId, ContainerId, EnumId, FunctionId, GenericDefId, HasModule, ImplId, |
15 | LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId, | 15 | LocalEnumVariantId, LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, |
16 | TraitId, TypeAliasId, UnionId, | 16 | StaticId, StructId, TraitId, TypeAliasId, UnionId, |
17 | }; | 17 | }; |
18 | use hir_expand::{ | 18 | use hir_expand::{ |
19 | diagnostics::DiagnosticSink, | 19 | diagnostics::DiagnosticSink, |
@@ -897,16 +897,6 @@ impl_froms!( | |||
897 | Const | 897 | Const |
898 | ); | 898 | ); |
899 | 899 | ||
900 | impl From<AssocItem> for GenericDef { | ||
901 | fn from(item: AssocItem) -> Self { | ||
902 | match item { | ||
903 | AssocItem::Function(f) => f.into(), | ||
904 | AssocItem::Const(c) => c.into(), | ||
905 | AssocItem::TypeAlias(t) => t.into(), | ||
906 | } | ||
907 | } | ||
908 | } | ||
909 | |||
910 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | 900 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
911 | pub struct Local { | 901 | pub struct Local { |
912 | pub(crate) parent: DefWithBody, | 902 | pub(crate) parent: DefWithBody, |
@@ -960,7 +950,7 @@ impl Local { | |||
960 | 950 | ||
961 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | 951 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
962 | pub struct GenericParam { | 952 | pub struct GenericParam { |
963 | pub(crate) parent: GenericDef, | 953 | pub(crate) parent: GenericDefId, |
964 | pub(crate) idx: u32, | 954 | pub(crate) idx: u32, |
965 | } | 955 | } |
966 | 956 | ||
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 7ec04ad73..b034d4e44 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -12,7 +12,7 @@ use crate::{ | |||
12 | CallableDef, FnSig, GenericPredicate, InferenceResult, Namespace, Substs, Ty, TypableDef, | 12 | CallableDef, FnSig, GenericPredicate, InferenceResult, Namespace, Substs, Ty, TypableDef, |
13 | TypeCtor, | 13 | TypeCtor, |
14 | }, | 14 | }, |
15 | Crate, DefWithBody, GenericDef, ImplBlock, Trait, | 15 | Crate, DefWithBody, ImplBlock, Trait, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | pub use hir_def::{ | 18 | pub use hir_def::{ |
@@ -49,7 +49,7 @@ pub trait HirDatabase: DefDatabase { | |||
49 | #[salsa::invoke(crate::ty::generic_predicates_for_param_query)] | 49 | #[salsa::invoke(crate::ty::generic_predicates_for_param_query)] |
50 | fn generic_predicates_for_param( | 50 | fn generic_predicates_for_param( |
51 | &self, | 51 | &self, |
52 | def: GenericDef, | 52 | def: GenericDefId, |
53 | param_idx: u32, | 53 | param_idx: u32, |
54 | ) -> Arc<[GenericPredicate]>; | 54 | ) -> Arc<[GenericPredicate]>; |
55 | 55 | ||
@@ -57,7 +57,7 @@ pub trait HirDatabase: DefDatabase { | |||
57 | fn generic_predicates(&self, def: GenericDefId) -> Arc<[GenericPredicate]>; | 57 | fn generic_predicates(&self, def: GenericDefId) -> Arc<[GenericPredicate]>; |
58 | 58 | ||
59 | #[salsa::invoke(crate::ty::generic_defaults_query)] | 59 | #[salsa::invoke(crate::ty::generic_defaults_query)] |
60 | fn generic_defaults(&self, def: GenericDef) -> Substs; | 60 | fn generic_defaults(&self, def: GenericDefId) -> Substs; |
61 | 61 | ||
62 | #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] | 62 | #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)] |
63 | fn impls_in_crate(&self, krate: Crate) -> Arc<CrateImplBlocks>; | 63 | fn impls_in_crate(&self, krate: Crate) -> Arc<CrateImplBlocks>; |
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs index 3a27d6f0c..619f6055e 100644 --- a/crates/ra_hir/src/from_id.rs +++ b/crates/ra_hir/src/from_id.rs | |||
@@ -137,20 +137,6 @@ impl From<GenericDef> for GenericDefId { | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | impl From<GenericDefId> for GenericDef { | ||
141 | fn from(def: GenericDefId) -> Self { | ||
142 | match def { | ||
143 | GenericDefId::FunctionId(it) => GenericDef::Function(it.into()), | ||
144 | GenericDefId::AdtId(it) => GenericDef::Adt(it.into()), | ||
145 | GenericDefId::TraitId(it) => GenericDef::Trait(it.into()), | ||
146 | GenericDefId::TypeAliasId(it) => GenericDef::TypeAlias(it.into()), | ||
147 | GenericDefId::ImplId(it) => GenericDef::ImplBlock(it.into()), | ||
148 | GenericDefId::EnumVariantId(it) => GenericDef::EnumVariant(it.into()), | ||
149 | GenericDefId::ConstId(it) => GenericDef::Const(it.into()), | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | |||
154 | impl From<AdtId> for TypableDef { | 140 | impl From<AdtId> for TypableDef { |
155 | fn from(id: AdtId) -> Self { | 141 | fn from(id: AdtId) -> Self { |
156 | Adt::from(id).into() | 142 | Adt::from(id).into() |
@@ -244,3 +230,13 @@ impl From<AttrDef> for AttrDefId { | |||
244 | } | 230 | } |
245 | } | 231 | } |
246 | } | 232 | } |
233 | |||
234 | impl From<AssocItem> for GenericDefId { | ||
235 | fn from(item: AssocItem) -> Self { | ||
236 | match item { | ||
237 | AssocItem::Function(f) => f.id.into(), | ||
238 | AssocItem::Const(c) => c.id.into(), | ||
239 | AssocItem::TypeAlias(t) => t.id.into(), | ||
240 | } | ||
241 | } | ||
242 | } | ||
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index b4f0e81d3..cbfeca3ab 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -251,7 +251,7 @@ impl SourceAnalyzer { | |||
251 | let types = self.resolver.resolve_path_in_type_ns_fully(db, &path).map(|ty| match ty { | 251 | let types = self.resolver.resolve_path_in_type_ns_fully(db, &path).map(|ty| match ty { |
252 | TypeNs::SelfType(it) => PathResolution::SelfType(it.into()), | 252 | TypeNs::SelfType(it) => PathResolution::SelfType(it.into()), |
253 | TypeNs::GenericParam(idx) => PathResolution::GenericParam(GenericParam { | 253 | TypeNs::GenericParam(idx) => PathResolution::GenericParam(GenericParam { |
254 | parent: self.resolver.generic_def().unwrap().into(), | 254 | parent: self.resolver.generic_def().unwrap(), |
255 | idx, | 255 | idx, |
256 | }), | 256 | }), |
257 | TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => { | 257 | TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => { |
@@ -326,7 +326,7 @@ impl SourceAnalyzer { | |||
326 | resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()), | 326 | resolver::ScopeDef::ImplSelfType(it) => ScopeDef::ImplSelfType(it.into()), |
327 | resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), | 327 | resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), |
328 | resolver::ScopeDef::GenericParam(idx) => { | 328 | resolver::ScopeDef::GenericParam(idx) => { |
329 | let parent = self.resolver.generic_def().unwrap().into(); | 329 | let parent = self.resolver.generic_def().unwrap(); |
330 | ScopeDef::GenericParam(GenericParam { parent, idx }) | 330 | ScopeDef::GenericParam(GenericParam { parent, idx }) |
331 | } | 331 | } |
332 | resolver::ScopeDef::Local(pat_id) => { | 332 | resolver::ScopeDef::Local(pat_id) => { |
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 2473ac574..1e05ac3f2 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -21,8 +21,8 @@ use hir_def::{generics::GenericParams, AdtId, GenericDefId}; | |||
21 | use ra_db::{impl_intern_key, salsa}; | 21 | use ra_db::{impl_intern_key, salsa}; |
22 | 22 | ||
23 | use crate::{ | 23 | use crate::{ |
24 | db::HirDatabase, expr::ExprId, util::make_mut_slice, Adt, Crate, DefWithBody, FloatTy, | 24 | db::HirDatabase, expr::ExprId, util::make_mut_slice, Adt, Crate, DefWithBody, FloatTy, IntTy, |
25 | GenericDef, IntTy, Mutability, Name, Trait, TypeAlias, Uncertain, | 25 | Mutability, Name, Trait, TypeAlias, Uncertain, |
26 | }; | 26 | }; |
27 | use display::{HirDisplay, HirFormatter}; | 27 | use display::{HirDisplay, HirFormatter}; |
28 | 28 | ||
@@ -356,9 +356,9 @@ impl Substs { | |||
356 | ) | 356 | ) |
357 | } | 357 | } |
358 | 358 | ||
359 | pub fn build_for_def(db: &impl HirDatabase, def: impl Into<GenericDef>) -> SubstsBuilder { | 359 | pub fn build_for_def(db: &impl HirDatabase, def: impl Into<GenericDefId>) -> SubstsBuilder { |
360 | let def = def.into(); | 360 | let def = def.into(); |
361 | let params = db.generic_params(def.into()); | 361 | let params = db.generic_params(def); |
362 | let param_count = params.count_params_including_parent(); | 362 | let param_count = params.count_params_including_parent(); |
363 | Substs::builder(param_count) | 363 | Substs::builder(param_count) |
364 | } | 364 | } |
diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs index ee54d8217..6165eba4f 100644 --- a/crates/ra_hir/src/ty/infer/path.rs +++ b/crates/ra_hir/src/ty/infer/path.rs | |||
@@ -203,7 +203,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
203 | Container::ImplBlock(_) => self.find_self_types(&def, ty.clone()), | 203 | Container::ImplBlock(_) => self.find_self_types(&def, ty.clone()), |
204 | Container::Trait(t) => { | 204 | Container::Trait(t) => { |
205 | // we're picking this method | 205 | // we're picking this method |
206 | let trait_substs = Substs::build_for_def(self.db, t) | 206 | let trait_substs = Substs::build_for_def(self.db, t.id) |
207 | .push(ty.clone()) | 207 | .push(ty.clone()) |
208 | .fill(std::iter::repeat_with(|| self.new_type_var())) | 208 | .fill(std::iter::repeat_with(|| self.new_type_var())) |
209 | .build(); | 209 | .build(); |
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index da3c8e94a..1ceafd9b1 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -29,8 +29,8 @@ use crate::{ | |||
29 | Adt, | 29 | Adt, |
30 | }, | 30 | }, |
31 | util::make_mut_slice, | 31 | util::make_mut_slice, |
32 | Const, Enum, EnumVariant, Function, GenericDef, ImplBlock, ModuleDef, Path, Static, Struct, | 32 | Const, Enum, EnumVariant, Function, ImplBlock, ModuleDef, Path, Static, Struct, Trait, |
33 | Trait, TypeAlias, Union, | 33 | TypeAlias, Union, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | // FIXME: this is only really used in `type_for_def`, which contains a bunch of | 36 | // FIXME: this is only really used in `type_for_def`, which contains a bunch of |
@@ -261,8 +261,10 @@ impl Ty { | |||
261 | let traits = traits_from_env.flat_map(|t| t.all_super_traits(db)); | 261 | let traits = traits_from_env.flat_map(|t| t.all_super_traits(db)); |
262 | for t in traits { | 262 | for t in traits { |
263 | if let Some(associated_ty) = t.associated_type_by_name(db, &segment.name) { | 263 | if let Some(associated_ty) = t.associated_type_by_name(db, &segment.name) { |
264 | let substs = | 264 | let substs = Substs::build_for_def(db, t.id) |
265 | Substs::build_for_def(db, t).push(self_ty.clone()).fill_with_unknown().build(); | 265 | .push(self_ty.clone()) |
266 | .fill_with_unknown() | ||
267 | .build(); | ||
266 | // FIXME handle type parameters on the segment | 268 | // FIXME handle type parameters on the segment |
267 | return Ty::Projection(ProjectionTy { associated_ty, parameters: substs }); | 269 | return Ty::Projection(ProjectionTy { associated_ty, parameters: substs }); |
268 | } | 270 | } |
@@ -287,11 +289,11 @@ impl Ty { | |||
287 | segment: &PathSegment, | 289 | segment: &PathSegment, |
288 | resolved: TypableDef, | 290 | resolved: TypableDef, |
289 | ) -> Substs { | 291 | ) -> Substs { |
290 | let def_generic: Option<GenericDef> = match resolved { | 292 | let def_generic: Option<GenericDefId> = match resolved { |
291 | TypableDef::Function(func) => Some(func.into()), | 293 | TypableDef::Function(func) => Some(func.id.into()), |
292 | TypableDef::Adt(adt) => Some(adt.into()), | 294 | TypableDef::Adt(adt) => Some(adt.into()), |
293 | TypableDef::EnumVariant(var) => Some(var.parent_enum(db).into()), | 295 | TypableDef::EnumVariant(var) => Some(var.parent_enum(db).id.into()), |
294 | TypableDef::TypeAlias(t) => Some(t.into()), | 296 | TypableDef::TypeAlias(t) => Some(t.id.into()), |
295 | TypableDef::Const(_) | TypableDef::Static(_) | TypableDef::BuiltinType(_) => None, | 297 | TypableDef::Const(_) | TypableDef::Static(_) | TypableDef::BuiltinType(_) => None, |
296 | }; | 298 | }; |
297 | substs_from_path_segment(db, resolver, segment, def_generic, false) | 299 | substs_from_path_segment(db, resolver, segment, def_generic, false) |
@@ -338,7 +340,7 @@ pub(super) fn substs_from_path_segment( | |||
338 | db: &impl HirDatabase, | 340 | db: &impl HirDatabase, |
339 | resolver: &Resolver, | 341 | resolver: &Resolver, |
340 | segment: &PathSegment, | 342 | segment: &PathSegment, |
341 | def_generic: Option<GenericDef>, | 343 | def_generic: Option<GenericDefId>, |
342 | add_self_param: bool, | 344 | add_self_param: bool, |
343 | ) -> Substs { | 345 | ) -> Substs { |
344 | let mut substs = Vec::new(); | 346 | let mut substs = Vec::new(); |
@@ -376,7 +378,7 @@ pub(super) fn substs_from_path_segment( | |||
376 | 378 | ||
377 | // handle defaults | 379 | // handle defaults |
378 | if let Some(def_generic) = def_generic { | 380 | if let Some(def_generic) = def_generic { |
379 | let default_substs = db.generic_defaults(def_generic); | 381 | let default_substs = db.generic_defaults(def_generic.into()); |
380 | assert_eq!(substs.len(), default_substs.len()); | 382 | assert_eq!(substs.len(), default_substs.len()); |
381 | 383 | ||
382 | for (i, default_ty) in default_substs.iter().enumerate() { | 384 | for (i, default_ty) in default_substs.iter().enumerate() { |
@@ -439,7 +441,7 @@ impl TraitRef { | |||
439 | ) -> Substs { | 441 | ) -> Substs { |
440 | let has_self_param = | 442 | let has_self_param = |
441 | segment.args_and_bindings.as_ref().map(|a| a.has_self_type).unwrap_or(false); | 443 | segment.args_and_bindings.as_ref().map(|a| a.has_self_type).unwrap_or(false); |
442 | substs_from_path_segment(db, resolver, segment, Some(resolved.into()), !has_self_param) | 444 | substs_from_path_segment(db, resolver, segment, Some(resolved.id.into()), !has_self_param) |
443 | } | 445 | } |
444 | 446 | ||
445 | pub(crate) fn for_trait(db: &impl HirDatabase, trait_: Trait) -> TraitRef { | 447 | pub(crate) fn for_trait(db: &impl HirDatabase, trait_: Trait) -> TraitRef { |
@@ -579,10 +581,10 @@ pub(crate) fn field_types_query( | |||
579 | /// these are fine: `T: Foo<U::Item>, U: Foo<()>`. | 581 | /// these are fine: `T: Foo<U::Item>, U: Foo<()>`. |
580 | pub(crate) fn generic_predicates_for_param_query( | 582 | pub(crate) fn generic_predicates_for_param_query( |
581 | db: &impl HirDatabase, | 583 | db: &impl HirDatabase, |
582 | def: GenericDef, | 584 | def: GenericDefId, |
583 | param_idx: u32, | 585 | param_idx: u32, |
584 | ) -> Arc<[GenericPredicate]> { | 586 | ) -> Arc<[GenericPredicate]> { |
585 | let resolver = GenericDefId::from(def).resolver(db); | 587 | let resolver = def.resolver(db); |
586 | resolver | 588 | resolver |
587 | .where_predicates_in_scope() | 589 | .where_predicates_in_scope() |
588 | // we have to filter out all other predicates *first*, before attempting to lower them | 590 | // we have to filter out all other predicates *first*, before attempting to lower them |
@@ -615,8 +617,8 @@ pub(crate) fn generic_predicates_query( | |||
615 | } | 617 | } |
616 | 618 | ||
617 | /// Resolve the default type params from generics | 619 | /// Resolve the default type params from generics |
618 | pub(crate) fn generic_defaults_query(db: &impl HirDatabase, def: GenericDef) -> Substs { | 620 | pub(crate) fn generic_defaults_query(db: &impl HirDatabase, def: GenericDefId) -> Substs { |
619 | let resolver = GenericDefId::from(def).resolver(db); | 621 | let resolver = def.resolver(db); |
620 | let generic_params = db.generic_params(def.into()); | 622 | let generic_params = db.generic_params(def.into()); |
621 | 623 | ||
622 | let defaults = generic_params | 624 | let defaults = generic_params |
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index f7905b5ff..c5ab690eb 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -365,7 +365,7 @@ fn generic_implements_goal( | |||
365 | self_ty: Canonical<Ty>, | 365 | self_ty: Canonical<Ty>, |
366 | ) -> Canonical<InEnvironment<super::Obligation>> { | 366 | ) -> Canonical<InEnvironment<super::Obligation>> { |
367 | let num_vars = self_ty.num_vars; | 367 | let num_vars = self_ty.num_vars; |
368 | let substs = super::Substs::build_for_def(db, trait_) | 368 | let substs = super::Substs::build_for_def(db, trait_.id) |
369 | .push(self_ty.value) | 369 | .push(self_ty.value) |
370 | .fill_with_bound_vars(num_vars as u32) | 370 | .fill_with_bound_vars(num_vars as u32) |
371 | .build(); | 371 | .build(); |
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index a0dbf6305..0272dd9ae 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -736,7 +736,7 @@ fn closure_fn_trait_impl_datum( | |||
736 | 736 | ||
737 | let trait_ref = TraitRef { | 737 | let trait_ref = TraitRef { |
738 | trait_, | 738 | trait_, |
739 | substs: Substs::build_for_def(db, trait_).push(self_ty).push(arg_ty).build(), | 739 | substs: Substs::build_for_def(db, trait_.id).push(self_ty).push(arg_ty).build(), |
740 | }; | 740 | }; |
741 | 741 | ||
742 | let output_ty_id = AssocTyValue::ClosureFnTraitImplOutput(data.clone()).to_chalk(db); | 742 | let output_ty_id = AssocTyValue::ClosureFnTraitImplOutput(data.clone()).to_chalk(db); |
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index bac3f7582..85b053a6e 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -292,7 +292,7 @@ fn is_deprecated(node: impl HasAttrs, db: &impl HirDatabase) -> bool { | |||
292 | } | 292 | } |
293 | 293 | ||
294 | fn has_non_default_type_params(def: hir::GenericDef, db: &db::RootDatabase) -> bool { | 294 | fn has_non_default_type_params(def: hir::GenericDef, db: &db::RootDatabase) -> bool { |
295 | let subst = db.generic_defaults(def); | 295 | let subst = db.generic_defaults(def.into()); |
296 | subst.iter().any(|ty| ty == &Ty::Unknown) | 296 | subst.iter().any(|ty| ty == &Ty::Unknown) |
297 | } | 297 | } |
298 | 298 | ||