Skip to content

Commit 2490ee5

Browse files
committed
correct various error messages that changed
The new messages seem universally better. I think these result because we recognize that we are in an invariant context more often.
1 parent a4151ff commit 2490ee5

5 files changed

+9
-10
lines changed

src/test/compile-fail/region-invariant-static-error-reporting.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
// over time, but this test used to exhibit some pretty bogus messages
1414
// that were not remotely helpful.
1515

16-
// error-pattern:cannot infer
17-
// error-pattern:cannot outlive the lifetime 'a
18-
// error-pattern:must be valid for the static lifetime
16+
// error-pattern:the lifetime 'a
17+
// error-pattern:the static lifetime
1918

2019
struct Invariant<'a>(Option<&'a mut &'a mut ()>);
2120

src/test/compile-fail/regions-trait-object-subtyping.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn foo2<'a:'b,'b>(x: &'b mut (Dummy+'a)) -> &'b mut (Dummy+'b) {
2222

2323
fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
2424
// Without knowing 'a:'b, we can't coerce
25-
x //~ ERROR cannot infer an appropriate lifetime
25+
x //~ ERROR lifetime bound not satisfied
2626
//~^ ERROR cannot infer an appropriate lifetime
2727
}
2828

src/test/compile-fail/variance-contravariant-arg-object.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
2121
-> Box<Get<&'min i32>>
2222
where 'max : 'min
2323
{
24-
v //~ ERROR cannot infer an appropriate lifetime
24+
v //~ ERROR mismatched types
2525
}
2626

2727
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
2828
-> Box<Get<&'max i32>>
2929
where 'max : 'min
3030
{
3131
// Previously OK:
32-
v //~ ERROR cannot infer an appropriate lifetime
32+
v //~ ERROR mismatched types
3333
}
3434

3535
fn main() { }

src/test/compile-fail/variance-covariant-arg-object.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
2222
where 'max : 'min
2323
{
2424
// Previously OK, now an error as traits are invariant.
25-
v //~ ERROR cannot infer an appropriate lifetime
25+
v //~ ERROR mismatched types
2626
}
2727

2828
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
2929
-> Box<Get<&'max i32>>
3030
where 'max : 'min
3131
{
32-
v //~ ERROR cannot infer an appropriate lifetime
32+
v //~ ERROR mismatched types
3333
}
3434

3535
fn main() { }

src/test/compile-fail/variance-invariant-arg-object.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
1818
-> Box<Get<&'min i32>>
1919
where 'max : 'min
2020
{
21-
v //~ ERROR cannot infer an appropriate lifetime
21+
v //~ ERROR mismatched types
2222
}
2323

2424
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
2525
-> Box<Get<&'max i32>>
2626
where 'max : 'min
2727
{
28-
v //~ ERROR cannot infer an appropriate lifetime
28+
v //~ ERROR mismatched types
2929
}
3030

3131
fn main() { }

0 commit comments

Comments
 (0)