@@ -138,9 +138,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
138
138
self . explain_span ( scope_decorated_tag, span)
139
139
}
140
140
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
+ }
144
144
145
145
ty:: ReEmpty => ( "the empty lifetime" . to_owned ( ) , None ) ,
146
146
@@ -175,6 +175,19 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
175
175
}
176
176
177
177
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 > ) {
178
191
let scope = region. free_region_binding_scope ( self ) ;
179
192
let node = self . hir . as_local_node_id ( scope) . unwrap_or ( DUMMY_NODE_ID ) ;
180
193
let unknown;
0 commit comments