mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Fallout in tests --- misc error message changes, WF fixes
This commit is contained in:
parent
f4aaedb51e
commit
dee8b54b71
@ -12,7 +12,9 @@ fn bar<F>(blk: F) where F: FnOnce() + 'static {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn foo(x: &()) {
|
fn foo(x: &()) {
|
||||||
bar(|| { //~ ERROR cannot infer an appropriate lifetime
|
bar(|| {
|
||||||
|
//~^ ERROR cannot infer
|
||||||
|
//~| ERROR does not fulfill
|
||||||
let _ = x;
|
let _ = x;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::any::TypeId;
|
use std::any::TypeId;
|
||||||
|
|
||||||
pub trait Pt {}
|
trait Private<P, R> {
|
||||||
pub trait Rt {}
|
|
||||||
|
|
||||||
trait Private<P: Pt, R: Rt> {
|
|
||||||
fn call(&self, p: P, r: R);
|
fn call(&self, p: P, r: R);
|
||||||
}
|
}
|
||||||
pub trait Public: Private< //~ ERROR private trait in exported type parameter bound
|
pub trait Public: Private< //~ ERROR private trait in exported type parameter bound
|
||||||
|
@ -19,6 +19,7 @@ trait To {
|
|||||||
self //~ error: the trait `core::marker::Sized` is not implemented
|
self //~ error: the trait `core::marker::Sized` is not implemented
|
||||||
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
|
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
|
||||||
From::from( //~ error: the trait `core::marker::Sized` is not implemented
|
From::from( //~ error: the trait `core::marker::Sized` is not implemented
|
||||||
|
//~^ ERROR E0277
|
||||||
self
|
self
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,5 @@ fn main()
|
|||||||
{
|
{
|
||||||
fn bar(x:i32) ->i32 { 3*x };
|
fn bar(x:i32) ->i32 { 3*x };
|
||||||
let b:Box<Any> = Box::new(bar as fn(_)->_);
|
let b:Box<Any> = Box::new(bar as fn(_)->_);
|
||||||
b.downcast_ref::<fn(_)->_>();
|
b.downcast_ref::<fn(_)->_>(); //~ ERROR E0101
|
||||||
//~^ ERROR cannot determine a type for this expression: unconstrained type
|
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,5 @@ fn main() {
|
|||||||
let a = 1;
|
let a = 1;
|
||||||
let b = 2;
|
let b = 2;
|
||||||
unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
|
unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
|
||||||
//~^ ERROR cannot determine a type for this expression: unconstrained type
|
//~^ ERROR unable to infer enough type information about `_`
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ struct S {
|
|||||||
name: isize
|
name: isize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bar(_x: Foo) {} //~ ERROR the trait `core::marker::Sized` is not implemented
|
fn bar(_x: Foo) {}
|
||||||
|
//~^ ERROR E0277
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -31,7 +31,9 @@ fn a() {
|
|||||||
fn b() {
|
fn b() {
|
||||||
let x: Box<_> = box 3;
|
let x: Box<_> = box 3;
|
||||||
let y = &x;
|
let y = &x;
|
||||||
let z = &x as &Foo; //~ ERROR E0038
|
let z = &x as &Foo;
|
||||||
|
//~^ ERROR E0038
|
||||||
|
//~| ERROR E0038
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
@ -47,7 +47,7 @@ fn with_assoc<'a,'b>() {
|
|||||||
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
|
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
|
||||||
// which is &'b (), must outlive 'a.
|
// which is &'b (), must outlive 'a.
|
||||||
|
|
||||||
let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR cannot infer
|
let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
trait A<T> { }
|
trait A<T> { }
|
||||||
struct B<'a, T>(&'a (A<T>+'a));
|
struct B<'a, T:'a>(&'a (A<T>+'a));
|
||||||
|
|
||||||
trait X { }
|
trait X { }
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
trait A<T> { }
|
trait A<T> { }
|
||||||
struct B<'a, T>(&'a (A<T>+'a));
|
struct B<'a, T:'a>(&'a (A<T>+'a));
|
||||||
|
|
||||||
trait X { }
|
trait X { }
|
||||||
impl<'a, T> X for B<'a, T> {}
|
impl<'a, T> X for B<'a, T> {}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
trait A<T> { }
|
trait A<T> { }
|
||||||
struct B<'a, T>(&'a (A<T>+'a));
|
struct B<'a, T:'a>(&'a (A<T>+'a));
|
||||||
|
|
||||||
trait X { }
|
trait X { }
|
||||||
impl<'a, T> X for B<'a, T> {}
|
impl<'a, T> X for B<'a, T> {}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
trait A<T> { }
|
trait A<T> { }
|
||||||
struct B<'a, T>(&'a (A<T>+'a));
|
struct B<'a, T:'a>(&'a (A<T>+'a));
|
||||||
|
|
||||||
trait X { }
|
trait X { }
|
||||||
impl<'a, T> X for B<'a, T> {}
|
impl<'a, T> X for B<'a, T> {}
|
||||||
|
@ -16,15 +16,22 @@ trait A<T>
|
|||||||
fn get(&self) -> T { panic!() }
|
fn get(&self) -> T { panic!() }
|
||||||
}
|
}
|
||||||
|
|
||||||
struct B<'a, T>(&'a (A<T>+'a));
|
struct B<'a, T:'a>(&'a (A<T>+'a));
|
||||||
|
|
||||||
trait X { fn foo(&self) {} }
|
trait X { fn foo(&self) {} }
|
||||||
|
|
||||||
impl<'a, T> X for B<'a, T> {}
|
impl<'a, T> X for B<'a, T> {}
|
||||||
|
|
||||||
fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
|
fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
|
||||||
box B(&*v) as Box<X> //~ ERROR the parameter type `T` may not live long enough
|
// oh dear!
|
||||||
|
box B(&*v) as Box<X>
|
||||||
//~^ ERROR the parameter type `T` may not live long enough
|
//~^ ERROR the parameter type `T` may not live long enough
|
||||||
|
//~| WARNING the parameter type `T` may not live long enough
|
||||||
|
//~| WARNING the parameter type `T` may not live long enough
|
||||||
|
//~| ERROR the parameter type `T` may not live long enough
|
||||||
|
//~| WARNING the parameter type `T` may not live long enough
|
||||||
|
//~| ERROR the parameter type `T` may not live long enough
|
||||||
|
//~| ERROR the parameter type `T` may not live long enough
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -25,11 +25,13 @@ enum RefOk<'a, T:'a> {
|
|||||||
RefOkVariant1(&'a T)
|
RefOkVariant1(&'a T)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RefIndirect<'a, T> { //~ ERROR the parameter type `T` may not live long enough
|
enum RefIndirect<'a, T> {
|
||||||
|
//~^ ERROR the parameter type `T` may not live long enough
|
||||||
RefIndirectVariant1(isize, RefOk<'a,T>)
|
RefIndirectVariant1(isize, RefOk<'a,T>)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RefDouble<'a, 'b, T> { //~ ERROR reference has a longer lifetime than the data
|
enum RefDouble<'a, 'b, T> {
|
||||||
|
//~^ ERROR reference has a longer lifetime than the data
|
||||||
RefDoubleVariant1(&'a &'b T)
|
RefDoubleVariant1(&'a &'b T)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ fn with_assoc<'a,'b>() {
|
|||||||
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
|
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
|
||||||
// which is &'b (), must outlive 'a.
|
// which is &'b (), must outlive 'a.
|
||||||
|
|
||||||
let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR cannot infer
|
let _: &'a WithAssoc<TheType<'b>> = loop { };
|
||||||
|
//~^ ERROR reference has a longer lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -45,7 +45,7 @@ fn with_assoc<'a,'b>() {
|
|||||||
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
|
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
|
||||||
// which is &'b (), must outlive 'a.
|
// which is &'b (), must outlive 'a.
|
||||||
|
|
||||||
let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR cannot infer
|
let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_assoc1<'a,'b>() where 'b : 'a {
|
fn with_assoc1<'a,'b>() where 'b : 'a {
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
struct Ref<'a, T> { //~ ERROR the parameter type `T` may not live long enough
|
struct Ref<'a, T> {
|
||||||
|
//~^ ERROR the parameter type `T` may not live long enough
|
||||||
field: &'a T
|
field: &'a T
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,11 +21,13 @@ struct RefOk<'a, T:'a> {
|
|||||||
field: &'a T
|
field: &'a T
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RefIndirect<'a, T> { //~ ERROR the parameter type `T` may not live long enough
|
struct RefIndirect<'a, T> {
|
||||||
|
//~^ ERROR the parameter type `T` may not live long enough
|
||||||
field: RefOk<'a, T>
|
field: RefOk<'a, T>
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DoubleRef<'a, 'b, T> { //~ ERROR reference has a longer lifetime than the data it references
|
struct DoubleRef<'a, 'b, T> {
|
||||||
|
//~^ ERROR reference has a longer lifetime than the data it references
|
||||||
field: &'a &'b T
|
field: &'a &'b T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,5 +22,6 @@ impl Tr for St {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: &Tr = &St; //~ ERROR cannot convert to a trait object because trait `Tr` is not
|
let _: &Tr = &St; //~ ERROR E0038
|
||||||
|
//~^ ERROR E0038
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah<X>(&self) {} }
|
|||||||
fn main() {
|
fn main() {
|
||||||
10.dup::<i32>(); //~ ERROR does not take type parameters
|
10.dup::<i32>(); //~ ERROR does not take type parameters
|
||||||
10.blah::<i32, i32>(); //~ ERROR incorrect number of type parameters
|
10.blah::<i32, i32>(); //~ ERROR incorrect number of type parameters
|
||||||
(box 10 as Box<bar>).dup(); //~ ERROR cannot convert to a trait object
|
(box 10 as Box<bar>).dup();
|
||||||
//~^ ERROR the trait `bar` is not implemented for the type `bar`
|
//~^ ERROR E0038
|
||||||
|
//~| ERROR E0038
|
||||||
|
//~| ERROR E0277
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,23 @@ fn dummy() {
|
|||||||
|
|
||||||
Outer(TestType);
|
Outer(TestType);
|
||||||
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
|
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
|
||||||
|
//~| ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dummy1b() {
|
||||||
|
struct TestType;
|
||||||
|
impl !Send for TestType {}
|
||||||
|
|
||||||
is_send(TestType);
|
is_send(TestType);
|
||||||
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
|
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy1b::TestType`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dummy1c() {
|
||||||
|
struct TestType;
|
||||||
|
impl !Send for TestType {}
|
||||||
|
|
||||||
is_send((8, TestType));
|
is_send((8, TestType));
|
||||||
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
|
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy1c::TestType`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dummy2() {
|
fn dummy2() {
|
||||||
|
@ -22,5 +22,6 @@ impl MyAdd for i32 {
|
|||||||
fn main() {
|
fn main() {
|
||||||
let x: i32 = 5;
|
let x: i32 = 5;
|
||||||
let y = x as MyAdd<i32>;
|
let y = x as MyAdd<i32>;
|
||||||
//~^ ERROR as `MyAdd<i32>`
|
//~^ ERROR E0038
|
||||||
|
//~| ERROR cast to unsized type: `i32` as `MyAdd<i32>`
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ struct Test4<'a, 'b:'a> { //~ ERROR regions=[[-, o];[];[]]
|
|||||||
// contravariant context:
|
// contravariant context:
|
||||||
|
|
||||||
#[rustc_variance]
|
#[rustc_variance]
|
||||||
struct Test5<'a, 'b> { //~ ERROR regions=[[+, o];[];[]]
|
struct Test5<'a, 'b:'a> { //~ ERROR regions=[[+, o];[];[]]
|
||||||
x: extern "Rust" fn(&'a mut &'b isize),
|
x: extern "Rust" fn(&'a mut &'b isize),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ struct Test5<'a, 'b> { //~ ERROR regions=[[+, o];[];[]]
|
|||||||
// argument list occurs in an invariant context.
|
// argument list occurs in an invariant context.
|
||||||
|
|
||||||
#[rustc_variance]
|
#[rustc_variance]
|
||||||
struct Test6<'a, 'b> { //~ ERROR regions=[[-, o];[];[]]
|
struct Test6<'a, 'b:'a> { //~ ERROR regions=[[-, o];[];[]]
|
||||||
x: &'a mut extern "Rust" fn(&'b isize),
|
x: &'a mut extern "Rust" fn(&'b isize),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// pretty-expanded FIXME #23616
|
// pretty-expanded FIXME #23616
|
||||||
|
|
||||||
trait Foo {
|
trait Foo: Sized {
|
||||||
fn bar(&self);
|
fn bar(&self);
|
||||||
fn baz(&self) { }
|
fn baz(&self) { }
|
||||||
fn bah(_: Option<Self>) { }
|
fn bah(_: Option<Self>) { }
|
||||||
|
@ -52,7 +52,7 @@ pub trait MyTrait<T> {
|
|||||||
fn dummy(&self, t: T) -> T { panic!() }
|
fn dummy(&self, t: T) -> T { panic!() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MyContainer<'a, T> {
|
pub struct MyContainer<'a, T:'a> {
|
||||||
foos: Vec<&'a (MyTrait<T>+'a)> ,
|
foos: Vec<&'a (MyTrait<T>+'a)> ,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user