Skip to content

Commit a69dbd7

Browse files
committed
Fix tidy error
1 parent 4edcd63 commit a69dbd7

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
@@ -180,12 +180,12 @@ trait TypeOpInfo<'tcx> {
180180
ty::Placeholder { universe: adjusted_universe.into(), bound: placeholder.bound },
181181
);
182182

183-
let error_region = None;
184-
185183
debug!(?placeholder_region);
186184

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

190190
debug!(?nice_error);
191191

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

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

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

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

compiler/rustc_borrowck/src/region_infer/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl RegionTracker {
151151

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

1667-
for error_element in self.scc_values.elements_contained_in(longer_fr_scc) {
1667+
if let Some(error_element) = self.scc_values.elements_contained_in(longer_fr_scc).next() {
16681668
debug!(
16691669
"check_bound_universal_region, error_element: {error_element:?} for placeholder {placeholder:?} in scc: {longer_fr_scc:?}"
16701670
);
@@ -1674,11 +1674,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
16741674
error_element,
16751675
placeholder,
16761676
});
1677-
16781677
// Stop after the first error, it gets too noisy otherwise, and does not provide more information.
1679-
break;
1678+
} else {
1679+
debug!("check_bound_universal_region: all bounds satisfied");
16801680
}
1681-
debug!("check_bound_universal_region: all bounds satisfied");
16821681
}
16831682

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

0 commit comments

Comments
 (0)