Skip to content

Commit 9cde34e

Browse files
committed
use propagate_through_exprs instead of propagate_through_expr
fix `ExprKind` static_assert_size fix hir-stats
1 parent fea1c5f commit 9cde34e

File tree

5 files changed

+26
-35
lines changed

5 files changed

+26
-35
lines changed

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

-2
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
900900
let mut closure_span = None::<rustc_span::Span>;
901901
match expr.kind {
902902
hir::ExprKind::MethodCall(.., args, _) => {
903-
// only the first closre parameter of the method. args[0] is MethodCall PathSegment
904-
905903
for arg in args {
906904
if let hir::ExprKind::Closure(hir::Closure {
907905
capture_clause: hir::CaptureBy::Ref,

compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,7 @@ mod size_asserts {
34983498
static_assert_size!(Block<'_>, 48);
34993499
static_assert_size!(Body<'_>, 32);
35003500
static_assert_size!(Expr<'_>, 64);
3501-
static_assert_size!(ExprKind<'_>, 40);
3501+
static_assert_size!(ExprKind<'_>, 48);
35023502
static_assert_size!(FnDecl<'_>, 40);
35033503
static_assert_size!(ForeignItem<'_>, 72);
35043504
static_assert_size!(ForeignItemKind<'_>, 40);

compiler/rustc_passes/src/liveness.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
10411041

10421042
hir::ExprKind::MethodCall(.., receiver, ref args, _) => {
10431043
let succ = self.check_is_ty_uninhabited(expr, succ);
1044-
let succ = args
1045-
.iter()
1046-
.rev()
1047-
.fold(succ, |succ, expr| self.propagate_through_expr(expr, succ));
1044+
let succ = self.propagate_through_exprs(args, succ);
10481045
self.propagate_through_expr(receiver, succ)
10491046
}
10501047

src/test/ui/stats/hir-stats.stderr

+22-22
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ hir-stats ----------------------------------------------------------------
121121
hir-stats ForeignItemRef 24 ( 0.2%) 1 24
122122
hir-stats Mod 32 ( 0.3%) 1 32
123123
hir-stats ExprField 40 ( 0.4%) 1 40
124-
hir-stats TraitItemRef 56 ( 0.6%) 2 28
124+
hir-stats TraitItemRef 56 ( 0.5%) 2 28
125125
hir-stats Param 64 ( 0.6%) 2 32
126126
hir-stats Local 64 ( 0.6%) 1 64
127127
hir-stats InlineAsm 72 ( 0.7%) 1 72
128128
hir-stats ImplItemRef 72 ( 0.7%) 2 36
129-
hir-stats FieldDef 96 ( 1.0%) 2 48
130-
hir-stats Arm 96 ( 1.0%) 2 48
131-
hir-stats Body 96 ( 1.0%) 3 32
132-
hir-stats Stmt 96 ( 1.0%) 3 32
129+
hir-stats FieldDef 96 ( 0.9%) 2 48
130+
hir-stats Arm 96 ( 0.9%) 2 48
131+
hir-stats Body 96 ( 0.9%) 3 32
132+
hir-stats Stmt 96 ( 0.9%) 3 32
133133
hir-stats - Local 32 ( 0.3%) 1
134134
hir-stats - Semi 32 ( 0.3%) 1
135135
hir-stats - Expr 32 ( 0.3%) 1
@@ -144,34 +144,34 @@ hir-stats GenericBound 192 ( 1.9%) 4 48
144144
hir-stats - Trait 192 ( 1.9%) 4
145145
hir-stats WherePredicate 216 ( 2.1%) 3 72
146146
hir-stats - BoundPredicate 216 ( 2.1%) 3
147-
hir-stats Block 288 ( 2.9%) 6 48
148-
hir-stats GenericParam 400 ( 4.0%) 5 80
149-
hir-stats Pat 440 ( 4.4%) 5 88
147+
hir-stats Block 288 ( 2.8%) 6 48
148+
hir-stats GenericParam 400 ( 3.9%) 5 80
149+
hir-stats Pat 440 ( 4.3%) 5 88
150150
hir-stats - Wild 88 ( 0.9%) 1
151151
hir-stats - Struct 88 ( 0.9%) 1
152152
hir-stats - Binding 264 ( 2.6%) 3
153153
hir-stats Generics 560 ( 5.5%) 10 56
154-
hir-stats Expr 672 ( 6.7%) 12 56
155-
hir-stats - Path 56 ( 0.6%) 1
156-
hir-stats - Struct 56 ( 0.6%) 1
157-
hir-stats - Match 56 ( 0.6%) 1
158-
hir-stats - InlineAsm 56 ( 0.6%) 1
159-
hir-stats - Lit 112 ( 1.1%) 2
160-
hir-stats - Block 336 ( 3.3%) 6
161-
hir-stats Item 960 ( 9.5%) 12 80
154+
hir-stats Expr 768 ( 7.5%) 12 64
155+
hir-stats - Path 64 ( 0.6%) 1
156+
hir-stats - Struct 64 ( 0.6%) 1
157+
hir-stats - Match 64 ( 0.6%) 1
158+
hir-stats - InlineAsm 64 ( 0.6%) 1
159+
hir-stats - Lit 128 ( 1.3%) 2
160+
hir-stats - Block 384 ( 3.8%) 6
161+
hir-stats Item 960 ( 9.4%) 12 80
162162
hir-stats - Trait 80 ( 0.8%) 1
163163
hir-stats - Enum 80 ( 0.8%) 1
164164
hir-stats - ExternCrate 80 ( 0.8%) 1
165165
hir-stats - ForeignMod 80 ( 0.8%) 1
166166
hir-stats - Impl 80 ( 0.8%) 1
167167
hir-stats - Fn 160 ( 1.6%) 2
168-
hir-stats - Use 400 ( 4.0%) 5
169-
hir-stats Ty 1_080 (10.7%) 15 72
168+
hir-stats - Use 400 ( 3.9%) 5
169+
hir-stats Ty 1_080 (10.6%) 15 72
170170
hir-stats - Ptr 72 ( 0.7%) 1
171171
hir-stats - Rptr 72 ( 0.7%) 1
172-
hir-stats - Path 936 ( 9.3%) 13
173-
hir-stats Path 1_536 (15.2%) 32 48
174-
hir-stats PathSegment 2_240 (22.2%) 40 56
172+
hir-stats - Path 936 ( 9.2%) 13
173+
hir-stats Path 1_536 (15.1%) 32 48
174+
hir-stats PathSegment 2_240 (22.0%) 40 56
175175
hir-stats ----------------------------------------------------------------
176-
hir-stats Total 10_104
176+
hir-stats Total 10_200
177177
hir-stats

src/tools/clippy/clippy_lints/src/eta_reduction.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,8 @@ fn check_inputs(
206206
_ => false,
207207
}
208208
};
209-
if let Some(receiver) = receiver {
210-
std::iter::zip(params, std::iter::once(receiver).chain(call_args.iter()))
211-
.all(|(param, arg)| check_inputs(param, arg))
212-
} else {
213-
std::iter::zip(params, call_args).all(|(param, arg)| check_inputs(param, arg))
214-
}
209+
std::iter::zip(params, receiver.into_iter().chain(call_args.iter()))
210+
.all(|(param, arg)| check_inputs(param, arg))
215211
}
216212

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

0 commit comments

Comments
 (0)