Make Send and Sync traits unsafe
This commit is contained in:
parent
686ce664da
commit
f436f9ca29
32 changed files with 73 additions and 55 deletions
|
|
@ -18,7 +18,7 @@ struct Foo {
|
|||
b: *const ()
|
||||
}
|
||||
|
||||
impl Sync for Foo {}
|
||||
unsafe impl Sync for Foo {}
|
||||
|
||||
fn foo<T>(a: T) -> T {
|
||||
a
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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]};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 _};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue