mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-14 17:07:26 +00:00
extract const generic in ArrayType
This commit is contained in:
parent
71c15f2a44
commit
9480b38189
1 changed files with 19 additions and 0 deletions
|
@ -171,6 +171,25 @@ fn collect_used_generics<'gp>(
|
|||
ast::Type::RefType(ref_) => generics.extend(
|
||||
ref_.lifetime().and_then(|lt| known_generics.iter().find(find_lifetime(<.text()))),
|
||||
),
|
||||
ast::Type::ArrayType(ar) => {
|
||||
if let Some(expr) = ar.expr() {
|
||||
if let ast::Expr::PathExpr(p) = expr {
|
||||
if let Some(path) = p.path() {
|
||||
if let Some(name_ref) = path.as_single_name_ref() {
|
||||
if let Some(param) = known_generics.iter().find(|gp| {
|
||||
if let ast::GenericParam::ConstParam(cp) = gp {
|
||||
cp.name().map_or(false, |n| n.text() == name_ref.text())
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}) {
|
||||
generics.push(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
});
|
||||
// stable resort to lifetime, type, const
|
||||
|
|
Loading…
Reference in a new issue