@@ -17,11 +17,6 @@ mod util;
17
17
18
18
impl < ' cx , ' tcx > InferCtxt < ' cx , ' tcx > {
19
19
pub fn try_report_nice_region_error ( & self , error : & RegionResolutionError < ' tcx > ) -> bool {
20
- match * error {
21
- ConcreteFailure ( ..) | SubSupConflict ( ..) => { }
22
- _ => return false , // inapplicable
23
- }
24
-
25
20
if let Some ( tables) = self . in_progress_tables {
26
21
let tables = tables. borrow ( ) ;
27
22
NiceRegionError :: new ( self , error. clone ( ) , Some ( & tables) ) . try_report ( ) . is_some ( )
@@ -79,13 +74,14 @@ impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx> {
79
74
. or_else ( || self . try_report_impl_not_conforming_to_trait ( ) )
80
75
}
81
76
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 > ) > {
83
78
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 ,
89
85
}
90
86
}
91
87
}
0 commit comments