Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebank
feat(rustc_parse): recover from pre-RFC-2000 const generics syntax Fixes #89013
This commit is contained in:
commit
1708219940
11 changed files with 180 additions and 6 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