Skip to content

Commit 6e6604c

Browse files
committed
---
yaml --- r: 273361 b: refs/heads/beta c: bca07b5 h: refs/heads/master i: 273359: fb6d490
1 parent 35b22b4 commit 6e6604c

File tree

7 files changed

+156
-90
lines changed

7 files changed

+156
-90
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 5abacd36f0149a9106d7ee04e97eadba4e523bb4
26+
refs/heads/beta: bca07b5ebb59738ef64cd5891507a06c7002dd26
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc/middle/infer/error_reporting.rs

Lines changed: 138 additions & 76 deletions
Large diffs are not rendered by default.

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ pub fn common_supertype<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
407407
match result {
408408
Ok(t) => t,
409409
Err(ref err) => {
410-
cx.report_and_explain_type_error(trace, err);
410+
cx.report_and_explain_type_error(trace, err).emit();
411411
cx.tcx.types.err
412412
}
413413
}
@@ -1396,7 +1396,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13961396
found: actual
13971397
})
13981398
};
1399-
self.report_and_explain_type_error(trace, &err);
1399+
self.report_and_explain_type_error(trace, &err).emit();
14001400
}
14011401

14021402
pub fn report_conflicting_default_types(&self,
@@ -1411,11 +1411,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14111411
})
14121412
};
14131413

1414-
self.report_and_explain_type_error(trace,
1414+
self.report_and_explain_type_error(
1415+
trace,
14151416
&TypeError::TyParamDefaultMismatch(ExpectedFound {
14161417
expected: expected,
14171418
found: actual
1418-
}));
1419+
}))
1420+
.emit();
14191421
}
14201422

14211423
pub fn replace_late_bound_regions_with_fresh_var<T>(

branches/beta/src/librustc/middle/infer/region_inference/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use self::CombineMapType::*;
1717
pub use self::RegionResolutionError::*;
1818
pub use self::VarValue::*;
1919

20-
use super::{RegionVariableOrigin, SubregionOrigin, TypeTrace, MiscVariable};
20+
use super::{RegionVariableOrigin, SubregionOrigin, MiscVariable};
2121
use super::unify_key;
2222

2323
use rustc_data_structures::graph::{self, Direction, NodeIndex};
@@ -27,7 +27,6 @@ use middle::ty::{self, Ty, TyCtxt};
2727
use middle::ty::{BoundRegion, Region, RegionVid};
2828
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
2929
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
30-
use middle::ty::error::TypeError;
3130
use util::common::indenter;
3231
use util::nodemap::{FnvHashMap, FnvHashSet};
3332

@@ -152,11 +151,16 @@ pub enum RegionResolutionError<'tcx> {
152151
/// more specific errors message by suggesting to the user where they
153152
/// should put a lifetime. In those cases we process and put those errors
154153
/// into `ProcessedErrors` before we do any reporting.
155-
ProcessedErrors(Vec<RegionVariableOrigin>,
156-
Vec<(TypeTrace<'tcx>, TypeError<'tcx>)>,
154+
ProcessedErrors(Vec<ProcessedErrorOrigin<'tcx>>,
157155
Vec<SameRegions>),
158156
}
159157

158+
#[derive(Clone, Debug)]
159+
pub enum ProcessedErrorOrigin<'tcx> {
160+
ConcreteFailure(SubregionOrigin<'tcx>, Region, Region),
161+
VariableFailure(RegionVariableOrigin),
162+
}
163+
160164
/// SameRegions is used to group regions that we think are the same and would
161165
/// like to indicate so to the user.
162166
/// For example, the following function

branches/beta/src/test/compile-fail/issue-13058.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,5 @@ fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
3636
fn main() {
3737
check((3, 5));
3838
//~^ ERROR mismatched types
39-
//~| expected `&_`
40-
//~| found `(_, _)`
41-
//~| expected &-ptr
42-
//~| found tuple
4339
//~| HELP run `rustc --explain E0308` to see a detailed explanation
4440
}

branches/beta/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn bar1<'a>(x: &Bar) -> (&'a i32, &'a i32, &'a i32) {
2222
}
2323

2424
fn bar2<'a, 'b, 'c>(x: &Bar<'a, 'b, 'c>) -> (&'a i32, &'a i32, &'a i32) {
25-
//~^ HELP: consider using an explicit lifetime parameter as shown: fn bar2<'a, 'b, 'c>(x: &'a Bar<'a, 'b, 'c>) -> (&'a i32, &'a i32, &'a i32)
25+
//~^ HELP: consider using an explicit lifetime parameter as shown: fn bar2<'a, 'c>(x: &'a Bar<'a, 'a, 'c>) -> (&'a i32, &'a i32, &'a i32)
2626
(x.bar, &x.baz, &x.baz)
2727
//~^ ERROR E0312
2828
//~| ERROR cannot infer

branches/beta/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct Cat<'x, T> { cat: &'x isize, t: T }
3939
struct Dog<'y> { dog: &'y isize }
4040

4141
fn cat2<'x, 'y>(x: Cat<'x, Dog<'y>>) -> &'x isize {
42+
//~^ HELP consider using an explicit lifetime parameter as shown: fn cat2<'x>(x: Cat<'x, Dog<'x>>) -> &'x isize
4243
x.t.dog //~ ERROR E0312
4344
}
4445

@@ -48,6 +49,7 @@ struct Baz<'x> {
4849

4950
impl<'a> Baz<'a> {
5051
fn baz2<'b>(&self, x: &isize) -> (&'b isize, &'b isize) {
52+
//~^ HELP consider using an explicit lifetime parameter as shown: fn baz2<'b>(&self, x: &'b isize) -> (&'a isize, &'a isize)
5153
(self.bar, x) //~ ERROR E0312
5254
//~^ ERROR E0312
5355
}

0 commit comments

Comments
 (0)