eddyb's changes for DST coercions
+ lots of rebasing
This commit is contained in:
parent
c2b30b86df
commit
843db01bd9
40 changed files with 1019 additions and 514 deletions
|
|
@ -35,7 +35,7 @@ fn main() {
|
|||
// n == m
|
||||
let &x = &1 as &T; //~ ERROR type `&T` cannot be dereferenced
|
||||
let &&x = &(&1 as &T); //~ ERROR type `&T` cannot be dereferenced
|
||||
let box x = box 1 as Box<T>; //~ ERROR type `Box<T>` cannot be dereferenced
|
||||
let box x = box 1 as Box<T>; //~ ERROR the trait `core::marker::Sized` is not implemented
|
||||
|
||||
// n > m
|
||||
let &&x = &1 as &T;
|
||||
|
|
|
|||
|
|
@ -33,18 +33,4 @@ pub fn main() {
|
|||
let x: &mut T = &S; //~ ERROR mismatched types
|
||||
let x: *mut T = &S; //~ ERROR mismatched types
|
||||
let x: *mut S = &S; //~ ERROR mismatched types
|
||||
|
||||
// The below four sets of tests test that we cannot implicitly deref a *-ptr
|
||||
// during a coercion.
|
||||
let x: *const S = &S;
|
||||
let y: *const T = x; //~ ERROR mismatched types
|
||||
|
||||
let x: *mut S = &mut S;
|
||||
let y: *mut T = x; //~ ERROR mismatched types
|
||||
|
||||
let x: *const Foo<S> = &Foo {f: S};
|
||||
let y: *const Foo<T> = x; //~ ERROR mismatched types
|
||||
|
||||
let x: *mut Foo<S> = &mut Foo {f: S};
|
||||
let y: *mut Foo<T> = x; //~ ERROR mismatched types
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ struct Homura;
|
|||
|
||||
fn akemi(homura: Homura) {
|
||||
let Some(ref madoka) = Some(homura.kaname()); //~ ERROR does not implement any method
|
||||
madoka.clone();
|
||||
madoka.clone(); //~ ERROR the type of this value must be known in this context
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -12,6 +12,5 @@ fn main() {
|
|||
for (ref i,) in [].iter() { //~ ERROR: type mismatch resolving
|
||||
i.clone();
|
||||
//~^ ERROR: the type of this value must be known in this context
|
||||
//~| ERROR: reached the recursion limit while auto-dereferencing
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ fn main() {
|
|||
let ptr: *mut () = 0 as *mut _;
|
||||
let _: &mut Fn() = unsafe {
|
||||
&mut *(ptr as *mut Fn())
|
||||
//~^ ERROR illegal cast
|
||||
//~^ ERROR the trait `core::ops::Fn<()>` is not implemented
|
||||
//~| ERROR the trait `core::ops::FnOnce<()>` is not implemented
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
|
|||
// which fails to type check.
|
||||
|
||||
ss
|
||||
//~^ ERROR lifetime of the source pointer does not outlive lifetime bound
|
||||
//~^ ERROR lifetime bound not satisfied
|
||||
//~| ERROR cannot infer
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ fn load(ss: &mut SomeStruct) -> Box<SomeTrait> {
|
|||
// `Box<SomeTrait>` defaults to a `'static` bound, so this return
|
||||
// is illegal.
|
||||
|
||||
ss.r //~ ERROR lifetime of the source pointer does not outlive lifetime bound
|
||||
ss.r //~ ERROR lifetime bound not satisfied
|
||||
}
|
||||
|
||||
fn store(ss: &mut SomeStruct, b: Box<SomeTrait>) {
|
||||
|
|
@ -38,7 +38,7 @@ fn store(ss: &mut SomeStruct, b: Box<SomeTrait>) {
|
|||
fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) {
|
||||
// Here we override the lifetimes explicitly, and so naturally we get an error.
|
||||
|
||||
ss.r = b; //~ ERROR lifetime of the source pointer does not outlive lifetime bound
|
||||
ss.r = b; //~ ERROR lifetime bound not satisfied
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box<SomeTrait+'b> {
|
|||
|
||||
fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<SomeTrait+'c> {
|
||||
// A outlives 'a AND 'b...but not 'c.
|
||||
box v as Box<SomeTrait+'a> //~ ERROR lifetime of the source pointer does not outlive
|
||||
box v as Box<SomeTrait+'a> //~ ERROR lifetime bound not satisfied
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -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 lifetime of the source pointer does not outlive
|
||||
x //~ ERROR lifetime bound not satisfied
|
||||
//~^ ERROR cannot infer
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue