Don't trigger debug_assert_with_mut_call on .await

This commit is contained in:
flip1995 2020-01-29 15:46:38 +01:00
parent 2c4df2418c
commit f16e383709
No known key found for this signature in database
GPG Key ID: 693086869D506637

View File

@ -4,7 +4,7 @@ use matches::matches;
use rustc::hir::map::Map;
use rustc::ty;
use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability, StmtKind, UnOp};
use rustc_hir::{BorrowKind, Expr, ExprKind, MatchSource, Mutability, StmtKind, UnOp};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::Span;
@ -147,6 +147,8 @@ impl<'a, 'tcx> Visitor<'tcx> for MutArgVisitor<'a, 'tcx> {
}
}
},
// Don't check await desugars
ExprKind::Match(_, _, MatchSource::AwaitDesugar) => return,
_ if !self.found => self.expr_span = Some(expr.span),
_ => return,
}