tests: update some compile-fail tests for the new behavior of type expectations.
This commit is contained in:
parent
e73fbc69cd
commit
474872160a
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user