Inline the remaining hir::Arm::top_pats_hack
This commit is contained in:
parent
a07b030998
commit
0022baae00
@ -1291,17 +1291,6 @@ pub struct Arm {
|
||||
pub body: P<Expr>,
|
||||
}
|
||||
|
||||
impl Arm {
|
||||
// HACK(or_patterns; Centril | dlrobertson): Remove this and
|
||||
// correctly handle each case in which this method is used.
|
||||
pub fn top_pats_hack(&self) -> &[P<Pat>] {
|
||||
match &self.pat.kind {
|
||||
PatKind::Or(pats) => pats,
|
||||
_ => std::slice::from_ref(&self.pat),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||
pub enum Guard {
|
||||
If(P<Expr>),
|
||||
|
@ -140,10 +140,17 @@ fn check_match(
|
||||
let mut have_errors = false;
|
||||
|
||||
let inlined_arms : Vec<(Vec<_>, _)> = arms.iter().map(|arm| (
|
||||
arm.top_pats_hack().iter().map(|pat| {
|
||||
let mut patcx = PatCtxt::new(self.tcx,
|
||||
self.param_env.and(self.identity_substs),
|
||||
self.tables);
|
||||
// HACK(or_patterns; Centril | dlrobertson): Remove this and
|
||||
// correctly handle exhaustiveness checking for nested or-patterns.
|
||||
match &arm.pat.kind {
|
||||
hir::PatKind::Or(pats) => pats,
|
||||
_ => std::slice::from_ref(&arm.pat),
|
||||
}.iter().map(|pat| {
|
||||
let mut patcx = PatCtxt::new(
|
||||
self.tcx,
|
||||
self.param_env.and(self.identity_substs),
|
||||
self.tables
|
||||
);
|
||||
patcx.include_lint_checks();
|
||||
let pattern = expand_pattern(cx, patcx.lower_pattern(&pat));
|
||||
if !patcx.errors.is_empty() {
|
||||
|
Loading…
Reference in New Issue
Block a user