@@ -1107,11 +1107,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1107
1107
. map ( |method| resolve_ty ( method. ty ) ) )
1108
1108
}
1109
1109
1110
+ pub fn errors_since_creation ( & self ) -> bool {
1111
+ self . tcx . sess . err_count ( ) - self . err_count_on_creation != 0
1112
+ }
1113
+
1110
1114
pub fn node_type ( & self , id : ast:: NodeId ) -> Ty < ' tcx > {
1111
1115
match self . tables . borrow ( ) . node_types . get ( & id) {
1112
1116
Some ( & t) => t,
1113
1117
// FIXME
1114
- None if self . tcx . sess . err_count ( ) - self . err_count_on_creation != 0 =>
1118
+ None if self . errors_since_creation ( ) =>
1115
1119
self . tcx . types . err ,
1116
1120
None => {
1117
1121
self . tcx . sess . bug (
@@ -1134,7 +1138,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1134
1138
free_regions : & FreeRegionMap ,
1135
1139
subject_node_id : ast:: NodeId ) {
1136
1140
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
+ }
1138
1149
}
1139
1150
1140
1151
pub fn ty_to_string ( & self , t : Ty < ' tcx > ) -> String {
0 commit comments