@@ -1120,11 +1120,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1120
1120
. map ( |method| resolve_ty ( method. ty ) ) )
1121
1121
}
1122
1122
1123
+ pub fn errors_since_creation ( & self ) -> bool {
1124
+ self . tcx . sess . err_count ( ) - self . err_count_on_creation != 0
1125
+ }
1126
+
1123
1127
pub fn node_type ( & self , id : ast:: NodeId ) -> Ty < ' tcx > {
1124
1128
match self . tables . borrow ( ) . node_types . get ( & id) {
1125
1129
Some ( & t) => t,
1126
1130
// FIXME
1127
- None if self . tcx . sess . err_count ( ) - self . err_count_on_creation != 0 =>
1131
+ None if self . errors_since_creation ( ) =>
1128
1132
self . tcx . types . err ,
1129
1133
None => {
1130
1134
self . tcx . sess . bug (
@@ -1147,7 +1151,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1147
1151
free_regions : & FreeRegionMap ,
1148
1152
subject_node_id : ast:: NodeId ) {
1149
1153
let errors = self . region_vars . resolve_regions ( free_regions, subject_node_id) ;
1150
- self . report_region_errors ( & errors) ; // see error_reporting.rs
1154
+ if !self . errors_since_creation ( ) {
1155
+ // As a heuristic, just skip reporting region errors
1156
+ // altogether if other errors have been reported while
1157
+ // this infcx was in use. This is totally hokey but
1158
+ // otherwise we have a hard time separating legit region
1159
+ // errors from silly ones.
1160
+ self . report_region_errors ( & errors) ; // see error_reporting.rs
1161
+ }
1151
1162
}
1152
1163
1153
1164
pub fn ty_to_string ( & self , t : Ty < ' tcx > ) -> String {
0 commit comments