Auto merge of #151003 - matthiaskrgr:rollup-wvnF9sN, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang/rust#150861 (Folding/`ReErased` cleanups) - rust-lang/rust#150869 (Emit error instead of delayed bug when meeting mismatch type for const tuple) - rust-lang/rust#150920 (Use a hook to decouple `rustc_mir_transform` from `rustc_mir_build`) - rust-lang/rust#150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping) - rust-lang/rust#150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items)) - rust-lang/rust#150980 (Use updated indexes to build reverse map for delegation generics) - rust-lang/rust#150986 (std: Fix size returned by UEFI tcp4 read operations) - rust-lang/rust#150996 (Remove `S-waiting-on-bors` after a PR is merged) r? @ghost
This commit is contained in:
commit
5e73d9dc69
1 changed files with 3 additions and 21 deletions
|
|
@ -12,7 +12,7 @@ use rustc_errors::{Applicability, Diag};
|
|||
use rustc_hir::intravisit::{Visitor, walk_expr};
|
||||
use rustc_hir::{Arm, Expr, ExprKind, MatchSource};
|
||||
use rustc_lint::{LateContext, LintContext};
|
||||
use rustc_middle::ty::{GenericArgKind, Region, RegionKind, Ty, TyCtxt, TypeVisitable, TypeVisitor};
|
||||
use rustc_middle::ty::{GenericArgKind, RegionKind, Ty, TypeVisitableExt};
|
||||
use rustc_span::Span;
|
||||
|
||||
use super::SIGNIFICANT_DROP_IN_SCRUTINEE;
|
||||
|
|
@ -303,13 +303,13 @@ impl<'a, 'tcx> SigDropHelper<'a, 'tcx> {
|
|||
|
||||
if self.sig_drop_holder != SigDropHolder::None {
|
||||
let parent_ty = self.cx.typeck_results().expr_ty(parent_expr);
|
||||
if !ty_has_erased_regions(parent_ty) && !parent_expr.is_syntactic_place_expr() {
|
||||
if !parent_ty.has_erased_regions() && !parent_expr.is_syntactic_place_expr() {
|
||||
self.replace_current_sig_drop(parent_expr.span, parent_ty.is_unit(), 0);
|
||||
self.sig_drop_holder = SigDropHolder::Moved;
|
||||
}
|
||||
|
||||
let (peel_ref_ty, peel_ref_times) = ty_peel_refs(parent_ty);
|
||||
if !ty_has_erased_regions(peel_ref_ty) && is_copy(self.cx, peel_ref_ty) {
|
||||
if !peel_ref_ty.has_erased_regions() && is_copy(self.cx, peel_ref_ty) {
|
||||
self.replace_current_sig_drop(parent_expr.span, peel_ref_ty.is_unit(), peel_ref_times);
|
||||
self.sig_drop_holder = SigDropHolder::Moved;
|
||||
}
|
||||
|
|
@ -399,24 +399,6 @@ fn ty_peel_refs(mut ty: Ty<'_>) -> (Ty<'_>, usize) {
|
|||
(ty, n)
|
||||
}
|
||||
|
||||
fn ty_has_erased_regions(ty: Ty<'_>) -> bool {
|
||||
struct V;
|
||||
|
||||
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for V {
|
||||
type Result = ControlFlow<()>;
|
||||
|
||||
fn visit_region(&mut self, region: Region<'tcx>) -> Self::Result {
|
||||
if region.is_erased() {
|
||||
ControlFlow::Break(())
|
||||
} else {
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ty.visit_with(&mut V).is_break()
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for SigDropHelper<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
|
||||
// We've emitted a lint on some neighborhood expression. That lint will suggest to move out the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue