Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
10e7f12d
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,发现更多精彩内容 >>
提交
10e7f12d
编写于
9月 27, 2013
作者:
B
bors
浏览文件
操作
浏览文件
下载
差异文件
auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger
The 0.8 release was cut, down with printf!
上级
01313a13
409182de
变更
81
隐藏空白更改
内联
并排
Showing
81 changed file
with
170 addition
and
194 deletion
+170
-194
src/libextra/base64.rs
src/libextra/base64.rs
+4
-4
src/libextra/future.rs
src/libextra/future.rs
+1
-1
src/libextra/getopts.rs
src/libextra/getopts.rs
+1
-1
src/libextra/hex.rs
src/libextra/hex.rs
+4
-4
src/libextra/task_pool.rs
src/libextra/task_pool.rs
+1
-1
src/librust/rust.rs
src/librust/rust.rs
+4
-4
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+11
-11
src/librustc/middle/borrowck/mod.rs
src/librustc/middle/borrowck/mod.rs
+10
-10
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+12
-12
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/glue.rs
+2
-2
src/librustc/rustc.rs
src/librustc/rustc.rs
+12
-12
src/librustc/util/common.rs
src/librustc/util/common.rs
+1
-1
src/librusti/rusti.rs
src/librusti/rusti.rs
+1
-1
src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs
src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs
+1
-1
src/libstd/iter.rs
src/libstd/iter.rs
+1
-1
src/libstd/rand/distributions.rs
src/libstd/rand/distributions.rs
+2
-2
src/libstd/rand/mod.rs
src/libstd/rand/mod.rs
+18
-18
src/libstd/str.rs
src/libstd/str.rs
+1
-1
src/libstd/vec.rs
src/libstd/vec.rs
+2
-2
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+0
-20
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/macro_rules.rs
+2
-2
src/test/bench/core-map.rs
src/test/bench/core-map.rs
+2
-2
src/test/bench/core-std.rs
src/test/bench/core-std.rs
+1
-1
src/test/bench/msgsend-ring-mutex-arcs.rs
src/test/bench/msgsend-ring-mutex-arcs.rs
+3
-3
src/test/bench/msgsend-ring-rw-arcs.rs
src/test/bench/msgsend-ring-rw-arcs.rs
+3
-3
src/test/bench/shootout-ackermann.rs
src/test/bench/shootout-ackermann.rs
+1
-1
src/test/bench/shootout-binarytrees.rs
src/test/bench/shootout-binarytrees.rs
+3
-3
src/test/bench/shootout-fannkuch-redux.rs
src/test/bench/shootout-fannkuch-redux.rs
+1
-1
src/test/bench/shootout-fibo.rs
src/test/bench/shootout-fibo.rs
+1
-1
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-k-nucleotide.rs
+4
-4
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-mandelbrot.rs
+1
-1
src/test/bench/shootout-nbody.rs
src/test/bench/shootout-nbody.rs
+2
-2
src/test/bench/shootout-spectralnorm.rs
src/test/bench/shootout-spectralnorm.rs
+1
-1
src/test/bench/shootout-threadring.rs
src/test/bench/shootout-threadring.rs
+2
-2
src/test/compile-fail/borrowck-auto-mut-ref-to-immut-var.rs
src/test/compile-fail/borrowck-auto-mut-ref-to-immut-var.rs
+1
-1
src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
...st/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
+1
-1
src/test/compile-fail/issue-3820.rs
src/test/compile-fail/issue-3820.rs
+0
-1
src/test/compile-fail/issue-4335.rs
src/test/compile-fail/issue-4335.rs
+1
-1
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
...le-fail/moves-based-on-type-no-recursive-stack-closure.rs
+1
-1
src/test/compile-fail/tuple-struct-nonexhaustive.rs
src/test/compile-fail/tuple-struct-nonexhaustive.rs
+2
-2
src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs
...test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs
+1
-1
src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
+1
-1
src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
+1
-1
src/test/run-fail/borrowck-wg-two-array-indices.rs
src/test/run-fail/borrowck-wg-two-array-indices.rs
+1
-1
src/test/run-pass/auto-ref.rs
src/test/run-pass/auto-ref.rs
+1
-1
src/test/run-pass/borrowck-wg-two-imm-borrows.rs
src/test/run-pass/borrowck-wg-two-imm-borrows.rs
+1
-1
src/test/run-pass/cci_impl_exe.rs
src/test/run-pass/cci_impl_exe.rs
+1
-1
src/test/run-pass/cci_iter_exe.rs
src/test/run-pass/cci_iter_exe.rs
+1
-1
src/test/run-pass/cci_no_inline_exe.rs
src/test/run-pass/cci_no_inline_exe.rs
+1
-1
src/test/run-pass/const-fields-and-indexing.rs
src/test/run-pass/const-fields-and-indexing.rs
+3
-3
src/test/run-pass/const-rec-and-tup.rs
src/test/run-pass/const-rec-and-tup.rs
+1
-1
src/test/run-pass/const-region-ptrs.rs
src/test/run-pass/const-region-ptrs.rs
+2
-2
src/test/run-pass/const-struct.rs
src/test/run-pass/const-struct.rs
+2
-2
src/test/run-pass/const-vecs-and-slices.rs
src/test/run-pass/const-vecs-and-slices.rs
+2
-2
src/test/run-pass/functional-struct-upd.rs
src/test/run-pass/functional-struct-upd.rs
+1
-1
src/test/run-pass/issue-2185.rs
src/test/run-pass/issue-2185.rs
+1
-1
src/test/run-pass/issue-2989.rs
src/test/run-pass/issue-2989.rs
+1
-1
src/test/run-pass/issue-3211.rs
src/test/run-pass/issue-3211.rs
+1
-1
src/test/run-pass/issue-3743.rs
src/test/run-pass/issue-3743.rs
+2
-2
src/test/run-pass/issue-3753.rs
src/test/run-pass/issue-3753.rs
+1
-1
src/test/run-pass/issue-3794.rs
src/test/run-pass/issue-3794.rs
+1
-1
src/test/run-pass/issue-3904.rs
src/test/run-pass/issue-3904.rs
+1
-1
src/test/run-pass/issue-4241.rs
src/test/run-pass/issue-4241.rs
+1
-2
src/test/run-pass/issue-4401.rs
src/test/run-pass/issue-4401.rs
+1
-1
src/test/run-pass/link-section.rs
src/test/run-pass/link-section.rs
+1
-1
src/test/run-pass/max-min-classes.rs
src/test/run-pass/max-min-classes.rs
+1
-1
src/test/run-pass/new-style-constants.rs
src/test/run-pass/new-style-constants.rs
+1
-1
src/test/run-pass/new-style-fixed-length-vec.rs
src/test/run-pass/new-style-fixed-length-vec.rs
+1
-3
src/test/run-pass/newtype.rs
src/test/run-pass/newtype.rs
+1
-1
src/test/run-pass/placement-new-arena.rs
src/test/run-pass/placement-new-arena.rs
+1
-1
src/test/run-pass/recursion.rs
src/test/run-pass/recursion.rs
+1
-1
src/test/run-pass/reflect-visit-data.rs
src/test/run-pass/reflect-visit-data.rs
+2
-2
src/test/run-pass/reflect-visit-type.rs
src/test/run-pass/reflect-visit-type.rs
+1
-1
src/test/run-pass/struct-pattern-matching.rs
src/test/run-pass/struct-pattern-matching.rs
+1
-1
src/test/run-pass/trait-inheritance-num2.rs
src/test/run-pass/trait-inheritance-num2.rs
+1
-1
src/test/run-pass/trait-inheritance-num3.rs
src/test/run-pass/trait-inheritance-num3.rs
+1
-1
src/test/run-pass/tuple-struct-construct.rs
src/test/run-pass/tuple-struct-construct.rs
+1
-1
src/test/run-pass/tuple-struct-destructuring.rs
src/test/run-pass/tuple-struct-destructuring.rs
+1
-1
src/test/run-pass/tuple-struct-matching.rs
src/test/run-pass/tuple-struct-matching.rs
+1
-1
src/test/run-pass/vec-fixed-length.rs
src/test/run-pass/vec-fixed-length.rs
+1
-1
src/test/run-pass/vec-matching-legal-tail-element-borrow.rs
src/test/run-pass/vec-matching-legal-tail-element-borrow.rs
+1
-1
未找到文件。
src/libextra/base64.rs
浏览文件 @
10e7f12d
...
...
@@ -68,7 +68,7 @@ impl<'self> ToBase64 for &'self [u8] {
*
* fn main () {
* let str = [52,32].to_base64(standard);
* print
fln!("%s
", str);
* print
ln!("{}
", str);
* }
* ```
*/
...
...
@@ -177,11 +177,11 @@ impl<'self> FromBase64 for &'self str {
*
* fn main () {
* let hello_str = "Hello, World".to_base64(standard);
* print
fln!("%s
", hello_str);
* print
ln!("{}
", hello_str);
* let bytes = hello_str.from_base64();
* print
fln!("%?
", bytes);
* print
ln!("{:?}
", bytes);
* let result_str = str::from_utf8(bytes);
* print
fln!("%s
", result_str);
* print
ln!("{}
", result_str);
* }
* ```
*/
...
...
src/libextra/future.rs
浏览文件 @
10e7f12d
...
...
@@ -19,7 +19,7 @@
* # fn make_a_sandwich() {};
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
* make_a_sandwich();
* print
fln!("fib(5000) = %?
", delayed_fib.get())
* print
ln!("fib(5000) = {}
", delayed_fib.get())
* ```
*/
...
...
src/libextra/getopts.rs
浏览文件 @
10e7f12d
...
...
@@ -43,7 +43,7 @@
//! }
//!
//! fn print_usage(program: &str, _opts: &[Opt]) {
//! print
fln!("Usage: %s
[options]", program);
//! print
ln!("Usage: {}
[options]", program);
//! println("-o\t\tOutput");
//! println("-h --help\tUsage");
//! }
...
...
src/libextra/hex.rs
浏览文件 @
10e7f12d
...
...
@@ -33,7 +33,7 @@ impl<'self> ToHex for &'self [u8] {
*
* fn main () {
* let str = [52,32].to_hex();
* print
fln!("%s
", str);
* print
ln!("{}
", str);
* }
* ```
*/
...
...
@@ -77,11 +77,11 @@ impl<'self> FromHex for &'self str {
*
* fn main () {
* let hello_str = "Hello, World".to_hex();
* print
fln!("%s
", hello_str);
* print
ln!("{}
", hello_str);
* let bytes = hello_str.from_hex().unwrap();
* print
fln!("%?
", bytes);
* print
ln!("{:?}
", bytes);
* let result_str = str::from_utf8(bytes);
* print
fln!("%s
", result_str);
* print
ln!("{}
", result_str);
* }
* ```
*/
...
...
src/libextra/task_pool.rs
浏览文件 @
10e7f12d
...
...
@@ -103,6 +103,6 @@ fn test_task_pool() {
};
let
mut
pool
=
TaskPool
::
new
(
4
,
Some
(
SingleThreaded
),
f
);
do
8
.times
{
pool
.execute
(|
i
|
print
fln!
(
"Hello from thread %u
!"
,
*
i
));
pool
.execute
(|
i
|
print
ln!
(
"Hello from thread {}
!"
,
*
i
));
}
}
src/librust/rust.rs
浏览文件 @
10e7f12d
...
...
@@ -136,13 +136,13 @@ fn print_usage(command_string: ~str) -> ValidUsage {
match
find_cmd
(
command_string
)
{
Some
(
command
)
=>
{
match
command
.action
{
CallMain
(
prog
,
_
)
=>
print
f
ln!
(
"The
%s command is an alias for the %s
program."
,
CallMain
(
prog
,
_
)
=>
println!
(
"The
{} command is an alias for the {}
program."
,
command
.cmd
,
prog
),
_
=>
()
}
match
command
.usage_full
{
UsgStr
(
msg
)
=>
print
fln!
(
"%s
\n
"
,
msg
),
UsgStr
(
msg
)
=>
print
ln!
(
"{}
\n
"
,
msg
),
UsgCall
(
f
)
=>
f
(),
}
Valid
(
0
)
...
...
@@ -215,7 +215,7 @@ fn usage() {
for
command
in
COMMANDS
.iter
()
{
let
padding
=
" "
.repeat
(
INDENT
-
command
.cmd
.len
());
print
fln!
(
" %s%s%s
"
,
command
.cmd
,
padding
,
command
.usage_line
);
print
ln!
(
" {}{}{}
"
,
command
.cmd
,
padding
,
command
.usage_line
);
}
io
::
print
(
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
10e7f12d
...
...
@@ -1822,17 +1822,17 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
}
io
::
println
(
"metadata stats:"
);
print
fln!
(
" inline bytes: %u
"
,
ecx
.stats.inline_bytes
);
print
fln!
(
" attribute bytes: %u
"
,
ecx
.stats.attr_bytes
);
print
fln!
(
" dep bytes: %u
"
,
ecx
.stats.dep_bytes
);
print
fln!
(
" lang item bytes: %u
"
,
ecx
.stats.lang_item_bytes
);
print
fln!
(
" link args bytes: %u
"
,
ecx
.stats.link_args_bytes
);
print
fln!
(
" impl bytes: %u
"
,
ecx
.stats.impl_bytes
);
print
fln!
(
" misc bytes: %u
"
,
ecx
.stats.misc_bytes
);
print
fln!
(
" item bytes: %u
"
,
ecx
.stats.item_bytes
);
print
fln!
(
" index bytes: %u
"
,
ecx
.stats.index_bytes
);
print
fln!
(
" zero bytes: %u
"
,
ecx
.stats.zero_bytes
);
print
fln!
(
" total bytes: %u
"
,
ecx
.stats.total_bytes
);
print
ln!
(
" inline bytes: {}
"
,
ecx
.stats.inline_bytes
);
print
ln!
(
" attribute bytes: {}
"
,
ecx
.stats.attr_bytes
);
print
ln!
(
" dep bytes: {}
"
,
ecx
.stats.dep_bytes
);
print
ln!
(
" lang item bytes: {}
"
,
ecx
.stats.lang_item_bytes
);
print
ln!
(
" link args bytes: {}
"
,
ecx
.stats.link_args_bytes
);
print
ln!
(
" impl bytes: {}
"
,
ecx
.stats.impl_bytes
);
print
ln!
(
" misc bytes: {}
"
,
ecx
.stats.misc_bytes
);
print
ln!
(
" item bytes: {}
"
,
ecx
.stats.item_bytes
);
print
ln!
(
" index bytes: {}
"
,
ecx
.stats.index_bytes
);
print
ln!
(
" zero bytes: {}
"
,
ecx
.stats.zero_bytes
);
print
ln!
(
" total bytes: {}
"
,
ecx
.stats.total_bytes
);
}
// Pad this, since something (LLVM, presumably) is cutting off the
...
...
src/librustc/middle/borrowck/mod.rs
浏览文件 @
10e7f12d
...
...
@@ -100,16 +100,16 @@ pub fn check_crate(
if
tcx
.sess
.borrowck_stats
()
{
io
::
println
(
"--- borrowck stats ---"
);
print
fln!
(
"paths requiring guarantees: %u
"
,
bccx
.stats.guaranteed_paths
);
print
fln!
(
"paths requiring loans : %s
"
,
make_stat
(
bccx
,
bccx
.stats.loaned_paths_same
));
print
fln!
(
"paths requiring imm loans : %s
"
,
make_stat
(
bccx
,
bccx
.stats.loaned_paths_imm
));
print
fln!
(
"stable paths : %s
"
,
make_stat
(
bccx
,
bccx
.stats.stable_paths
));
print
fln!
(
"paths requiring purity : %s
"
,
make_stat
(
bccx
,
bccx
.stats.req_pure_paths
));
print
ln!
(
"paths requiring guarantees: {}
"
,
bccx
.stats.guaranteed_paths
);
print
ln!
(
"paths requiring loans : {}
"
,
make_stat
(
bccx
,
bccx
.stats.loaned_paths_same
));
print
ln!
(
"paths requiring imm loans : {}
"
,
make_stat
(
bccx
,
bccx
.stats.loaned_paths_imm
));
print
ln!
(
"stable paths : {}
"
,
make_stat
(
bccx
,
bccx
.stats.stable_paths
));
print
ln!
(
"paths requiring purity : {}
"
,
make_stat
(
bccx
,
bccx
.stats.req_pure_paths
));
}
return
(
bccx
.root_map
,
bccx
.write_guard_map
);
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
10e7f12d
...
...
@@ -121,7 +121,7 @@ fn drop(&mut self) {
}
pub
fn
push_ctxt
(
s
:
&
'static
str
)
->
_
InsnCtxt
{
debug
!
(
"new InsnCtxt: %s
"
,
s
);
debug
2!
(
"new InsnCtxt: {}
"
,
s
);
do
local_data
::
modify
(
task_local_insn_key
)
|
c
|
{
do
c
.map_move
|
ctx
|
{
let
mut
ctx
=
(
*
ctx
)
.clone
();
...
...
@@ -3147,15 +3147,15 @@ pub fn trans_crate(sess: session::Session,
write_metadata
(
ccx
,
crate
);
if
ccx
.sess
.trans_stats
()
{
io
::
println
(
"--- trans stats ---"
);
print
fln!
(
"n_static_tydescs: %u
"
,
ccx
.stats.n_static_tydescs
);
print
fln!
(
"n_glues_created: %u
"
,
ccx
.stats.n_glues_created
);
print
fln!
(
"n_null_glues: %u
"
,
ccx
.stats.n_null_glues
);
print
fln!
(
"n_real_glues: %u
"
,
ccx
.stats.n_real_glues
);
print
fln!
(
"n_fns: %u
"
,
ccx
.stats.n_fns
);
print
fln!
(
"n_monos: %u
"
,
ccx
.stats.n_monos
);
print
fln!
(
"n_inlines: %u
"
,
ccx
.stats.n_inlines
);
print
fln!
(
"n_closures: %u
"
,
ccx
.stats.n_closures
);
print
ln!
(
"n_static_tydescs: {}
"
,
ccx
.stats.n_static_tydescs
);
print
ln!
(
"n_glues_created: {}
"
,
ccx
.stats.n_glues_created
);
print
ln!
(
"n_null_glues: {}
"
,
ccx
.stats.n_null_glues
);
print
ln!
(
"n_real_glues: {}
"
,
ccx
.stats.n_real_glues
);
print
ln!
(
"n_fns: {}
"
,
ccx
.stats.n_fns
);
print
ln!
(
"n_monos: {}
"
,
ccx
.stats.n_monos
);
print
ln!
(
"n_inlines: {}
"
,
ccx
.stats.n_inlines
);
print
ln!
(
"n_closures: {}
"
,
ccx
.stats.n_closures
);
io
::
println
(
"fn stats:"
);
do
sort
::
quick_sort
(
ccx
.stats.fn_stats
)
|
&
(
_
,
_
,
insns_a
),
&
(
_
,
_
,
insns_b
)|
{
insns_a
>
insns_b
...
...
@@ -3163,14 +3163,14 @@ pub fn trans_crate(sess: session::Session,
for
tuple
in
ccx
.stats.fn_stats
.iter
()
{
match
*
tuple
{
(
ref
name
,
ms
,
insns
)
=>
{
print
fln!
(
"%u insns, %u ms, %s
"
,
insns
,
ms
,
*
name
);
print
ln!
(
"{} insns, {} ms, {}
"
,
insns
,
ms
,
*
name
);
}
}
}
}
if
ccx
.sess
.count_llvm_insns
()
{
for
(
k
,
v
)
in
ccx
.stats.llvm_insns
.iter
()
{
print
fln!
(
"%-7u %s
"
,
*
v
,
*
k
);
print
ln!
(
"{:7u} {}
"
,
*
v
,
*
k
);
}
}
...
...
src/librustc/middle/trans/glue.rs
浏览文件 @
10e7f12d
...
...
@@ -646,8 +646,8 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
let
llty
=
type_of
(
ccx
,
t
);
if
ccx
.sess
.count_type_sizes
()
{
print
fln!
(
"%u
\t
%s
"
,
llsize_of_real
(
ccx
,
llty
),
ppaux
::
ty_to_str
(
ccx
.tcx
,
t
));
print
ln!
(
"{}
\t
{}
"
,
llsize_of_real
(
ccx
,
llty
),
ppaux
::
ty_to_str
(
ccx
.tcx
,
t
));
}
let
has_header
=
match
ty
::
get
(
t
)
.sty
{
...
...
src/librustc/rustc.rs
浏览文件 @
10e7f12d
...
...
@@ -130,13 +130,13 @@ pub fn version(argv0: &str) {
Some
(
vers
)
=>
vers
,
None
=>
"unknown version"
};
print
fln!
(
"%s %s
"
,
argv0
,
vers
);
print
fln!
(
"host: %s
"
,
host_triple
());
print
ln!
(
"{} {}
"
,
argv0
,
vers
);
print
ln!
(
"host: {}
"
,
host_triple
());
}
pub
fn
usage
(
argv0
:
&
str
)
{
let
message
=
fmt!
(
"Usage: %s [OPTIONS] INPUT"
,
argv0
);
print
fln!
(
"%s
\n
\
print
ln!
(
"{}
\n
\
Additional help:
-W help Print 'lint' options and default settings
-Z help Print internal options for debugging rustc
\n
"
,
...
...
@@ -167,16 +167,16 @@ fn padded(max: uint, s: &str) -> ~str {
str
::
from_utf8
(
vec
::
from_elem
(
max
-
s
.len
(),
' '
as
u8
))
+
s
}
println
(
"
\n
Available lint checks:
\n
"
);
print
fln!
(
" %s %7.7s %s
"
,
padded
(
max_key
,
"name"
),
"default"
,
"meaning"
);
print
fln!
(
" %s %7.7s %s
\n
"
,
padded
(
max_key
,
"----"
),
"-------"
,
"-------"
);
print
ln!
(
" {} {:7.7s} {}
"
,
padded
(
max_key
,
"name"
),
"default"
,
"meaning"
);
print
ln!
(
" {} {:7.7s} {}
\n
"
,
padded
(
max_key
,
"----"
),
"-------"
,
"-------"
);
for
(
spec
,
name
)
in
lint_dict
.move_iter
()
{
let
name
=
name
.replace
(
"_"
,
"-"
);
print
fln!
(
" %s %7.7s %s
"
,
padded
(
max_key
,
name
),
lint
::
level_to_str
(
spec
.default
),
spec
.desc
);
print
ln!
(
" {} {:7.7s} {}
"
,
padded
(
max_key
,
name
),
lint
::
level_to_str
(
spec
.default
),
spec
.desc
);
}
io
::
println
(
""
);
}
...
...
@@ -187,7 +187,7 @@ pub fn describe_debug_flags() {
for
tuple
in
r
.iter
()
{
match
*
tuple
{
(
ref
name
,
ref
desc
,
_
)
=>
{
print
fln!
(
" -Z %-20s -- %s
"
,
*
name
,
*
desc
);
print
ln!
(
" -Z {:>20s} -- {}
"
,
*
name
,
*
desc
);
}
}
}
...
...
src/librustc/util/common.rs
浏览文件 @
10e7f12d
...
...
@@ -22,7 +22,7 @@ pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {
let
start
=
extra
::
time
::
precise_time_s
();
let
rv
=
thunk
();
let
end
=
extra
::
time
::
precise_time_s
();
print
fln!
(
"time: %3.3f s
\t
%s
"
,
end
-
start
,
what
);
print
ln!
(
"time: {:3.3f} s
\t
{}
"
,
end
-
start
,
what
);
rv
}
...
...
src/librusti/rusti.rs
浏览文件 @
10e7f12d
...
...
@@ -437,7 +437,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
if
loaded_crates
.is_empty
()
{
println
(
"no crates loaded"
);
}
else
{
print
fln!
(
"crates loaded: %s
"
,
loaded_crates
.connect
(
", "
));
print
ln!
(
"crates loaded: {}
"
,
loaded_crates
.connect
(
", "
));
}
}
~
"{"
=>
{
...
...
src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs
浏览文件 @
10e7f12d
...
...
@@ -34,7 +34,7 @@ pub fn main() {
}
if
args
[
2
]
!=
~
"install"
{
print
fln!
(
"Warning: I don't know how to %s
"
,
args
[
2
]);
print
ln!
(
"Warning: I don't know how to {}
"
,
args
[
2
]);
return
;
}
...
...
src/libstd/iter.rs
浏览文件 @
10e7f12d
...
...
@@ -413,7 +413,7 @@ fn inspect<'r>(self, f: &'r fn(&A)) -> Inspect<'r, A, Self> {
/// use std::iter::count;
///
/// for i in count(0, 10) {
/// print
fln!("%d
", i);
/// print
ln!("{}
", i);
/// }
/// ```
#[inline]
...
...
src/libstd/rand/distributions.rs
浏览文件 @
10e7f12d
...
...
@@ -70,7 +70,7 @@ fn ziggurat<R:Rng>(rng: &mut R,
///
/// fn main() {
/// let normal = 2.0 + (*rand::random::<StandardNormal>()) * 3.0;
/// print
fln!("%f
is from a N(2, 9) distribution", normal)
/// print
ln!("{}
is from a N(2, 9) distribution", normal)
/// }
/// ```
pub
struct
StandardNormal
(
f64
);
...
...
@@ -124,7 +124,7 @@ fn zero_case<R:Rng>(rng: &mut R, u: f64) -> f64 {
///
/// fn main() {
/// let exp2 = (*rand::random::<Exp1>()) * 0.5;
/// print
fln!("%f
is from a Exp(2) distribution", exp2);
/// print
ln!("{}
is from a Exp(2) distribution", exp2);
/// }
/// ```
pub
struct
Exp1
(
f64
);
...
...
src/libstd/rand/mod.rs
浏览文件 @
10e7f12d
...
...
@@ -28,7 +28,7 @@
fn main() {
let mut rng = rand::rng();
if rng.gen() { // bool
print
fln!("int: %d, uint: %u", rng.gen(), rng.gen
())
print
ln!("int: {}, uint: {}", rng.gen::<int>(), rng.gen::<uint>
())
}
}
```
...
...
@@ -38,7 +38,7 @@ fn main() {
fn main () {
let tuple_ptr = rand::random::<~(f64, char)>();
print
f
ln!(tuple_ptr)
println!(tuple_ptr)
}
```
*/
...
...
@@ -270,8 +270,8 @@ pub trait Rng {
/// fn main() {
/// let rng = rand::task_rng();
/// let x: uint = rng.gen();
/// print
fln!(
x);
/// print
fln!(
rng.gen::<(float, bool)>());
/// print
ln!("{}",
x);
/// print
ln!("{:?}",
rng.gen::<(float, bool)>());
/// }
/// ```
#[inline(always)]
...
...
@@ -289,8 +289,8 @@ fn gen<T: Rand>(&mut self) -> T {
/// fn main() {
/// let rng = rand::task_rng();
/// let x: ~[uint] = rng.gen_vec(10);
/// print
fln!(
x);
/// print
fln!(
rng.gen_vec::<(float, bool)>(5));
/// print
ln!("{:?}",
x);
/// print
ln!("{:?}",
rng.gen_vec::<(float, bool)>(5));
/// }
/// ```
fn
gen_vec
<
T
:
Rand
>
(
&
mut
self
,
len
:
uint
)
->
~
[
T
]
{
...
...
@@ -314,9 +314,9 @@ fn gen_vec<T: Rand>(&mut self, len: uint) -> ~[T] {
/// fn main() {
/// let rng = rand::task_rng();
/// let n: uint = rng.gen_integer_range(0u, 10);
/// print
fln!(
n);
/// print
ln!("{}",
n);
/// let m: i16 = rng.gen_integer_range(-40, 400);
/// print
fln!(
m);
/// print
ln!("{}",
m);
/// }
/// ```
fn
gen_integer_range
<
T
:
Rand
+
Int
>
(
&
mut
self
,
low
:
T
,
high
:
T
)
->
T
{
...
...
@@ -341,7 +341,7 @@ fn gen_integer_range<T: Rand + Int>(&mut self, low: T, high: T) -> T {
///
/// fn main() {
/// let mut rng = rand::rng();
/// print
fln!("%b
", rng.gen_weighted_bool(3));
/// print
ln!("{:b}
", rng.gen_weighted_bool(3));
/// }
/// ```
fn
gen_weighted_bool
(
&
mut
self
,
n
:
uint
)
->
bool
{
...
...
@@ -385,8 +385,8 @@ fn choose<T: Clone>(&mut self, values: &[T]) -> T {
/// use std::rand;
///
/// fn main() {
/// print
fln!(
rand::task_rng().choose_option([1,2,4,8,16,32]));
/// print
fln!(
rand::task_rng().choose_option([]));
/// print
ln!("{:?}",
rand::task_rng().choose_option([1,2,4,8,16,32]));
/// print
ln!("{:?}",
rand::task_rng().choose_option([]));
/// }
/// ```
fn
choose_option
<
'a
,
T
>
(
&
mut
self
,
values
:
&
'a
[
T
])
->
Option
<&
'a
T
>
{
...
...
@@ -411,7 +411,7 @@ fn choose_option<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
/// let x = [rand::Weighted {weight: 4, item: 'a'},
/// rand::Weighted {weight: 2, item: 'b'},
/// rand::Weighted {weight: 2, item: 'c'}];
/// print
fln!("%c
", rng.choose_weighted(x));
/// print
ln!("{}
", rng.choose_weighted(x));
/// }
/// ```
fn
choose_weighted
<
T
:
Clone
>
(
&
mut
self
,
v
:
&
[
Weighted
<
T
>
])
->
T
{
...
...
@@ -432,7 +432,7 @@ fn choose_weighted<T:Clone>(&mut self, v: &[Weighted<T>]) -> T {
/// let x = [rand::Weighted {weight: 4, item: 'a'},
/// rand::Weighted {weight: 2, item: 'b'},
/// rand::Weighted {weight: 2, item: 'c'}];
/// print
fln!(
rng.choose_weighted_option(x));
/// print
ln!("{:?}",
rng.choose_weighted_option(x));
/// }
/// ```
fn
choose_weighted_option
<
T
:
Clone
>
(
&
mut
self
,
v
:
&
[
Weighted
<
T
>
])
...
...
@@ -469,7 +469,7 @@ fn choose_weighted_option<T:Clone>(&mut self, v: &[Weighted<T>])
/// let x = [rand::Weighted {weight: 4, item: 'a'},
/// rand::Weighted {weight: 2, item: 'b'},
/// rand::Weighted {weight: 2, item: 'c'}];
/// print
fln!(
rng.weighted_vec(x));
/// print
ln!("{}",
rng.weighted_vec(x));
/// }
/// ```
fn
weighted_vec
<
T
:
Clone
>
(
&
mut
self
,
v
:
&
[
Weighted
<
T
>
])
->
~
[
T
]
{
...
...
@@ -490,7 +490,7 @@ fn weighted_vec<T:Clone>(&mut self, v: &[Weighted<T>]) -> ~[T] {
/// use std::rand;
///
/// fn main() {
/// print
fln!(
rand::task_rng().shuffle(~[1,2,3]));
/// print
ln!("{:?}",
rand::task_rng().shuffle(~[1,2,3]));
/// }
/// ```
fn
shuffle
<
T
>
(
&
mut
self
,
values
:
~
[
T
])
->
~
[
T
]
{
...
...
@@ -510,9 +510,9 @@ fn shuffle<T>(&mut self, values: ~[T]) -> ~[T] {
/// let rng = rand::task_rng();
/// let mut y = [1,2,3];
/// rng.shuffle_mut(y);
/// print
fln!(
y);
/// print
ln!("{:?}",
y);
/// rng.shuffle_mut(y);
/// print
fln!(
y);
/// print
ln!("{:?}",
y);
/// }
/// ```
fn
shuffle_mut
<
T
>
(
&
mut
self
,
values
:
&
mut
[
T
])
{
...
...
@@ -535,7 +535,7 @@ fn shuffle_mut<T>(&mut self, values: &mut [T]) {
/// fn main() {
/// let rng = rand::task_rng();
/// let sample = rng.sample(range(1, 100), 5);
/// print
fln!(
sample);
/// print
ln!("{:?}",
sample);
/// }
/// ```
fn
sample
<
A
,
T
:
Iterator
<
A
>>
(
&
mut
self
,
iter
:
T
,
n
:
uint
)
->
~
[
A
]
{
...
...
src/libstd/str.rs
浏览文件 @
10e7f12d
...
...
@@ -1695,7 +1695,7 @@ pub trait StrSlice<'self> {
/// let i = 0u;
/// while i < s.len() {
/// let CharRange {ch, next} = s.char_range_at(i);
/// print
fln!("%u: %c
", i, ch);
/// print
ln!("{}: {}
", i, ch);
/// i = next;
/// }
/// ```
...
...
src/libstd/vec.rs
浏览文件 @
10e7f12d
...
...
@@ -1003,7 +1003,7 @@ fn rsplitn_iter(self, n: uint, pred: &'self fn(&T) -> bool) -> RSplitIterator<'s
* ```rust
* let v = &[1,2,3,4];
* for win in v.window_iter() {
* print
fln!(
win);
* print
ln!("{:?}",
win);
* }
* ```
*
...
...
@@ -1032,7 +1032,7 @@ fn window_iter(self, size: uint) -> WindowIter<'self, T> {
* ```rust
* let v = &[1,2,3,4,5];
* for win in v.chunk_iter() {
* print
fln!(
win);
* print
ln!("{:?}",
win);
* }
* ```
*
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
10e7f12d
...
...
@@ -1012,26 +1012,6 @@ mod $c {
}
)
// NOTE(acrichto): start removing this after the next snapshot
macro_rules! printf (
($arg:expr) => (
print(fmt!(
\"
%?
\"
, $arg))
);
($( $arg:expr ),+) => (
print(fmt!($($arg),+))
)
)
// NOTE(acrichto): start removing this after the next snapshot
macro_rules! printfln (
($arg:expr) => (
println(fmt!(
\"
%?
\"
, $arg))
);
($( $arg:expr ),+) => (
println(fmt!($($arg),+))
)
)
macro_rules! format(($($arg:tt)*) => (
format_args!(::std::fmt::format, $($arg)*)
))
...
...
src/libsyntax/ext/tt/macro_rules.rs
浏览文件 @
10e7f12d
...
...
@@ -66,7 +66,7 @@ fn generic_extension(cx: @ExtCtxt,
rhses
:
&
[
@
named_match
])
->
MacResult
{
if
cx
.trace_macros
()
{
print
fln!
(
"%s! { %s
}"
,
print
ln!
(
"{}!
\\
{ {}
\\
}"
,
cx
.str_of
(
name
),
print
::
pprust
::
tt_to_str
(
&
ast
::
tt_delim
(
@
mut
arg
.to_owned
()),
...
...
@@ -194,7 +194,7 @@ fn generic_extension(cx: @ExtCtxt,
rhses
:
&
[
@
named_match
])
->
MacResult
{
if
cx
.trace_macros
()
{
print
fln!
(
"%s! { %s
}"
,
print
ln!
(
"{}!
\\
{ {}
\\
}"
,
cx
.str_of
(
name
),
print
::
pprust
::
tt_to_str
(
&
ast
::
tt_delim
(
@
mut
arg
.to_owned
()),
...
...
src/test/bench/core-map.rs
浏览文件 @
10e7f12d
...
...
@@ -24,7 +24,7 @@ fn timed(label: &str, f: &fn()) {
let
start
=
time
::
precise_time_s
();
f
();
let
end
=
time
::
precise_time_s
();
print
fln!
(
" %s: %f
"
,
label
,
end
-
start
);
print
ln!
(
" {}: {}
"
,
label
,
end
-
start
);
}
fn
ascending
<
M
:
MutableMap
<
uint
,
uint
>>
(
map
:
&
mut
M
,
n_keys
:
uint
)
{
...
...
@@ -116,7 +116,7 @@ fn main() {
}
}
print
fln!
(
"%?
keys"
,
n_keys
);
print
ln!
(
"{}
keys"
,
n_keys
);
io
::
println
(
"
\n
TreeMap:"
);
...
...
src/test/bench/core-std.rs
浏览文件 @
10e7f12d
...
...
@@ -55,7 +55,7 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
test
();
let
stop
=
precise_time_s
();
print
fln!
(
"%s:
\t\t
%f
ms"
,
name
,
(
stop
-
start
)
*
1000
f
);
print
ln!
(
"{}:
\t\t
{}
ms"
,
name
,
(
stop
-
start
)
*
1000
f
);
}
fn
shift_push
()
{
...
...
src/test/bench/msgsend-ring-mutex-arcs.rs
浏览文件 @
10e7f12d
...
...
@@ -118,7 +118,7 @@ fn main() {
let
elapsed
=
(
stop
-
start
);
let
rate
=
(
num_msgs
as
float
)
/
elapsed
;
print
fln!
(
"Sent %? messages in %?
seconds"
,
num_msgs
,
elapsed
);
print
fln!
(
" %?
messages / second"
,
rate
);
print
fln!
(
" %?
μs / message"
,
1000000
.
/
rate
);
print
ln!
(
"Sent {} messages in {}
seconds"
,
num_msgs
,
elapsed
);
print
ln!
(
" {}
messages / second"
,
rate
);
print
ln!
(
" {}
μs / message"
,
1000000
.
/
rate
);
}
src/test/bench/msgsend-ring-rw-arcs.rs
浏览文件 @
10e7f12d
...
...
@@ -114,7 +114,7 @@ fn main() {
let
elapsed
=
(
stop
-
start
);
let
rate
=
(
num_msgs
as
float
)
/
elapsed
;
print
fln!
(
"Sent %? messages in %?
seconds"
,
num_msgs
,
elapsed
);
print
fln!
(
" %?
messages / second"
,
rate
);
print
fln!
(
" %?
μs / message"
,
1000000
.
/
rate
);
print
ln!
(
"Sent {} messages in {}
seconds"
,
num_msgs
,
elapsed
);
print
ln!
(
" {}
messages / second"
,
rate
);
print
ln!
(
" {}
μs / message"
,
1000000
.
/
rate
);
}
src/test/bench/shootout-ackermann.rs
浏览文件 @
10e7f12d
...
...
@@ -35,5 +35,5 @@ fn main() {
args
};
let
n
=
from_str
::
<
int
>
(
args
[
1
])
.unwrap
();
print
fln!
(
"Ack(3,%d): %d
\n
"
,
n
,
ack
(
3
,
n
));
print
ln!
(
"Ack(3,{}): {}
\n
"
,
n
,
ack
(
3
,
n
));
}
src/test/bench/shootout-binarytrees.rs
浏览文件 @
10e7f12d
...
...
@@ -61,7 +61,7 @@ fn main() {
let
stretch_depth
=
max_depth
+
1
;
let
stretch_tree
=
bottom_up_tree
(
&
stretch_arena
,
0
,
stretch_depth
);
print
fln!
(
"stretch tree of depth %d
\t
check: %d
"
,
print
ln!
(
"stretch tree of depth {}
\t
check: {}
"
,
stretch_depth
,
item_check
(
stretch_tree
));
...
...
@@ -79,11 +79,11 @@ fn main() {
chk
+=
item_check
(
temp_tree
);
i
+=
1
;
}
print
fln!
(
"%d
\t
trees of depth %d
\t
check: %d
"
,
print
ln!
(
"{}
\t
trees of depth {}
\t
check: {}
"
,
iterations
*
2
,
depth
,
chk
);
depth
+=
2
;
}
print
fln!
(
"long lived tree of depth %d
\t
check: %d
"
,
print
ln!
(
"long lived tree of depth {}
\t
check: {}
"
,
max_depth
,
item_check
(
long_lived_tree
));
}
src/test/bench/shootout-fannkuch-redux.rs
浏览文件 @
10e7f12d
...
...
@@ -94,5 +94,5 @@ fn fannkuch_redux(n: i32) -> i32 {
#[fixed_stack_segment]
fn
main
()
{
let
n
:
i32
=
FromStr
::
from_str
(
os
::
args
()[
1
])
.unwrap
();
print
fln!
(
"Pfannkuchen(%d) = %d
"
,
n
as
int
,
fannkuch_redux
(
n
)
as
int
);
print
ln!
(
"Pfannkuchen({}) = {}
"
,
n
as
int
,
fannkuch_redux
(
n
)
as
int
);
}
src/test/bench/shootout-fibo.rs
浏览文件 @
10e7f12d
...
...
@@ -31,5 +31,5 @@ fn main() {
args
};
let
n
=
from_str
::
<
int
>
(
args
[
1
])
.unwrap
();
print
fln!
(
"%d
\n
"
,
fib
(
n
));
print
ln!
(
"{}
\n
"
,
fib
(
n
));
}
src/test/bench/shootout-k-nucleotide.rs
浏览文件 @
10e7f12d
...
...
@@ -82,7 +82,7 @@ fn f(&self, entry: &mut Entry) {
impl
TableCallback
for
PrintCallback
{
fn
f
(
&
self
,
entry
:
&
mut
Entry
)
{
print
fln!
(
"%d
\t
%s
"
,
entry
.count
as
int
,
**
self
);
print
ln!
(
"{}
\t
{}
"
,
entry
.count
as
int
,
**
self
);
}
}
...
...
@@ -279,9 +279,9 @@ fn print_frequencies(frequencies: &Table, frame: i32) {
}
for
vector
.each
|
&
(
key
,
count
)|
{
print
fln!
(
"%s %.3f
"
,
key
.unpack
(
frame
),
(
count
as
float
*
100.0
)
/
(
total_count
as
float
));
print
ln!
(
"{} {:.3f}
"
,
key
.unpack
(
frame
),
(
count
as
float
*
100.0
)
/
(
total_count
as
float
));
}
}
...
...
src/test/bench/shootout-mandelbrot.rs
浏览文件 @
10e7f12d
...
...
@@ -16,7 +16,7 @@ fn main() {
let
mut
byte_acc
:
i8
=
0
;
let
mut
bit_num
:
i32
=
0
;
print
fln!
(
"P4
\n
%d %d"
,
w
as
int
,
h
as
int
);
print
ln!
(
"P4
\n
{} {}"
,
w
,
h
);
let
mode
=
"w"
;
let
stdout
=
fdopen
(
STDOUT_FILENO
as
c_int
,
transmute
(
&
mode
[
0
]));
...
...
src/test/bench/shootout-nbody.rs
浏览文件 @
10e7f12d
...
...
@@ -143,9 +143,9 @@ fn main() {
let
mut
bodies
=
BODIES
;
offset_momentum
(
&
mut
bodies
);
print
fln!
(
"%.9f
"
,
energy
(
&
bodies
)
as
float
);
print
ln!
(
"{:.9f}
"
,
energy
(
&
bodies
)
as
float
);
advance
(
&
mut
bodies
,
0.01
,
n
);
print
fln!
(
"%.9f
"
,
energy
(
&
bodies
)
as
float
);
print
ln!
(
"{:.9f}
"
,
energy
(
&
bodies
)
as
float
);
}
src/test/bench/shootout-spectralnorm.rs
浏览文件 @
10e7f12d
...
...
@@ -63,5 +63,5 @@ fn main() {
mult_AtAv
(
v
,
u
,
tmp
);
}
print
fln!
(
"%.9f
"
,
(
dot
(
u
,
v
)
/
dot
(
v
,
v
))
.sqrt
()
as
float
);
print
ln!
(
"{:.9f}
"
,
(
dot
(
u
,
v
)
/
dot
(
v
,
v
))
.sqrt
()
as
float
);
}
src/test/bench/shootout-threadring.rs
浏览文件 @
10e7f12d
...
...
@@ -40,11 +40,11 @@ fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
while
(
true
)
{
match
p
.recv
()
{
1
=>
{
print
fln!
(
"%d
\n
"
,
id
);
print
ln!
(
"{}
\n
"
,
id
);
return
;
}
token
=>
{
info
!
(
"thread: %d got token: %d
"
,
id
,
token
);
info
2!
(
"thread: {} got token: {}
"
,
id
,
token
);
ch
.send
(
token
-
1
);
if
token
<=
n_tasks
{
return
;
...
...
src/test/compile-fail/borrowck-auto-mut-ref-to-immut-var.rs
浏览文件 @
10e7f12d
...
...
@@ -18,7 +18,7 @@ struct Foo {
impl
Foo
{
pub
fn
printme
(
&
mut
self
)
{
print
fln!
(
"%d
"
,
self
.x
);
print
ln!
(
"{}
"
,
self
.x
);
}
}
...
...
src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
浏览文件 @
10e7f12d
...
...
@@ -9,5 +9,5 @@ fn a() -> &int {
fn
main
()
{
let
fifth
=
a
();
print
fln!
(
"%d
"
,
*
fifth
);
print
ln!
(
"{}
"
,
*
fifth
);
}
src/test/compile-fail/issue-3820.rs
浏览文件 @
10e7f12d
...
...
@@ -22,5 +22,4 @@ fn main() {
let
u
=
Thing
{
x
:
2
};
let
_
v
=
u
.mul
(
&
3
);
// This is ok
let
w
=
u
*
3
;
//~ ERROR binary operation * cannot be applied to type `Thing`
printfln!
(
"%i"
,
w
.x
);
}
src/test/compile-fail/issue-4335.rs
浏览文件 @
10e7f12d
...
...
@@ -14,5 +14,5 @@ fn f<'r, T>(v: &'r T) -> &'r fn()->T { id::<&'r fn()->T>(|| *v) } //~ ERROR cann
fn
main
()
{
let
v
=
&
5
;
print
fln!
(
"%d
"
,
f
(
v
)());
print
ln!
(
"{}
"
,
f
(
v
)());
}
src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
浏览文件 @
10e7f12d
...
...
@@ -28,7 +28,7 @@ fn innocent_looking_victim() {
match
x
{
Some
(
ref
msg
)
=>
{
(
f
.c
)(
f
,
true
);
print
fln!
(
msg
);
print
ln!
(
"{:?}"
,
msg
);
},
None
=>
fail
!
(
"oops"
),
}
...
...
src/test/compile-fail/tuple-struct-nonexhaustive.rs
浏览文件 @
10e7f12d
...
...
@@ -13,7 +13,7 @@
fn
main
()
{
let
x
=
Foo
(
1
,
2
);
match
x
{
//~ ERROR non-exhaustive
Foo
(
1
,
b
)
=>
print
fln!
(
"%d
"
,
b
),
Foo
(
2
,
b
)
=>
print
fln!
(
"%d
"
,
b
)
Foo
(
1
,
b
)
=>
print
ln!
(
"{}
"
,
b
),
Foo
(
2
,
b
)
=>
print
ln!
(
"{}
"
,
b
)
}
}
src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs
浏览文件 @
10e7f12d
...
...
@@ -33,5 +33,5 @@ pub fn main()
let
z
=
@
mut
[
1
,
2
,
3
];
let
z2
=
z
;
add
(
z
.my_mut_slice
(),
z2
.my_slice
());
print
fln!
(
"%d
"
,
z
[
0
]);
print
ln!
(
"{}
"
,
z
[
0
]);
}
src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
浏览文件 @
10e7f12d
...
...
@@ -12,5 +12,5 @@ pub fn main()
let
z
=
@
mut
[
1
,
2
,
3
];
let
z2
=
z
;
add
(
z
,
z2
);
print
fln!
(
"%d
"
,
z
[
0
]);
print
ln!
(
"{}
"
,
z
[
0
]);
}
src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
浏览文件 @
10e7f12d
...
...
@@ -13,5 +13,5 @@ pub fn main()
let
z
=
@
mut
[
1
,
2
,
3
];
let
z2
=
z
;
add
(
&
mut
z
[
0
],
&
z2
[
0
]);
print
fln!
(
"%d
"
,
z
[
0
]);
print
ln!
(
"{}
"
,
z
[
0
]);
}
src/test/run-fail/borrowck-wg-two-array-indices.rs
浏览文件 @
10e7f12d
...
...
@@ -13,5 +13,5 @@ pub fn main()
let
z
=
@
mut
[
1
,
2
,
3
];
let
z2
=
z
;
add
(
&
mut
z
[
0
],
&
mut
z2
[
0
]);
print
fln!
(
"%d
"
,
z
[
0
]);
print
ln!
(
"{}
"
,
z
[
0
]);
}
src/test/run-pass/auto-ref.rs
浏览文件 @
10e7f12d
...
...
@@ -18,7 +18,7 @@ trait Stuff {
impl
Stuff
for
Foo
{
fn
printme
(
&
self
)
{
print
fln!
(
"%d
"
,
self
.x
);
print
ln!
(
"{}
"
,
self
.x
);
}
}
...
...
src/test/run-pass/borrowck-wg-two-imm-borrows.rs
浏览文件 @
10e7f12d
...
...
@@ -10,5 +10,5 @@ pub fn main()
let
z
=
@
mut
[
1
,
2
,
3
];
let
z2
=
z
;
add
(
&
z
[
0
],
&
z2
[
0
]);
print
fln!
(
"%d
"
,
z
[
0
]);
print
ln!
(
"{}
"
,
z
[
0
]);
}
src/test/run-pass/cci_impl_exe.rs
浏览文件 @
10e7f12d
...
...
@@ -19,7 +19,7 @@ pub fn main() {
//info!("%?", bt0);
do
3u
.to
(
10u
)
|
i
|
{
print
fln!
(
"%u
"
,
i
);
print
ln!
(
"{}
"
,
i
);
//let bt1 = sys::frame_address();
//info!("%?", bt1);
...
...
src/test/run-pass/cci_iter_exe.rs
浏览文件 @
10e7f12d
...
...
@@ -17,7 +17,7 @@ pub fn main() {
//let bt0 = sys::rusti::frame_address(1u32);
//info!("%?", bt0);
do
cci_iter_lib
::
iter
([
1
,
2
,
3
])
|
i
|
{
print
f!
(
"%d
"
,
*
i
);
print
ln!
(
"{}
"
,
*
i
);
//assert!(bt0 == sys::rusti::frame_address(2u32));
}
}
src/test/run-pass/cci_no_inline_exe.rs
浏览文件 @
10e7f12d
...
...
@@ -23,7 +23,7 @@ pub fn main() {
//let bt0 = sys::frame_address();
//info!("%?", bt0);
do
iter
(
~
[
1u
,
2u
,
3u
])
|
i
|
{
print
fln!
(
"%u
"
,
i
);
print
ln!
(
"{}
"
,
i
);
//let bt1 = sys::frame_address();
//info!("%?", bt1);
...
...
src/test/run-pass/const-fields-and-indexing.rs
浏览文件 @
10e7f12d
...
...
@@ -25,9 +25,9 @@ struct D { d: int, e: int }
static
m
:
int
=
k
.c.e
;
pub
fn
main
()
{
print
fln!
(
p
);
print
fln!
(
q
);
print
fln!
(
t
);
print
ln!
(
"{:?}"
,
p
);
print
ln!
(
"{:?}"
,
q
);
print
ln!
(
"{:?}"
,
t
);
assert_eq!
(
p
,
3
);
assert_eq!
(
q
,
3
);
assert_eq!
(
t
,
20
);
...
...
src/test/run-pass/const-rec-and-tup.rs
浏览文件 @
10e7f12d
...
...
@@ -21,5 +21,5 @@ struct AnotherPair { x: (i64, i64), y: Pair }
pub
fn
main
()
{
let
(
p
,
_
)
=
y
.x
;
assert_eq!
(
p
,
-
1085102592571150096
);
print
fln!
(
"0x%x"
,
p
as
uint
);
print
ln!
(
"{:#x}"
,
p
);
}
src/test/run-pass/const-region-ptrs.rs
浏览文件 @
10e7f12d
...
...
@@ -15,8 +15,8 @@ struct Pair<'self> { a: int, b: &'self int }
static
y
:
&
'static
Pair
<
'static
>
=
&
Pair
{
a
:
15
,
b
:
x
};
pub
fn
main
()
{
print
fln!
(
"x = %?
"
,
*
x
);
print
fln!
(
"y = {a: %?, b: %?
}"
,
y
.a
,
*
(
y
.b
));
print
ln!
(
"x = {}
"
,
*
x
);
print
ln!
(
"y =
\\
{a: {}, b: {}
\\
}"
,
y
.a
,
*
(
y
.b
));
assert_eq!
(
*
x
,
10
);
assert_eq!
(
*
(
y
.b
),
10
);
}
src/test/run-pass/const-struct.rs
浏览文件 @
10e7f12d
...
...
@@ -32,6 +32,6 @@ pub fn main() {
assert_eq!
(
z
.b
,
22
);
assert_eq!
(
w
.a
,
5
);
assert_eq!
(
w
.c
,
3
);
print
fln!
(
"0x%x"
,
x
.b
as
uint
);
print
fln!
(
"0x%x"
,
z
.c
as
uint
);
print
ln!
(
"{:#x}"
,
x
.b
);
print
ln!
(
"{:#x}"
,
z
.c
);
}
src/test/run-pass/const-vecs-and-slices.rs
浏览文件 @
10e7f12d
...
...
@@ -12,8 +12,8 @@
static
y
:
&
'static
[
int
]
=
&
[
1
,
2
,
3
,
4
];
pub
fn
main
()
{
print
fln!
(
x
[
1
]);
print
fln!
(
y
[
1
]);
print
ln!
(
"{:?}"
,
x
[
1
]);
print
ln!
(
"{:?}"
,
y
[
1
]);
assert_eq!
(
x
[
1
],
2
);
assert_eq!
(
x
[
3
],
4
);
assert_eq!
(
x
[
3
],
y
[
3
]);
...
...
src/test/run-pass/functional-struct-upd.rs
浏览文件 @
10e7f12d
...
...
@@ -16,5 +16,5 @@ struct Foo {
pub
fn
main
()
{
let
a
=
Foo
{
x
:
1
,
y
:
2
};
let
c
=
Foo
{
x
:
4
,
..
a
};
print
fln!
(
c
);
print
ln!
(
"{:?}"
,
c
);
}
src/test/run-pass/issue-2185.rs
浏览文件 @
10e7f12d
...
...
@@ -82,5 +82,5 @@ pub fn main() {
a
);
let
sum
=
foldl
(
filt
,
0u
,
|
accum
,
&&
n
:
uint
|
accum
+
n
);
print
fln!
(
"%u
"
,
sum
);
print
ln!
(
"{}
"
,
sum
);
}
src/test/run-pass/issue-2989.rs
浏览文件 @
10e7f12d
...
...
@@ -40,7 +40,7 @@ pub fn main() {
let
bools2
=
to_bools
(
Storage
{
storage
:
~
[
0b01100100
]});
for
i
in
range
(
0u
,
8
)
{
print
fln!
(
"%u => %u vs %u"
,
i
,
bools
[
i
]
as
uint
,
bools2
[
i
]
as
uint
);
print
ln!
(
"{} => {} vs {}"
,
i
,
bools
[
i
],
bools2
[
i
]
);
}
assert_eq!
(
bools
,
bools2
);
...
...
src/test/run-pass/issue-3211.rs
浏览文件 @
10e7f12d
...
...
@@ -4,5 +4,5 @@ pub fn main() {
x
+=
1
;
}
assert_eq!
(
x
,
4096
);
print
fln!
(
"x = %u
"
,
x
);
print
ln!
(
"x = {}
"
,
x
);
}
src/test/run-pass/issue-3743.rs
浏览文件 @
10e7f12d
...
...
@@ -40,11 +40,11 @@ pub fn main() {
// the following compiles and works properly
let
v1
:
Vec2
=
a
*
3
f
;
print
fln!
(
"%f %f
"
,
v1
.x
,
v1
.y
);
print
ln!
(
"{} {}
"
,
v1
.x
,
v1
.y
);
// the following compiles but v2 will not be Vec2 yet and
// using it later will cause an error that the type of v2
// must be known
let
v2
=
a
*
3
f
;
print
fln!
(
"%f %f
"
,
v2
.x
,
v2
.y
);
// error regarding v2's type
print
ln!
(
"{} {}
"
,
v2
.x
,
v2
.y
);
// error regarding v2's type
}
src/test/run-pass/issue-3753.rs
浏览文件 @
10e7f12d
...
...
@@ -35,5 +35,5 @@ pub fn area(&self, sh: Shape) -> float {
pub
fn
main
(){
let
s
=
Circle
(
Point
{
x
:
1
f
,
y
:
2
f
},
3
f
);
print
fln!
(
"%f
"
,
s
.area
(
s
));
print
ln!
(
"{}
"
,
s
.area
(
s
));
}
src/test/run-pass/issue-3794.rs
浏览文件 @
10e7f12d
...
...
@@ -18,7 +18,7 @@ struct S {
impl
T
for
S
{
fn
print
(
&
self
)
{
print
fln!
(
self
);
print
ln!
(
"{:?}"
,
self
);
}
}
...
...
src/test/run-pass/issue-3904.rs
浏览文件 @
10e7f12d
...
...
@@ -12,7 +12,7 @@
type
ErrPrinter
=
&
fn
(
&
str
,
&
str
);
fn
example_err
(
prog
:
&
str
,
arg
:
&
str
)
{
print
fln!
(
"%s: %s
"
,
prog
,
arg
)
print
ln!
(
"{}: {}
"
,
prog
,
arg
)
}
fn
exit
(
+
print
:
ErrPrinter
,
prog
:
&
str
,
arg
:
&
str
)
{
...
...
src/test/run-pass/issue-4241.rs
浏览文件 @
10e7f12d
...
...
@@ -114,7 +114,6 @@ fn query(cmd: ~[~str], sb: TcpSocketBuf) -> Result {
//io::println(cmd);
sb
.write_str
(
cmd
);
let
res
=
parse_response
(
@
sb
as
@
io
::
Reader
);
//printfln!(res);
res
}
...
...
@@ -122,7 +121,7 @@ fn query2(cmd: ~[~str]) -> Result {
let
_
cmd
=
cmd_to_str
(
cmd
);
do
io
::
with_str_reader
(
~
"$3
\r\n
XXX
\r\n
"
)
|
sb
|
{
let
res
=
parse_response
(
@
sb
as
@
io
::
Reader
);
print
fln!
(
res
);
print
ln!
(
"{:?}"
,
res
);
res
}
}
...
...
src/test/run-pass/issue-4401.rs
浏览文件 @
10e7f12d
...
...
@@ -4,5 +4,5 @@ pub fn main() {
count
+=
1
;
}
assert_eq!
(
count
,
999_999
);
print
fln!
(
"%u
"
,
count
);
print
ln!
(
"{}
"
,
count
);
}
src/test/run-pass/link-section.rs
浏览文件 @
10e7f12d
...
...
@@ -29,6 +29,6 @@ fn i_live_in_more_text() -> &'static str {
pub
fn
main
()
{
unsafe
{
frobulator
=
0xcafebabe
;
print
fln!
(
"%? %? %?
"
,
i_live_in_more_text
(),
magic
,
frobulator
);
print
ln!
(
"{} {} {}
"
,
i_live_in_more_text
(),
magic
,
frobulator
);
}
}
src/test/run-pass/max-min-classes.rs
浏览文件 @
10e7f12d
...
...
@@ -35,5 +35,5 @@ fn Foo(x: int, y: int) -> Foo {
pub
fn
main
()
{
let
foo
=
Foo
(
3
,
20
);
print
fln!
(
"%d %d
"
,
foo
.sum
(),
foo
.product
());
print
ln!
(
"{} {}
"
,
foo
.sum
(),
foo
.product
());
}
src/test/run-pass/new-style-constants.rs
浏览文件 @
10e7f12d
...
...
@@ -13,5 +13,5 @@
static
FOO
:
int
=
3
;
pub
fn
main
()
{
print
fln!
(
"%d
"
,
FOO
);
print
ln!
(
"{}
"
,
FOO
);
}
src/test/run-pass/new-style-fixed-length-vec.rs
浏览文件 @
10e7f12d
...
...
@@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
std
::
io
::
println
;
static
FOO
:
[
int
,
..
3
]
=
[
1
,
2
,
3
];
pub
fn
main
()
{
print
fln!
(
"%d %d %d
"
,
FOO
[
0
],
FOO
[
1
],
FOO
[
2
]);
print
ln!
(
"{} {} {}
"
,
FOO
[
0
],
FOO
[
1
],
FOO
[
2
]);
}
src/test/run-pass/newtype.rs
浏览文件 @
10e7f12d
...
...
@@ -16,6 +16,6 @@ struct Mytype {compute: extern fn(mytype) -> int, val: int}
pub
fn
main
()
{
let
myval
=
mytype
(
Mytype
{
compute
:
compute
,
val
:
30
});
print
fln!
(
"%d
"
,
compute
(
myval
));
print
ln!
(
"{}
"
,
compute
(
myval
));
assert_eq!
((
myval
.compute
)(
myval
),
50
);
}
src/test/run-pass/placement-new-arena.rs
浏览文件 @
10e7f12d
...
...
@@ -17,6 +17,6 @@ pub fn main() {
let
mut
arena
=
Arena
::
new
();
let
p
=
&
mut
arena
;
let
x
=
p
.alloc
(||
4u
);
print
f!
(
"%u
"
,
*
x
);
print
ln!
(
"{}
"
,
*
x
);
assert_eq!
(
*
x
,
4u
);
}
src/test/run-pass/recursion.rs
浏览文件 @
10e7f12d
...
...
@@ -30,5 +30,5 @@ fn test<T:Dot> (n:int, i:int, first:T, second:T) ->int {
}
pub
fn
main
()
{
let
n
=
test
(
1
,
0
,
Nil
,
Nil
);
print
fln!
(
"%d
"
,
n
);
print
ln!
(
"{}
"
,
n
);
}
src/test/run-pass/reflect-visit-data.rs
浏览文件 @
10e7f12d
...
...
@@ -647,9 +647,9 @@ pub fn main() {
let
r
=
u
.vals
.clone
();
for
s
in
r
.iter
()
{
print
fln!
(
"val: %s
"
,
*
s
);
print
ln!
(
"val: {}
"
,
*
s
);
}
error
!
(
"%?
"
,
u
.vals
.clone
());
error
2!
(
"{:?}
"
,
u
.vals
.clone
());
assert_eq!
(
u
.vals
.clone
(),
~
[
~
"1"
,
~
"2"
,
~
"3"
,
~
"true"
,
~
"false"
,
~
"5"
,
~
"4"
,
~
"3"
,
~
"12"
]);
}
...
...
src/test/run-pass/reflect-visit-type.rs
浏览文件 @
10e7f12d
...
...
@@ -161,7 +161,7 @@ pub fn main() {
visit_ty
::
<~
[
int
]
>
(
&
mut
v
);
for
s
in
v
.types
.iter
()
{
print
fln!
(
"type: %s
"
,
(
*
s
)
.clone
());
print
ln!
(
"type: {}
"
,
(
*
s
)
.clone
());
}
assert_eq!
((
*
v
.types
)
.clone
(),
~
[
~
"bool"
,
~
"int"
,
~
"i8"
,
~
"i16"
,
~
"["
,
~
"int"
,
~
"]"
]);
}
src/test/run-pass/struct-pattern-matching.rs
浏览文件 @
10e7f12d
...
...
@@ -16,6 +16,6 @@ struct Foo {
pub
fn
main
()
{
let
a
=
Foo
{
x
:
1
,
y
:
2
};
match
a
{
Foo
{
x
:
x
,
y
:
y
}
=>
print
fln!
(
"yes, %d, %d
"
,
x
,
y
)
Foo
{
x
:
x
,
y
:
y
}
=>
print
ln!
(
"yes, {}, {}
"
,
x
,
y
)
}
}
src/test/run-pass/trait-inheritance-num2.rs
浏览文件 @
10e7f12d
...
...
@@ -99,7 +99,7 @@ impl FloatExt for f64 {}
impl
FloatExt
for
float
{}
fn
test_float_ext
<
T
:
FloatExt
>
(
n
:
T
)
{
print
fln!
(
n
<
n
)
}
fn
test_float_ext
<
T
:
FloatExt
>
(
n
:
T
)
{
print
ln!
(
"{}"
,
n
<
n
)
}
pub
fn
main
()
{
test_float_ext
(
1f32
);
...
...
src/test/run-pass/trait-inheritance-num3.rs
浏览文件 @
10e7f12d
...
...
@@ -16,7 +16,7 @@ pub trait NumExt: Eq + Ord + Num + NumCast {}
impl
NumExt
for
f32
{}
fn
num_eq_one
<
T
:
NumExt
>
(
n
:
T
)
{
print
fln!
(
n
==
NumCast
::
from
(
1
))
print
ln!
(
"{}"
,
n
==
NumCast
::
from
(
1
))
}
pub
fn
main
()
{
...
...
src/test/run-pass/tuple-struct-construct.rs
浏览文件 @
10e7f12d
...
...
@@ -12,5 +12,5 @@
pub
fn
main
()
{
let
x
=
Foo
(
1
,
2
);
print
fln!
(
x
);
print
ln!
(
"{:?}"
,
x
);
}
src/test/run-pass/tuple-struct-destructuring.rs
浏览文件 @
10e7f12d
...
...
@@ -13,7 +13,7 @@
pub
fn
main
()
{
let
x
=
Foo
(
1
,
2
);
let
Foo
(
y
,
z
)
=
x
;
print
fln!
(
"%d %d
"
,
y
,
z
);
print
ln!
(
"{} {}
"
,
y
,
z
);
assert_eq!
(
y
,
1
);
assert_eq!
(
z
,
2
);
}
src/test/run-pass/tuple-struct-matching.rs
浏览文件 @
10e7f12d
...
...
@@ -16,7 +16,7 @@ pub fn main() {
Foo
(
a
,
b
)
=>
{
assert_eq!
(
a
,
1
);
assert_eq!
(
b
,
2
);
print
fln!
(
"%d %d
"
,
a
,
b
);
print
ln!
(
"{} {}
"
,
a
,
b
);
}
}
}
src/test/run-pass/vec-fixed-length.rs
浏览文件 @
10e7f12d
...
...
@@ -10,5 +10,5 @@
pub
fn
main
()
{
let
x
:
[
int
,
..
4
]
=
[
1
,
2
,
3
,
4
];
print
fln!
(
"%d
"
,
x
[
0
]);
print
ln!
(
"{}
"
,
x
[
0
]);
}
src/test/run-pass/vec-matching-legal-tail-element-borrow.rs
浏览文件 @
10e7f12d
...
...
@@ -5,6 +5,6 @@ pub fn main() {
[
1
,
..
ref
tail
]
=>
&
tail
[
0
],
_
=>
unreachable!
()
};
print
fln!
(
"%d
"
,
*
el
);
print
ln!
(
"{}
"
,
*
el
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录