Skip to content

Commit 08d44ad

Browse files
committed
debug
1 parent 81d403e commit 08d44ad

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ pub(crate) fn handle_opaque_type_uses<'tcx>(
7272
for (external_name, variable) in
7373
universal_region_relations.universal_regions.named_universal_regions_iter()
7474
{
75-
debug!(
76-
"init_free_and_bound_regions: region {:?} has external name {:?}",
77-
variable, external_name
78-
);
7975
definitions[variable].external_name = Some(external_name);
8076
}
8177

@@ -119,6 +115,8 @@ pub(crate) fn handle_opaque_type_uses<'tcx>(
119115
}
120116
}
121117

118+
debug!(?opaque_type_key, ?hidden_type, "check defining use");
119+
122120
let opaque_type_key = opaque_type_key.fold_captured_lifetime_args(tcx, |region| {
123121
let scc = constraint_sccs.scc(region.as_var());
124122
let vid = constraint_sccs.annotation(scc).representative;
@@ -247,16 +245,19 @@ struct OpaqueHiddenTypeFolder<'a, 'tcx> {
247245
}
248246

249247
impl<'tcx> OpaqueHiddenTypeFolder<'_, 'tcx> {
248+
#[instrument(level = "debug", skip(self))]
250249
fn apply_member_constraint(&mut self, r: RegionVid) -> Option<Region<'tcx>> {
251250
let member = self.constraint_sccs.scc(r);
252251

253252
if let Some((_, reg)) = self.arg_regions.iter().copied().find(|&(vid, _)| vid == r) {
253+
debug!("member equal to arg");
254254
return Some(reg);
255255
}
256256

257257
// If the member region lives in a higher universe, we currently choose
258258
// the most conservative option by leaving it unchanged.
259259
if !self.constraint_sccs.annotation(member).min_universe().is_root() {
260+
debug!("member not in root universe");
260261
return None;
261262
}
262263

@@ -273,6 +274,7 @@ impl<'tcx> OpaqueHiddenTypeFolder<'_, 'tcx> {
273274
})
274275
})
275276
.collect::<Vec<_>>();
277+
debug!(?choice_regions, "after enforcing lower-bound");
276278

277279
// Now find all the *upper bounds* -- that is, each UB is a
278280
// free region that must outlive the member region `R0` (`UB:
@@ -282,6 +284,8 @@ impl<'tcx> OpaqueHiddenTypeFolder<'_, 'tcx> {
282284
choice_regions.retain(|&(o_r, _)| self.universal_region_relations.outlives(ub, o_r));
283285
}
284286

287+
debug!(?choice_regions, "after enforcing upper-bound");
288+
285289
// At this point we can pick any member of `choice_regions` and would like to choose
286290
// it to be a small as possible. To avoid potential non-determinism we will pick the
287291
// smallest such choice.
@@ -319,7 +323,7 @@ impl<'tcx> OpaqueHiddenTypeFolder<'_, 'tcx> {
319323
debug!("no unique minimum choice");
320324
return None;
321325
};
322-
326+
debug!(?min_choice);
323327
Some(min_choice)
324328
}
325329

0 commit comments

Comments
 (0)