Skip to content

Commit

Permalink
correct various error messages that changed
Browse files Browse the repository at this point in the history
The new messages seem universally better. I think these result because
we recognize that we are in an invariant context more often.
  • Loading branch information
nikomatsakis committed May 11, 2017
1 parent a4151ff commit 2490ee5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
// over time, but this test used to exhibit some pretty bogus messages
// that were not remotely helpful.

// error-pattern:cannot infer
// error-pattern:cannot outlive the lifetime 'a
// error-pattern:must be valid for the static lifetime
// error-pattern:the lifetime 'a
// error-pattern:the static lifetime

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

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/regions-trait-object-subtyping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
// 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
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/variance-contravariant-arg-object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
-> Box<Get<&'min i32>>
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>>)
-> Box<Get<&'max i32>>
where 'max : 'min
{
// Previously OK:
v //~ ERROR cannot infer an appropriate lifetime
v //~ ERROR mismatched types
}

fn main() { }
4 changes: 2 additions & 2 deletions src/test/compile-fail/variance-covariant-arg-object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
where 'max : 'min
{
// 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>>)
-> Box<Get<&'max i32>>
where 'max : 'min
{
v //~ ERROR cannot infer an appropriate lifetime
v //~ ERROR mismatched types
}

fn main() { }
4 changes: 2 additions & 2 deletions src/test/compile-fail/variance-invariant-arg-object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
-> Box<Get<&'min i32>>
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>>)
-> Box<Get<&'max i32>>
where 'max : 'min
{
v //~ ERROR cannot infer an appropriate lifetime
v //~ ERROR mismatched types
}

fn main() { }

0 comments on commit 2490ee5

Please sign in to comment.