Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f518827

Browse files
committed
Use impl1 and impl2 instead of a and b prefixes
1 parent 2f004d2 commit f518827

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,21 @@ fn with_fresh_ty_vars<'cx, 'tcx>(
140140
fn overlap<'cx, 'tcx>(
141141
selcx: &mut SelectionContext<'cx, 'tcx>,
142142
skip_leak_check: SkipLeakCheck,
143-
a_def_id: DefId,
144-
b_def_id: DefId,
143+
impl1_def_id: DefId,
144+
impl2_def_id: DefId,
145145
) -> Option<OverlapResult<'tcx>> {
146-
debug!("overlap(a_def_id={:?}, b_def_id={:?})", a_def_id, b_def_id);
146+
debug!("overlap(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
147147

148148
selcx.infcx().probe_maybe_skip_leak_check(skip_leak_check.is_yes(), |snapshot| {
149-
overlap_within_probe(selcx, skip_leak_check, a_def_id, b_def_id, snapshot)
149+
overlap_within_probe(selcx, skip_leak_check, impl1_def_id, impl2_def_id, snapshot)
150150
})
151151
}
152152

153153
fn overlap_within_probe<'cx, 'tcx>(
154154
selcx: &mut SelectionContext<'cx, 'tcx>,
155155
skip_leak_check: SkipLeakCheck,
156-
a_def_id: DefId,
157-
b_def_id: DefId,
156+
impl1_def_id: DefId,
157+
impl2_def_id: DefId,
158158
snapshot: &CombinedSnapshot<'_, 'tcx>,
159159
) -> Option<OverlapResult<'tcx>> {
160160
fn loose_check<'cx, 'tcx>(
@@ -182,17 +182,17 @@ fn overlap_within_probe<'cx, 'tcx>(
182182
// empty environment.
183183
let param_env = ty::ParamEnv::empty();
184184

185-
let a_impl_header = with_fresh_ty_vars(selcx, param_env, a_def_id);
186-
let b_impl_header = with_fresh_ty_vars(selcx, param_env, b_def_id);
185+
let impl1_header = with_fresh_ty_vars(selcx, param_env, impl1_def_id);
186+
let impl2_header = with_fresh_ty_vars(selcx, param_env, impl2_def_id);
187187

188-
debug!("overlap: a_impl_header={:?}", a_impl_header);
189-
debug!("overlap: b_impl_header={:?}", b_impl_header);
188+
debug!("overlap: impl1_header={:?}", impl1_header);
189+
debug!("overlap: impl2_header={:?}", impl2_header);
190190

191191
// Do `a` and `b` unify? If not, no overlap.
192192
let obligations = match selcx
193193
.infcx()
194194
.at(&ObligationCause::dummy(), param_env)
195-
.eq_impl_headers(&a_impl_header, &b_impl_header)
195+
.eq_impl_headers(&impl1_header, &impl2_header)
196196
{
197197
Ok(InferOk { obligations, value: () }) => obligations,
198198
Err(_) => {
@@ -225,11 +225,11 @@ fn overlap_within_probe<'cx, 'tcx>(
225225
// at some point an impl for `&'?a str: Error` could be added.
226226
let infcx = selcx.infcx();
227227
let tcx = infcx.tcx;
228-
let opt_failing_obligation = a_impl_header
228+
let opt_failing_obligation = impl1_header
229229
.predicates
230230
.iter()
231231
.copied()
232-
.chain(b_impl_header.predicates)
232+
.chain(impl2_header.predicates)
233233
.map(|p| infcx.resolve_vars_if_possible(p))
234234
.map(|p| Obligation {
235235
cause: ObligationCause::dummy(),
@@ -241,8 +241,8 @@ fn overlap_within_probe<'cx, 'tcx>(
241241
.find(|o| {
242242
// if both impl headers are set to strict coherence it means that this will be accepted
243243
// only if it's stated that T: !Trait. So only prove that the negated obligation holds.
244-
if tcx.has_attr(a_def_id, sym::rustc_strict_coherence)
245-
&& tcx.has_attr(b_def_id, sym::rustc_strict_coherence)
244+
if tcx.has_attr(impl1_def_id, sym::rustc_strict_coherence)
245+
&& tcx.has_attr(impl2_def_id, sym::rustc_strict_coherence)
246246
{
247247
strict_check(selcx, o)
248248
} else {
@@ -265,7 +265,7 @@ fn overlap_within_probe<'cx, 'tcx>(
265265
}
266266
}
267267

268-
let impl_header = selcx.infcx().resolve_vars_if_possible(a_impl_header);
268+
let impl_header = selcx.infcx().resolve_vars_if_possible(impl1_header);
269269
let intercrate_ambiguity_causes = selcx.take_intercrate_ambiguity_causes();
270270
debug!("overlap: intercrate_ambiguity_causes={:#?}", intercrate_ambiguity_causes);
271271

0 commit comments

Comments
 (0)