Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
splade
rust
提交
f436f9ca
R
rust
项目概览
splade
/
rust
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f436f9ca
编写于
12月 22, 2014
作者:
F
Flavio Percoco
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make Send and Sync traits unsafe
上级
686ce664
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
73 addition
and
55 deletion
+73
-55
src/liballoc/arc.rs
src/liballoc/arc.rs
+2
-2
src/libcore/cell.rs
src/libcore/cell.rs
+2
-2
src/libcore/kinds.rs
src/libcore/kinds.rs
+2
-2
src/libcore/ptr.rs
src/libcore/ptr.rs
+2
-2
src/librustc_trans/back/write.rs
src/librustc_trans/back/write.rs
+1
-1
src/librustc_trans/trans/mod.rs
src/librustc_trans/trans/mod.rs
+2
-2
src/libstd/c_str.rs
src/libstd/c_str.rs
+2
-2
src/libstd/comm/blocking.rs
src/libstd/comm/blocking.rs
+4
-1
src/libstd/comm/mod.rs
src/libstd/comm/mod.rs
+2
-2
src/libstd/comm/mpsc_queue.rs
src/libstd/comm/mpsc_queue.rs
+2
-2
src/libstd/comm/spsc_queue.rs
src/libstd/comm/spsc_queue.rs
+2
-2
src/libstd/comm/sync.rs
src/libstd/comm/sync.rs
+5
-4
src/libstd/rt/exclusive.rs
src/libstd/rt/exclusive.rs
+2
-2
src/libstd/sync/mutex.rs
src/libstd/sync/mutex.rs
+5
-4
src/libstd/sync/once.rs
src/libstd/sync/once.rs
+3
-1
src/libstd/sys/common/helper_thread.rs
src/libstd/sys/common/helper_thread.rs
+2
-2
src/libstd/sys/common/mutex.rs
src/libstd/sys/common/mutex.rs
+3
-1
src/libstd/sys/unix/c.rs
src/libstd/sys/unix/c.rs
+2
-2
src/libstd/sys/unix/mutex.rs
src/libstd/sys/unix/mutex.rs
+3
-1
src/libstd/sys/unix/pipe.rs
src/libstd/sys/unix/pipe.rs
+4
-2
src/libstd/sys/unix/tcp.rs
src/libstd/sys/unix/tcp.rs
+4
-2
src/libstd/thread.rs
src/libstd/thread.rs
+5
-2
src/libstd/thread_local/mod.rs
src/libstd/thread_local/mod.rs
+2
-2
src/libstd/thread_local/scoped.rs
src/libstd/thread_local/scoped.rs
+2
-2
src/libtest/lib.rs
src/libtest/lib.rs
+1
-1
src/test/run-pass/const-block.rs
src/test/run-pass/const-block.rs
+1
-1
src/test/run-pass/const-cast-ptr-int.rs
src/test/run-pass/const-cast-ptr-int.rs
+1
-1
src/test/run-pass/const-cast.rs
src/test/run-pass/const-cast.rs
+1
-1
src/test/run-pass/issue-13837.rs
src/test/run-pass/issue-13837.rs
+1
-1
src/test/run-pass/issue-17718-static-unsafe-interior.rs
src/test/run-pass/issue-17718-static-unsafe-interior.rs
+1
-1
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2718.rs
+1
-1
src/test/run-pass/typeck_type_placeholder_1.rs
src/test/run-pass/typeck_type_placeholder_1.rs
+1
-1
未找到文件。
src/liballoc/arc.rs
浏览文件 @
f436f9ca
...
...
@@ -129,9 +129,9 @@ pub struct Weak<T> {
_
ptr
:
*
mut
ArcInner
<
T
>
,
}
impl
<
T
:
Sync
+
Send
>
Send
for
Arc
<
T
>
{
}
unsafe
impl
<
T
:
Sync
+
Send
>
Send
for
Arc
<
T
>
{
}
impl
<
T
:
Sync
+
Send
>
Sync
for
Arc
<
T
>
{
}
unsafe
impl
<
T
:
Sync
+
Send
>
Sync
for
Arc
<
T
>
{
}
struct
ArcInner
<
T
>
{
strong
:
atomic
::
AtomicUint
,
...
...
src/libcore/cell.rs
浏览文件 @
f436f9ca
...
...
@@ -577,6 +577,6 @@ pub unsafe fn into_inner(self) -> T {
}
}
impl
<
T
:
Send
>
Send
for
RacyCell
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
RacyCell
<
T
>
{
}
impl
<
T
>
Sync
for
RacyCell
<
T
>
{
}
// Oh dear
unsafe
impl
<
T
>
Sync
for
RacyCell
<
T
>
{
}
// Oh dear
src/libcore/kinds.rs
浏览文件 @
f436f9ca
...
...
@@ -19,7 +19,7 @@
/// Types able to be transferred across task boundaries.
#[lang=
"send"
]
pub
trait
Send
for
Sized
?
:
'static
{
pub
unsafe
trait
Send
for
Sized
?
:
'static
{
// empty.
}
...
...
@@ -81,7 +81,7 @@ pub trait Copy for Sized? {
/// reference; not doing this is undefined behaviour (for example,
/// `transmute`-ing from `&T` to `&mut T` is illegal).
#[lang=
"sync"
]
pub
trait
Sync
for
Sized
?
{
pub
unsafe
trait
Sync
for
Sized
?
{
// Empty
}
...
...
src/libcore/ptr.rs
浏览文件 @
f436f9ca
...
...
@@ -515,13 +515,13 @@ fn ge(&self, other: &*mut T) -> bool { *self >= *other }
/// reference is unaliased. Note that this aliasing invariant is
/// unenforced by the type system; the abstraction using the
/// `UniquePtr` must enforce it.
impl
<
T
:
Send
>
Send
for
UniquePtr
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
UniquePtr
<
T
>
{
}
/// `UniquePtr` pointers are `Sync` if `T` is `Sync` because the data they
/// reference is unaliased. Note that this aliasing invariant is
/// unenforced by the type system; the abstraction using the
/// `UniquePtr` must enforce it.
impl
<
T
:
Sync
>
Sync
for
UniquePtr
<
T
>
{
}
unsafe
impl
<
T
:
Sync
>
Sync
for
UniquePtr
<
T
>
{
}
impl
<
T
>
UniquePtr
<
T
>
{
/// Returns a null UniquePtr.
...
...
src/librustc_trans/back/write.rs
浏览文件 @
f436f9ca
...
...
@@ -281,7 +281,7 @@ struct ModuleConfig {
time_passes
:
bool
,
}
impl
Send
for
ModuleConfig
{
}
unsafe
impl
Send
for
ModuleConfig
{
}
impl
ModuleConfig
{
fn
new
(
tm
:
TargetMachineRef
,
passes
:
Vec
<
String
>
)
->
ModuleConfig
{
...
...
src/librustc_trans/trans/mod.rs
浏览文件 @
f436f9ca
...
...
@@ -60,8 +60,8 @@ pub struct ModuleTranslation {
pub
llmod
:
ModuleRef
,
}
impl
Send
for
ModuleTranslation
{
}
impl
Sync
for
ModuleTranslation
{
}
unsafe
impl
Send
for
ModuleTranslation
{
}
unsafe
impl
Sync
for
ModuleTranslation
{
}
pub
struct
CrateTranslation
{
pub
modules
:
Vec
<
ModuleTranslation
>
,
...
...
src/libstd/c_str.rs
浏览文件 @
f436f9ca
...
...
@@ -89,8 +89,8 @@ pub struct CString {
owns_buffer_
:
bool
,
}
impl
Send
for
CString
{
}
impl
Sync
for
CString
{
}
unsafe
impl
Send
for
CString
{
}
unsafe
impl
Sync
for
CString
{
}
impl
Clone
for
CString
{
/// Clone this CString into a new, uniquely owned CString. For safety
...
...
src/libstd/comm/blocking.rs
浏览文件 @
f436f9ca
...
...
@@ -13,16 +13,19 @@
use
thread
::
Thread
;
use
sync
::
atomic
::{
AtomicBool
,
INIT_ATOMIC_BOOL
,
Ordering
};
use
sync
::
Arc
;
use
kinds
::{
Sync
,
Send
};
use
kinds
::
marker
::{
NoSend
,
NoSync
};
use
mem
;
use
clone
::
Clone
;
#[deriving(Send,
Sync)]
struct
Inner
{
thread
:
Thread
,
woken
:
AtomicBool
,
}
unsafe
impl
Send
for
Inner
{}
unsafe
impl
Sync
for
Inner
{}
#[deriving(Clone)]
pub
struct
SignalToken
{
inner
:
Arc
<
Inner
>
,
...
...
src/libstd/comm/mod.rs
浏览文件 @
f436f9ca
...
...
@@ -363,7 +363,7 @@ pub struct Receiver<T> {
// The receiver port can be sent from place to place, so long as it
// is not used to receive non-sendable things.
impl
<
T
:
Send
>
Send
for
Receiver
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
Receiver
<
T
>
{
}
/// An iterator over messages on a receiver, this iterator will block
/// whenever `next` is called, waiting for a new message, and `None` will be
...
...
@@ -382,7 +382,7 @@ pub struct Sender<T> {
// The send port can be sent from place to place, so long as it
// is not used to send non-sendable things.
impl
<
T
:
Send
>
Send
for
Sender
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
Sender
<
T
>
{
}
/// The sending-half of Rust's synchronous channel type. This half can only be
/// owned by one task, but it can be cloned to send to other tasks.
...
...
src/libstd/comm/mpsc_queue.rs
浏览文件 @
f436f9ca
...
...
@@ -76,8 +76,8 @@ pub struct Queue<T> {
tail
:
UnsafeCell
<*
mut
Node
<
T
>>
,
}
impl
<
T
:
Send
>
Send
for
Queue
<
T
>
{
}
impl
<
T
:
Send
>
Sync
for
Queue
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
Queue
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Sync
for
Queue
<
T
>
{
}
impl
<
T
>
Node
<
T
>
{
unsafe
fn
new
(
v
:
Option
<
T
>
)
->
*
mut
Node
<
T
>
{
...
...
src/libstd/comm/spsc_queue.rs
浏览文件 @
f436f9ca
...
...
@@ -73,9 +73,9 @@ pub struct Queue<T> {
cache_subtractions
:
AtomicUint
,
}
impl
<
T
:
Send
>
Send
for
Queue
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
Queue
<
T
>
{
}
impl
<
T
:
Send
>
Sync
for
Queue
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Sync
for
Queue
<
T
>
{
}
impl
<
T
:
Send
>
Node
<
T
>
{
fn
new
()
->
*
mut
Node
<
T
>
{
...
...
src/libstd/comm/sync.rs
浏览文件 @
f436f9ca
...
...
@@ -53,11 +53,10 @@ pub struct Packet<T> {
lock
:
Mutex
<
State
<
T
>>
,
}
impl
<
T
:
Send
>
Send
for
Packet
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
Packet
<
T
>
{
}
impl
<
T
:
Send
>
Sync
for
Packet
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Sync
for
Packet
<
T
>
{
}
#[deriving(Send)]
struct
State
<
T
>
{
disconnected
:
bool
,
// Is the channel disconnected yet?
queue
:
Queue
,
// queue of senders waiting to send data
...
...
@@ -74,6 +73,8 @@ struct State<T> {
canceled
:
Option
<&
'static
mut
bool
>
,
}
unsafe
impl
<
T
:
Send
>
Send
for
State
<
T
>
{}
/// Possible flavors of threads who can be blocked on this channel.
enum
Blocker
{
BlockedSender
(
SignalToken
),
...
...
@@ -93,7 +94,7 @@ struct Node {
next
:
*
mut
Node
,
}
impl
Send
for
Node
{}
unsafe
impl
Send
for
Node
{}
/// A simple ring-buffer
struct
Buffer
<
T
>
{
...
...
src/libstd/rt/exclusive.rs
浏览文件 @
f436f9ca
...
...
@@ -26,9 +26,9 @@ pub struct Exclusive<T> {
data
:
UnsafeCell
<
T
>
,
}
impl
<
T
:
Send
>
Send
for
Exclusive
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
Exclusive
<
T
>
{
}
impl
<
T
:
Send
>
Sync
for
Exclusive
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Sync
for
Exclusive
<
T
>
{
}
/// An RAII guard returned via `lock`
pub
struct
ExclusiveGuard
<
'a
,
T
:
'a
>
{
...
...
src/libstd/sync/mutex.rs
浏览文件 @
f436f9ca
...
...
@@ -11,7 +11,7 @@
use
prelude
::
*
;
use
cell
::{
UnsafeCell
,
RacyCell
};
use
kinds
::
marker
;
use
kinds
::
{
marker
,
Sync
}
;
use
sync
::{
poison
,
AsMutexGuard
};
use
sys_common
::
mutex
as
sys
;
...
...
@@ -73,9 +73,9 @@ pub struct Mutex<T> {
data
:
RacyCell
<
T
>
,
}
impl
<
T
:
Send
>
Send
for
Mutex
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Send
for
Mutex
<
T
>
{
}
impl
<
T
:
Send
>
Sync
for
Mutex
<
T
>
{
}
unsafe
impl
<
T
:
Send
>
Sync
for
Mutex
<
T
>
{
}
/// The static mutex type is provided to allow for static allocation of mutexes.
///
...
...
@@ -98,12 +98,13 @@ impl<T:Send> Sync for Mutex<T> { }
/// }
/// // lock is unlocked here.
/// ```
#[deriving(Sync)]
pub
struct
StaticMutex
{
lock
:
sys
::
Mutex
,
poison
:
RacyCell
<
poison
::
Flag
>
,
}
unsafe
impl
Sync
for
StaticMutex
{}
/// An RAII implementation of a "scoped lock" of a mutex. When this structure is
/// dropped (falls out of scope), the lock will be unlocked.
///
...
...
src/libstd/sync/once.rs
浏览文件 @
f436f9ca
...
...
@@ -14,6 +14,7 @@
//! example use case would be for initializing an FFI library.
use
int
;
use
kinds
::
Sync
;
use
mem
::
drop
;
use
ops
::
FnOnce
;
use
sync
::
atomic
;
...
...
@@ -35,13 +36,14 @@
/// // run initialization here
/// });
/// ```
#[deriving(Sync)]
pub
struct
Once
{
mutex
:
StaticMutex
,
cnt
:
atomic
::
AtomicInt
,
lock_cnt
:
atomic
::
AtomicInt
,
}
unsafe
impl
Sync
for
Once
{}
/// Initialization value for static `Once` values.
pub
const
ONCE_INIT
:
Once
=
Once
{
mutex
:
MUTEX_INIT
,
...
...
src/libstd/sys/common/helper_thread.rs
浏览文件 @
f436f9ca
...
...
@@ -59,9 +59,9 @@ pub struct Helper<M> {
pub
shutdown
:
UnsafeCell
<
bool
>
,
}
impl
<
M
:
Send
>
Send
for
Helper
<
M
>
{
}
unsafe
impl
<
M
:
Send
>
Send
for
Helper
<
M
>
{
}
impl
<
M
:
Send
>
Sync
for
Helper
<
M
>
{
}
unsafe
impl
<
M
:
Send
>
Sync
for
Helper
<
M
>
{
}
impl
<
M
:
Send
>
Helper
<
M
>
{
/// Lazily boots a helper thread, becoming a no-op if the helper has already
...
...
src/libstd/sys/common/mutex.rs
浏览文件 @
f436f9ca
...
...
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
kinds
::
Sync
;
use
sys
::
mutex
as
imp
;
/// An OS-based mutual exclusion lock.
...
...
@@ -15,9 +16,10 @@
/// This is the thinnest cross-platform wrapper around OS mutexes. All usage of
/// this mutex is unsafe and it is recommended to instead use the safe wrapper
/// at the top level of the crate instead of this type.
#[deriving(Sync)]
pub
struct
Mutex
(
imp
::
Mutex
);
unsafe
impl
Sync
for
Mutex
{}
/// Constant initializer for statically allocated mutexes.
pub
const
MUTEX_INIT
:
Mutex
=
Mutex
(
imp
::
MUTEX_INIT
);
...
...
src/libstd/sys/unix/c.rs
浏览文件 @
f436f9ca
...
...
@@ -162,8 +162,8 @@ pub struct sigaction {
sa_restorer
:
*
mut
libc
::
c_void
,
}
impl
::
kinds
::
Send
for
sigaction
{
}
impl
::
kinds
::
Sync
for
sigaction
{
}
unsafe
impl
::
kinds
::
Send
for
sigaction
{
}
unsafe
impl
::
kinds
::
Sync
for
sigaction
{
}
#[repr(C)]
#[cfg(target_word_size
=
"32"
)]
...
...
src/libstd/sys/unix/mutex.rs
浏览文件 @
f436f9ca
...
...
@@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
kinds
::
Sync
;
use
cell
::{
UnsafeCell
,
RacyCell
};
use
sys
::
sync
as
ffi
;
use
sys_common
::
mutex
;
#[deriving(Sync)]
pub
struct
Mutex
{
inner
:
RacyCell
<
ffi
::
pthread_mutex_t
>
}
#[inline]
...
...
@@ -24,6 +24,8 @@ pub unsafe fn raw(m: &Mutex) -> *mut ffi::pthread_mutex_t {
inner
:
RacyCell
(
UnsafeCell
{
value
:
ffi
::
PTHREAD_MUTEX_INITIALIZER
}),
};
unsafe
impl
Sync
for
Mutex
{}
impl
Mutex
{
#[inline]
pub
unsafe
fn
new
()
->
Mutex
{
...
...
src/libstd/sys/unix/pipe.rs
浏览文件 @
f436f9ca
...
...
@@ -210,12 +210,13 @@ fn clone(&self) -> UnixStream {
// Unix Listener
////////////////////////////////////////////////////////////////////////////////
#[deriving(Sync)]
pub
struct
UnixListener
{
inner
:
Inner
,
path
:
CString
,
}
unsafe
impl
Sync
for
UnixListener
{}
impl
UnixListener
{
pub
fn
bind
(
addr
:
&
CString
)
->
IoResult
<
UnixListener
>
{
bind
(
addr
,
libc
::
SOCK_STREAM
)
.map
(|
fd
|
{
...
...
@@ -253,7 +254,6 @@ pub struct UnixAcceptor {
deadline
:
u64
,
}
#[deriving(Sync)]
struct
AcceptorInner
{
listener
:
UnixListener
,
reader
:
FileDesc
,
...
...
@@ -261,6 +261,8 @@ struct AcceptorInner {
closed
:
atomic
::
AtomicBool
,
}
unsafe
impl
Sync
for
AcceptorInner
{}
impl
UnixAcceptor
{
pub
fn
fd
(
&
self
)
->
fd_t
{
self
.inner.listener
.fd
()
}
...
...
src/libstd/sys/unix/tcp.rs
浏览文件 @
f436f9ca
...
...
@@ -29,11 +29,12 @@
// TCP listeners
////////////////////////////////////////////////////////////////////////////////
#[deriving(Sync)]
pub
struct
TcpListener
{
pub
inner
:
FileDesc
,
}
unsafe
impl
Sync
for
TcpListener
{}
impl
TcpListener
{
pub
fn
bind
(
addr
:
ip
::
SocketAddr
)
->
IoResult
<
TcpListener
>
{
let
fd
=
try!
(
net
::
socket
(
addr
,
libc
::
SOCK_STREAM
));
...
...
@@ -90,7 +91,6 @@ pub struct TcpAcceptor {
deadline
:
u64
,
}
#[deriving(Sync)]
struct
AcceptorInner
{
listener
:
TcpListener
,
reader
:
FileDesc
,
...
...
@@ -98,6 +98,8 @@ struct AcceptorInner {
closed
:
atomic
::
AtomicBool
,
}
unsafe
impl
Sync
for
AcceptorInner
{}
impl
TcpAcceptor
{
pub
fn
fd
(
&
self
)
->
sock_t
{
self
.inner.listener
.fd
()
}
...
...
src/libstd/thread.rs
浏览文件 @
f436f9ca
...
...
@@ -283,19 +283,22 @@ fn spawn_inner<T: Send>(self, f: Thunk<(), T>) -> JoinGuard<T> {
}
}
#[deriving(Sync)]
struct
Inner
{
name
:
Option
<
String
>
,
lock
:
Mutex
<
bool
>
,
// true when there is a buffered unpark
cvar
:
Condvar
,
}
#[deriving(Clone,
Sync)]
unsafe
impl
Sync
for
Inner
{}
#[deriving(Clone)]
/// A handle to a thread.
pub
struct
Thread
{
inner
:
Arc
<
Inner
>
,
}
unsafe
impl
Sync
for
Thread
{}
impl
Thread
{
// Used only internally to construct a thread object without spawning
fn
new
(
name
:
Option
<
String
>
)
->
Thread
{
...
...
src/libstd/thread_local/mod.rs
浏览文件 @
f436f9ca
...
...
@@ -280,7 +280,7 @@ pub struct Key<T> {
pub
dtor_running
:
UnsafeCell
<
bool
>
,
// should be Cell
}
impl
<
T
>
::
kinds
::
Sync
for
Key
<
T
>
{
}
unsafe
impl
<
T
>
::
kinds
::
Sync
for
Key
<
T
>
{
}
#[doc(hidden)]
impl
<
T
>
Key
<
T
>
{
...
...
@@ -412,7 +412,7 @@ pub struct Key<T> {
pub
os
:
OsStaticKey
,
}
impl
<
T
>
::
kinds
::
Sync
for
Key
<
T
>
{
}
unsafe
impl
<
T
>
::
kinds
::
Sync
for
Key
<
T
>
{
}
struct
Value
<
T
:
'static
>
{
key
:
&
'static
Key
<
T
>
,
...
...
src/libstd/thread_local/scoped.rs
浏览文件 @
f436f9ca
...
...
@@ -202,7 +202,7 @@ mod imp {
#[doc(hidden)]
pub
struct
KeyInner
<
T
>
{
pub
inner
:
UnsafeCell
<*
mut
T
>
}
#[cfg(not(stage0))]
impl
<
T
>
::
kinds
::
Sync
for
KeyInner
<
T
>
{
}
unsafe
impl
<
T
>
::
kinds
::
Sync
for
KeyInner
<
T
>
{
}
#[doc(hidden)]
impl
<
T
>
KeyInner
<
T
>
{
...
...
@@ -224,7 +224,7 @@ pub struct KeyInner<T> {
pub
marker
:
marker
::
InvariantType
<
T
>
,
}
#[cfg(not(stage0))]
impl
<
T
>
::
kinds
::
Sync
for
KeyInner
<
T
>
{
}
unsafe
impl
<
T
>
::
kinds
::
Sync
for
KeyInner
<
T
>
{
}
#[doc(hidden)]
impl
<
T
>
KeyInner
<
T
>
{
...
...
src/libtest/lib.rs
浏览文件 @
f436f9ca
...
...
@@ -976,7 +976,7 @@ enum TestEvent {
pub
type
MonitorMsg
=
(
TestDesc
,
TestResult
,
Vec
<
u8
>
);
impl
Send
for
MonitorMsg
{}
unsafe
impl
Send
for
MonitorMsg
{}
fn
run_tests
<
F
>
(
opts
:
&
TestOpts
,
tests
:
Vec
<
TestDescAndFn
>
,
...
...
src/test/run-pass/const-block.rs
浏览文件 @
f436f9ca
...
...
@@ -18,7 +18,7 @@ struct Foo {
b
:
*
const
()
}
impl
Sync
for
Foo
{}
unsafe
impl
Sync
for
Foo
{}
fn
foo
<
T
>
(
a
:
T
)
->
T
{
a
...
...
src/test/run-pass/const-cast-ptr-int.rs
浏览文件 @
f436f9ca
...
...
@@ -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
};
...
...
src/test/run-pass/const-cast.rs
浏览文件 @
f436f9ca
...
...
@@ -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
;
...
...
src/test/run-pass/issue-13837.rs
浏览文件 @
f436f9ca
...
...
@@ -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
]};
...
...
src/test/run-pass/issue-17718-static-unsafe-interior.rs
浏览文件 @
f436f9ca
...
...
@@ -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
};
...
...
src/test/run-pass/issue-2718.rs
浏览文件 @
f436f9ca
...
...
@@ -46,7 +46,7 @@ pub struct packet<T> {
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
{
...
...
src/test/run-pass/typeck_type_placeholder_1.rs
浏览文件 @
f436f9ca
...
...
@@ -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
_
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录