Skip to content

Commit e96166e

Browse files
authored
Rollup merge of #105867 - matthiaskrgr:rec_param, r=compiler-errors
remove redundant fn params that were only "used" in recursion
2 parents be48d21 + 6e52a0f commit e96166e

File tree

4 files changed

+10
-44
lines changed

4 files changed

+10
-44
lines changed

Diff for: compiler/rustc_borrowck/src/region_infer/mod.rs

+3-26
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
831831
if self.eval_verify_bound(
832832
infcx,
833833
param_env,
834-
body,
835834
generic_ty,
836835
type_test.lower_bound,
837836
&type_test.verify_bound,
@@ -962,14 +961,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
962961
// where `ur` is a local bound -- we are sometimes in a
963962
// position to prove things that our caller cannot. See
964963
// #53570 for an example.
965-
if self.eval_verify_bound(
966-
infcx,
967-
param_env,
968-
body,
969-
generic_ty,
970-
ur,
971-
&type_test.verify_bound,
972-
) {
964+
if self.eval_verify_bound(infcx, param_env, generic_ty, ur, &type_test.verify_bound) {
973965
continue;
974966
}
975967

@@ -1190,7 +1182,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
11901182
&self,
11911183
infcx: &InferCtxt<'tcx>,
11921184
param_env: ty::ParamEnv<'tcx>,
1193-
body: &Body<'tcx>,
11941185
generic_ty: Ty<'tcx>,
11951186
lower_bound: RegionVid,
11961187
verify_bound: &VerifyBound<'tcx>,
@@ -1213,25 +1204,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
12131204
}
12141205

12151206
VerifyBound::AnyBound(verify_bounds) => verify_bounds.iter().any(|verify_bound| {
1216-
self.eval_verify_bound(
1217-
infcx,
1218-
param_env,
1219-
body,
1220-
generic_ty,
1221-
lower_bound,
1222-
verify_bound,
1223-
)
1207+
self.eval_verify_bound(infcx, param_env, generic_ty, lower_bound, verify_bound)
12241208
}),
12251209

12261210
VerifyBound::AllBounds(verify_bounds) => verify_bounds.iter().all(|verify_bound| {
1227-
self.eval_verify_bound(
1228-
infcx,
1229-
param_env,
1230-
body,
1231-
generic_ty,
1232-
lower_bound,
1233-
verify_bound,
1234-
)
1211+
self.eval_verify_bound(infcx, param_env, generic_ty, lower_bound, verify_bound)
12351212
}),
12361213
}
12371214
}

Diff for: compiler/rustc_hir_analysis/src/check/check.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,17 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
9999
ty: Ty<'tcx>,
100100
tcx: TyCtxt<'tcx>,
101101
param_env: ty::ParamEnv<'tcx>,
102-
span: Span,
103102
) -> bool {
104103
// We don't just accept all !needs_drop fields, due to semver concerns.
105104
match ty.kind() {
106105
ty::Ref(..) => true, // references never drop (even mutable refs, which are non-Copy and hence fail the later check)
107106
ty::Tuple(tys) => {
108107
// allow tuples of allowed types
109-
tys.iter().all(|ty| allowed_union_field(ty, tcx, param_env, span))
108+
tys.iter().all(|ty| allowed_union_field(ty, tcx, param_env))
110109
}
111110
ty::Array(elem, _len) => {
112111
// Like `Copy`, we do *not* special-case length 0.
113-
allowed_union_field(*elem, tcx, param_env, span)
112+
allowed_union_field(*elem, tcx, param_env)
114113
}
115114
_ => {
116115
// Fallback case: allow `ManuallyDrop` and things that are `Copy`.
@@ -124,7 +123,7 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
124123
for field in &def.non_enum_variant().fields {
125124
let field_ty = field.ty(tcx, substs);
126125

127-
if !allowed_union_field(field_ty, tcx, param_env, span) {
126+
if !allowed_union_field(field_ty, tcx, param_env) {
128127
let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) {
129128
// We are currently checking the type this field came from, so it must be local.
130129
Some(Node::Field(field)) => (field.span, field.ty.span),

Diff for: compiler/rustc_hir_typeck/src/pat.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21302130
&& let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span)
21312131
{
21322132
let ty = self.resolve_vars_if_possible(ti.expected);
2133-
let is_slice_or_array_or_vector = self.is_slice_or_array_or_vector(&mut err, snippet.clone(), ty);
2133+
let is_slice_or_array_or_vector = self.is_slice_or_array_or_vector(ty);
21342134
match is_slice_or_array_or_vector.1.kind() {
21352135
ty::Adt(adt_def, _)
21362136
if self.tcx.is_diagnostic_item(sym::Option, adt_def.did())
@@ -2159,17 +2159,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21592159
err.emit();
21602160
}
21612161

2162-
fn is_slice_or_array_or_vector(
2163-
&self,
2164-
err: &mut Diagnostic,
2165-
snippet: String,
2166-
ty: Ty<'tcx>,
2167-
) -> (bool, Ty<'tcx>) {
2162+
fn is_slice_or_array_or_vector(&self, ty: Ty<'tcx>) -> (bool, Ty<'tcx>) {
21682163
match ty.kind() {
21692164
ty::Adt(adt_def, _) if self.tcx.is_diagnostic_item(sym::Vec, adt_def.did()) => {
21702165
(true, ty)
21712166
}
2172-
ty::Ref(_, ty, _) => self.is_slice_or_array_or_vector(err, snippet, *ty),
2167+
ty::Ref(_, ty, _) => self.is_slice_or_array_or_vector(*ty),
21732168
ty::Slice(..) | ty::Array(..) => (true, ty),
21742169
_ => (false, ty),
21752170
}

Diff for: compiler/rustc_trait_selection/src/traits/auto_trait.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,12 @@ impl<'tcx> AutoTraitFinder<'tcx> {
159159
orig_env,
160160
orig_env,
161161
&mut fresh_preds,
162-
false,
163162
) else {
164163
return AutoTraitResult::NegativeImpl;
165164
};
166165

167166
let (full_env, full_user_env) = self
168-
.evaluate_predicates(&infcx, trait_did, ty, new_env, user_env, &mut fresh_preds, true)
167+
.evaluate_predicates(&infcx, trait_did, ty, new_env, user_env, &mut fresh_preds)
169168
.unwrap_or_else(|| {
170169
panic!("Failed to fully process: {:?} {:?} {:?}", ty, trait_did, orig_env)
171170
});
@@ -247,7 +246,6 @@ impl<'tcx> AutoTraitFinder<'tcx> {
247246
param_env: ty::ParamEnv<'tcx>,
248247
user_env: ty::ParamEnv<'tcx>,
249248
fresh_preds: &mut FxHashSet<ty::Predicate<'tcx>>,
250-
only_projections: bool,
251249
) -> Option<(ty::ParamEnv<'tcx>, ty::ParamEnv<'tcx>)> {
252250
let tcx = infcx.tcx;
253251

@@ -322,7 +320,6 @@ impl<'tcx> AutoTraitFinder<'tcx> {
322320
fresh_preds,
323321
&mut predicates,
324322
&mut select,
325-
only_projections,
326323
) {
327324
return None;
328325
}
@@ -600,7 +597,6 @@ impl<'tcx> AutoTraitFinder<'tcx> {
600597
fresh_preds: &mut FxHashSet<ty::Predicate<'tcx>>,
601598
predicates: &mut VecDeque<ty::PolyTraitPredicate<'tcx>>,
602599
selcx: &mut SelectionContext<'_, 'tcx>,
603-
only_projections: bool,
604600
) -> bool {
605601
let dummy_cause = ObligationCause::dummy();
606602

@@ -744,7 +740,6 @@ impl<'tcx> AutoTraitFinder<'tcx> {
744740
fresh_preds,
745741
predicates,
746742
selcx,
747-
only_projections,
748743
) {
749744
return false;
750745
}

0 commit comments

Comments
 (0)