aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/adt.rs54
-rw-r--r--crates/ra_hir/src/code_model.rs65
-rw-r--r--crates/ra_hir/src/code_model/src.rs3
-rw-r--r--crates/ra_hir/src/impl_block.rs8
-rw-r--r--crates/ra_hir/src/lib.rs8
-rw-r--r--crates/ra_hir/src/resolve.rs39
-rw-r--r--crates/ra_hir/src/ty/infer.rs3
-rw-r--r--crates/ra_hir/src/ty/lower.rs3
-rw-r--r--crates/ra_hir_def/src/generics.rs3
9 files changed, 81 insertions, 105 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs
deleted file mode 100644
index 945f236c2..000000000
--- a/crates/ra_hir/src/adt.rs
+++ /dev/null
@@ -1,54 +0,0 @@
1//! This module contains the implementation details of the HIR for ADTs, i.e.
2//! structs and enums (and unions).
3
4use std::sync::Arc;
5
6use hir_def::adt::VariantData;
7
8use crate::{
9 db::{DefDatabase, HirDatabase},
10 EnumVariant, Module, Name, Struct, StructField,
11};
12
13impl Struct {
14 pub(crate) fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> {
15 db.struct_data(self.id.into()).variant_data.clone()
16 }
17}
18
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
20pub enum VariantDef {
21 Struct(Struct),
22 EnumVariant(EnumVariant),
23}
24impl_froms!(VariantDef: Struct, EnumVariant);
25
26impl VariantDef {
27 pub fn fields(self, db: &impl HirDatabase) -> Vec<StructField> {
28 match self {
29 VariantDef::Struct(it) => it.fields(db),
30 VariantDef::EnumVariant(it) => it.fields(db),
31 }
32 }
33
34 pub fn field(self, db: &impl HirDatabase, name: &Name) -> Option<StructField> {
35 match self {
36 VariantDef::Struct(it) => it.field(db, name),
37 VariantDef::EnumVariant(it) => it.field(db, name),
38 }
39 }
40
41 pub fn module(self, db: &impl HirDatabase) -> Module {
42 match self {
43 VariantDef::Struct(it) => it.module(db),
44 VariantDef::EnumVariant(it) => it.module(db),
45 }
46 }
47
48 pub(crate) fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> {
49 match self {
50 VariantDef::Struct(it) => it.variant_data(db),
51 VariantDef::EnumVariant(it) => it.variant_data(db),
52 }
53 }
54}
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 920899dce..9b6276b51 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -23,7 +23,6 @@ use ra_db::{CrateId, Edition};
23use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; 23use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
24 24
25use crate::{ 25use crate::{
26 adt::VariantDef,
27 db::{AstDatabase, DefDatabase, HirDatabase}, 26 db::{AstDatabase, DefDatabase, HirDatabase},
28 expr::{BindingAnnotation, Body, BodySourceMap, ExprValidator, Pat, PatId}, 27 expr::{BindingAnnotation, Body, BodySourceMap, ExprValidator, Pat, PatId},
29 generics::{GenericDef, HasGenericParams}, 28 generics::{GenericDef, HasGenericParams},
@@ -322,9 +321,11 @@ impl Struct {
322 // take the outer scope... 321 // take the outer scope...
323 let r = self.module(db).resolver(db); 322 let r = self.module(db).resolver(db);
324 // ...and add generic params, if present 323 // ...and add generic params, if present
325 let p = self.generic_params(db); 324 r.push_generic_params_scope(db, self.into())
326 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r }; 325 }
327 r 326
327 fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> {
328 db.struct_data(self.id.into()).variant_data.clone()
328 } 329 }
329} 330}
330 331
@@ -352,9 +353,7 @@ impl Union {
352 // take the outer scope... 353 // take the outer scope...
353 let r = self.module(db).resolver(db); 354 let r = self.module(db).resolver(db);
354 // ...and add generic params, if present 355 // ...and add generic params, if present
355 let p = self.generic_params(db); 356 r.push_generic_params_scope(db, self.into())
356 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
357 r
358 } 357 }
359} 358}
360 359
@@ -402,8 +401,7 @@ impl Enum {
402 // take the outer scope... 401 // take the outer scope...
403 let r = self.module(db).resolver(db); 402 let r = self.module(db).resolver(db);
404 // ...and add generic params, if present 403 // ...and add generic params, if present
405 let p = self.generic_params(db); 404 let r = r.push_generic_params_scope(db, self.into());
406 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
407 r.push_scope(Scope::AdtScope(self.into())) 405 r.push_scope(Scope::AdtScope(self.into()))
408 } 406 }
409} 407}
@@ -487,6 +485,43 @@ impl Adt {
487 } 485 }
488} 486}
489 487
488#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
489pub enum VariantDef {
490 Struct(Struct),
491 EnumVariant(EnumVariant),
492}
493impl_froms!(VariantDef: Struct, EnumVariant);
494
495impl VariantDef {
496 pub fn fields(self, db: &impl HirDatabase) -> Vec<StructField> {
497 match self {
498 VariantDef::Struct(it) => it.fields(db),
499 VariantDef::EnumVariant(it) => it.fields(db),
500 }
501 }
502
503 pub fn field(self, db: &impl HirDatabase, name: &Name) -> Option<StructField> {
504 match self {
505 VariantDef::Struct(it) => it.field(db, name),
506 VariantDef::EnumVariant(it) => it.field(db, name),
507 }
508 }
509
510 pub fn module(self, db: &impl HirDatabase) -> Module {
511 match self {
512 VariantDef::Struct(it) => it.module(db),
513 VariantDef::EnumVariant(it) => it.module(db),
514 }
515 }
516
517 pub(crate) fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> {
518 match self {
519 VariantDef::Struct(it) => it.variant_data(db),
520 VariantDef::EnumVariant(it) => it.variant_data(db),
521 }
522 }
523}
524
490/// The defs which have a body. 525/// The defs which have a body.
491#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 526#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
492pub enum DefWithBody { 527pub enum DefWithBody {
@@ -709,9 +744,7 @@ impl Function {
709 // take the outer scope... 744 // take the outer scope...
710 let r = self.container(db).map_or_else(|| self.module(db).resolver(db), |c| c.resolver(db)); 745 let r = self.container(db).map_or_else(|| self.module(db).resolver(db), |c| c.resolver(db));
711 // ...and add generic params, if present 746 // ...and add generic params, if present
712 let p = self.generic_params(db); 747 r.push_generic_params_scope(db, self.into())
713 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
714 r
715 } 748 }
716 749
717 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { 750 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) {
@@ -946,9 +979,7 @@ impl Trait {
946 pub(crate) fn resolver(self, db: &impl DefDatabase) -> Resolver { 979 pub(crate) fn resolver(self, db: &impl DefDatabase) -> Resolver {
947 let r = self.module(db).resolver(db); 980 let r = self.module(db).resolver(db);
948 // add generic params, if present 981 // add generic params, if present
949 let p = self.generic_params(db); 982 r.push_generic_params_scope(db, self.into())
950 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
951 r
952 } 983 }
953} 984}
954 985
@@ -1010,9 +1041,7 @@ impl TypeAlias {
1010 .map(|ib| ib.resolver(db)) 1041 .map(|ib| ib.resolver(db))
1011 .unwrap_or_else(|| self.module(db).resolver(db)); 1042 .unwrap_or_else(|| self.module(db).resolver(db));
1012 // ...and add generic params, if present 1043 // ...and add generic params, if present
1013 let p = self.generic_params(db); 1044 r.push_generic_params_scope(db, self.into())
1014 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
1015 r
1016 } 1045 }
1017} 1046}
1018 1047
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index 354d2c98f..4aa427de4 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -4,11 +4,10 @@ use hir_def::{HasSource as _, Lookup};
4use ra_syntax::ast::{self, AstNode}; 4use ra_syntax::ast::{self, AstNode};
5 5
6use crate::{ 6use crate::{
7 adt::VariantDef,
8 db::{AstDatabase, DefDatabase, HirDatabase}, 7 db::{AstDatabase, DefDatabase, HirDatabase},
9 ids::AstItemDef, 8 ids::AstItemDef,
10 Const, Either, Enum, EnumVariant, FieldSource, Function, HasBody, HirFileId, MacroDef, Module, 9 Const, Either, Enum, EnumVariant, FieldSource, Function, HasBody, HirFileId, MacroDef, Module,
11 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, 10 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, VariantDef,
12}; 11};
13 12
14pub use hir_expand::Source; 13pub use hir_expand::Source;
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 0513f28a9..492d964a4 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -5,7 +5,6 @@ use ra_syntax::ast::{self};
5 5
6use crate::{ 6use crate::{
7 db::{AstDatabase, DefDatabase, HirDatabase}, 7 db::{AstDatabase, DefDatabase, HirDatabase},
8 generics::HasGenericParams,
9 resolve::Resolver, 8 resolve::Resolver,
10 ty::Ty, 9 ty::Ty,
11 AssocItem, Crate, HasSource, ImplBlock, Module, Source, TraitRef, 10 AssocItem, Crate, HasSource, ImplBlock, Module, Source, TraitRef,
@@ -52,12 +51,11 @@ impl ImplBlock {
52 Crate { crate_id: self.module(db).id.krate } 51 Crate { crate_id: self.module(db).id.krate }
53 } 52 }
54 53
55 pub(crate) fn resolver(&self, db: &impl DefDatabase) -> Resolver { 54 pub(crate) fn resolver(self, db: &impl DefDatabase) -> Resolver {
56 let r = self.module(db).resolver(db); 55 let r = self.module(db).resolver(db);
57 // add generic params, if present 56 // add generic params, if present
58 let p = self.generic_params(db); 57 let r = r.push_generic_params_scope(db, self.into());
59 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r }; 58 let r = r.push_impl_block_scope(self);
60 let r = r.push_impl_block_scope(self.clone());
61 r 59 r
62 } 60 }
63} 61}
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index 7ac9a9041..31da74d2f 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -32,7 +32,6 @@ pub mod db;
32pub mod source_binder; 32pub mod source_binder;
33 33
34mod ids; 34mod ids;
35mod adt;
36mod type_alias; 35mod type_alias;
37mod ty; 36mod ty;
38mod impl_block; 37mod impl_block;
@@ -56,15 +55,14 @@ mod marks;
56use crate::resolve::Resolver; 55use crate::resolve::Resolver;
57 56
58pub use crate::{ 57pub use crate::{
59 adt::VariantDef,
60 code_model::ImplBlock,
61 code_model::{ 58 code_model::{
62 attrs::{AttrDef, Attrs}, 59 attrs::{AttrDef, Attrs},
63 docs::{DocDef, Docs, Documentation}, 60 docs::{DocDef, Docs, Documentation},
64 src::{HasBodySource, HasSource}, 61 src::{HasBodySource, HasSource},
65 Adt, AssocItem, Const, ConstData, Container, Crate, CrateDependency, DefWithBody, Enum, 62 Adt, AssocItem, Const, ConstData, Container, Crate, CrateDependency, DefWithBody, Enum,
66 EnumVariant, FieldSource, FnData, Function, GenericParam, HasBody, Local, MacroDef, Module, 63 EnumVariant, FieldSource, FnData, Function, GenericParam, HasBody, ImplBlock, Local,
67 ModuleDef, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, 64 MacroDef, Module, ModuleDef, ModuleSource, Static, Struct, StructField, Trait, TypeAlias,
65 Union, VariantDef,
68 }, 66 },
69 expr::ExprScopes, 67 expr::ExprScopes,
70 from_source::FromSource, 68 from_source::FromSource,
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index a2fa0bb79..e5e768be9 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -14,9 +14,9 @@ use crate::{
14 code_model::Crate, 14 code_model::Crate,
15 db::{DefDatabase, HirDatabase}, 15 db::{DefDatabase, HirDatabase},
16 expr::{ExprScopes, PatId, ScopeId}, 16 expr::{ExprScopes, PatId, ScopeId},
17 generics::GenericParams, 17 generics::{GenericParams, HasGenericParams},
18 Adt, Const, DefWithBody, Enum, EnumVariant, Function, ImplBlock, Local, MacroDef, ModuleDef, 18 Adt, Const, DefWithBody, Enum, EnumVariant, Function, GenericDef, ImplBlock, Local, MacroDef,
19 PerNs, Static, Struct, Trait, TypeAlias, 19 ModuleDef, PerNs, Static, Struct, Trait, TypeAlias,
20}; 20};
21 21
22#[derive(Debug, Clone, Default)] 22#[derive(Debug, Clone, Default)]
@@ -43,7 +43,7 @@ pub(crate) enum Scope {
43 /// All the items and imported names of a module 43 /// All the items and imported names of a module
44 ModuleScope(ModuleItemMap), 44 ModuleScope(ModuleItemMap),
45 /// Brings the generic parameters of an item into scope 45 /// Brings the generic parameters of an item into scope
46 GenericParams(Arc<GenericParams>), 46 GenericParams { def: GenericDef, params: Arc<GenericParams> },
47 /// Brings `Self` in `impl` block into scope 47 /// Brings `Self` in `impl` block into scope
48 ImplBlockScope(ImplBlock), 48 ImplBlockScope(ImplBlock),
49 /// Brings `Self` in enum, struct and union definitions into scope 49 /// Brings `Self` in enum, struct and union definitions into scope
@@ -141,9 +141,9 @@ impl Resolver {
141 for scope in self.scopes.iter().rev() { 141 for scope in self.scopes.iter().rev() {
142 match scope { 142 match scope {
143 Scope::ExprScope(_) => continue, 143 Scope::ExprScope(_) => continue,
144 Scope::GenericParams(_) | Scope::ImplBlockScope(_) if skip_to_mod => continue, 144 Scope::GenericParams { .. } | Scope::ImplBlockScope(_) if skip_to_mod => continue,
145 145
146 Scope::GenericParams(params) => { 146 Scope::GenericParams { params, .. } => {
147 if let Some(param) = params.find_by_name(first_name) { 147 if let Some(param) = params.find_by_name(first_name) {
148 let idx = if path.segments.len() == 1 { None } else { Some(1) }; 148 let idx = if path.segments.len() == 1 { None } else { Some(1) };
149 return Some((TypeNs::GenericParam(param.idx), idx)); 149 return Some((TypeNs::GenericParam(param.idx), idx));
@@ -212,7 +212,7 @@ impl Resolver {
212 match scope { 212 match scope {
213 Scope::AdtScope(_) 213 Scope::AdtScope(_)
214 | Scope::ExprScope(_) 214 | Scope::ExprScope(_)
215 | Scope::GenericParams(_) 215 | Scope::GenericParams { .. }
216 | Scope::ImplBlockScope(_) 216 | Scope::ImplBlockScope(_)
217 if skip_to_mod => 217 if skip_to_mod =>
218 { 218 {
@@ -232,13 +232,13 @@ impl Resolver {
232 } 232 }
233 Scope::ExprScope(_) => continue, 233 Scope::ExprScope(_) => continue,
234 234
235 Scope::GenericParams(params) if n_segments > 1 => { 235 Scope::GenericParams { params, .. } if n_segments > 1 => {
236 if let Some(param) = params.find_by_name(first_name) { 236 if let Some(param) = params.find_by_name(first_name) {
237 let ty = TypeNs::GenericParam(param.idx); 237 let ty = TypeNs::GenericParam(param.idx);
238 return Some(ResolveValueResult::Partial(ty, 1)); 238 return Some(ResolveValueResult::Partial(ty, 1));
239 } 239 }
240 } 240 }
241 Scope::GenericParams(_) => continue, 241 Scope::GenericParams { .. } => continue,
242 242
243 Scope::ImplBlockScope(impl_) if n_segments > 1 => { 243 Scope::ImplBlockScope(impl_) if n_segments > 1 => {
244 if first_name == &name::SELF_TYPE { 244 if first_name == &name::SELF_TYPE {
@@ -361,7 +361,7 @@ impl Resolver {
361 self.scopes 361 self.scopes
362 .iter() 362 .iter()
363 .filter_map(|scope| match scope { 363 .filter_map(|scope| match scope {
364 Scope::GenericParams(params) => Some(params), 364 Scope::GenericParams { params, .. } => Some(params),
365 _ => None, 365 _ => None,
366 }) 366 })
367 .flat_map(|params| params.where_predicates.iter()) 367 .flat_map(|params| params.where_predicates.iter())
@@ -369,7 +369,7 @@ impl Resolver {
369 369
370 pub(crate) fn generic_def(&self) -> Option<crate::generics::GenericDef> { 370 pub(crate) fn generic_def(&self) -> Option<crate::generics::GenericDef> {
371 self.scopes.iter().find_map(|scope| match scope { 371 self.scopes.iter().find_map(|scope| match scope {
372 Scope::GenericParams(params) => Some(params.def.into()), 372 Scope::GenericParams { def, .. } => Some(*def),
373 _ => None, 373 _ => None,
374 }) 374 })
375 } 375 }
@@ -381,8 +381,17 @@ impl Resolver {
381 self 381 self
382 } 382 }
383 383
384 pub(crate) fn push_generic_params_scope(self, params: Arc<GenericParams>) -> Resolver { 384 pub(crate) fn push_generic_params_scope(
385 self.push_scope(Scope::GenericParams(params)) 385 self,
386 db: &impl DefDatabase,
387 def: GenericDef,
388 ) -> Resolver {
389 let params = def.generic_params(db);
390 if params.params.is_empty() {
391 self
392 } else {
393 self.push_scope(Scope::GenericParams { def, params })
394 }
386 } 395 }
387 396
388 pub(crate) fn push_impl_block_scope(self, impl_block: ImplBlock) -> Resolver { 397 pub(crate) fn push_impl_block_scope(self, impl_block: ImplBlock) -> Resolver {
@@ -457,8 +466,8 @@ impl Scope {
457 }); 466 });
458 } 467 }
459 } 468 }
460 Scope::GenericParams(gp) => { 469 Scope::GenericParams { params, .. } => {
461 for param in &gp.params { 470 for param in params.params.iter() {
462 f(param.name.clone(), ScopeDef::GenericParam(param.idx)) 471 f(param.name.clone(), ScopeDef::GenericParam(param.idx))
463 } 472 }
464 } 473 }
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index c35378cc4..092bc3a3f 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -37,14 +37,13 @@ use super::{
37 TypeCtor, TypeWalk, Uncertain, 37 TypeCtor, TypeWalk, Uncertain,
38}; 38};
39use crate::{ 39use crate::{
40 adt::VariantDef,
41 code_model::TypeAlias, 40 code_model::TypeAlias,
42 db::HirDatabase, 41 db::HirDatabase,
43 expr::{BindingAnnotation, Body, ExprId, PatId}, 42 expr::{BindingAnnotation, Body, ExprId, PatId},
44 resolve::{Resolver, TypeNs}, 43 resolve::{Resolver, TypeNs},
45 ty::infer::diagnostics::InferenceDiagnostic, 44 ty::infer::diagnostics::InferenceDiagnostic,
46 Adt, AssocItem, ConstData, DefWithBody, FloatTy, FnData, Function, HasBody, IntTy, Path, 45 Adt, AssocItem, ConstData, DefWithBody, FloatTy, FnData, Function, HasBody, IntTy, Path,
47 StructField, 46 StructField, VariantDef,
48}; 47};
49 48
50macro_rules! ty_app { 49macro_rules! ty_app {
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index 03db38605..91e60b5ab 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -19,7 +19,6 @@ use super::{
19 TypeWalk, 19 TypeWalk,
20}; 20};
21use crate::{ 21use crate::{
22 adt::VariantDef,
23 db::HirDatabase, 22 db::HirDatabase,
24 generics::HasGenericParams, 23 generics::HasGenericParams,
25 generics::{GenericDef, WherePredicate}, 24 generics::{GenericDef, WherePredicate},
@@ -30,7 +29,7 @@ use crate::{
30 }, 29 },
31 util::make_mut_slice, 30 util::make_mut_slice,
32 Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, Trait, 31 Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, Trait,
33 TypeAlias, Union, 32 TypeAlias, Union, VariantDef,
34}; 33};
35 34
36// FIXME: this is only really used in `type_for_def`, which contains a bunch of 35// FIXME: this is only really used in `type_for_def`, which contains a bunch of
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs
index f794eefbc..9e2e4c3cc 100644
--- a/crates/ra_hir_def/src/generics.rs
+++ b/crates/ra_hir_def/src/generics.rs
@@ -25,7 +25,6 @@ pub struct GenericParam {
25/// Data about the generic parameters of a function, struct, impl, etc. 25/// Data about the generic parameters of a function, struct, impl, etc.
26#[derive(Clone, PartialEq, Eq, Debug)] 26#[derive(Clone, PartialEq, Eq, Debug)]
27pub struct GenericParams { 27pub struct GenericParams {
28 pub def: GenericDefId,
29 pub parent_params: Option<Arc<GenericParams>>, 28 pub parent_params: Option<Arc<GenericParams>>,
30 pub params: Vec<GenericParam>, 29 pub params: Vec<GenericParam>,
31 pub where_predicates: Vec<WherePredicate>, 30 pub where_predicates: Vec<WherePredicate>,
@@ -56,7 +55,7 @@ impl GenericParams {
56 parent_params: Option<Arc<GenericParams>>, 55 parent_params: Option<Arc<GenericParams>>,
57 ) -> GenericParams { 56 ) -> GenericParams {
58 let mut generics = 57 let mut generics =
59 GenericParams { def, params: Vec::new(), parent_params, where_predicates: Vec::new() }; 58 GenericParams { params: Vec::new(), parent_params, where_predicates: Vec::new() };
60 let start = generics.parent_params.as_ref().map(|p| p.params.len()).unwrap_or(0) as u32; 59 let start = generics.parent_params.as_ref().map(|p| p.params.len()).unwrap_or(0) as u32;
61 // FIXME: add `: Sized` bound for everything except for `Self` in traits 60 // FIXME: add `: Sized` bound for everything except for `Self` in traits
62 match def { 61 match def {