mirror of https://github.com/rust-lang/rust.git
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.
This commit is contained in:
parent
a4151ff3c4
commit
2490ee5080
|
@ -13,9 +13,8 @@
|
||||||
// over time, but this test used to exhibit some pretty bogus messages
|
// over time, but this test used to exhibit some pretty bogus messages
|
||||||
// that were not remotely helpful.
|
// that were not remotely helpful.
|
||||||
|
|
||||||
// error-pattern:cannot infer
|
// error-pattern:the lifetime 'a
|
||||||
// error-pattern:cannot outlive the lifetime 'a
|
// error-pattern:the static lifetime
|
||||||
// error-pattern:must be valid for the static lifetime
|
|
||||||
|
|
||||||
struct Invariant<'a>(Option<&'a mut &'a mut ()>);
|
struct Invariant<'a>(Option<&'a mut &'a mut ()>);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ fn foo2<'a:'b,'b>(x: &'b mut (Dummy+'a)) -> &'b mut (Dummy+'b) {
|
||||||
|
|
||||||
fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
|
fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
|
||||||
// Without knowing 'a:'b, we can't coerce
|
// Without knowing 'a:'b, we can't coerce
|
||||||
x //~ ERROR cannot infer an appropriate lifetime
|
x //~ ERROR lifetime bound not satisfied
|
||||||
//~^ ERROR cannot infer an appropriate lifetime
|
//~^ ERROR cannot infer an appropriate lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
|
||||||
-> Box<Get<&'min i32>>
|
-> Box<Get<&'min i32>>
|
||||||
where 'max : 'min
|
where 'max : 'min
|
||||||
{
|
{
|
||||||
v //~ ERROR cannot infer an appropriate lifetime
|
v //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
||||||
|
@ -29,7 +29,7 @@ fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
||||||
where 'max : 'min
|
where 'max : 'min
|
||||||
{
|
{
|
||||||
// Previously OK:
|
// Previously OK:
|
||||||
v //~ ERROR cannot infer an appropriate lifetime
|
v //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -22,14 +22,14 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
|
||||||
where 'max : 'min
|
where 'max : 'min
|
||||||
{
|
{
|
||||||
// Previously OK, now an error as traits are invariant.
|
// Previously OK, now an error as traits are invariant.
|
||||||
v //~ ERROR cannot infer an appropriate lifetime
|
v //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
||||||
-> Box<Get<&'max i32>>
|
-> Box<Get<&'max i32>>
|
||||||
where 'max : 'min
|
where 'max : 'min
|
||||||
{
|
{
|
||||||
v //~ ERROR cannot infer an appropriate lifetime
|
v //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -18,14 +18,14 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
|
||||||
-> Box<Get<&'min i32>>
|
-> Box<Get<&'min i32>>
|
||||||
where 'max : 'min
|
where 'max : 'min
|
||||||
{
|
{
|
||||||
v //~ ERROR cannot infer an appropriate lifetime
|
v //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
||||||
-> Box<Get<&'max i32>>
|
-> Box<Get<&'max i32>>
|
||||||
where 'max : 'min
|
where 'max : 'min
|
||||||
{
|
{
|
||||||
v //~ ERROR cannot infer an appropriate lifetime
|
v //~ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
Loading…
Reference in New Issue