mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Auto merge of #18371 - Veykril:veykril/push-kwttrusywysp, r=Veykril
fix: Fix incorrect parsing of use bounds Fixes https://github.com/rust-lang/rust-analyzer/issues/18357
This commit is contained in:
commit
c58427ff94
11 changed files with 184 additions and 25 deletions
|
@ -19,7 +19,7 @@ use hir_def::{
|
|||
lang_item::{LangItem, LangItemTarget},
|
||||
nameres::DefMap,
|
||||
path::{Path, PathKind},
|
||||
type_ref::{TraitBoundModifier, TypeBound, TypeRef},
|
||||
type_ref::{TraitBoundModifier, TypeBound, TypeRef, UseArgRef},
|
||||
visibility::Visibility,
|
||||
GenericDefId, HasModule, ImportPathConfig, ItemContainerId, LocalFieldId, Lookup, ModuleDefId,
|
||||
ModuleId, TraitId,
|
||||
|
@ -2025,6 +2025,19 @@ impl HirDisplay for TypeBound {
|
|||
)?;
|
||||
path.hir_fmt(f)
|
||||
}
|
||||
TypeBound::Use(args) => {
|
||||
let edition = f.edition();
|
||||
write!(
|
||||
f,
|
||||
"use<{}> ",
|
||||
args.iter()
|
||||
.map(|it| match it {
|
||||
UseArgRef::Lifetime(lt) => lt.name.display(f.db.upcast(), edition),
|
||||
UseArgRef::Name(n) => n.display(f.db.upcast(), edition),
|
||||
})
|
||||
.format(", ")
|
||||
)
|
||||
}
|
||||
TypeBound::Error => write!(f, "{{error}}"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1067,7 +1067,7 @@ impl<'a> TyLoweringContext<'a> {
|
|||
lifetime,
|
||||
})))
|
||||
}
|
||||
TypeBound::Error => None,
|
||||
TypeBound::Use(_) | TypeBound::Error => None,
|
||||
};
|
||||
clause.into_iter().chain(
|
||||
trait_ref
|
||||
|
@ -1087,6 +1087,7 @@ impl<'a> TyLoweringContext<'a> {
|
|||
path.segments().last()
|
||||
}
|
||||
TypeBound::Path(_, TraitBoundModifier::Maybe)
|
||||
| TypeBound::Use(_)
|
||||
| TypeBound::Error
|
||||
| TypeBound::Lifetime(_) => None,
|
||||
};
|
||||
|
@ -1571,7 +1572,7 @@ pub(crate) fn generic_predicates_for_param_query(
|
|||
})
|
||||
})
|
||||
}
|
||||
TypeBound::Lifetime(_) | TypeBound::Error => false,
|
||||
TypeBound::Use(_) | TypeBound::Lifetime(_) | TypeBound::Error => false,
|
||||
}
|
||||
}
|
||||
WherePredicate::Lifetime { .. } => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue