aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/generics.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-08-22 13:28:08 +0100
committerAleksey Kladov <[email protected]>2019-08-22 13:35:42 +0100
commit9f238930f1969731869c89956414f4b160b180c0 (patch)
tree182d17948da88b2acff477154cf54896e959efcd /crates/ra_hir/src/generics.rs
parent2d0931b9ba7aabdc634c799b32957cc6f057e875 (diff)
Don't add `?` bounds as real bounds
closes #1709
Diffstat (limited to 'crates/ra_hir/src/generics.rs')
-rw-r--r--crates/ra_hir/src/generics.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs
index e6482180d..e75337cdf 100644
--- a/crates/ra_hir/src/generics.rs
+++ b/crates/ra_hir/src/generics.rs
@@ -75,6 +75,7 @@ impl GenericParams {
75 }; 75 };
76 generics.parent_params = parent.map(|p| db.generic_params(p)); 76 generics.parent_params = parent.map(|p| db.generic_params(p));
77 let start = generics.parent_params.as_ref().map(|p| p.params.len()).unwrap_or(0) as u32; 77 let start = generics.parent_params.as_ref().map(|p| p.params.len()).unwrap_or(0) as u32;
78 // FIXME: add `: Sized` bound for everything except for `Self` in traits
78 match def { 79 match def {
79 GenericDef::Function(it) => generics.fill(&it.source(db).ast, start), 80 GenericDef::Function(it) => generics.fill(&it.source(db).ast, start),
80 GenericDef::Struct(it) => generics.fill(&it.source(db).ast, start), 81 GenericDef::Struct(it) => generics.fill(&it.source(db).ast, start),
@@ -86,6 +87,9 @@ impl GenericParams {
86 generics.fill(&it.source(db).ast, start + 1); 87 generics.fill(&it.source(db).ast, start + 1);
87 } 88 }
88 GenericDef::TypeAlias(it) => generics.fill(&it.source(db).ast, start), 89 GenericDef::TypeAlias(it) => generics.fill(&it.source(db).ast, start),
90 // Note that we don't add `Self` here: in `impl`s, `Self` is not a
91 // type-parameter, but rather is a type-alias for impl's target
92 // type, so this is handled by the resovler.
89 GenericDef::ImplBlock(it) => generics.fill(&it.source(db).ast, start), 93 GenericDef::ImplBlock(it) => generics.fill(&it.source(db).ast, start),
90 GenericDef::EnumVariant(_) => {} 94 GenericDef::EnumVariant(_) => {}
91 } 95 }
@@ -135,6 +139,10 @@ impl GenericParams {
135 } 139 }
136 140
137 fn add_where_predicate_from_bound(&mut self, bound: ast::TypeBound, type_ref: TypeRef) { 141 fn add_where_predicate_from_bound(&mut self, bound: ast::TypeBound, type_ref: TypeRef) {
142 if bound.has_question_mark() {
143 // FIXME: remove this bound
144 return;
145 }
138 let path = bound 146 let path = bound
139 .type_ref() 147 .type_ref()
140 .and_then(|tr| match tr { 148 .and_then(|tr| match tr {