mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Record method resolution for call expressions
This commit is contained in:
parent
9814d79841
commit
54da0bfbf0
10 changed files with 119 additions and 77 deletions
|
@ -63,7 +63,7 @@ impl<D> TyBuilder<D> {
|
|||
}
|
||||
|
||||
fn build_internal(self) -> (D, Substitution) {
|
||||
assert_eq!(self.vec.len(), self.param_kinds.len());
|
||||
assert_eq!(self.vec.len(), self.param_kinds.len(), "{:?}", &self.param_kinds);
|
||||
for (a, e) in self.vec.iter().zip(self.param_kinds.iter()) {
|
||||
self.assert_match_kind(a, e);
|
||||
}
|
||||
|
@ -282,6 +282,21 @@ impl TyBuilder<Tuple> {
|
|||
let (Tuple(size), subst) = self.build_internal();
|
||||
TyKind::Tuple(size, subst).intern(Interner)
|
||||
}
|
||||
|
||||
pub fn tuple_with<I>(elements: I) -> Ty
|
||||
where
|
||||
I: IntoIterator<Item = Ty>,
|
||||
<I as IntoIterator>::IntoIter: ExactSizeIterator,
|
||||
{
|
||||
let elements = elements.into_iter();
|
||||
let len = elements.len();
|
||||
let mut b =
|
||||
TyBuilder::new(Tuple(len), iter::repeat(ParamKind::Type).take(len).collect(), None);
|
||||
for e in elements {
|
||||
b = b.push(e);
|
||||
}
|
||||
b.build()
|
||||
}
|
||||
}
|
||||
|
||||
impl TyBuilder<TraitId> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue