Skip to content

Commit b61e1bb

Browse files
committed
Add debug calls for negative impls in coherence
1 parent 74c4318 commit b61e1bb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ fn overlap<'cx, 'tcx>(
150150
impl2_def_id: DefId,
151151
overlap_mode: OverlapMode,
152152
) -> Option<OverlapResult<'tcx>> {
153-
debug!("overlap(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
153+
debug!(
154+
"overlap(impl1_def_id={:?}, impl2_def_id={:?}, overlap_mode={:?})",
155+
impl1_def_id, impl2_def_id, overlap_mode
156+
);
154157

155158
selcx.infcx().probe_maybe_skip_leak_check(skip_leak_check.is_yes(), |snapshot| {
156159
overlap_within_probe(
@@ -191,9 +194,6 @@ fn overlap_within_probe<'cx, 'tcx>(
191194
let impl1_header = with_fresh_ty_vars(selcx, param_env, impl1_def_id);
192195
let impl2_header = with_fresh_ty_vars(selcx, param_env, impl2_def_id);
193196

194-
debug!("overlap: impl1_header={:?}", impl1_header);
195-
debug!("overlap: impl2_header={:?}", impl2_header);
196-
197197
let obligations = equate_impl_headers(selcx, &impl1_header, &impl2_header)?;
198198
debug!("overlap: unification check succeeded");
199199

@@ -226,6 +226,7 @@ fn equate_impl_headers<'cx, 'tcx>(
226226
impl2_header: &ty::ImplHeader<'tcx>,
227227
) -> Option<PredicateObligations<'tcx>> {
228228
// Do `a` and `b` unify? If not, no overlap.
229+
debug!("equate_impl_headers(impl1_header={:?}, impl2_header={:?}", impl1_header, impl2_header);
229230
selcx
230231
.infcx()
231232
.at(&ObligationCause::dummy(), ty::ParamEnv::empty())
@@ -264,6 +265,10 @@ fn implicit_negative<'cx, 'tcx>(
264265
// If the obligation `&'?a str: Error` holds, it means that there's overlap. If that doesn't
265266
// hold we need to check if `&'?a str: !Error` holds, if doesn't hold there's overlap because
266267
// at some point an impl for `&'?a str: Error` could be added.
268+
debug!(
269+
"implicit_negative(impl1_header={:?}, impl2_header={:?}, obligations={:?})",
270+
impl1_header, impl2_header, obligations
271+
);
267272
let infcx = selcx.infcx();
268273
let tcx = infcx.tcx;
269274
let opt_failing_obligation = impl1_header
@@ -296,6 +301,7 @@ fn negative_impl<'cx, 'tcx>(
296301
impl1_def_id: DefId,
297302
impl2_def_id: DefId,
298303
) -> bool {
304+
debug!("negative_impl(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
299305
let tcx = selcx.infcx().tcx;
300306

301307
// create a parameter environment corresponding to a (placeholder) instantiation of impl1

0 commit comments

Comments
 (0)