mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
extract const generic in ArrayType
This commit is contained in:
parent
71c15f2a44
commit
9480b38189
@ -171,6 +171,25 @@ fn collect_used_generics<'gp>(
|
|||||||
ast::Type::RefType(ref_) => generics.extend(
|
ast::Type::RefType(ref_) => generics.extend(
|
||||||
ref_.lifetime().and_then(|lt| known_generics.iter().find(find_lifetime(<.text()))),
|
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
|
// stable resort to lifetime, type, const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user