Skip to content

Commit

Permalink
Don't use NoSend/NoSync in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flaper87 committed Jan 16, 2015
1 parent 094397a commit 921ba5a
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 41 deletions.
9 changes: 6 additions & 3 deletions src/test/compile-fail/issue-17718-static-sync.rs
Expand Up @@ -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() {}
1 change: 0 additions & 1 deletion src/test/compile-fail/issue-7013.rs
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/kindck-nonsendable-1.rs
Expand Up @@ -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
}

4 changes: 4 additions & 0 deletions src/test/compile-fail/marker-no-send.rs
Expand Up @@ -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) { }
Expand Down
4 changes: 4 additions & 0 deletions src/test/compile-fail/marker-no-share.rs
Expand Up @@ -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) { }
Expand Down
11 changes: 8 additions & 3 deletions src/test/compile-fail/mutable-enum-indirect.rs
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/no-send-res-ports.rs
Expand Up @@ -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);
});
Expand Down
11 changes: 8 additions & 3 deletions src/test/compile-fail/no_send-enum.rs
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/no_send-rc.rs
Expand Up @@ -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
}
9 changes: 6 additions & 3 deletions src/test/compile-fail/no_send-struct.rs
Expand Up @@ -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
}
11 changes: 8 additions & 3 deletions src/test/compile-fail/no_share-enum.rs
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/no_share-rc.rs
Expand Up @@ -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
}
9 changes: 6 additions & 3 deletions src/test/compile-fail/no_share-struct.rs
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/task-rng-isnt-sendable.rs
Expand Up @@ -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
}
18 changes: 7 additions & 11 deletions src/test/compile-fail/typeck-unsafe-always-share.rs
Expand Up @@ -10,37 +10,33 @@

// 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
}

fn test<T: Sync>(s: T){
struct NoSync;
impl !Sync for NoSync {}

}
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

let ms = MySync{u: uns};
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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/unique-unique-kind.rs
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/unsendable-class.rs
Expand Up @@ -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)));
}
2 changes: 0 additions & 2 deletions src/test/run-pass/coherence-negative-impls-safe.rs
Expand Up @@ -14,8 +14,6 @@ use std::marker::Send;

struct TestType;

unsafe impl Send for TestType {}

impl !Send for TestType {}

fn main() {}
4 changes: 2 additions & 2 deletions src/test/run-pass/syntax-trait-polarity.rs
Expand Up @@ -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() {}

0 comments on commit 921ba5a

Please sign in to comment.