@@ -18,9 +18,9 @@ use rustc_infer::infer::{
1818use rustc_middle:: hir:: place:: PlaceBase ;
1919use rustc_middle:: mir:: { ConstraintCategory , ReturnConstraint } ;
2020use rustc_middle:: ty:: subst:: InternalSubsts ;
21- use rustc_middle:: ty:: Region ;
2221use rustc_middle:: ty:: TypeVisitor ;
2322use rustc_middle:: ty:: { self , RegionVid , Ty } ;
23+ use rustc_middle:: ty:: { Region , TyCtxt } ;
2424use rustc_span:: symbol:: { kw, Ident } ;
2525use rustc_span:: { Span , DUMMY_SP } ;
2626
@@ -70,14 +70,16 @@ impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
7070///
7171/// Usually we expect this to either be empty or contain a small number of items, so we can avoid
7272/// allocation most of the time.
73- #[ derive( Default ) ]
74- pub ( crate ) struct RegionErrors < ' tcx > ( Vec < RegionErrorKind < ' tcx > > ) ;
73+ pub ( crate ) struct RegionErrors < ' tcx > ( Vec < RegionErrorKind < ' tcx > > , TyCtxt < ' tcx > ) ;
7574
7675impl < ' tcx > RegionErrors < ' tcx > {
76+ pub fn new ( tcx : TyCtxt < ' tcx > ) -> Self {
77+ Self ( vec ! [ ] , tcx)
78+ }
7779 #[ track_caller]
7880 pub fn push ( & mut self , val : impl Into < RegionErrorKind < ' tcx > > ) {
7981 let val = val. into ( ) ;
80- ty :: tls :: with ( |tcx| tcx . sess . delay_span_bug ( DUMMY_SP , "{val:?}" ) ) ;
82+ self . 1 . sess . delay_span_bug ( DUMMY_SP , "{val:?}" ) ;
8183 self . 0 . push ( val) ;
8284 }
8385 pub fn is_empty ( & self ) -> bool {
0 commit comments