Skip to content

Commit 18ccd6a

Browse files
committed
Add exceptions for ExprKind::Err/TyKind::Error.
1 parent 5f4dd1d commit 18ccd6a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/librustc_passes/ast_validation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl<'a> AstValidator<'a> {
287287
// ```
288288
fn check_expr_within_pat(&self, expr: &Expr, allow_paths: bool) {
289289
match expr.node {
290-
ExprKind::Lit(..) => {}
290+
ExprKind::Lit(..) | ExprKind::Err => {}
291291
ExprKind::Path(..) if allow_paths => {}
292292
ExprKind::Unary(UnOp::Neg, ref inner)
293293
if match inner.node { ExprKind::Lit(_) => true, _ => false } => {}

src/librustc_typeck/check/_match.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
196196
let rhs_ty = self.check_expr(end);
197197

198198
// Check that both end-points are of numeric or char type.
199-
let numeric_or_char = |ty: Ty<'_>| ty.is_numeric() || ty.is_char();
199+
let numeric_or_char = |ty: Ty<'_>| {
200+
ty.is_numeric()
201+
|| ty.is_char()
202+
|| ty.references_error()
203+
};
200204
let lhs_compat = numeric_or_char(lhs_ty);
201205
let rhs_compat = numeric_or_char(rhs_ty);
202206

0 commit comments

Comments
 (0)