@@ -1107,11 +1107,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11071107 . map ( |method| resolve_ty ( method. ty ) ) )
11081108 }
11091109
1110+ pub fn errors_since_creation ( & self ) -> bool {
1111+ self . tcx . sess . err_count ( ) - self . err_count_on_creation != 0
1112+ }
1113+
11101114 pub fn node_type ( & self , id : ast:: NodeId ) -> Ty < ' tcx > {
11111115 match self . tables . borrow ( ) . node_types . get ( & id) {
11121116 Some ( & t) => t,
11131117 // FIXME
1114- None if self . tcx . sess . err_count ( ) - self . err_count_on_creation != 0 =>
1118+ None if self . errors_since_creation ( ) =>
11151119 self . tcx . types . err ,
11161120 None => {
11171121 self . tcx . sess . bug (
@@ -1134,7 +1138,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11341138 free_regions : & FreeRegionMap ,
11351139 subject_node_id : ast:: NodeId ) {
11361140 let errors = self . region_vars . resolve_regions ( free_regions, subject_node_id) ;
1137- self . report_region_errors ( & errors) ; // see error_reporting.rs
1141+ if !self . errors_since_creation ( ) {
1142+ // As a heuristic, just skip reporting region errors
1143+ // altogether if other errors have been reported while
1144+ // this infcx was in use. This is totally hokey but
1145+ // otherwise we have a hard time separating legit region
1146+ // errors from silly ones.
1147+ self . report_region_errors ( & errors) ; // see error_reporting.rs
1148+ }
11381149 }
11391150
11401151 pub fn ty_to_string ( & self , t : Ty < ' tcx > ) -> String {
0 commit comments