remove fr_is_local
and outlived_fr_is_local
fields from ErrorConstraintInfo
`fr_is_local` was fully unused, and `outlived_fr_is_local` was used once
This commit is contained in:
parent
c241e14650
commit
3f9cca3943
1 changed files with 14 additions and 31 deletions
|
@ -147,9 +147,7 @@ pub(crate) enum RegionErrorKind<'tcx> {
|
|||
pub(crate) struct ErrorConstraintInfo<'tcx> {
|
||||
// fr: outlived_fr
|
||||
pub(super) fr: RegionVid,
|
||||
pub(super) fr_is_local: bool,
|
||||
pub(super) outlived_fr: RegionVid,
|
||||
pub(super) outlived_fr_is_local: bool,
|
||||
|
||||
// Category and span for best blame constraint
|
||||
pub(super) category: ConstraintCategory<'tcx>,
|
||||
|
@ -471,14 +469,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
fr_is_local, outlived_fr_is_local, category
|
||||
);
|
||||
|
||||
let errci = ErrorConstraintInfo {
|
||||
fr,
|
||||
outlived_fr,
|
||||
fr_is_local,
|
||||
outlived_fr_is_local,
|
||||
category,
|
||||
span: cause.span,
|
||||
};
|
||||
let errci = ErrorConstraintInfo { fr, outlived_fr, category, span: cause.span };
|
||||
|
||||
let mut diag = match (category, fr_is_local, outlived_fr_is_local) {
|
||||
(ConstraintCategory::Return(kind), true, false) if self.is_closure_fn_mut(fr) => {
|
||||
|
@ -680,11 +671,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
&& self.regioncx.universal_regions().defining_ty.is_fn_def())
|
||||
|| self.regioncx.universal_regions().defining_ty.is_const()
|
||||
{
|
||||
return self.report_general_error(&ErrorConstraintInfo {
|
||||
fr_is_local: true,
|
||||
outlived_fr_is_local: false,
|
||||
..*errci
|
||||
});
|
||||
return self.report_general_error(errci);
|
||||
}
|
||||
|
||||
let mut diag =
|
||||
|
@ -762,15 +749,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
/// ```
|
||||
#[allow(rustc::diagnostic_outside_of_impl)] // FIXME
|
||||
fn report_general_error(&self, errci: &ErrorConstraintInfo<'tcx>) -> Diag<'infcx> {
|
||||
let ErrorConstraintInfo {
|
||||
fr,
|
||||
fr_is_local,
|
||||
outlived_fr,
|
||||
outlived_fr_is_local,
|
||||
span,
|
||||
category,
|
||||
..
|
||||
} = errci;
|
||||
let ErrorConstraintInfo { fr, outlived_fr, span, category, .. } = errci;
|
||||
|
||||
let mir_def_name = self.infcx.tcx.def_descr(self.mir_def_id().to_def_id());
|
||||
|
||||
|
@ -789,13 +768,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||
let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap();
|
||||
outlived_fr_name.highlight_region_name(&mut diag);
|
||||
|
||||
let err_category = match (category, outlived_fr_is_local, fr_is_local) {
|
||||
(ConstraintCategory::Return(_), true, _) => LifetimeReturnCategoryErr::WrongReturn {
|
||||
span: *span,
|
||||
mir_def_name,
|
||||
outlived_fr_name,
|
||||
fr_name: &fr_name,
|
||||
},
|
||||
let err_category = match category {
|
||||
ConstraintCategory::Return(_)
|
||||
if self.regioncx.universal_regions().is_local_free_region(*outlived_fr) =>
|
||||
{
|
||||
LifetimeReturnCategoryErr::WrongReturn {
|
||||
span: *span,
|
||||
mir_def_name,
|
||||
outlived_fr_name,
|
||||
fr_name: &fr_name,
|
||||
}
|
||||
}
|
||||
_ => LifetimeReturnCategoryErr::ShortReturn {
|
||||
span: *span,
|
||||
category_desc: category.description(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue