Skip to content

Commit a555e50

Browse files
committed
Fix tidy error
1 parent 102b4fc commit a555e50

File tree

3 files changed

+14
-32
lines changed

3 files changed

+14
-32
lines changed

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ trait TypeOpInfo<'tcx> {
181181
bound: placeholder.bound,
182182
});
183183

184-
let error_region = None;
185-
186184
debug!(?placeholder_region);
187185

186+
// FIXME: this is obviously weird; this whole argument now does nothing and maybe
187+
// it should?
188188
let span = cause.span;
189-
let nice_error = self.nice_error(mbcx, cause, placeholder_region, error_region);
189+
let nice_error = self.nice_error(mbcx, cause, placeholder_region, None);
190190

191191
debug!(?nice_error);
192192

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+7-24
Original file line numberDiff line numberDiff line change
@@ -210,33 +210,16 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
210210
let mut suggestions = vec![];
211211
let hir = self.infcx.tcx.hir();
212212

213-
// find generic associated types in the given region 'lower_bound'
214-
// FIXME: this should find one of the special-case blamable
215-
// new constraints instead!
216-
//let gat_id_and_generics = vec![];
217-
//debug!(?gat_id_and_generics);
218-
219213
// find higher-ranked trait bounds bounded to the generic associated types
220214
let hrtb_bounds = vec![];
221215
/*
222-
gat_id_and_generics.iter().flatten().for_each(|(gat_hir_id, generics)| {
223-
for pred in generics.predicates {
224-
let BoundPredicate(WhereBoundPredicate { bound_generic_params, bounds, .. }) = pred
225-
else {
226-
continue;
227-
};
228-
if bound_generic_params
229-
.iter()
230-
.rfind(|bgp| self.infcx.tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id)
231-
.is_some()
232-
{
233-
for bound in *bounds {
234-
hrtb_bounds.push(bound);
235-
}
236-
}
237-
}
238-
});
239-
debug!(?hrtb_bounds);
216+
// FIXME: the best we can do is look at the representative, using something like:
217+
let scc = self.regioncx.constraint_sccs().scc(lower_bound);
218+
let Some(representative) =
219+
self.regioncx.constraint_sccs().annotation(scc).placeholder_representative()
220+
else {
221+
return;
222+
};
240223
*/
241224

242225
hrtb_bounds.iter().for_each(|bound| {

compiler/rustc_borrowck/src/region_infer/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl RegionTracker {
153153

154154
/// If the representative is a placeholder, return it,
155155
/// otherwise return None.
156-
fn placeholder_representative(&self) -> Option<RegionVid> {
156+
pub(crate) fn placeholder_representative(&self) -> Option<RegionVid> {
157157
if self.representative_origin == RepresentativeOrigin::Placeholder {
158158
Some(self.representative)
159159
} else {
@@ -1666,7 +1666,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
16661666
let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
16671667
debug!("check_bound_universal_region: longer_fr_scc={:?}", longer_fr_scc,);
16681668

1669-
for error_element in self.scc_values.elements_contained_in(longer_fr_scc) {
1669+
if let Some(error_element) = self.scc_values.elements_contained_in(longer_fr_scc).next() {
16701670
debug!(
16711671
"check_bound_universal_region, error_element: {error_element:?} for placeholder {placeholder:?} in scc: {longer_fr_scc:?}"
16721672
);
@@ -1676,11 +1676,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
16761676
error_element,
16771677
placeholder,
16781678
});
1679-
16801679
// Stop after the first error, it gets too noisy otherwise, and does not provide more information.
1681-
break;
1680+
} else {
1681+
debug!("check_bound_universal_region: all bounds satisfied");
16821682
}
1683-
debug!("check_bound_universal_region: all bounds satisfied");
16841683
}
16851684

16861685
#[instrument(level = "debug", skip(self, infcx, errors_buffer))]

0 commit comments

Comments
 (0)