Make Send and Sync traits unsafe

This commit is contained in:
Flavio Percoco 2014-12-22 00:49:42 +01:00
parent 686ce664da
commit f436f9ca29
32 changed files with 73 additions and 55 deletions

View file

@ -18,7 +18,7 @@ struct Foo {
b: *const ()
}
impl Sync for Foo {}
unsafe impl Sync for Foo {}
fn foo<T>(a: T) -> T {
a

View file

@ -14,7 +14,7 @@ struct TestStruct {
x: *const u8
}
impl Sync for TestStruct {}
unsafe impl Sync for TestStruct {}
static a: TestStruct = TestStruct{x: 0 as *const u8};

View file

@ -14,7 +14,7 @@ struct TestStruct {
x: *const libc::c_void
}
impl Sync for TestStruct {}
unsafe impl Sync for TestStruct {}
extern fn foo() {}
const x: extern "C" fn() = foo;

View file

@ -12,7 +12,7 @@ struct TestStruct {
x: *const [int; 2]
}
impl Sync for TestStruct {}
unsafe impl Sync for TestStruct {}
static TEST_VALUE : TestStruct = TestStruct{x: 0x1234 as *const [int; 2]};

View file

@ -36,7 +36,7 @@ struct Wrap<T> {
value: T
}
impl<T: Send> Sync for Wrap<T> {}
unsafe impl<T: Send> Sync for Wrap<T> {}
static UNSAFE: RacyCell<int> = RacyCell(UnsafeCell{value: 1});
static WRAPPED_UNSAFE: Wrap<&'static RacyCell<int>> = Wrap { value: &UNSAFE };

View file

@ -46,7 +46,7 @@ pub mod pipes {
payload: Option<T>
}
impl<T:Send> Send for packet<T> {}
unsafe impl<T:Send> Send for packet<T> {}
pub fn packet<T:Send>() -> *const packet<T> {
unsafe {

View file

@ -15,7 +15,7 @@ struct TestStruct {
x: *const int
}
impl Sync for TestStruct {}
unsafe impl Sync for TestStruct {}
static CONSTEXPR: TestStruct = TestStruct{x: &413 as *const _};