mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Fix lifetime parameters moving paramter defaults
This commit is contained in:
parent
1b283db47f
commit
1a929d6485
5 changed files with 113 additions and 68 deletions
|
@ -20,6 +20,7 @@ use hir_def::{
|
|||
LocalLifetimeParamId, LocalTypeOrConstParamId, Lookup, TypeOrConstParamId, TypeParamId,
|
||||
};
|
||||
use intern::Interned;
|
||||
use stdx::TupleExt;
|
||||
|
||||
use crate::{db::HirDatabase, lt_to_placeholder_idx, to_placeholder_idx, Interner, Substitution};
|
||||
|
||||
|
@ -57,7 +58,7 @@ impl Generics {
|
|||
self.iter_self().map(|(id, _)| id)
|
||||
}
|
||||
|
||||
fn iter_parent_id(&self) -> impl Iterator<Item = GenericParamId> + '_ {
|
||||
pub(crate) fn iter_parent_id(&self) -> impl Iterator<Item = GenericParamId> + '_ {
|
||||
self.iter_parent().map(|(id, _)| id)
|
||||
}
|
||||
|
||||
|
@ -67,6 +68,16 @@ impl Generics {
|
|||
self.params.iter_type_or_consts()
|
||||
}
|
||||
|
||||
pub(crate) fn iter_self_type_or_consts_id(
|
||||
&self,
|
||||
) -> impl DoubleEndedIterator<Item = GenericParamId> + '_ {
|
||||
self.params.iter_type_or_consts().map(from_toc_id(self)).map(TupleExt::head)
|
||||
}
|
||||
|
||||
pub(crate) fn iter_self_lt_id(&self) -> impl DoubleEndedIterator<Item = GenericParamId> + '_ {
|
||||
self.params.iter_lt().map(from_lt_id(self)).map(TupleExt::head)
|
||||
}
|
||||
|
||||
/// Iterate over the params followed by the parent params.
|
||||
pub(crate) fn iter(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue