@@ -17,11 +17,6 @@ mod util;
1717
1818impl < ' cx , ' tcx > InferCtxt < ' cx , ' tcx > {
1919 pub fn try_report_nice_region_error ( & self , error : & RegionResolutionError < ' tcx > ) -> bool {
20- match * error {
21- ConcreteFailure ( ..) | SubSupConflict ( ..) => { }
22- _ => return false , // inapplicable
23- }
24-
2520 if let Some ( tables) = self . in_progress_tables {
2621 let tables = tables. borrow ( ) ;
2722 NiceRegionError :: new ( self , error. clone ( ) , Some ( & tables) ) . try_report ( ) . is_some ( )
@@ -79,13 +74,14 @@ impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx> {
7974 . or_else ( || self . try_report_impl_not_conforming_to_trait ( ) )
8075 }
8176
82- pub fn regions ( & self ) -> ( Span , ty:: Region < ' tcx > , ty:: Region < ' tcx > ) {
77+ pub fn regions ( & self ) -> Option < ( Span , ty:: Region < ' tcx > , ty:: Region < ' tcx > ) > {
8378 match ( & self . error , self . regions ) {
84- ( Some ( ConcreteFailure ( origin, sub, sup) ) , None ) => ( origin. span ( ) , sub, sup) ,
85- ( Some ( SubSupConflict ( _, _, origin, sub, _, sup) ) , None ) => ( origin. span ( ) , sub, sup) ,
86- ( None , Some ( ( span, sub, sup) ) ) => ( span, sub, sup) ,
87- ( Some ( _) , Some ( _) ) => panic ! ( "incorrectly built NiceRegionError" ) ,
88- _ => panic ! ( "trying to report on an incorrect lifetime failure" ) ,
79+ ( Some ( ConcreteFailure ( origin, sub, sup) ) , None ) => Some ( ( origin. span ( ) , sub, sup) ) ,
80+ ( Some ( SubSupConflict ( _, _, origin, sub, _, sup) ) , None ) => {
81+ Some ( ( origin. span ( ) , sub, sup) )
82+ }
83+ ( None , Some ( ( span, sub, sup) ) ) => Some ( ( span, sub, sup) ) ,
84+ _ => None ,
8985 }
9086 }
9187}
0 commit comments