}
fn foo(x: &()) {
- bar(|| { //~ ERROR cannot infer an appropriate lifetime
+ bar(|| {
+ //~^ ERROR cannot infer
+ //~| ERROR does not fulfill
let _ = x;
})
}
use std::any::Any;
use std::any::TypeId;
-pub trait Pt {}
-pub trait Rt {}
-
-trait Private<P: Pt, R: Rt> {
+trait Private<P, R> {
fn call(&self, p: P, r: R);
}
pub trait Public: Private< //~ ERROR private trait in exported type parameter bound
self //~ error: the trait `core::marker::Sized` is not implemented
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
From::from( //~ error: the trait `core::marker::Sized` is not implemented
+ //~^ ERROR E0277
self
)
}
{
fn bar(x:i32) ->i32 { 3*x };
let b:Box<Any> = Box::new(bar as fn(_)->_);
- b.downcast_ref::<fn(_)->_>();
- //~^ ERROR cannot determine a type for this expression: unconstrained type
+ b.downcast_ref::<fn(_)->_>(); //~ ERROR E0101
}
let a = 1;
let b = 2;
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 `_`
}
name: isize
}
-fn bar(_x: Foo) {} //~ ERROR the trait `core::marker::Sized` is not implemented
+fn bar(_x: Foo) {}
+//~^ ERROR E0277
fn main() {}
fn b() {
let x: Box<_> = box 3;
let y = &x;
- let z = &x as &Foo; //~ ERROR E0038
+ let z = &x as &Foo;
+ //~^ ERROR E0038
+ //~| ERROR E0038
}
fn main() { }
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
// 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() {
#![allow(warnings)]
trait A<T> { }
-struct B<'a, T>(&'a (A<T>+'a));
+struct B<'a, T:'a>(&'a (A<T>+'a));
trait X { }
#![feature(box_syntax)]
trait A<T> { }
-struct B<'a, T>(&'a (A<T>+'a));
+struct B<'a, T:'a>(&'a (A<T>+'a));
trait X { }
impl<'a, T> X for B<'a, T> {}
#![allow(warnings)]
trait A<T> { }
-struct B<'a, T>(&'a (A<T>+'a));
+struct B<'a, T:'a>(&'a (A<T>+'a));
trait X { }
impl<'a, T> X for B<'a, T> {}
#![feature(box_syntax)]
trait A<T> { }
-struct B<'a, T>(&'a (A<T>+'a));
+struct B<'a, T:'a>(&'a (A<T>+'a));
trait X { }
impl<'a, T> X for B<'a, T> {}
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) {} }
impl<'a, T> X for B<'a, T> {}
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
+ //~| 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() {}
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>)
}
-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)
}
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
// 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() {
// outlive 'a. In this case, that means TheType<'b>::TheAssocType,
// 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 {
#![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
}
-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>
}
-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
}
}
fn main() {
- let _: &Tr = &St; //~ ERROR cannot convert to a trait object because trait `Tr` is not
+ let _: &Tr = &St; //~ ERROR E0038
+ //~^ ERROR E0038
}
fn main() {
10.dup::<i32>(); //~ ERROR does not take 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
- //~^ ERROR the trait `bar` is not implemented for the type `bar`
+ (box 10 as Box<bar>).dup();
+ //~^ ERROR E0038
+ //~| ERROR E0038
+ //~| ERROR E0277
}
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`
+}
+
+fn dummy1b() {
+ struct TestType;
+ impl !Send for 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));
- //~^ 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 main() {
let x: i32 = 5;
let y = x as MyAdd<i32>;
- //~^ ERROR as `MyAdd<i32>`
+ //~^ ERROR E0038
+ //~| ERROR cast to unsized type: `i32` as `MyAdd<i32>`
}
// contravariant context:
#[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),
}
// argument list occurs in an invariant context.
#[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),
}
// pretty-expanded FIXME #23616
-trait Foo {
+trait Foo: Sized {
fn bar(&self);
fn baz(&self) { }
fn bah(_: Option<Self>) { }
fn dummy(&self, t: T) -> T { panic!() }
}
-pub struct MyContainer<'a, T> {
+pub struct MyContainer<'a, T:'a> {
foos: Vec<&'a (MyTrait<T>+'a)> ,
}