mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
Correct various compile-fail tests. Most of the changes are because we
now don't print duplicate errors within one context, so I sometimes had to break functions into two functions.
This commit is contained in:
parent
d85ff16173
commit
594e21f19b
15
src/test/compile-fail/comm-not-freeze-receiver.rs
Normal file
15
src/test/compile-fail/comm-not-freeze-receiver.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn test<T: Sync>() {}
|
||||
|
||||
fn main() {
|
||||
test::<Receiver<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
|
||||
}
|
@ -11,7 +11,5 @@
|
||||
fn test<T: Sync>() {}
|
||||
|
||||
fn main() {
|
||||
test::<Sender<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
|
||||
test::<Receiver<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
|
||||
test::<Sender<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
|
||||
test::<Sender<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ fn new_struct(r: A+'static)
|
||||
-> Struct { //~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
Struct { r: r }
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
}
|
||||
|
||||
trait Curve {}
|
||||
|
@ -32,5 +32,5 @@ struct A {
|
||||
|
||||
fn main() {
|
||||
let a = A {v: box B{v: None} as Box<Foo+Send>};
|
||||
//~^ ERROR the trait `core::kinds::Send` is not implemented for the type `B`
|
||||
//~^ ERROR the trait `core::kinds::Send` is not implemented
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:reached the recursion limit during monomorphization
|
||||
|
||||
// Verify the compiler fails with an error on infinite function
|
||||
// recursions.
|
||||
|
||||
|
||||
struct Data(Box<Option<Data>>);
|
||||
|
||||
fn generic<T>( _ : Vec<(Data,T)> ) {
|
||||
//~^ ERROR reached the recursion limit during monomorphization
|
||||
let rec : Vec<(Data,(bool,T))> = Vec::new();
|
||||
generic( rec );
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ struct MyStruct {
|
||||
}
|
||||
|
||||
struct MyNoncopyStruct {
|
||||
x: Box<int>,
|
||||
x: Box<char>,
|
||||
}
|
||||
|
||||
fn test<'a,T,U:Copy>(_: &'a int) {
|
||||
|
@ -16,7 +16,7 @@ struct Foo {
|
||||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
//~^ ERROR the trait `core::kinds::Send` is not implemented for the type `Foo`
|
||||
//~^ ERROR the trait `core::kinds::Send` is not implemented
|
||||
//~^^ NOTE cannot implement a destructor on a structure or enumeration that does not satisfy Send
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
|
@ -22,6 +22,10 @@ fn f<T>(val: T) {
|
||||
let a = &t as &Gettable<T>;
|
||||
//~^ ERROR the trait `core::kinds::Send` is not implemented
|
||||
//~^^ ERROR the trait `core::kinds::Copy` is not implemented
|
||||
}
|
||||
|
||||
fn g<T>(val: T) {
|
||||
let t: S<T> = S;
|
||||
let a: &Gettable<T> = &t;
|
||||
//~^ ERROR the trait `core::kinds::Send` is not implemented
|
||||
//~^^ ERROR the trait `core::kinds::Copy` is not implemented
|
||||
@ -30,9 +34,15 @@ fn f<T>(val: T) {
|
||||
fn foo<'a>() {
|
||||
let t: S<&'a int> = S;
|
||||
let a = &t as &Gettable<&'a int>;
|
||||
}
|
||||
|
||||
fn foo2<'a>() {
|
||||
let t: Box<S<String>> = box S;
|
||||
let a = t as Box<Gettable<String>>;
|
||||
//~^ ERROR the trait `core::kinds::Copy` is not implemented
|
||||
}
|
||||
|
||||
fn foo3<'a>() {
|
||||
let t: Box<S<String>> = box S;
|
||||
let a: Box<Gettable<String>> = t;
|
||||
//~^ ERROR the trait `core::kinds::Copy` is not implemented
|
||||
|
@ -13,10 +13,14 @@ use std::rc::Rc;
|
||||
|
||||
fn foo(_x: Rc<uint>) {}
|
||||
|
||||
fn main() {
|
||||
fn bar() {
|
||||
let x = Rc::new(3u);
|
||||
let _: proc():Send = proc() foo(x); //~ ERROR `core::kinds::Send` is not implemented
|
||||
let _: proc():Send = proc() foo(x); //~ ERROR `core::kinds::Send` is not implemented
|
||||
let _: proc():Send = proc() foo(x); //~ ERROR `core::kinds::Send` is not implemented
|
||||
}
|
||||
|
||||
fn bar2() {
|
||||
let x = Rc::new(3u);
|
||||
let _: proc() = proc() foo(x);
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -29,5 +29,5 @@ fn foo(i:int, j: Rc<String>) -> foo {
|
||||
fn main() {
|
||||
let cat = "kitty".to_string();
|
||||
let (tx, _) = channel(); //~ ERROR `core::kinds::Send` is not implemented
|
||||
tx.send(foo(42, Rc::new(cat))); //~ ERROR `core::kinds::Send` is not implemented
|
||||
tx.send(foo(42, Rc::new(cat)));
|
||||
}
|
||||
|
@ -8,14 +8,22 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum Foo<T> { FooSome(T), FooNone }
|
||||
|
||||
fn bar<T: Sized>() { }
|
||||
fn foo<Sized? T>() { bar::<Foo<T>>() }
|
||||
fn is_sized<T:Sized>() { }
|
||||
fn not_sized<Sized? T>() { }
|
||||
|
||||
enum Foo<U> { FooSome(U), FooNone }
|
||||
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
|
||||
fn foo2<Sized? T>() { not_sized::<Foo<T>>() }
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
//~^^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
//
|
||||
// One error is for T being provided to Foo<T>, the other is
|
||||
// for Foo<T> being provided to bar.
|
||||
// Not OK: `T` is not sized.
|
||||
|
||||
enum Bar<Sized? U> { BarSome(U), BarNone }
|
||||
fn bar1<Sized? T>() { not_sized::<Bar<T>>() }
|
||||
fn bar2<Sized? T>() { is_sized::<Bar<T>>() }
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
//
|
||||
// Not OK: `Bar<T>` is not sized, but it should be.
|
||||
|
||||
fn main() { }
|
||||
|
@ -8,13 +8,22 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Foo<T> { data: T }
|
||||
|
||||
fn bar<T: Sized>() { }
|
||||
fn foo<Sized? T>() { bar::<Foo<T>>() }
|
||||
fn is_sized<T:Sized>() { }
|
||||
fn not_sized<Sized? T>() { }
|
||||
|
||||
struct Foo<T> { data: T }
|
||||
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
|
||||
fn foo2<Sized? T>() { not_sized::<Foo<T>>() }
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
//~^^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
// One error is for the T in Foo<T>, the other is for Foo<T> as a value
|
||||
// for bar's type parameter.
|
||||
//
|
||||
// Not OK: `T` is not sized.
|
||||
|
||||
struct Bar<Sized? T> { data: T }
|
||||
fn bar1<Sized? T>() { not_sized::<Bar<T>>() }
|
||||
fn bar2<Sized? T>() { is_sized::<Bar<T>>() }
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
//
|
||||
// Not OK: `Bar<T>` is not sized, but it should be.
|
||||
|
||||
fn main() { }
|
||||
|
@ -57,6 +57,9 @@ fn f8<Sized? X>(x1: &S<X>, x2: &S<X>) {
|
||||
fn f9<Sized? X>(x1: Box<S<X>>, x2: Box<E<X>>) {
|
||||
f5(&(*x1, 34i));
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
}
|
||||
|
||||
fn f10<Sized? X>(x1: Box<S<X>>, x2: Box<E<X>>) {
|
||||
f5(&(32i, *x2));
|
||||
//~^ ERROR the trait `core::kinds::Sized` is not implemented
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ struct S4 {
|
||||
}
|
||||
enum E<Sized? X> {
|
||||
V1(X, int), //~ERROR `core::kinds::Sized` is not implemented
|
||||
}
|
||||
enum F<Sized? X> {
|
||||
V2{f1: X, f: int}, //~ERROR `core::kinds::Sized` is not implemented
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user