feat(rustc_typeck): avoid erroring with "wrong number of generics" if there's other problems
As shown in the two test requirements that got updated, if there's other problems, then those other problems are probably the root cause of the incorrect generics count.
This commit is contained in:
parent
befdfb5c71
commit
105b60f250
6 changed files with 17 additions and 43 deletions
|
@ -384,6 +384,16 @@ impl GenericArgs<'_> {
|
|||
self.args.iter().any(|arg| matches!(arg, GenericArg::Type(_)))
|
||||
}
|
||||
|
||||
pub fn has_err(&self) -> bool {
|
||||
self.args.iter().any(|arg| match arg {
|
||||
GenericArg::Type(ty) => matches!(ty.kind, TyKind::Err),
|
||||
_ => false,
|
||||
}) || self.bindings.iter().any(|arg| match arg.kind {
|
||||
TypeBindingKind::Equality { ty } => matches!(ty.kind, TyKind::Err),
|
||||
_ => false,
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn num_type_params(&self) -> usize {
|
||||
self.args.iter().filter(|arg| matches!(arg, GenericArg::Type(_))).count()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue