@@ -138,9 +138,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
138138 self . explain_span ( scope_decorated_tag, span)
139139 }
140140
141- ty:: ReEarlyBound ( _) | ty:: ReFree ( _) => self . msg_span_from_free_region ( region ) ,
142-
143- ty :: ReStatic => ( "the static lifetime" . to_owned ( ) , None ) ,
141+ ty:: ReEarlyBound ( _) | ty:: ReFree ( _) | ty :: ReStatic => {
142+ self . msg_span_from_free_region ( region )
143+ }
144144
145145 ty:: ReEmpty => ( "the empty lifetime" . to_owned ( ) , None ) ,
146146
@@ -175,6 +175,19 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
175175 }
176176
177177 fn msg_span_from_free_region ( self , region : ty:: Region < ' tcx > ) -> ( String , Option < Span > ) {
178+ match * region {
179+ ty:: ReEarlyBound ( _) | ty:: ReFree ( _) => {
180+ self . msg_span_from_early_bound_and_free_regions ( region)
181+ } ,
182+ ty:: ReStatic => ( "the static lifetime" . to_owned ( ) , None ) ,
183+ _ => bug ! ( ) ,
184+ }
185+ }
186+
187+ fn msg_span_from_early_bound_and_free_regions (
188+ self ,
189+ region : ty:: Region < ' tcx > ,
190+ ) -> ( String , Option < Span > ) {
178191 let scope = region. free_region_binding_scope ( self ) ;
179192 let node = self . hir . as_local_node_id ( scope) . unwrap_or ( DUMMY_NODE_ID ) ;
180193 let unknown;
0 commit comments