tests: update some compile-fail tests for the new behavior of type expectations.

This commit is contained in:
Eduard Burtescu 2015-01-08 18:39:17 +02:00
parent e73fbc69cd
commit 474872160a
3 changed files with 5 additions and 1 deletions

View File

@ -14,7 +14,8 @@ pub fn foo(params: Option<&[&str]>) -> usize {
fn main() {
let name = "Foo";
let msg = foo(Some(&[name.as_slice()]));
let x = Some(&[name.as_slice()]);
let msg = foo(x);
//~^ ERROR mismatched types: expected `core::option::Option<&[&str]>`
assert_eq!(msg, 3);
}

View File

@ -28,6 +28,8 @@ impl<'a> GetRef<'a> for Box<'a> {
impl<'a> Box<'a> {
fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
g2.get() //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to
//~^ ERROR mismatched types: expected `&'a isize`, found `&'b isize` (lifetime mismatch)
}
}

View File

@ -27,6 +27,7 @@ impl<'a,T:Clone> GetRef<'a,T> for Box<'a,T> {
fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize {
g1.get() //~ ERROR cannot infer an appropriate lifetime for automatic coercion due to
//~^ ERROR mismatched types: expected `&'b isize`, found `&'a isize` (lifetime mismatch)
}
fn main() {