aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/generics.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-08-22 14:13:07 +0100
committerGitHub <[email protected]>2019-08-22 14:13:07 +0100
commit79a46f258854f8a81651f41cadffbe4d6139f2c5 (patch)
treed41acbbf7895f17fb4af653fa9e8b4bb1a9a2c93 /crates/ra_hir/src/generics.rs
parent5c7d832bf9110350f0107791229172b0305f2701 (diff)
parent9f238930f1969731869c89956414f4b160b180c0 (diff)
Merge #1717
1717: Don't add `?` bounds as real bounds r=flodiebold a=matklad closes #1709 Co-authored-by: Aleksey Kladov <[email protected]>
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 {