Skip to content

Commit a87ad4e

Browse files
authored
Rollup merge of #117870 - lcnr:rename-args_ref, r=compiler-errors
`fn args_ref_X` to `fn args_X`
2 parents 918c17a + 42945fc commit a87ad4e

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

compiler/rustc_middle/src/ty/fast_reject.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ pub struct DeepRejectCtxt {
189189
}
190190

191191
impl DeepRejectCtxt {
192-
pub fn args_refs_may_unify<'tcx>(
192+
pub fn args_may_unify<'tcx>(
193193
self,
194194
obligation_args: GenericArgsRef<'tcx>,
195195
impl_args: GenericArgsRef<'tcx>,
196196
) -> bool {
197197
iter::zip(obligation_args, impl_args).all(|(obl, imp)| {
198198
match (obl.unpack(), imp.unpack()) {
199-
// We don't fast reject based on regions for now.
199+
// We don't fast reject based on regions.
200200
(GenericArgKind::Lifetime(_), GenericArgKind::Lifetime(_)) => true,
201201
(GenericArgKind::Type(obl), GenericArgKind::Type(imp)) => {
202202
self.types_may_unify(obl, imp)
@@ -231,7 +231,7 @@ impl DeepRejectCtxt {
231231
| ty::Never
232232
| ty::Tuple(..)
233233
| ty::FnPtr(..)
234-
| ty::Foreign(..) => {}
234+
| ty::Foreign(..) => debug_assert!(impl_ty.is_known_rigid()),
235235
ty::FnDef(..)
236236
| ty::Closure(..)
237237
| ty::Coroutine(..)
@@ -260,7 +260,7 @@ impl DeepRejectCtxt {
260260
},
261261
ty::Adt(obl_def, obl_args) => match k {
262262
&ty::Adt(impl_def, impl_args) => {
263-
obl_def == impl_def && self.args_refs_may_unify(obl_args, impl_args)
263+
obl_def == impl_def && self.args_may_unify(obl_args, impl_args)
264264
}
265265
_ => false,
266266
},

compiler/rustc_trait_selection/src/solve/project_goals/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
160160
let goal_trait_ref = goal.predicate.projection_ty.trait_ref(tcx);
161161
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
162162
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::ForLookup };
163-
if !drcx.args_refs_may_unify(goal_trait_ref.args, impl_trait_ref.skip_binder().args) {
163+
if !drcx.args_may_unify(goal_trait_ref.args, impl_trait_ref.skip_binder().args) {
164164
return Err(NoSolution);
165165
}
166166

compiler/rustc_trait_selection/src/solve/trait_goals.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
4343

4444
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
4545
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::ForLookup };
46-
if !drcx
47-
.args_refs_may_unify(goal.predicate.trait_ref.args, impl_trait_ref.skip_binder().args)
48-
{
46+
if !drcx.args_may_unify(goal.predicate.trait_ref.args, impl_trait_ref.skip_binder().args) {
4947
return Err(NoSolution);
5048
}
5149

compiler/rustc_trait_selection/src/traits/coherence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub fn overlapping_impls(
100100
let impl1_ref = tcx.impl_trait_ref(impl1_def_id);
101101
let impl2_ref = tcx.impl_trait_ref(impl2_def_id);
102102
let may_overlap = match (impl1_ref, impl2_ref) {
103-
(Some(a), Some(b)) => drcx.args_refs_may_unify(a.skip_binder().args, b.skip_binder().args),
103+
(Some(a), Some(b)) => drcx.args_may_unify(a.skip_binder().args, b.skip_binder().args),
104104
(None, None) => {
105105
let self_ty1 = tcx.type_of(impl1_def_id).skip_binder();
106106
let self_ty2 = tcx.type_of(impl2_def_id).skip_binder();

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
375375
// consider a "quick reject". This avoids creating more types
376376
// and so forth that we need to.
377377
let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap();
378-
if !drcx.args_refs_may_unify(obligation_args, impl_trait_ref.skip_binder().args) {
378+
if !drcx.args_may_unify(obligation_args, impl_trait_ref.skip_binder().args) {
379379
return;
380380
}
381381
if self.reject_fn_ptr_impls(

0 commit comments

Comments
 (0)