// 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() {}
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
}
let x = Rc::new(3us);
bar(move|| foo(x));
//~^ ERROR `core::marker::Send` is not implemented
- //~^^ ERROR `core::marker::Send` is not implemented
}
// 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) { }
// 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) { }
// 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
}
Thread::spawn(move|| {
//~^ ERROR `core::marker::Send` is not implemented
- //~^^ ERROR `core::marker::Send` is not implemented
let y = x;
println!("{:?}", y);
});
// 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
}
let x = Rc::new(5is);
bar(x);
//~^ ERROR `core::marker::Send` is not implemented
- //~^^ ERROR `core::marker::Send` is not implemented
}
// 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
}
// 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
}
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
}
// 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
}
pub fn main() {
test_send::<rand::ThreadRng>();
//~^ ERROR `core::marker::Send` is not implemented
- //~^^ ERROR `core::marker::Send` is not implemented
}
// 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
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
}
let i = box Rc::new(100is);
f(i);
//~^ ERROR `core::marker::Send` is not implemented
- //~^^ ERROR `core::marker::Send` is not implemented
}
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)));
}
struct TestType;
-unsafe impl Send for TestType {}
-
impl !Send for TestType {}
fn main() {}
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() {}