mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
parent
2d0931b9ba
commit
9f238930f1
3 changed files with 49 additions and 0 deletions
|
@ -75,6 +75,7 @@ impl GenericParams {
|
|||
};
|
||||
generics.parent_params = parent.map(|p| db.generic_params(p));
|
||||
let start = generics.parent_params.as_ref().map(|p| p.params.len()).unwrap_or(0) as u32;
|
||||
// FIXME: add `: Sized` bound for everything except for `Self` in traits
|
||||
match def {
|
||||
GenericDef::Function(it) => generics.fill(&it.source(db).ast, start),
|
||||
GenericDef::Struct(it) => generics.fill(&it.source(db).ast, start),
|
||||
|
@ -86,6 +87,9 @@ impl GenericParams {
|
|||
generics.fill(&it.source(db).ast, start + 1);
|
||||
}
|
||||
GenericDef::TypeAlias(it) => generics.fill(&it.source(db).ast, start),
|
||||
// Note that we don't add `Self` here: in `impl`s, `Self` is not a
|
||||
// type-parameter, but rather is a type-alias for impl's target
|
||||
// type, so this is handled by the resovler.
|
||||
GenericDef::ImplBlock(it) => generics.fill(&it.source(db).ast, start),
|
||||
GenericDef::EnumVariant(_) => {}
|
||||
}
|
||||
|
@ -135,6 +139,10 @@ impl GenericParams {
|
|||
}
|
||||
|
||||
fn add_where_predicate_from_bound(&mut self, bound: ast::TypeBound, type_ref: TypeRef) {
|
||||
if bound.has_question_mark() {
|
||||
// FIXME: remove this bound
|
||||
return;
|
||||
}
|
||||
let path = bound
|
||||
.type_ref()
|
||||
.and_then(|tr| match tr {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue