// ```
fn check_expr_within_pat(&self, expr: &Expr, allow_paths: bool) {
match expr.node {
- ExprKind::Lit(..) => {}
+ ExprKind::Lit(..) | ExprKind::Err => {}
ExprKind::Path(..) if allow_paths => {}
ExprKind::Unary(UnOp::Neg, ref inner)
if match inner.node { ExprKind::Lit(_) => true, _ => false } => {}
let rhs_ty = self.check_expr(end);
// Check that both end-points are of numeric or char type.
- let numeric_or_char = |ty: Ty<'_>| ty.is_numeric() || ty.is_char();
+ let numeric_or_char = |ty: Ty<'_>| {
+ ty.is_numeric()
+ || ty.is_char()
+ || ty.references_error()
+ };
let lhs_compat = numeric_or_char(lhs_ty);
let rhs_compat = numeric_or_char(rhs_ty);