MirBorrowckCtxt,
};
-use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource};
+use super::{OutlivesSuggestionBuilder, RegionName};
impl ConstraintDescription for ConstraintCategory {
fn description(&self) -> &'static str {
diag.span_label(upvar_span, "variable captured here");
}
- match self.give_region_a_name(*outlived_fr).unwrap().source {
- RegionNameSource::NamedEarlyBoundRegion(fr_span)
- | RegionNameSource::NamedFreeRegion(fr_span)
- | RegionNameSource::SynthesizedFreeEnvRegion(fr_span, _)
- | RegionNameSource::CannotMatchHirTy(fr_span, _)
- | RegionNameSource::MatchedHirTy(fr_span)
- | RegionNameSource::MatchedAdtAndSegment(fr_span)
- | RegionNameSource::AnonRegionFromUpvar(fr_span, _)
- | RegionNameSource::AnonRegionFromOutput(fr_span, _, _) => {
- diag.span_label(fr_span, "inferred to be a `FnMut` closure");
- }
- _ => {}
+ if let Some(fr_span) = self.give_region_a_name(*outlived_fr).unwrap().span() {
+ diag.span_label(fr_span, "inferred to be a `FnMut` closure");
}
diag.note(
let mut found = false;
for predicate in bounds.predicates {
- if let ty::PredicateKind::TypeOutlives(binder) = predicate.kind() {
- if let ty::OutlivesPredicate(_, ty::RegionKind::ReStatic) =
- binder.skip_binder()
- {
+ if let ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(_, r)) =
+ predicate.skip_binders()
+ {
+ if let ty::RegionKind::ReStatic = r {
found = true;
break;
} else {