Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f9865eac
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,发现更多精彩内容 >>
提交
f9865eac
编写于
1月 10, 2015
作者:
J
Jorge Aparicio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix fallout
上级
9fdc0eff
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
118 addition
and
43 deletion
+118
-43
src/doc/trpl/unsafe.md
src/doc/trpl/unsafe.md
+4
-0
src/libcollections/bit.rs
src/libcollections/bit.rs
+3
-1
src/libcollections/btree/node.rs
src/libcollections/btree/node.rs
+4
-4
src/libcollections/lib.rs
src/libcollections/lib.rs
+4
-0
src/libcollections/ring_buf.rs
src/libcollections/ring_buf.rs
+7
-3
src/libcollections/slice.rs
src/libcollections/slice.rs
+1
-1
src/libcollections/str.rs
src/libcollections/str.rs
+1
-1
src/libcollections/vec.rs
src/libcollections/vec.rs
+6
-4
src/libcore/iter.rs
src/libcore/iter.rs
+9
-9
src/libcore/lib.rs
src/libcore/lib.rs
+4
-0
src/libcore/num/mod.rs
src/libcore/num/mod.rs
+2
-2
src/librand/lib.rs
src/librand/lib.rs
+2
-0
src/librustc/lib.rs
src/librustc/lib.rs
+3
-0
src/librustc/middle/dataflow.rs
src/librustc/middle/dataflow.rs
+3
-1
src/librustc_trans/lib.rs
src/librustc_trans/lib.rs
+3
-0
src/librustc_typeck/lib.rs
src/librustc_typeck/lib.rs
+3
-0
src/librustdoc/lib.rs
src/librustdoc/lib.rs
+3
-0
src/libserialize/collection_impls.rs
src/libserialize/collection_impls.rs
+3
-1
src/libstd/ascii.rs
src/libstd/ascii.rs
+4
-1
src/libstd/collections/hash/table.rs
src/libstd/collections/hash/table.rs
+2
-2
src/libstd/lib.rs
src/libstd/lib.rs
+5
-0
src/libstd/path/windows.rs
src/libstd/path/windows.rs
+1
-1
src/libstd/rand/os.rs
src/libstd/rand/os.rs
+3
-1
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/mpsc/mod.rs
+6
-2
src/libstd/sync/mpsc/mpsc_queue.rs
src/libstd/sync/mpsc/mpsc_queue.rs
+3
-1
src/libsyntax/fold.rs
src/libsyntax/fold.rs
+8
-4
src/libsyntax/lib.rs
src/libsyntax/lib.rs
+3
-0
src/libtest/lib.rs
src/libtest/lib.rs
+3
-0
src/libunicode/lib.rs
src/libunicode/lib.rs
+3
-0
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-mandelbrot.rs
+6
-2
src/test/bench/shootout-meteor.rs
src/test/bench/shootout-meteor.rs
+6
-2
未找到文件。
src/doc/trpl/unsafe.md
浏览文件 @
f9865eac
...
...
@@ -576,6 +576,10 @@ extern fn panic_fmt(args: &core::fmt::Arguments,
#[lang = "eh_personality"] extern fn eh_personality() {}
# #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 }
# fn main() {}
# mod std { // for-loops
# pub use core::iter;
# pub use core::option;
# }
```
Note that there is one extra lang item here which differs from the examples
...
...
src/libcollections/bit.rs
浏览文件 @
f9865eac
...
...
@@ -104,7 +104,9 @@
fn
reverse_bits
(
byte
:
u8
)
->
u8
{
let
mut
result
=
0
;
for
i
in
0
..
u8
::
BITS
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
..
u8
::
BITS
;
while
let
Some
(
i
)
=
iter
.next
()
{
result
|
=
((
byte
>>
i
)
&
1
)
<<
(
u8
::
BITS
-
1
-
i
);
}
result
...
...
src/libcollections/btree/node.rs
浏览文件 @
f9865eac
...
...
@@ -271,7 +271,7 @@ fn next_back(&mut self) -> Option<T> {
#[unsafe_destructor]
impl
<
T
>
Drop
for
RawItems
<
T
>
{
fn
drop
(
&
mut
self
)
{
for
_
in
*
self
{}
for
_
in
self
.by_ref
()
{}
}
}
...
...
@@ -1374,9 +1374,9 @@ impl<K, V> Drop for MoveTraversalImpl<K, V> {
fn
drop
(
&
mut
self
)
{
// We need to cleanup the stored values manually, as the RawItems destructor would run
// after our deallocation.
for
_
in
self
.keys
{}
for
_
in
self
.vals
{}
for
_
in
self
.edges
{}
for
_
in
self
.keys
.by_ref
()
{}
for
_
in
self
.vals
.by_ref
()
{}
for
_
in
self
.edges
.by_ref
()
{}
let
(
alignment
,
size
)
=
calculate_allocation_generic
::
<
K
,
V
>
(
self
.capacity
,
self
.is_leaf
);
...
...
src/libcollections/lib.rs
浏览文件 @
f9865eac
...
...
@@ -34,6 +34,8 @@
#![feature(unicode)]
#![feature(hash)]
#![cfg_attr(test,
feature(test))]
// NOTE(stage0): remove after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
#[macro_use]
extern
crate
core
;
...
...
@@ -114,6 +116,8 @@ mod std {
pub
use
core
::
marker
;
// derive(Copy)
pub
use
core
::
hash
;
// derive(Hash)
pub
use
core
::
ops
;
// RangeFull
// for-loops
pub
use
core
::
iter
;
}
#[cfg(test)]
...
...
src/libcollections/ring_buf.rs
浏览文件 @
f9865eac
...
...
@@ -1510,7 +1510,7 @@ pub struct Drain<'a, T: 'a> {
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
impl
<
'a
,
T
:
'a
>
Drop
for
Drain
<
'a
,
T
>
{
fn
drop
(
&
mut
self
)
{
for
_
in
*
self
{}
for
_
in
self
.by_ref
()
{}
self
.inner.head
=
0
;
self
.inner.tail
=
0
;
}
...
...
@@ -1793,7 +1793,9 @@ fn bench_new(b: &mut test::Bencher) {
fn
bench_push_back_100
(
b
:
&
mut
test
::
Bencher
)
{
let
mut
deq
=
RingBuf
::
with_capacity
(
101
);
b
.iter
(||
{
for
i
in
0
i
..
100
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
i
..
100
;
while
let
Some
(
i
)
=
iter
.next
()
{
deq
.push_back
(
i
);
}
deq
.head
=
0
;
...
...
@@ -1805,7 +1807,9 @@ fn bench_push_back_100(b: &mut test::Bencher) {
fn
bench_push_front_100
(
b
:
&
mut
test
::
Bencher
)
{
let
mut
deq
=
RingBuf
::
with_capacity
(
101
);
b
.iter
(||
{
for
i
in
0
i
..
100
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
i
..
100
;
while
let
Some
(
i
)
=
iter
.next
()
{
deq
.push_front
(
i
);
}
deq
.head
=
0
;
...
...
src/libcollections/slice.rs
浏览文件 @
f9865eac
...
...
@@ -1958,7 +1958,7 @@ fn test_permutations() {
let
mut
amt
=
0
;
let
mut
it
=
v
.permutations
();
let
(
min_size
,
max_opt
)
=
it
.size_hint
();
for
_
perm
in
it
{
for
_
perm
in
it
.by_ref
()
{
amt
+=
1
;
}
assert_eq!
(
amt
,
it
.swaps.swaps_made
);
...
...
src/libcollections/str.rs
浏览文件 @
f9865eac
...
...
@@ -279,7 +279,7 @@ fn next(&mut self) -> Option<char> {
loop
{
match
self
.state
{
Composing
=>
{
for
ch
in
self
.iter
{
for
ch
in
self
.iter
.by_ref
()
{
let
ch_class
=
unicode
::
char
::
canonical_combining_class
(
ch
);
if
self
.composee
.is_none
()
{
if
ch_class
!=
0
{
...
...
src/libcollections/vec.rs
浏览文件 @
f9865eac
...
...
@@ -1567,7 +1567,9 @@ fn drop(&mut self) {
// zeroed (when moving out, because of #[unsafe_no_drop_flag]).
if
self
.cap
!=
0
{
unsafe
{
for
x
in
self
.iter
()
{
// FIXME(#21245) use a for loop
let
mut
iter
=
self
.iter
();
while
let
Some
(
x
)
=
iter
.next
()
{
ptr
::
read
(
x
);
}
dealloc
(
*
self
.ptr
,
self
.cap
)
...
...
@@ -1648,7 +1650,7 @@ impl<T> IntoIter<T> {
#[unstable(feature
=
"collections"
)]
pub
fn
into_inner
(
mut
self
)
->
Vec
<
T
>
{
unsafe
{
for
_
x
in
self
{
}
for
_
x
in
self
.by_ref
()
{
}
let
IntoIter
{
allocation
,
cap
,
ptr
:
_
ptr
,
end
:
_
end
}
=
self
;
mem
::
forget
(
self
);
Vec
{
ptr
:
NonZero
::
new
(
allocation
),
cap
:
cap
,
len
:
0
}
...
...
@@ -1726,7 +1728,7 @@ impl<T> Drop for IntoIter<T> {
fn
drop
(
&
mut
self
)
{
// destroy the remaining elements
if
self
.cap
!=
0
{
for
_
x
in
*
self
{}
for
_
x
in
self
.by_ref
()
{}
unsafe
{
dealloc
(
self
.allocation
,
self
.cap
);
}
...
...
@@ -1816,7 +1818,7 @@ fn drop(&mut self) {
// so we can use #[unsafe_no_drop_flag].
// destroy the remaining elements
for
_
x
in
*
self
{}
for
_
x
in
self
.by_ref
()
{}
}
}
...
...
src/libcore/iter.rs
浏览文件 @
f9865eac
...
...
@@ -195,7 +195,7 @@ fn last(mut self) -> Option<Self::Item> {
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
fn
nth
(
&
mut
self
,
mut
n
:
usize
)
->
Option
<
Self
::
Item
>
{
for
x
in
*
self
{
for
x
in
self
.by_ref
()
{
if
n
==
0
{
return
Some
(
x
)
}
n
-=
1
;
}
...
...
@@ -492,7 +492,7 @@ fn flat_map<B, U, F>(self, f: F) -> FlatMap<Self::Item, B, Self, U, F> where
/// fn process<U: Iterator<Item=isize>>(it: U) -> isize {
/// let mut it = it.fuse();
/// let mut sum = 0;
/// for x in it {
/// for x in it
.by_ref()
{
/// if x > 5 {
/// break;
/// }
...
...
@@ -660,7 +660,7 @@ fn all<F>(mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
fn
any
<
F
>
(
&
mut
self
,
mut
f
:
F
)
->
bool
where
F
:
FnMut
(
Self
::
Item
)
->
bool
{
for
x
in
*
self
{
if
f
(
x
)
{
return
true
;
}
}
for
x
in
self
.by_ref
()
{
if
f
(
x
)
{
return
true
;
}
}
false
}
...
...
@@ -680,7 +680,7 @@ fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
fn
find
<
P
>
(
&
mut
self
,
mut
predicate
:
P
)
->
Option
<
Self
::
Item
>
where
P
:
FnMut
(
&
Self
::
Item
)
->
bool
,
{
for
x
in
*
self
{
for
x
in
self
.by_ref
()
{
if
predicate
(
&
x
)
{
return
Some
(
x
)
}
}
None
...
...
@@ -703,7 +703,7 @@ fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
P
:
FnMut
(
Self
::
Item
)
->
bool
,
{
let
mut
i
=
0
;
for
x
in
*
self
{
for
x
in
self
.by_ref
()
{
if
predicate
(
x
)
{
return
Some
(
i
);
}
...
...
@@ -1664,7 +1664,7 @@ impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&
#[inline]
fn
next
(
&
mut
self
)
->
Option
<
A
>
{
for
x
in
self
.iter
{
for
x
in
self
.iter
.by_ref
()
{
if
(
self
.predicate
)(
&
x
)
{
return
Some
(
x
);
}
else
{
...
...
@@ -1728,7 +1728,7 @@ impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where
#[inline]
fn
next
(
&
mut
self
)
->
Option
<
B
>
{
for
x
in
self
.iter
{
for
x
in
self
.iter
.by_ref
()
{
match
(
self
.f
)(
x
)
{
Some
(
y
)
=>
return
Some
(
y
),
None
=>
()
...
...
@@ -1914,7 +1914,7 @@ impl<A, I, P> Iterator for SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMu
#[inline]
fn
next
(
&
mut
self
)
->
Option
<
A
>
{
for
x
in
self
.iter
{
for
x
in
self
.iter
.by_ref
()
{
if
self
.flag
||
!
(
self
.predicate
)(
&
x
)
{
self
.flag
=
true
;
return
Some
(
x
);
...
...
@@ -2207,7 +2207,7 @@ impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
fn
next
(
&
mut
self
)
->
Option
<
B
>
{
loop
{
for
inner
in
self
.frontiter
.iter_mut
()
{
for
x
in
*
inner
{
for
x
in
inner
.by_ref
()
{
return
Some
(
x
)
}
}
...
...
src/libcore/lib.rs
浏览文件 @
f9865eac
...
...
@@ -65,6 +65,8 @@
#![allow(unknown_features)]
#![feature(int_uint)]
#![feature(on_unimplemented)]
#![deny(missing_docs)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
#[macro_use]
mod
macros
;
...
...
@@ -158,4 +160,6 @@ mod std {
pub
use
marker
;
pub
use
ops
;
pub
use
option
;
// for-loops
pub
use
iter
;
}
src/libcore/num/mod.rs
浏览文件 @
f9865eac
...
...
@@ -1524,7 +1524,7 @@ fn from_str_radix(src: &str, radix: uint) -> Option<$T> {
let
mut
exp_info
=
None
::
<
(
char
,
uint
)
>
;
// Parse the integer part of the significand
for
(
i
,
c
)
in
cs
{
for
(
i
,
c
)
in
cs
.by_ref
()
{
match
c
.to_digit
(
radix
)
{
Some
(
digit
)
=>
{
// shift significand one digit left
...
...
@@ -1572,7 +1572,7 @@ fn from_str_radix(src: &str, radix: uint) -> Option<$T> {
// part of the significand
if
exp_info
.is_none
()
{
let
mut
power
=
1.0
;
for
(
i
,
c
)
in
cs
{
for
(
i
,
c
)
in
cs
.by_ref
()
{
match
c
.to_digit
(
radix
)
{
Some
(
digit
)
=>
{
// Decrease power one order of magnitude
...
...
src/librand/lib.rs
浏览文件 @
f9865eac
...
...
@@ -498,6 +498,8 @@ mod std {
pub
use
core
::{
option
,
fmt
};
// panic!()
pub
use
core
::
clone
;
// derive Clone
pub
use
core
::
marker
;
// for-loops
pub
use
core
::
iter
;
}
#[cfg(test)]
...
...
src/librustc/lib.rs
浏览文件 @
f9865eac
...
...
@@ -41,6 +41,9 @@
#![feature(unicode)]
#![feature(hash)]
#![cfg_attr(test,
feature(test))]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
extern
crate
arena
;
extern
crate
flate
;
...
...
src/librustc/middle/dataflow.rs
浏览文件 @
f9865eac
...
...
@@ -352,7 +352,9 @@ fn each_bit<F>(&self, words: &[uint], mut f: F) -> bool where
for
(
word_index
,
&
word
)
in
words
.iter
()
.enumerate
()
{
if
word
!=
0
{
let
base_index
=
word_index
*
uint
::
BITS
;
for
offset
in
0u
..
uint
::
BITS
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0u
..
uint
::
BITS
;
while
let
Some
(
offset
)
=
iter
.next
()
{
let
bit
=
1
<<
offset
;
if
(
word
&
bit
)
!=
0
{
// NB: we round up the total number of bits
...
...
src/librustc_trans/lib.rs
浏览文件 @
f9865eac
...
...
@@ -41,6 +41,9 @@
#![feature(std_misc)]
#![feature(unicode)]
#![feature(hash)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
extern
crate
arena
;
extern
crate
flate
;
...
...
src/librustc_typeck/lib.rs
浏览文件 @
f9865eac
...
...
@@ -84,6 +84,9 @@
#![feature(core)]
#![feature(rustc_private)]
#![feature(std_misc)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
#[macro_use]
extern
crate
log
;
#[macro_use]
extern
crate
syntax
;
...
...
src/librustdoc/lib.rs
浏览文件 @
f9865eac
...
...
@@ -32,6 +32,9 @@
#![feature(test)]
#![feature(unicode)]
#![feature(hash)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
extern
crate
arena
;
extern
crate
getopts
;
...
...
src/libserialize/collection_impls.rs
浏览文件 @
f9865eac
...
...
@@ -148,7 +148,9 @@ impl<
fn
decode
<
D
:
Decoder
>
(
d
:
&
mut
D
)
->
Result
<
EnumSet
<
T
>
,
D
::
Error
>
{
let
bits
=
try!
(
d
.read_uint
());
let
mut
set
=
EnumSet
::
new
();
for
bit
in
0
..
uint
::
BITS
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
..
uint
::
BITS
;
while
let
Some
(
bit
)
=
iter
.next
()
{
if
bits
&
(
1
<<
bit
)
!=
0
{
set
.insert
(
CLike
::
from_uint
(
1
<<
bit
));
}
...
...
src/libstd/ascii.rs
浏览文件 @
f9865eac
...
...
@@ -232,7 +232,10 @@ pub fn escape_default<F>(c: u8, mut f: F) where
_
=>
{
f
(
b
'\\'
);
f
(
b
'x'
);
for
&
offset
in
[
4u
,
0u
]
.iter
()
{
// FIXME(#21245) use a for loop
let
arr
=
[
4u
,
0u
];
let
mut
iter
=
arr
.iter
();
while
let
::
option
::
Option
::
Some
(
&
offset
)
=
::
iter
::
Iterator
::
next
(
&
mut
iter
)
{
match
((
c
as
i32
)
>>
offset
)
&
0xf
{
i
@
0
...
9
=>
f
(
b
'0'
+
(
i
as
u8
)),
i
=>
f
(
b
'a'
+
(
i
as
u8
-
10
)),
...
...
src/libstd/collections/hash/table.rs
浏览文件 @
f9865eac
...
...
@@ -15,7 +15,7 @@
use
clone
::
Clone
;
use
cmp
;
use
hash
::{
Hash
,
Hasher
};
use
iter
::{
Iterator
,
ExactSizeIterator
,
count
};
use
iter
::{
Iterator
,
IteratorExt
,
ExactSizeIterator
,
count
};
use
marker
::{
Copy
,
Sized
,
self
};
use
mem
::{
min_align_of
,
size_of
};
use
mem
;
...
...
@@ -921,7 +921,7 @@ fn len(&self) -> usize { self.table.size() }
#[unsafe_destructor]
impl
<
'a
,
K
:
'a
,
V
:
'a
>
Drop
for
Drain
<
'a
,
K
,
V
>
{
fn
drop
(
&
mut
self
)
{
for
_
in
*
self
{}
for
_
in
self
.by_ref
()
{}
}
}
...
...
src/libstd/lib.rs
浏览文件 @
f9865eac
...
...
@@ -123,6 +123,9 @@
#![feature(rand)]
#![feature(hash)]
#![cfg_attr(test,
feature(test))]
#![allow(unstable)]
// NOTE(stage0): remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
// Don't link to std. We are std.
#![no_std]
...
...
@@ -310,4 +313,6 @@ mod std {
pub
use
slice
;
pub
use
boxed
;
// used for vec![]
// for-loops
pub
use
iter
;
}
src/libstd/path/windows.rs
浏览文件 @
f9865eac
...
...
@@ -557,7 +557,7 @@ fn comp_requires_verbatim(s: &str) -> bool {
}
(
Some
(
a
),
Some
(
_
))
=>
{
comps
.push
(
".."
);
for
_
in
itb
{
for
_
in
itb
.by_ref
()
{
comps
.push
(
".."
);
}
comps
.push
(
a
);
...
...
src/libstd/rand/os.rs
浏览文件 @
f9865eac
...
...
@@ -404,7 +404,9 @@ fn test_os_rng_tasks() {
}
// start all the tasks
for
tx
in
txs
.iter
()
{
// FIXME(#21245) use a for loop
let
mut
iter
=
txs
.iter
();
while
let
Some
(
tx
)
=
iter
.next
()
{
tx
.send
(())
.unwrap
();
}
}
...
...
src/libstd/sync/mpsc/mod.rs
浏览文件 @
f9865eac
...
...
@@ -1476,7 +1476,9 @@ fn test_recv_iter_break() {
let
_
t
=
Thread
::
spawn
(
move
||
{
let
mut
count
=
0
;
for
x
in
rx
.iter
()
{
// FIXME(#21245) use a for loop
let
mut
iter
=
rx
.iter
();
while
let
Some
(
x
)
=
iter
.next
()
{
if
count
>=
3
{
break
;
}
else
{
...
...
@@ -1940,7 +1942,9 @@ fn test_recv_iter_break() {
let
_
t
=
Thread
::
spawn
(
move
||
{
let
mut
count
=
0
;
for
x
in
rx
.iter
()
{
// FIXME(#21245) use a for loop
let
mut
iter
=
rx
.iter
();
while
let
Some
(
x
)
=
iter
.next
()
{
if
count
>=
3
{
break
;
}
else
{
...
...
src/libstd/sync/mpsc/mpsc_queue.rs
浏览文件 @
f9865eac
...
...
@@ -185,7 +185,9 @@ fn test() {
let
tx
=
tx
.clone
();
let
q
=
q
.clone
();
Thread
::
spawn
(
move
||
{
for
i
in
0
..
nmsgs
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0
..
nmsgs
;
while
let
Some
(
i
)
=
iter
.next
()
{
q
.push
(
i
);
}
tx
.send
(())
.unwrap
();
...
...
src/libsyntax/fold.rs
浏览文件 @
f9865eac
...
...
@@ -37,10 +37,14 @@ pub trait MoveMap<T> {
impl
<
T
>
MoveMap
<
T
>
for
Vec
<
T
>
{
fn
move_map
<
F
>
(
mut
self
,
mut
f
:
F
)
->
Vec
<
T
>
where
F
:
FnMut
(
T
)
->
T
{
for
p
in
self
.iter_mut
()
{
unsafe
{
// FIXME(#5016) this shouldn't need to zero to be safe.
ptr
::
write
(
p
,
f
(
ptr
::
read_and_zero
(
p
)));
// FIXME(#21245) use a for loop
{
let
mut
iter
=
self
.iter_mut
();
while
let
Some
(
p
)
=
iter
.next
()
{
unsafe
{
// FIXME(#5016) this shouldn't need to zero to be safe.
ptr
::
write
(
p
,
f
(
ptr
::
read_and_zero
(
p
)));
}
}
}
self
...
...
src/libsyntax/lib.rs
浏览文件 @
f9865eac
...
...
@@ -39,6 +39,9 @@
#![feature(rustc_private)]
#![feature(std_misc)]
#![feature(unicode)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
extern
crate
arena
;
extern
crate
fmt_macros
;
...
...
src/libtest/lib.rs
浏览文件 @
f9865eac
...
...
@@ -44,6 +44,9 @@
#![feature(rustc_private)]
#![feature(std_misc)]
#![feature(hash)]
#![allow(unstable)]
// NOTE(stage0): remove cfg_attr after a snapshot
#![cfg_attr(not(stage0),
allow(unused_mut))]
extern
crate
getopts
;
extern
crate
serialize
;
...
...
src/libunicode/lib.rs
浏览文件 @
f9865eac
...
...
@@ -84,4 +84,7 @@ mod std {
pub
use
core
::
cmp
;
pub
use
core
::
fmt
;
pub
use
core
::
marker
;
// for-loops
pub
use
core
::
iter
;
pub
use
core
::
option
;
}
src/test/bench/shootout-mandelbrot.rs
浏览文件 @
f9865eac
...
...
@@ -133,7 +133,9 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
(
i
+
1
)
*
chunk_size
};
for
&
init_i
in
vec_init_i
[
start
..
end
]
.iter
()
{
// FIXME(#21245) use a for loop
let
mut
iter
=
vec_init_i
[
start
..
end
]
.iter
();
while
let
Some
(
&
init_i
)
=
iter
.next
()
{
write_line
(
init_i
,
init_r_slice
,
&
mut
res
);
}
...
...
@@ -142,7 +144,9 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
})
.collect
::
<
Vec
<
_
>>
();
try!
(
writeln!
(
&
mut
out
as
&
mut
Writer
,
"P4
\n
{} {}"
,
w
,
h
));
for
res
in
data
.into_iter
()
{
// FIXME(#21245) use a for loop
let
mut
iter
=
data
.into_iter
();
while
let
Some
(
res
)
=
iter
.next
()
{
try!
(
out
.write
(
res
.join
()
.ok
()
.unwrap
()
.as_slice
()));
}
out
.flush
()
...
...
src/test/bench/shootout-meteor.rs
浏览文件 @
f9865eac
...
...
@@ -180,7 +180,9 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > {
// all unused piece can be placed on the board.
fn
is_board_unfeasible
(
board
:
u64
,
masks
:
&
Vec
<
Vec
<
Vec
<
u64
>>>
)
->
bool
{
let
mut
coverable
=
board
;
for
(
i
,
masks_at
)
in
masks
.iter
()
.enumerate
()
{
// FIXME(#21245) use a for loop
let
mut
iter
=
masks
.iter
()
.enumerate
();
while
let
Some
((
i
,
masks_at
))
=
iter
.next
()
{
if
board
&
1
<<
i
!=
0
{
continue
;
}
for
(
cur_id
,
pos_masks
)
in
masks_at
.iter
()
.enumerate
()
{
if
board
&
1
<<
(
50
+
cur_id
)
!=
0
{
continue
;
}
...
...
@@ -222,7 +224,9 @@ fn to_vec(raw_sol: &List<u64>) -> Vec<u8> {
let
mut
sol
=
repeat
(
'.'
as
u8
)
.take
(
50
)
.collect
::
<
Vec
<
_
>>
();
for
&
m
in
raw_sol
.iter
()
{
let
id
=
'0'
as
u8
+
get_id
(
m
);
for
i
in
0u
..
50
{
// FIXME(#21245) use a for loop
let
mut
iter
=
0u
..
50
;
while
let
Some
(
i
)
=
iter
.next
()
{
if
m
&
1
<<
i
!=
0
{
sol
[
i
]
=
id
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录