Skip to content

Commit

Permalink
use propagate_through_exprs instead of propagate_through_expr
Browse files Browse the repository at this point in the history
fix `ExprKind` static_assert_size

fix hir-stats
  • Loading branch information
TaKO8Ki committed Sep 5, 2022
1 parent fea1c5f commit 9cde34e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 35 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
let mut closure_span = None::<rustc_span::Span>;
match expr.kind {
hir::ExprKind::MethodCall(.., args, _) => {
// only the first closre parameter of the method. args[0] is MethodCall PathSegment

for arg in args {
if let hir::ExprKind::Closure(hir::Closure {
capture_clause: hir::CaptureBy::Ref,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,7 @@ mod size_asserts {
static_assert_size!(Block<'_>, 48);
static_assert_size!(Body<'_>, 32);
static_assert_size!(Expr<'_>, 64);
static_assert_size!(ExprKind<'_>, 40);
static_assert_size!(ExprKind<'_>, 48);
static_assert_size!(FnDecl<'_>, 40);
static_assert_size!(ForeignItem<'_>, 72);
static_assert_size!(ForeignItemKind<'_>, 40);
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_passes/src/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,10 +1041,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {

hir::ExprKind::MethodCall(.., receiver, ref args, _) => {
let succ = self.check_is_ty_uninhabited(expr, succ);
let succ = args
.iter()
.rev()
.fold(succ, |succ, expr| self.propagate_through_expr(expr, succ));
let succ = self.propagate_through_exprs(args, succ);
self.propagate_through_expr(receiver, succ)
}

Expand Down
44 changes: 22 additions & 22 deletions src/test/ui/stats/hir-stats.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ hir-stats ----------------------------------------------------------------
hir-stats ForeignItemRef 24 ( 0.2%) 1 24
hir-stats Mod 32 ( 0.3%) 1 32
hir-stats ExprField 40 ( 0.4%) 1 40
hir-stats TraitItemRef 56 ( 0.6%) 2 28
hir-stats TraitItemRef 56 ( 0.5%) 2 28
hir-stats Param 64 ( 0.6%) 2 32
hir-stats Local 64 ( 0.6%) 1 64
hir-stats InlineAsm 72 ( 0.7%) 1 72
hir-stats ImplItemRef 72 ( 0.7%) 2 36
hir-stats FieldDef 96 ( 1.0%) 2 48
hir-stats Arm 96 ( 1.0%) 2 48
hir-stats Body 96 ( 1.0%) 3 32
hir-stats Stmt 96 ( 1.0%) 3 32
hir-stats FieldDef 96 ( 0.9%) 2 48
hir-stats Arm 96 ( 0.9%) 2 48
hir-stats Body 96 ( 0.9%) 3 32
hir-stats Stmt 96 ( 0.9%) 3 32
hir-stats - Local 32 ( 0.3%) 1
hir-stats - Semi 32 ( 0.3%) 1
hir-stats - Expr 32 ( 0.3%) 1
Expand All @@ -144,34 +144,34 @@ hir-stats GenericBound 192 ( 1.9%) 4 48
hir-stats - Trait 192 ( 1.9%) 4
hir-stats WherePredicate 216 ( 2.1%) 3 72
hir-stats - BoundPredicate 216 ( 2.1%) 3
hir-stats Block 288 ( 2.9%) 6 48
hir-stats GenericParam 400 ( 4.0%) 5 80
hir-stats Pat 440 ( 4.4%) 5 88
hir-stats Block 288 ( 2.8%) 6 48
hir-stats GenericParam 400 ( 3.9%) 5 80
hir-stats Pat 440 ( 4.3%) 5 88
hir-stats - Wild 88 ( 0.9%) 1
hir-stats - Struct 88 ( 0.9%) 1
hir-stats - Binding 264 ( 2.6%) 3
hir-stats Generics 560 ( 5.5%) 10 56
hir-stats Expr 672 ( 6.7%) 12 56
hir-stats - Path 56 ( 0.6%) 1
hir-stats - Struct 56 ( 0.6%) 1
hir-stats - Match 56 ( 0.6%) 1
hir-stats - InlineAsm 56 ( 0.6%) 1
hir-stats - Lit 112 ( 1.1%) 2
hir-stats - Block 336 ( 3.3%) 6
hir-stats Item 960 ( 9.5%) 12 80
hir-stats Expr 768 ( 7.5%) 12 64
hir-stats - Path 64 ( 0.6%) 1
hir-stats - Struct 64 ( 0.6%) 1
hir-stats - Match 64 ( 0.6%) 1
hir-stats - InlineAsm 64 ( 0.6%) 1
hir-stats - Lit 128 ( 1.3%) 2
hir-stats - Block 384 ( 3.8%) 6
hir-stats Item 960 ( 9.4%) 12 80
hir-stats - Trait 80 ( 0.8%) 1
hir-stats - Enum 80 ( 0.8%) 1
hir-stats - ExternCrate 80 ( 0.8%) 1
hir-stats - ForeignMod 80 ( 0.8%) 1
hir-stats - Impl 80 ( 0.8%) 1
hir-stats - Fn 160 ( 1.6%) 2
hir-stats - Use 400 ( 4.0%) 5
hir-stats Ty 1_080 (10.7%) 15 72
hir-stats - Use 400 ( 3.9%) 5
hir-stats Ty 1_080 (10.6%) 15 72
hir-stats - Ptr 72 ( 0.7%) 1
hir-stats - Rptr 72 ( 0.7%) 1
hir-stats - Path 936 ( 9.3%) 13
hir-stats Path 1_536 (15.2%) 32 48
hir-stats PathSegment 2_240 (22.2%) 40 56
hir-stats - Path 936 ( 9.2%) 13
hir-stats Path 1_536 (15.1%) 32 48
hir-stats PathSegment 2_240 (22.0%) 40 56
hir-stats ----------------------------------------------------------------
hir-stats Total 10_104
hir-stats Total 10_200
hir-stats
8 changes: 2 additions & 6 deletions src/tools/clippy/clippy_lints/src/eta_reduction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,8 @@ fn check_inputs(
_ => false,
}
};
if let Some(receiver) = receiver {
std::iter::zip(params, std::iter::once(receiver).chain(call_args.iter()))
.all(|(param, arg)| check_inputs(param, arg))
} else {
std::iter::zip(params, call_args).all(|(param, arg)| check_inputs(param, arg))
}
std::iter::zip(params, receiver.into_iter().chain(call_args.iter()))
.all(|(param, arg)| check_inputs(param, arg))
}

fn check_sig<'tcx>(cx: &LateContext<'tcx>, closure_ty: Ty<'tcx>, call_ty: Ty<'tcx>) -> bool {
Expand Down

0 comments on commit 9cde34e

Please sign in to comment.