Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 861f451

Browse files
committed
Change to ReError(ErrorGuaranteed)
1 parent ffaf2a5 commit 861f451

File tree

23 files changed

+70
-61
lines changed

23 files changed

+70
-61
lines changed

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
368368
| ty::ReVar(..)
369369
| ty::RePlaceholder(..)
370370
| ty::ReErased
371-
| ty::ReError => None,
371+
| ty::ReError(_) => None,
372372
}
373373
}
374374

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
9191
}
9292
None => {
9393
subst_regions.push(vid);
94-
infcx.tcx.sess.delay_span_bug(
94+
infcx.tcx.re_error_with_message(
9595
concrete_type.span,
9696
"opaque type with non-universal region substs",
97-
);
98-
infcx.tcx.lifetimes.re_error
97+
)
9998
}
10099
}
101100
};

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
821821
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
822822
if let ty::ReVar(..) = *r {
823823
r.to_region_vid()
824-
} else if let ty::ReError = *r {
824+
} else if let ty::ReError(_) = *r {
825825
RegionVid::new(0)
826826
} else {
827827
*self

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
263263
// elision. `resolve_lifetime` should have
264264
// reported an error in this case -- but if
265265
// not, let's error out.
266-
tcx.sess.delay_span_bug(lifetime.ident.span, "unelided lifetime in signature");
267-
tcx.lifetimes.re_error
266+
tcx.re_error_with_message(lifetime.ident.span, "unelided lifetime in signature")
268267
})
269268
}
270269
}
@@ -478,8 +477,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
478477
debug!(?param, "unelided lifetime in signature");
479478

480479
// This indicates an illegal lifetime in a non-assoc-trait position
481-
tcx.sess.delay_span_bug(self.span, "unelided lifetime in signature");
482-
tcx.lifetimes.re_error
480+
tcx.re_error_with_message(self.span, "unelided lifetime in signature")
483481
})
484482
.into(),
485483
GenericParamDefKind::Type { has_default, .. } => {
@@ -1623,7 +1621,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16231621
} else {
16241622
err.emit();
16251623
}
1626-
tcx.lifetimes.re_error
1624+
tcx.re_error()
16271625
})
16281626
}
16291627
})

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
786786
}
787787
let Some(ty::ReEarlyBound(e)) = map.get(&region.into()).map(|r| r.expect_region().kind())
788788
else {
789-
tcx
790-
.sess
791-
.delay_span_bug(
792-
return_span,
793-
"expected ReFree to map to ReEarlyBound"
794-
);
795-
return tcx.lifetimes.re_error;
789+
return tcx.re_error_with_message(return_span, "expected ReFree to map to ReEarlyBound")
796790
};
797791
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion {
798792
def_id: e.def_id,

compiler/rustc_hir_analysis/src/outlives/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn is_free_region(region: Region<'_>) -> bool {
170170
// ignore it. We can't put it on the struct header anyway.
171171
ty::ReLateBound(..) => false,
172172

173-
ty::ReError => false,
173+
ty::ReError(_) => false,
174174

175175
// These regions don't appear in types from type declarations:
176176
ty::ReErased | ty::ReVar(..) | ty::RePlaceholder(..) | ty::ReFree(..) => {

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
409409
// way early-bound regions do, so we skip them here.
410410
}
411411

412-
ty::ReError => {}
412+
ty::ReError(_) => {}
413413

414414
ty::ReFree(..) | ty::ReVar(..) | ty::RePlaceholder(..) | ty::ReErased => {
415415
// We don't expect to see anything but 'static or bound

compiler/rustc_infer/src/errors/note_and_explain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'a> DescriptionCtx<'a> {
3131

3232
ty::RePlaceholder(_) => return None,
3333

34-
ty::ReError => return None,
34+
ty::ReError(_) => return None,
3535

3636
// FIXME(#13998) RePlaceholder should probably print like
3737
// ReFree rather than dumping Debug output on the user.

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
371371

372372
ty::ReStatic
373373
| ty::ReEarlyBound(..)
374-
| ty::ReError
374+
| ty::ReError(_)
375375
| ty::ReFree(_)
376376
| ty::RePlaceholder(..)
377377
| ty::ReErased => self.canonicalize_mode.canonicalize_free_region(self, r),

compiler/rustc_infer/src/infer/combine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
705705
return Ok(r);
706706
}
707707

708-
ty::ReError => {
708+
ty::ReError(_) => {
709709
return Ok(r);
710710
}
711711

@@ -865,7 +865,7 @@ impl<'tcx> FallibleTypeFolder<'tcx> for ConstInferUnifier<'_, 'tcx> {
865865
match *r {
866866
// Never make variables for regions bound within the type itself,
867867
// nor for erased regions.
868-
ty::ReLateBound(..) | ty::ReErased | ty::ReError => {
868+
ty::ReLateBound(..) | ty::ReErased | ty::ReError(_) => {
869869
return Ok(r);
870870
}
871871

0 commit comments

Comments
 (0)