Skip to content

Commit 4f43c5b

Browse files
committed
stop dumping DefPath into "failed type test" errors
The prior messages were not stable across platforms.
1 parent 0f8ef0c commit 4f43c5b

19 files changed

+54
-50
lines changed

src/librustc_mir/borrow_check/nll/region_infer/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
466466
// Oh the humanity. Obviously we will do better than this error eventually.
467467
tcx.sess.span_err(
468468
type_test.span,
469-
&format!("failed type test: {:?}", type_test),
469+
&format!(
470+
"`{}` does not outlive `{:?}`",
471+
type_test.generic_kind,
472+
type_test.lower_bound,
473+
),
470474
);
471475
}
472476
}

src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ where
4040
T: Trait<'a>,
4141
{
4242
establish_relationships(value, |value| {
43-
//~^ ERROR failed type test
43+
//~^ ERROR `T` does not outlive
4444

4545
// This function call requires that
4646
//

src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: External requirements
99
|
1010
42 | establish_relationships(value, |value| {
1111
| ____________________________________^
12-
43 | | //~^ ERROR failed type test
12+
43 | | //~^ ERROR `T` does not outlive
1313
44 | |
1414
45 | | // This function call requires that
1515
... |
@@ -26,12 +26,12 @@ note: External requirements
2626
= note: number of external vids: 2
2727
= note: where T: '_#1r
2828

29-
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]) }
29+
error: `T` does not outlive `'_#3r`
3030
--> $DIR/propagate-from-trait-match.rs:42:36
3131
|
3232
42 | establish_relationships(value, |value| {
3333
| ____________________________________^
34-
43 | | //~^ ERROR failed type test
34+
43 | | //~^ ERROR `T` does not outlive
3535
44 | |
3636
45 | | // This function call requires that
3737
... |

src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ where
3535
{
3636
with_signature(x, |mut y| Box::new(y.next()))
3737
//~^ WARNING not reporting region error due to -Znll
38-
//~| ERROR failed type test
38+
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
3939
}
4040

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

5959
#[rustc_regions]

src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ note: External requirements
7272
= note: number of external vids: 4
7373
= note: where <T as std::iter::Iterator>::Item: '_#3r
7474

75-
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]) }
75+
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#4r`
7676
--> $DIR/projection-no-regions-closure.rs:36:23
7777
|
7878
36 | with_signature(x, |mut y| Box::new(y.next()))
@@ -86,7 +86,7 @@ note: No external requirements
8686
34 | | T: Iterator,
8787
35 | | {
8888
... |
89-
38 | | //~| ERROR failed type test
89+
38 | | //~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
9090
39 | | }
9191
| |_^
9292
|
@@ -111,7 +111,7 @@ note: No external requirements
111111
T
112112
]
113113

114-
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]) }
114+
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#6r`
115115
--> $DIR/projection-no-regions-closure.rs:54:23
116116
|
117117
54 | with_signature(x, |mut y| Box::new(y.next()))
@@ -125,7 +125,7 @@ note: No external requirements
125125
52 | | T: 'b + Iterator,
126126
53 | | {
127127
... |
128-
56 | | //~| ERROR failed type test
128+
56 | | //~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
129129
57 | | }
130130
| |_^
131131
|

src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ where
2323
{
2424
Box::new(x.next())
2525
//~^ WARNING not reporting region error due to -Znll
26-
//~| ERROR failed type test
26+
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
2727
}
2828

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

4545
fn outlives_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>

src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ warning: not reporting region error due to -Znll
1010
40 | Box::new(x.next())
1111
| ^^^^^^^^^^^^^^^^^^
1212

13-
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]) }
13+
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#4r`
1414
--> $DIR/projection-no-regions-fn.rs:24:5
1515
|
1616
24 | Box::new(x.next())
1717
| ^^^^^^^^^^^^^^^^^^
1818

19-
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]) }
19+
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#5r`
2020
--> $DIR/projection-no-regions-fn.rs:40:5
2121
|
2222
40 | Box::new(x.next())

src/test/ui/nll/ty-outlives/projection-one-region-closure.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ where
5555
{
5656
with_signature(cell, t, |cell, t| require(cell, t));
5757
//~^ WARNING not reporting region error due to -Znll
58-
//~| ERROR failed type test
58+
//~| ERROR `T` does not outlive
5959
//~| ERROR free region `ReEarlyBound(0, 'b)` does not outlive free region `'_#2r`
6060
}
6161

@@ -67,7 +67,7 @@ where
6767
{
6868
with_signature(cell, t, |cell, t| require(cell, t));
6969
//~^ WARNING not reporting region error due to -Znll
70-
//~| ERROR failed type test
70+
//~| ERROR `T` does not outlive
7171
//~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
7272
}
7373

@@ -89,7 +89,7 @@ where
8989

9090
with_signature(cell, t, |cell, t| require(cell, t));
9191
//~^ WARNING not reporting region error due to -Znll
92-
//~| ERROR failed type test
92+
//~| ERROR `T` does not outlive
9393
//~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
9494
}
9595

src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ note: External requirements
8383
= note: where T: '_#3r
8484
= note: where '_#2r: '_#3r
8585

86-
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]) }
86+
error: `T` does not outlive `'_#5r`
8787
--> $DIR/projection-one-region-closure.rs:56:29
8888
|
8989
56 | with_signature(cell, t, |cell, t| require(cell, t));
@@ -112,7 +112,7 @@ note: No external requirements
112112
T
113113
]
114114

115-
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]) }
115+
error: `T` does not outlive `'_#6r`
116116
--> $DIR/projection-one-region-closure.rs:68:29
117117
|
118118
68 | with_signature(cell, t, |cell, t| require(cell, t));
@@ -142,7 +142,7 @@ note: No external requirements
142142
T
143143
]
144144

145-
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]) }
145+
error: `T` does not outlive `'_#6r`
146146
--> $DIR/projection-one-region-closure.rs:90:29
147147
|
148148
90 | with_signature(cell, t, |cell, t| require(cell, t));

src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ where
4848
{
4949
with_signature(cell, t, |cell, t| require(cell, t));
5050
//~^ WARNING not reporting region error due to -Znll
51-
//~| ERROR failed type test
51+
//~| ERROR `<T as Anything<'_#5r, '_#6r>>::AssocType` does not outlive `'_#7r`
5252
}
5353

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

6565
#[rustc_regions]
@@ -80,7 +80,7 @@ where
8080

8181
with_signature(cell, t, |cell, t| require(cell, t));
8282
//~^ WARNING not reporting region error due to -Znll
83-
//~| ERROR failed type test
83+
//~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
8484
}
8585

8686
#[rustc_regions]

0 commit comments

Comments
 (0)