Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7d72719e
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,发现更多精彩内容 >>
提交
7d72719e
编写于
1月 07, 2015
作者:
J
Jorge Aparicio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the `&mut _` patterns
上级
ed4bebda
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
23 addition
and
23 deletion
+23
-23
src/libcollections/vec.rs
src/libcollections/vec.rs
+1
-1
src/libcore/iter.rs
src/libcore/iter.rs
+1
-1
src/libcore/option.rs
src/libcore/option.rs
+1
-1
src/libcore/result.rs
src/libcore/result.rs
+3
-3
src/libcoretest/any.rs
src/libcoretest/any.rs
+2
-2
src/librustc_driver/pretty.rs
src/librustc_driver/pretty.rs
+2
-2
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+1
-1
src/libstd/sync/mpsc/stream.rs
src/libstd/sync/mpsc/stream.rs
+3
-3
src/libsyntax/ast_map/mod.rs
src/libsyntax/ast_map/mod.rs
+1
-1
src/test/bench/shootout-meteor.rs
src/test/bench/shootout-meteor.rs
+1
-1
src/test/compile-fail/issue-15756.rs
src/test/compile-fail/issue-15756.rs
+1
-1
src/test/compile-fail/mut-pattern-mismatched.rs
src/test/compile-fail/mut-pattern-mismatched.rs
+1
-1
src/test/compile-fail/pattern-bindings-after-at.rs
src/test/compile-fail/pattern-bindings-after-at.rs
+1
-1
src/test/run-pass/drop-trait-enum.rs
src/test/run-pass/drop-trait-enum.rs
+3
-3
src/test/run-pass/issue-16774.rs
src/test/run-pass/issue-16774.rs
+1
-1
未找到文件。
src/libcollections/vec.rs
浏览文件 @
7d72719e
...
...
@@ -2030,7 +2030,7 @@ fn zero_sized_values() {
v
.push
(());
assert_eq!
(
v
.iter_mut
()
.count
(),
4
);
for
&
()
in
v
.iter_mut
()
{}
for
&
mut
()
in
v
.iter_mut
()
{}
unsafe
{
v
.set_len
(
0
);
}
assert_eq!
(
v
.iter_mut
()
.count
(),
0
);
}
...
...
src/libcore/iter.rs
浏览文件 @
7d72719e
...
...
@@ -2344,7 +2344,7 @@ fn idx(&mut self, index: uint) -> Option<A> {
///
/// // This iterator will yield up to the last Fibonacci number before the max value of `u32`.
/// // You can simply change `u32` to `u64` in this line if you want higher values than that.
/// let mut fibonacci = Unfold::new((Some(0u32), Some(1u32)), |&(ref mut x2, ref mut x1)| {
/// let mut fibonacci = Unfold::new((Some(0u32), Some(1u32)), |&
mut
(ref mut x2, ref mut x1)| {
/// // Attempt to get the next Fibonacci number
/// // `x1` will be `None` if previously overflowed.
/// let next = match (*x2, *x1) {
...
...
src/libcore/option.rs
浏览文件 @
7d72719e
...
...
@@ -533,7 +533,7 @@ pub fn iter(&self) -> Iter<T> {
/// ```
/// let mut x = Some(4u);
/// match x.iter_mut().next() {
/// Some(&ref mut v) => *v = 42u,
/// Some(&
mut
ref mut v) => *v = 42u,
/// None => {},
/// }
/// assert_eq!(x, Some(42));
...
...
src/libcore/result.rs
浏览文件 @
7d72719e
...
...
@@ -383,8 +383,8 @@ pub fn as_ref(&self) -> Result<&T, &E> {
/// ```
/// fn mutate(r: &mut Result<int, int>) {
/// match r.as_mut() {
/// Ok(&ref mut v) => *v = 42,
/// Err(&ref mut e) => *e = 0,
/// Ok(&
mut
ref mut v) => *v = 42,
/// Err(&
mut
ref mut e) => *e = 0,
/// }
/// }
///
...
...
@@ -529,7 +529,7 @@ pub fn iter(&self) -> Iter<T> {
/// ```
/// let mut x: Result<uint, &str> = Ok(7);
/// match x.iter_mut().next() {
/// Some(&ref mut x) => *x = 40,
/// Some(&
mut
ref mut x) => *x = 40,
/// None => {},
/// }
/// assert_eq!(x, Ok(40));
...
...
src/libcoretest/any.rs
浏览文件 @
7d72719e
...
...
@@ -101,12 +101,12 @@ fn any_downcast_mut() {
}
match
a_r
.downcast_mut
::
<
uint
>
()
{
Some
(
&
612
)
=>
{}
Some
(
&
mut
612
)
=>
{}
x
=>
panic!
(
"Unexpected value {:?}"
,
x
)
}
match
b_r
.downcast_mut
::
<
uint
>
()
{
Some
(
&
413
)
=>
{}
Some
(
&
mut
413
)
=>
{}
x
=>
panic!
(
"Unexpected value {:?}"
,
x
)
}
}
...
...
src/librustc_driver/pretty.rs
浏览文件 @
7d72719e
...
...
@@ -350,8 +350,8 @@ impl<'a, 'ast> Iterator for NodesMatchingUII<'a, 'ast> {
fn
next
(
&
mut
self
)
->
Option
<
ast
::
NodeId
>
{
match
self
{
&
NodesMatchingDirect
(
ref
mut
iter
)
=>
iter
.next
(),
&
NodesMatchingSuffix
(
ref
mut
iter
)
=>
iter
.next
(),
&
mut
NodesMatchingDirect
(
ref
mut
iter
)
=>
iter
.next
(),
&
mut
NodesMatchingSuffix
(
ref
mut
iter
)
=>
iter
.next
(),
}
}
}
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
7d72719e
...
...
@@ -1709,7 +1709,7 @@ pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> Ty<'tcx> {
/// ! gets replaced with (), unconstrained ints with i32, and unconstrained floats with f64.
pub
fn
default_type_parameters
(
&
self
)
{
use
middle
::
ty
::
UnconstrainedNumeric
::{
UnconstrainedInt
,
UnconstrainedFloat
,
Neither
};
for
(
_
,
&
ref
ty
)
in
self
.inh.node_types
.borrow_mut
()
.iter_mut
()
{
for
(
_
,
&
mut
ref
ty
)
in
self
.inh.node_types
.borrow_mut
()
.iter_mut
()
{
let
resolved
=
self
.infcx
()
.resolve_type_vars_if_possible
(
ty
);
if
self
.infcx
()
.type_var_diverges
(
resolved
)
{
demand
::
eqtype
(
self
,
codemap
::
DUMMY_SP
,
*
ty
,
ty
::
mk_nil
(
self
.tcx
()));
...
...
src/libstd/sync/mpsc/stream.rs
浏览文件 @
7d72719e
...
...
@@ -338,7 +338,7 @@ pub fn can_recv(&mut self) -> Result<bool, Receiver<T>> {
// upgrade pending, then go through the whole recv rigamarole to update
// the internal state.
match
self
.queue
.peek
()
{
Some
(
&
GoUp
(
..
))
=>
{
Some
(
&
mut
GoUp
(
..
))
=>
{
match
self
.recv
()
{
Err
(
Upgraded
(
port
))
=>
Err
(
port
),
_
=>
unreachable!
(),
...
...
@@ -367,7 +367,7 @@ pub fn start_selection(&mut self, token: SignalToken) -> SelectionResult<T> {
Ok
(())
=>
SelSuccess
,
Err
(
token
)
=>
{
let
ret
=
match
self
.queue
.peek
()
{
Some
(
&
GoUp
(
..
))
=>
{
Some
(
&
mut
GoUp
(
..
))
=>
{
match
self
.queue
.pop
()
{
Some
(
GoUp
(
port
))
=>
SelUpgraded
(
token
,
port
),
_
=>
unreachable!
(),
...
...
@@ -457,7 +457,7 @@ pub fn abort_selection(&mut self,
// upgraded port.
if
has_data
{
match
self
.queue
.peek
()
{
Some
(
&
GoUp
(
..
))
=>
{
Some
(
&
mut
GoUp
(
..
))
=>
{
match
self
.queue
.pop
()
{
Some
(
GoUp
(
port
))
=>
Err
(
port
),
_
=>
unreachable!
(),
...
...
src/libsyntax/ast_map/mod.rs
浏览文件 @
7d72719e
...
...
@@ -90,7 +90,7 @@ impl<'a, T: Copy> Iterator for Values<'a, T> {
type
Item
=
T
;
fn
next
(
&
mut
self
)
->
Option
<
T
>
{
let
&
Values
(
ref
mut
items
)
=
self
;
let
&
mut
Values
(
ref
mut
items
)
=
self
;
items
.next
()
.map
(|
&
x
|
x
)
}
}
...
...
src/test/bench/shootout-meteor.rs
浏览文件 @
7d72719e
...
...
@@ -118,7 +118,7 @@ fn transform(piece: Vec<(int, int)> , all: bool) -> Vec<Vec<(int, int)>> {
// translating to (0, 0) as minimum coordinates.
for
cur_piece
in
res
.iter_mut
()
{
let
(
dy
,
dx
)
=
*
cur_piece
.iter
()
.min_by
(|
e
|
*
e
)
.unwrap
();
for
&
(
ref
mut
y
,
ref
mut
x
)
in
cur_piece
.iter_mut
()
{
for
&
mut
(
ref
mut
y
,
ref
mut
x
)
in
cur_piece
.iter_mut
()
{
*
y
-=
dy
;
*
x
-=
dx
;
}
}
...
...
src/test/compile-fail/issue-15756.rs
浏览文件 @
7d72719e
...
...
@@ -14,7 +14,7 @@
fn
dft_iter
<
'a
,
T
>
(
arg1
:
Chunks
<
'a
,
T
>
,
arg2
:
ChunksMut
<
'a
,
T
>
)
{
for
&
something
&
mut
something
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `[T]`
in
arg2
{
...
...
src/test/compile-fail/mut-pattern-mismatched.rs
浏览文件 @
7d72719e
...
...
@@ -13,7 +13,7 @@ fn main() {
// (separate lines to ensure the spans are accurate)
let
&
_
//
~ ERROR expected `&mut isize`, found `&_`
let
&
_
//~ ERROR expected `&mut isize`, found `&_`
=
foo
;
let
&
mut
_
=
foo
;
...
...
src/test/compile-fail/pattern-bindings-after-at.rs
浏览文件 @
7d72719e
...
...
@@ -15,7 +15,7 @@ enum Option<T> {
fn
main
()
{
match
&
mut
Some
(
1
i
)
{
ref
mut
z
@
&
Some
(
ref
a
)
=>
{
ref
mut
z
@
&
mut
Some
(
ref
a
)
=>
{
//~^ ERROR pattern bindings are not allowed after an `@`
**
z
=
None
;
println!
(
"{}"
,
*
a
);
...
...
src/test/run-pass/drop-trait-enum.rs
浏览文件 @
7d72719e
...
...
@@ -36,13 +36,13 @@ enum Foo {
impl
Drop
for
Foo
{
fn
drop
(
&
mut
self
)
{
match
self
{
&
Foo
::
SimpleVariant
(
ref
mut
sender
)
=>
{
&
mut
Foo
::
SimpleVariant
(
ref
mut
sender
)
=>
{
sender
.send
(
Message
::
DestructorRan
)
.unwrap
();
}
&
Foo
::
NestedVariant
(
_
,
_
,
ref
mut
sender
)
=>
{
&
mut
Foo
::
NestedVariant
(
_
,
_
,
ref
mut
sender
)
=>
{
sender
.send
(
Message
::
DestructorRan
)
.unwrap
();
}
&
Foo
::
FailingVariant
{
..
}
=>
{
&
mut
Foo
::
FailingVariant
{
..
}
=>
{
panic!
(
"Failed"
);
}
}
...
...
src/test/run-pass/issue-16774.rs
浏览文件 @
7d72719e
...
...
@@ -36,7 +36,7 @@ fn deref(&self) -> &int {
impl
DerefMut
for
X
{
fn
deref_mut
(
&
mut
self
)
->
&
mut
int
{
let
&
X
(
box
ref
mut
x
)
=
self
;
let
&
mut
X
(
box
ref
mut
x
)
=
self
;
x
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录