Skip to content

Commit 5e73d9d

Browse files
committed
Auto merge of rust-lang#151003 - matthiaskrgr:rollup-wvnF9sN, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#150861 (Folding/`ReErased` cleanups) - rust-lang#150869 (Emit error instead of delayed bug when meeting mismatch type for const tuple) - rust-lang#150920 (Use a hook to decouple `rustc_mir_transform` from `rustc_mir_build`) - rust-lang#150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping) - rust-lang#150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items)) - rust-lang#150980 (Use updated indexes to build reverse map for delegation generics) - rust-lang#150986 (std: Fix size returned by UEFI tcp4 read operations) - rust-lang#150996 (Remove `S-waiting-on-bors` after a PR is merged) r? @ghost
2 parents d20c5de + d419bdd commit 5e73d9d

1 file changed

Lines changed: 3 additions & 21 deletions

File tree

clippy_lints/src/matches/significant_drop_in_scrutinee.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_errors::{Applicability, Diag};
1212
use rustc_hir::intravisit::{Visitor, walk_expr};
1313
use rustc_hir::{Arm, Expr, ExprKind, MatchSource};
1414
use rustc_lint::{LateContext, LintContext};
15-
use rustc_middle::ty::{GenericArgKind, Region, RegionKind, Ty, TyCtxt, TypeVisitable, TypeVisitor};
15+
use rustc_middle::ty::{GenericArgKind, RegionKind, Ty, TypeVisitableExt};
1616
use rustc_span::Span;
1717

1818
use super::SIGNIFICANT_DROP_IN_SCRUTINEE;
@@ -303,13 +303,13 @@ impl<'a, 'tcx> SigDropHelper<'a, 'tcx> {
303303

304304
if self.sig_drop_holder != SigDropHolder::None {
305305
let parent_ty = self.cx.typeck_results().expr_ty(parent_expr);
306-
if !ty_has_erased_regions(parent_ty) && !parent_expr.is_syntactic_place_expr() {
306+
if !parent_ty.has_erased_regions() && !parent_expr.is_syntactic_place_expr() {
307307
self.replace_current_sig_drop(parent_expr.span, parent_ty.is_unit(), 0);
308308
self.sig_drop_holder = SigDropHolder::Moved;
309309
}
310310

311311
let (peel_ref_ty, peel_ref_times) = ty_peel_refs(parent_ty);
312-
if !ty_has_erased_regions(peel_ref_ty) && is_copy(self.cx, peel_ref_ty) {
312+
if !peel_ref_ty.has_erased_regions() && is_copy(self.cx, peel_ref_ty) {
313313
self.replace_current_sig_drop(parent_expr.span, peel_ref_ty.is_unit(), peel_ref_times);
314314
self.sig_drop_holder = SigDropHolder::Moved;
315315
}
@@ -399,24 +399,6 @@ fn ty_peel_refs(mut ty: Ty<'_>) -> (Ty<'_>, usize) {
399399
(ty, n)
400400
}
401401

402-
fn ty_has_erased_regions(ty: Ty<'_>) -> bool {
403-
struct V;
404-
405-
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for V {
406-
type Result = ControlFlow<()>;
407-
408-
fn visit_region(&mut self, region: Region<'tcx>) -> Self::Result {
409-
if region.is_erased() {
410-
ControlFlow::Break(())
411-
} else {
412-
ControlFlow::Continue(())
413-
}
414-
}
415-
}
416-
417-
ty.visit_with(&mut V).is_break()
418-
}
419-
420402
impl<'tcx> Visitor<'tcx> for SigDropHelper<'_, 'tcx> {
421403
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
422404
// We've emitted a lint on some neighborhood expression. That lint will suggest to move out the

0 commit comments

Comments
 (0)