mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Show only assoc type args in the correct arg pos
This commit is contained in:
parent
441e659aa1
commit
0f2eba54db
3 changed files with 69 additions and 3 deletions
|
@ -41,6 +41,7 @@ use hir_def::{
|
|||
adt::{ReprKind, VariantData},
|
||||
body::{BodyDiagnostic, SyntheticSyntax},
|
||||
expr::{BindingAnnotation, LabelId, Pat, PatId},
|
||||
generics::{TypeOrConstParamData, TypeParamProvenance},
|
||||
item_tree::ItemTreeNode,
|
||||
lang_item::LangItemTarget,
|
||||
nameres::{self, diagnostics::DefDiagnostic},
|
||||
|
@ -1707,6 +1708,22 @@ impl Trait {
|
|||
pub fn is_unsafe(&self, db: &dyn HirDatabase) -> bool {
|
||||
db.trait_data(self.id).is_unsafe
|
||||
}
|
||||
|
||||
pub fn type_parameters(&self, db: &dyn HirDatabase) -> Vec<TypeOrConstParamData> {
|
||||
db.generic_params(GenericDefId::from(self.id))
|
||||
.type_or_consts
|
||||
.iter()
|
||||
.filter(|(_, ty)| match ty {
|
||||
TypeOrConstParamData::TypeParamData(ty)
|
||||
if ty.provenance != TypeParamProvenance::TypeParamList =>
|
||||
{
|
||||
false
|
||||
}
|
||||
_ => true,
|
||||
})
|
||||
.map(|(_, ty)|ty.clone())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl HasVisibility for Trait {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue