mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
internal: Treat the self param as different from patterns when lowering
This commit is contained in:
parent
0931361b8f
commit
458f4a2960
18 changed files with 256 additions and 144 deletions
|
@ -22,7 +22,7 @@ mod pat;
|
|||
mod path;
|
||||
pub(crate) mod unify;
|
||||
|
||||
use std::{convert::identity, ops::Index};
|
||||
use std::{convert::identity, iter, ops::Index};
|
||||
|
||||
use chalk_ir::{
|
||||
cast::Cast, fold::TypeFoldable, interner::HasInterner, DebruijnIndex, Mutability, Safety,
|
||||
|
@ -777,7 +777,15 @@ impl<'a> InferenceContext<'a> {
|
|||
|
||||
param_tys.push(va_list_ty)
|
||||
}
|
||||
for (ty, pat) in param_tys.into_iter().zip(self.body.params.iter()) {
|
||||
let mut param_tys = param_tys.into_iter().chain(iter::repeat(self.table.new_type_var()));
|
||||
if let Some(self_param) = self.body.self_param {
|
||||
if let Some(ty) = param_tys.next() {
|
||||
let ty = self.insert_type_vars(ty);
|
||||
let ty = self.normalize_associated_types_in(ty);
|
||||
self.write_binding_ty(self_param, ty);
|
||||
}
|
||||
}
|
||||
for (ty, pat) in param_tys.zip(&*self.body.params) {
|
||||
let ty = self.insert_type_vars(ty);
|
||||
let ty = self.normalize_associated_types_in(ty);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue