mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
Ignore lifetime params in substitutions
This commit is contained in:
parent
10f6332831
commit
ae8a802085
3 changed files with 17 additions and 3 deletions
|
@ -246,7 +246,10 @@ struct GenericParamsStorage {
|
|||
|
||||
impl GenericParamsStorage {
|
||||
fn alloc(&mut self, params: GenericParams) -> GenericParamsId {
|
||||
if params.types.is_empty() && params.where_predicates.is_empty() {
|
||||
if params.types.is_empty()
|
||||
&& params.lifetimes.is_empty()
|
||||
&& params.where_predicates.is_empty()
|
||||
{
|
||||
return GenericParamsId::EMPTY;
|
||||
}
|
||||
|
||||
|
|
|
@ -856,7 +856,12 @@ impl<'a> InferenceContext<'a> {
|
|||
// handle provided type arguments
|
||||
if let Some(generic_args) = generic_args {
|
||||
// if args are provided, it should be all of them, but we can't rely on that
|
||||
for arg in generic_args.args.iter().take(type_params) {
|
||||
for arg in generic_args
|
||||
.args
|
||||
.iter()
|
||||
.filter(|arg| matches!(arg, GenericArg::Type(_)))
|
||||
.take(type_params)
|
||||
{
|
||||
match arg {
|
||||
GenericArg::Type(type_ref) => {
|
||||
let ty = self.make_ty(type_ref);
|
||||
|
|
|
@ -565,7 +565,13 @@ fn substs_from_path_segment(
|
|||
if generic_args.has_self_type { self_params + type_params } else { type_params };
|
||||
let skip = if generic_args.has_self_type && self_params == 0 { 1 } else { 0 };
|
||||
// if args are provided, it should be all of them, but we can't rely on that
|
||||
for arg in generic_args.args.iter().skip(skip).take(expected_num) {
|
||||
for arg in generic_args
|
||||
.args
|
||||
.iter()
|
||||
.filter(|arg| matches!(arg, GenericArg::Type(_)))
|
||||
.skip(skip)
|
||||
.take(expected_num)
|
||||
{
|
||||
match arg {
|
||||
GenericArg::Type(type_ref) => {
|
||||
had_explicit_type_args = true;
|
||||
|
|
Loading…
Reference in a new issue