Don't use NoSend/NoSync in tests

This commit is contained in:
Flavio Percoco 2015-01-11 13:14:39 +01:00
parent 094397a88b
commit 921ba5a09f
19 changed files with 59 additions and 41 deletions

View file

@ -8,12 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::marker;
#![feature(optin_builtin_traits)]
struct Foo { marker: marker::NoSync }
use std::marker::Sync;
struct Foo;
impl !Sync for Foo {}
static FOO: usize = 3;
static BAR: Foo = Foo { marker: marker::NoSync };
static BAR: Foo = Foo;
//~^ ERROR: the trait `core::marker::Sync` is not implemented
fn main() {}

View file

@ -35,5 +35,4 @@ struct A {
fn main() {
let a = A {v: box B{v: None} as Box<Foo+Send>};
//~^ ERROR the trait `core::marker::Send` is not implemented
//~^^ ERROR the trait `core::marker::Send` is not implemented
}

View file

@ -19,6 +19,5 @@ fn main() {
let x = Rc::new(3us);
bar(move|| foo(x));
//~^ ERROR `core::marker::Send` is not implemented
//~^^ ERROR `core::marker::Send` is not implemented
}

View file

@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-stage1
// ignore-stage2
// ignore-stage3
use std::marker;
fn foo<P:Send>(p: P) { }

View file

@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-stage1
// ignore-stage2
// ignore-stage3
use std::marker;
fn foo<P: Sync>(p: P) { }

View file

@ -11,13 +11,18 @@
// Tests that an `&` pointer to something inherently mutable is itself
// to be considered mutable.
use std::marker;
#![feature(optin_builtin_traits)]
enum Foo { A(marker::NoSync) }
use std::marker::Sync;
struct NoSync;
impl !Sync for NoSync {}
enum Foo { A(NoSync) }
fn bar<T: Sync>(_: T) {}
fn main() {
let x = Foo::A(marker::NoSync);
let x = Foo::A(NoSync);
bar(&x); //~ ERROR the trait `core::marker::Sync` is not implemented
}

View file

@ -37,7 +37,6 @@ fn main() {
Thread::spawn(move|| {
//~^ ERROR `core::marker::Send` is not implemented
//~^^ ERROR `core::marker::Send` is not implemented
let y = x;
println!("{:?}", y);
});

View file

@ -8,16 +8,21 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::marker;
#![feature(optin_builtin_traits)]
use std::marker::Send;
struct NoSend;
impl !Send for NoSend {}
enum Foo {
A(marker::NoSend)
A(NoSend)
}
fn bar<T: Send>(_: T) {}
fn main() {
let x = Foo::A(marker::NoSend);
let x = Foo::A(NoSend);
bar(x);
//~^ ERROR `core::marker::Send` is not implemented
}

View file

@ -16,5 +16,4 @@ fn main() {
let x = Rc::new(5is);
bar(x);
//~^ ERROR `core::marker::Send` is not implemented
//~^^ ERROR `core::marker::Send` is not implemented
}

View file

@ -8,17 +8,20 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::marker;
#![feature(optin_builtin_traits)]
use std::marker::Send;
struct Foo {
a: isize,
ns: marker::NoSend
}
impl !Send for Foo {}
fn bar<T: Send>(_: T) {}
fn main() {
let x = Foo { a: 5, ns: marker::NoSend };
let x = Foo { a: 5 };
bar(x);
//~^ ERROR the trait `core::marker::Send` is not implemented
}

View file

@ -8,14 +8,19 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::marker;
#![feature(optin_builtin_traits)]
enum Foo { A(marker::NoSync) }
use std::marker::Sync;
struct NoSync;
impl !Sync for NoSync {}
enum Foo { A(NoSync) }
fn bar<T: Sync>(_: T) {}
fn main() {
let x = Foo::A(marker::NoSync);
let x = Foo::A(NoSync);
bar(x);
//~^ ERROR the trait `core::marker::Sync` is not implemented
}

View file

@ -17,5 +17,4 @@ fn main() {
let x = Rc::new(RefCell::new(5is));
bar(x);
//~^ ERROR the trait `core::marker::Sync` is not implemented
//~^^ ERROR the trait `core::marker::Sync` is not implemented
}

View file

@ -8,14 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::marker;
#![feature(optin_builtin_traits)]
struct Foo { a: isize, m: marker::NoSync }
use std::marker::Sync;
struct Foo { a: isize }
impl !Sync for Foo {}
fn bar<T: Sync>(_: T) {}
fn main() {
let x = Foo { a: 5, m: marker::NoSync };
let x = Foo { a: 5 };
bar(x);
//~^ ERROR the trait `core::marker::Sync` is not implemented
}

View file

@ -17,5 +17,4 @@ fn test_send<S: Send>() {}
pub fn main() {
test_send::<rand::ThreadRng>();
//~^ ERROR `core::marker::Send` is not implemented
//~^^ ERROR `core::marker::Send` is not implemented
}

View file

@ -10,29 +10,26 @@
// Verify that UnsafeCell is *always* sync regardless if `T` is sync.
// ignore-tidy-linelength
#![feature(optin_builtin_traits)]
use std::cell::UnsafeCell;
use std::marker;
use std::marker::Sync;
struct MySync<T> {
u: UnsafeCell<T>
}
struct NoSync {
m: marker::NoSync
}
struct NoSync;
impl !Sync for NoSync {}
fn test<T: Sync>(s: T){
}
fn test<T: Sync>(s: T) {}
fn main() {
let us = UnsafeCell::new(MySync{u: UnsafeCell::new(0is)});
test(us);
//~^ ERROR `core::marker::Sync` is not implemented
let uns = UnsafeCell::new(NoSync{m: marker::NoSync});
let uns = UnsafeCell::new(NoSync);
test(uns);
//~^ ERROR `core::marker::Sync` is not implemented
@ -40,7 +37,6 @@ fn main() {
test(ms);
//~^ ERROR `core::marker::Sync` is not implemented
let ns = NoSync{m: marker::NoSync};
test(ns);
test(NoSync);
//~^ ERROR `core::marker::Sync` is not implemented
}

View file

@ -19,5 +19,4 @@ fn main() {
let i = box Rc::new(100is);
f(i);
//~^ ERROR `core::marker::Send` is not implemented
//~^^ ERROR `core::marker::Send` is not implemented
}

View file

@ -31,6 +31,5 @@ fn main() {
let cat = "kitty".to_string();
let (tx, _) = channel();
//~^ ERROR `core::marker::Send` is not implemented
//~^^ ERROR `core::marker::Send` is not implemented
tx.send(foo(42, Rc::new(cat)));
}

View file

@ -14,8 +14,6 @@ use std::marker::Send;
struct TestType;
unsafe impl Send for TestType {}
impl !Send for TestType {}
fn main() {}

View file

@ -18,14 +18,14 @@ impl TestType {}
trait TestTrait {}
unsafe impl !Send for TestType {}
impl !Send for TestType {}
impl !TestTrait for TestType {}
struct TestType2<T>;
impl<T> TestType2<T> {}
unsafe impl<T> !Send for TestType2<T> {}
impl<T> !Send for TestType2<T> {}
impl<T> !TestTrait for TestType2<T> {}
fn main() {}