diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-15 04:07:56 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-16 03:13:02 +0200 |
| commit | 57eeb61cc861f32351a9d45eed09b6b8ca3c9c5b (patch) | |
| tree | 46ac0043de16d6396baac934dc213f63e3ea4acb | |
| parent | 9ca42a56000d261be74db41339beff06bc6088c9 (diff) | |
| download | rust-57eeb61cc861f32351a9d45eed09b6b8ca3c9c5b.tar.gz rust-57eeb61cc861f32351a9d45eed09b6b8ca3c9c5b.zip | |
or-patterns: remove `Arm::contains_explicit_ref_binding`.
| -rw-r--r-- | src/librustc/hir/pat_util.rs | 17 | ||||
| -rw-r--r-- | src/librustc_typeck/check/_match.rs | 10 |
2 files changed, 5 insertions, 22 deletions
diff --git a/src/librustc/hir/pat_util.rs b/src/librustc/hir/pat_util.rs index b68886ba62c..ea35418bc1b 100644 --- a/src/librustc/hir/pat_util.rs +++ b/src/librustc/hir/pat_util.rs @@ -189,20 +189,3 @@ impl hir::Pat { result } } - -impl hir::Arm { - /// Checks if the patterns for this arm contain any `ref` or `ref mut` - /// bindings, and if yes whether its containing mutable ones or just immutables ones. - pub fn contains_explicit_ref_binding(&self) -> Option<hir::Mutability> { - // FIXME(tschottdorf): contains_explicit_ref_binding() must be removed - // for #42640 (default match binding modes). - // - // See #44848. - self.top_pats_hack().iter() - .filter_map(|pat| pat.contains_explicit_ref_binding()) - .max_by_key(|m| match *m { - hir::MutMutable => 1, - hir::MutImmutable => 0, - }) - } -} diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 7b971803db5..e0b53525dc9 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -411,11 +411,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // // See #44848. let contains_ref_bindings = arms.iter() - .filter_map(|a| a.contains_explicit_ref_binding()) - .max_by_key(|m| match *m { - hir::MutMutable => 1, - hir::MutImmutable => 0, - }); + .filter_map(|a| a.pat.contains_explicit_ref_binding()) + .max_by_key(|m| match *m { + hir::MutMutable => 1, + hir::MutImmutable => 0, + }); if let Some(m) = contains_ref_bindings { self.check_expr_with_needs(discrim, Needs::maybe_mut_place(m)) |
