stop dumping DefPath into "failed type test" errors

The prior messages were not stable across platforms.
This commit is contained in:
Niko Matsakis 2017-12-15 17:04:48 -05:00
parent 0f8ef0ca1a
commit 4f43c5b1e7
19 changed files with 54 additions and 50 deletions

View file

@ -466,7 +466,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
// Oh the humanity. Obviously we will do better than this error eventually.
tcx.sess.span_err(
type_test.span,
&format!("failed type test: {:?}", type_test),
&format!(
"`{}` does not outlive `{:?}`",
type_test.generic_kind,
type_test.lower_bound,
),
);
}
}

View file

@ -40,7 +40,7 @@ where
T: Trait<'a>,
{
establish_relationships(value, |value| {
//~^ ERROR failed type test
//~^ ERROR `T` does not outlive
// This function call requires that
//

View file

@ -9,7 +9,7 @@ note: External requirements
|
42 | establish_relationships(value, |value| {
| ____________________________________^
43 | | //~^ ERROR failed type test
43 | | //~^ ERROR `T` does not outlive
44 | |
45 | | // This function call requires that
... |
@ -26,12 +26,12 @@ note: External requirements
= note: number of external vids: 2
= note: where T: '_#1r
error: failed type test: TypeTest { generic_kind: T/#1, lower_bound: '_#3r, point: bb0[3], span: $DIR/propagate-from-trait-match.rs:42:36: 57:6, test: IsOutlivedByAnyRegionIn(['_#2r]) }
error: `T` does not outlive `'_#3r`
--> $DIR/propagate-from-trait-match.rs:42:36
|
42 | establish_relationships(value, |value| {
| ____________________________________^
43 | | //~^ ERROR failed type test
43 | | //~^ ERROR `T` does not outlive
44 | |
45 | | // This function call requires that
... |

View file

@ -35,7 +35,7 @@ where
{
with_signature(x, |mut y| Box::new(y.next()))
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
}
#[rustc_regions]
@ -53,7 +53,7 @@ where
{
with_signature(x, |mut y| Box::new(y.next()))
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
}
#[rustc_regions]

View file

@ -72,7 +72,7 @@ note: External requirements
= note: number of external vids: 4
= note: where <T as std::iter::Iterator>::Item: '_#3r
error: failed type test: TypeTest { generic_kind: ProjectionTy { substs: Slice([T]), item_def_id: DefId(2/0:1697 ~ core[2633]::iter[0]::iterator[0]::Iterator[0]::Item[0]) }, lower_bound: '_#4r, point: bb0[5], span: $DIR/projection-no-regions-closure.rs:36:23: 36:49, test: IsOutlivedByAnyRegionIn(['_#2r]) }
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#4r`
--> $DIR/projection-no-regions-closure.rs:36:23
|
36 | with_signature(x, |mut y| Box::new(y.next()))
@ -86,7 +86,7 @@ note: No external requirements
34 | | T: Iterator,
35 | | {
... |
38 | | //~| ERROR failed type test
38 | | //~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
39 | | }
| |_^
|
@ -111,7 +111,7 @@ note: No external requirements
T
]
error: failed type test: TypeTest { generic_kind: ProjectionTy { substs: Slice([T]), item_def_id: DefId(2/0:1697 ~ core[2633]::iter[0]::iterator[0]::Iterator[0]::Item[0]) }, lower_bound: '_#6r, point: bb0[5], span: $DIR/projection-no-regions-closure.rs:54:23: 54:49, test: IsOutlivedByAnyRegionIn(['_#2r, '_#3r]) }
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#6r`
--> $DIR/projection-no-regions-closure.rs:54:23
|
54 | with_signature(x, |mut y| Box::new(y.next()))
@ -125,7 +125,7 @@ note: No external requirements
52 | | T: 'b + Iterator,
53 | | {
... |
56 | | //~| ERROR failed type test
56 | | //~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
57 | | }
| |_^
|

View file

@ -23,7 +23,7 @@ where
{
Box::new(x.next())
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
}
fn correct_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a>
@ -39,7 +39,7 @@ where
{
Box::new(x.next())
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
}
fn outlives_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>

View file

@ -10,13 +10,13 @@ warning: not reporting region error due to -Znll
40 | Box::new(x.next())
| ^^^^^^^^^^^^^^^^^^
error: failed type test: TypeTest { generic_kind: ProjectionTy { substs: Slice([T]), item_def_id: DefId(2/0:1697 ~ core[2633]::iter[0]::iterator[0]::Iterator[0]::Item[0]) }, lower_bound: '_#4r, point: bb5[0], span: $DIR/projection-no-regions-fn.rs:24:5: 24:23, test: IsOutlivedByAnyRegionIn(['_#2r]) }
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#4r`
--> $DIR/projection-no-regions-fn.rs:24:5
|
24 | Box::new(x.next())
| ^^^^^^^^^^^^^^^^^^
error: failed type test: TypeTest { generic_kind: ProjectionTy { substs: Slice([T]), item_def_id: DefId(2/0:1697 ~ core[2633]::iter[0]::iterator[0]::Iterator[0]::Item[0]) }, lower_bound: '_#5r, point: bb5[0], span: $DIR/projection-no-regions-fn.rs:40:5: 40:23, test: IsOutlivedByAnyRegionIn(['_#2r, '_#3r]) }
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#5r`
--> $DIR/projection-no-regions-fn.rs:40:5
|
40 | Box::new(x.next())

View file

@ -55,7 +55,7 @@ where
{
with_signature(cell, t, |cell, t| require(cell, t));
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
//~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r`
}
@ -67,7 +67,7 @@ where
{
with_signature(cell, t, |cell, t| require(cell, t));
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
//~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
}
@ -89,7 +89,7 @@ where
with_signature(cell, t, |cell, t| require(cell, t));
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
//~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
}

View file

@ -83,7 +83,7 @@ note: External requirements
= note: where T: '_#3r
= note: where '_#2r: '_#3r
error: failed type test: TypeTest { generic_kind: T/#1, lower_bound: '_#5r, point: bb0[5], span: $DIR/projection-one-region-closure.rs:56:29: 56:55, test: IsOutlivedByAnyRegionIn(['_#3r]) }
error: `T` does not outlive `'_#5r`
--> $DIR/projection-one-region-closure.rs:56:29
|
56 | with_signature(cell, t, |cell, t| require(cell, t));
@ -112,7 +112,7 @@ note: No external requirements
T
]
error: failed type test: TypeTest { generic_kind: T/#2, lower_bound: '_#6r, point: bb0[5], span: $DIR/projection-one-region-closure.rs:68:29: 68:55, test: IsOutlivedByAnyRegionIn(['_#3r]) }
error: `T` does not outlive `'_#6r`
--> $DIR/projection-one-region-closure.rs:68:29
|
68 | with_signature(cell, t, |cell, t| require(cell, t));
@ -142,7 +142,7 @@ note: No external requirements
T
]
error: failed type test: TypeTest { generic_kind: T/#2, lower_bound: '_#6r, point: bb0[5], span: $DIR/projection-one-region-closure.rs:90:29: 90:55, test: IsOutlivedByAnyRegionIn(['_#3r]) }
error: `T` does not outlive `'_#6r`
--> $DIR/projection-one-region-closure.rs:90:29
|
90 | with_signature(cell, t, |cell, t| require(cell, t));

View file

@ -48,7 +48,7 @@ where
{
with_signature(cell, t, |cell, t| require(cell, t));
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `<T as Anything<'_#5r, '_#6r>>::AssocType` does not outlive `'_#7r`
}
#[rustc_regions]
@ -59,7 +59,7 @@ where
{
with_signature(cell, t, |cell, t| require(cell, t));
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
}
#[rustc_regions]
@ -80,7 +80,7 @@ where
with_signature(cell, t, |cell, t| require(cell, t));
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
}
#[rustc_regions]

View file

@ -152,7 +152,7 @@ note: External requirements
= note: number of external vids: 3
= note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#1r)>>::AssocType: '_#2r
error: failed type test: TypeTest { generic_kind: ProjectionTy { substs: Slice([T, '_#5r, '_#6r]), item_def_id: DefId(0/0:5 ~ projection_two_region_trait_bound_closure[317d]::Anything[0]::AssocType[0]) }, lower_bound: '_#7r, point: bb0[5], span: $DIR/projection-two-region-trait-bound-closure.rs:49:29: 49:55, test: Any([IsOutlivedByAnyRegionIn(['_#6r, '_#5r]), All([IsOutlivedByAnyRegionIn(['_#4r]), IsOutlivedByAllRegionsIn(['_#5r, '_#6r])])]) }
error: `<T as Anything<'_#5r, '_#6r>>::AssocType` does not outlive `'_#7r`
--> $DIR/projection-two-region-trait-bound-closure.rs:49:29
|
49 | with_signature(cell, t, |cell, t| require(cell, t));
@ -166,7 +166,7 @@ note: No external requirements
47 | | T: Anything<'b, 'c>,
48 | | {
... |
51 | | //~| ERROR failed type test
51 | | //~| ERROR `<T as Anything<'_#5r, '_#6r>>::AssocType` does not outlive `'_#7r`
52 | | }
| |_^
|
@ -176,7 +176,7 @@ note: No external requirements
T
]
error: failed type test: TypeTest { generic_kind: ProjectionTy { substs: Slice([T, '_#6r, '_#7r]), item_def_id: DefId(0/0:5 ~ projection_two_region_trait_bound_closure[317d]::Anything[0]::AssocType[0]) }, lower_bound: '_#8r, point: bb0[5], span: $DIR/projection-two-region-trait-bound-closure.rs:60:29: 60:55, test: Any([IsOutlivedByAnyRegionIn(['_#7r, '_#6r]), All([IsOutlivedByAnyRegionIn(['_#4r]), IsOutlivedByAllRegionsIn(['_#6r, '_#7r])])]) }
error: `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
--> $DIR/projection-two-region-trait-bound-closure.rs:60:29
|
60 | with_signature(cell, t, |cell, t| require(cell, t));
@ -190,7 +190,7 @@ note: No external requirements
57 | | T: Anything<'b, 'c>,
58 | | 'a: 'a,
... |
62 | | //~| ERROR failed type test
62 | | //~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
63 | | }
| |_^
|
@ -201,7 +201,7 @@ note: No external requirements
T
]
error: failed type test: TypeTest { generic_kind: ProjectionTy { substs: Slice([T, '_#6r, '_#7r]), item_def_id: DefId(0/0:5 ~ projection_two_region_trait_bound_closure[317d]::Anything[0]::AssocType[0]) }, lower_bound: '_#8r, point: bb0[5], span: $DIR/projection-two-region-trait-bound-closure.rs:81:29: 81:55, test: Any([IsOutlivedByAnyRegionIn(['_#7r, '_#6r]), All([IsOutlivedByAnyRegionIn(['_#4r]), IsOutlivedByAllRegionsIn(['_#6r, '_#7r])])]) }
error: `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
--> $DIR/projection-two-region-trait-bound-closure.rs:81:29
|
81 | with_signature(cell, t, |cell, t| require(cell, t));
@ -215,7 +215,7 @@ note: No external requirements
68 | | T: Anything<'b, 'c>,
69 | | T::AssocType: 'a,
... |
83 | | //~| ERROR failed type test
83 | | //~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
84 | | }
| |_^
|

View file

@ -36,7 +36,7 @@ where
with_signature(x, |y| y)
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
}
fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
@ -52,7 +52,7 @@ where
{
x
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
}
fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>

View file

@ -25,7 +25,7 @@ note: External requirements
= note: number of external vids: 3
= note: where T: '_#2r
error: failed type test: TypeTest { generic_kind: T/#1, lower_bound: '_#4r, point: bb0[5], span: $DIR/ty-param-closure-outlives-from-return-type.rs:37:23: 37:28, test: IsOutlivedByAnyRegionIn(['_#2r]) }
error: `T` does not outlive `'_#4r`
--> $DIR/ty-param-closure-outlives-from-return-type.rs:37:23
|
37 | with_signature(x, |y| y)
@ -39,7 +39,7 @@ note: No external requirements
28 | | T: Debug,
29 | | {
... |
39 | | //~| ERROR failed type test
39 | | //~| ERROR `T` does not outlive
40 | | }
| |_^
|
@ -48,7 +48,7 @@ note: No external requirements
T
]
error: failed type test: TypeTest { generic_kind: T/#2, lower_bound: '_#4r, point: bb0[3], span: $DIR/ty-param-closure-outlives-from-return-type.rs:53:5: 53:6, test: IsOutlivedByAnyRegionIn(['_#2r, '_#3r]) }
error: `T` does not outlive `'_#4r`
--> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5
|
53 | x

View file

@ -36,7 +36,7 @@ where
#[rustc_regions]
fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
with_signature(a, b, |x, y| {
//~^ ERROR failed type test
//~^ ERROR `T` does not outlive
//
// See `correct_region`, which explains the point of this
// test. The only difference is that, in the case of this
@ -74,7 +74,7 @@ where
T: 'b,
{
with_signature(a, b, |x, y| {
//~^ ERROR failed type test
//~^ ERROR `T` does not outlive
// See `correct_region`
require(&x, &y)
//~^ WARNING not reporting region error due to -Znll

View file

@ -15,7 +15,7 @@ note: External requirements
|
38 | with_signature(a, b, |x, y| {
| __________________________^
39 | | //~^ ERROR failed type test
39 | | //~^ ERROR `T` does not outlive
40 | | //
41 | | // See `correct_region`, which explains the point of this
... |
@ -58,7 +58,7 @@ note: External requirements
|
76 | with_signature(a, b, |x, y| {
| __________________________^
77 | | //~^ ERROR failed type test
77 | | //~^ ERROR `T` does not outlive
78 | | // See `correct_region`
79 | | require(&x, &y)
80 | | //~^ WARNING not reporting region error due to -Znll
@ -94,12 +94,12 @@ note: External requirements
= note: number of external vids: 4
= note: where T: '_#3r
error: failed type test: TypeTest { generic_kind: T/#0, lower_bound: '_#3r, point: bb0[5], span: $DIR/ty-param-closure-outlives-from-where-clause.rs:38:26: 47:6, test: IsOutlivedByAnyRegionIn(['_#2r]) }
error: `T` does not outlive `'_#3r`
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:26
|
38 | with_signature(a, b, |x, y| {
| __________________________^
39 | | //~^ ERROR failed type test
39 | | //~^ ERROR `T` does not outlive
40 | | //
41 | | // See `correct_region`, which explains the point of this
... |
@ -112,7 +112,7 @@ note: No external requirements
|
37 | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
38 | | with_signature(a, b, |x, y| {
39 | | //~^ ERROR failed type test
39 | | //~^ ERROR `T` does not outlive
40 | | //
... |
47 | | })
@ -140,12 +140,12 @@ note: No external requirements
T
]
error: failed type test: TypeTest { generic_kind: T/#1, lower_bound: '_#5r, point: bb0[5], span: $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26: 81:6, test: IsOutlivedByAnyRegionIn(['_#1r, '_#3r]) }
error: `T` does not outlive `'_#5r`
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26
|
76 | with_signature(a, b, |x, y| {
| __________________________^
77 | | //~^ ERROR failed type test
77 | | //~^ ERROR `T` does not outlive
78 | | // See `correct_region`
79 | | require(&x, &y)
80 | | //~^ WARNING not reporting region error due to -Znll

View file

@ -29,7 +29,7 @@ fn region_within_body<T>(t: T) {
fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
outlives(cell, t)
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
}
fn outlives<'a, T>(x: Cell<&'a usize>, y: T)

View file

@ -4,7 +4,7 @@ warning: not reporting region error due to -Znll
30 | outlives(cell, t)
| ^^^^^^^^
error: failed type test: TypeTest { generic_kind: T/#0, lower_bound: '_#4r, point: bb0[4], span: $DIR/ty-param-fn-body.rs:30:5: 30:22, test: IsOutlivedByAnyRegionIn(['_#2r]) }
error: `T` does not outlive `'_#4r`
--> $DIR/ty-param-fn-body.rs:30:5
|
30 | outlives(cell, t)

View file

@ -21,7 +21,7 @@ where
{
x
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
}
fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
@ -37,7 +37,7 @@ where
{
x
//~^ WARNING not reporting region error due to -Znll
//~| ERROR failed type test
//~| ERROR `T` does not outlive
}
fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>

View file

@ -10,13 +10,13 @@ warning: not reporting region error due to -Znll
38 | x
| ^
error: failed type test: TypeTest { generic_kind: T/#1, lower_bound: '_#3r, point: bb0[3], span: $DIR/ty-param-fn.rs:22:5: 22:6, test: IsOutlivedByAnyRegionIn(['_#2r]) }
error: `T` does not outlive `'_#3r`
--> $DIR/ty-param-fn.rs:22:5
|
22 | x
| ^
error: failed type test: TypeTest { generic_kind: T/#2, lower_bound: '_#4r, point: bb0[3], span: $DIR/ty-param-fn.rs:38:5: 38:6, test: IsOutlivedByAnyRegionIn(['_#2r, '_#3r]) }
error: `T` does not outlive `'_#4r`
--> $DIR/ty-param-fn.rs:38:5
|
38 | x