Skip to content

Commit 156c95e

Browse files
nikomatsakisalexcrichton
authored andcommitted
---
yaml --- r: 275327 b: refs/heads/stable c: a5487e8 h: refs/heads/master i: 275325: 158d895 275323: d3dfe7e 275319: 464a7d0 275311: d723811 275295: ba67bdc 275263: 6d672f6 275199: a1008e2
1 parent 0c2bb79 commit 156c95e

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: d66fabbb399ff6f06dbbe40cd098b5d91f9de115
32+
refs/heads/stable: a5487e86de205e0c0b84c68d402dd72c9d66da4f
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc/middle/infer/mod.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct Foo { a: u32 }
12+
pub struct Pass<'a, 'tcx: 'a>(&'a mut &'a (), &'a &'tcx ());
13+
14+
impl<'a, 'tcx> Pass<'a, 'tcx>
15+
{
16+
pub fn tcx(&self) -> &'a &'tcx () { self.1 }
17+
fn lol(&mut self, b: &Foo)
18+
{
19+
b.c; //~ ERROR no field with that name was found
20+
self.tcx();
21+
}
22+
}
23+
24+
fn main() {}

0 commit comments

Comments
 (0)