Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f8b774fb
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f8b774fb
编写于
5月 07, 2018
作者:
M
Manish Goregaokar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add explanation for #[must_use] on mutex guards
上级
6e49c837
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
4 deletion
+4
-4
src/libstd/sync/mutex.rs
src/libstd/sync/mutex.rs
+1
-1
src/libstd/sync/rwlock.rs
src/libstd/sync/rwlock.rs
+2
-2
src/libstd/sys_common/remutex.rs
src/libstd/sys_common/remutex.rs
+1
-1
未找到文件。
src/libstd/sync/mutex.rs
浏览文件 @
f8b774fb
...
...
@@ -150,7 +150,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
/// [`lock`]: struct.Mutex.html#method.lock
/// [`try_lock`]: struct.Mutex.html#method.try_lock
/// [`Mutex`]: struct.Mutex.html
#[must_use]
#[must_use
=
"if unused the Mutex will immediately unlock"
]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
struct
MutexGuard
<
'a
,
T
:
?
Sized
+
'a
>
{
// funny underscores due to how Deref/DerefMut currently work (they
...
...
src/libstd/sync/rwlock.rs
浏览文件 @
f8b774fb
...
...
@@ -94,7 +94,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
/// [`read`]: struct.RwLock.html#method.read
/// [`try_read`]: struct.RwLock.html#method.try_read
/// [`RwLock`]: struct.RwLock.html
#[must_use]
#[must_use
=
"if unused the RwLock will immediately unlock"
]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
struct
RwLockReadGuard
<
'a
,
T
:
?
Sized
+
'a
>
{
__
lock
:
&
'a
RwLock
<
T
>
,
...
...
@@ -115,7 +115,7 @@ unsafe impl<'a, T: ?Sized + Sync> Sync for RwLockReadGuard<'a, T> {}
/// [`write`]: struct.RwLock.html#method.write
/// [`try_write`]: struct.RwLock.html#method.try_write
/// [`RwLock`]: struct.RwLock.html
#[must_use]
#[must_use
=
"if unused the RwLock will immediately unlock"
]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
pub
struct
RwLockWriteGuard
<
'a
,
T
:
?
Sized
+
'a
>
{
__
lock
:
&
'a
RwLock
<
T
>
,
...
...
src/libstd/sys_common/remutex.rs
浏览文件 @
f8b774fb
...
...
@@ -41,7 +41,7 @@ unsafe impl<T: Send> Sync for ReentrantMutex<T> {}
/// because implementation of the trait would violate Rust’s reference aliasing
/// rules. Use interior mutability (usually `RefCell`) in order to mutate the
/// guarded data.
#[must_use]
#[must_use
=
"if unused the ReentrantMutex will immediately unlock"
]
pub
struct
ReentrantMutexGuard
<
'a
,
T
:
'a
>
{
// funny underscores due to how Deref currently works (it disregards field
// privacy).
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录