Skip to content

Commit 9ea5e29

Browse files
committed
---
yaml --- r: 83493 b: refs/heads/try c: 1434b4b h: refs/heads/master i: 83491: 3f7e8ed v: v3
1 parent 7e0d7f1 commit 9ea5e29

File tree

91 files changed

+323
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+323
-308
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 409182de6d74889134209e7fc98174eb8f267170
5+
refs/heads/try: 1434b4bfcafe90cffa6627e3be18a9e5b6501ad1
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/base64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'self> ToBase64 for &'self [u8] {
6868
*
6969
* fn main () {
7070
* let str = [52,32].to_base64(standard);
71-
* println!("{}", str);
71+
* printfln!("%s", str);
7272
* }
7373
* ```
7474
*/
@@ -177,11 +177,11 @@ impl<'self> FromBase64 for &'self str {
177177
*
178178
* fn main () {
179179
* let hello_str = "Hello, World".to_base64(standard);
180-
* println!("{}", hello_str);
180+
* printfln!("%s", hello_str);
181181
* let bytes = hello_str.from_base64();
182-
* println!("{:?}", bytes);
182+
* printfln!("%?", bytes);
183183
* let result_str = str::from_utf8(bytes);
184-
* println!("{}", result_str);
184+
* printfln!("%s", result_str);
185185
* }
186186
* ```
187187
*/

branches/try/src/libextra/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* # fn make_a_sandwich() {};
2020
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
2121
* make_a_sandwich();
22-
* println!("fib(5000) = {}", delayed_fib.get())
22+
* printfln!("fib(5000) = %?", delayed_fib.get())
2323
* ```
2424
*/
2525

branches/try/src/libextra/getopts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
//! }
4444
//!
4545
//! fn print_usage(program: &str, _opts: &[Opt]) {
46-
//! println!("Usage: {} [options]", program);
46+
//! printfln!("Usage: %s [options]", program);
4747
//! println("-o\t\tOutput");
4848
//! println("-h --help\tUsage");
4949
//! }

branches/try/src/libextra/hex.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'self> ToHex for &'self [u8] {
3333
*
3434
* fn main () {
3535
* let str = [52,32].to_hex();
36-
* println!("{}", str);
36+
* printfln!("%s", str);
3737
* }
3838
* ```
3939
*/
@@ -77,11 +77,11 @@ impl<'self> FromHex for &'self str {
7777
*
7878
* fn main () {
7979
* let hello_str = "Hello, World".to_hex();
80-
* println!("{}", hello_str);
80+
* printfln!("%s", hello_str);
8181
* let bytes = hello_str.from_hex().unwrap();
82-
* println!("{:?}", bytes);
82+
* printfln!("%?", bytes);
8383
* let result_str = str::from_utf8(bytes);
84-
* println!("{}", result_str);
84+
* printfln!("%s", result_str);
8585
* }
8686
* ```
8787
*/

branches/try/src/libextra/task_pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ fn test_task_pool() {
103103
};
104104
let mut pool = TaskPool::new(4, Some(SingleThreaded), f);
105105
do 8.times {
106-
pool.execute(|i| println!("Hello from thread {}!", *i));
106+
pool.execute(|i| printfln!("Hello from thread %u!", *i));
107107
}
108108
}

branches/try/src/librust/rust.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
136136
match find_cmd(command_string) {
137137
Some(command) => {
138138
match command.action {
139-
CallMain(prog, _) => println!(
140-
"The {} command is an alias for the {} program.",
139+
CallMain(prog, _) => printfln!(
140+
"The %s command is an alias for the %s program.",
141141
command.cmd, prog),
142142
_ => ()
143143
}
144144
match command.usage_full {
145-
UsgStr(msg) => println!("{}\n", msg),
145+
UsgStr(msg) => printfln!("%s\n", msg),
146146
UsgCall(f) => f(),
147147
}
148148
Valid(0)
@@ -215,7 +215,7 @@ fn usage() {
215215

216216
for command in COMMANDS.iter() {
217217
let padding = " ".repeat(INDENT - command.cmd.len());
218-
println!(" {}{}{}", command.cmd, padding, command.usage_line);
218+
printfln!(" %s%s%s", command.cmd, padding, command.usage_line);
219219
}
220220

221221
io::print(

branches/try/src/librustc/metadata/encoder.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,17 +1822,17 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
18221822
}
18231823

18241824
io::println("metadata stats:");
1825-
println!(" inline bytes: {}", ecx.stats.inline_bytes);
1826-
println!(" attribute bytes: {}", ecx.stats.attr_bytes);
1827-
println!(" dep bytes: {}", ecx.stats.dep_bytes);
1828-
println!(" lang item bytes: {}", ecx.stats.lang_item_bytes);
1829-
println!(" link args bytes: {}", ecx.stats.link_args_bytes);
1830-
println!(" impl bytes: {}", ecx.stats.impl_bytes);
1831-
println!(" misc bytes: {}", ecx.stats.misc_bytes);
1832-
println!(" item bytes: {}", ecx.stats.item_bytes);
1833-
println!(" index bytes: {}", ecx.stats.index_bytes);
1834-
println!(" zero bytes: {}", ecx.stats.zero_bytes);
1835-
println!(" total bytes: {}", ecx.stats.total_bytes);
1825+
printfln!(" inline bytes: %u", ecx.stats.inline_bytes);
1826+
printfln!(" attribute bytes: %u", ecx.stats.attr_bytes);
1827+
printfln!(" dep bytes: %u", ecx.stats.dep_bytes);
1828+
printfln!(" lang item bytes: %u", ecx.stats.lang_item_bytes);
1829+
printfln!(" link args bytes: %u", ecx.stats.link_args_bytes);
1830+
printfln!(" impl bytes: %u", ecx.stats.impl_bytes);
1831+
printfln!(" misc bytes: %u", ecx.stats.misc_bytes);
1832+
printfln!(" item bytes: %u", ecx.stats.item_bytes);
1833+
printfln!(" index bytes: %u", ecx.stats.index_bytes);
1834+
printfln!(" zero bytes: %u", ecx.stats.zero_bytes);
1835+
printfln!(" total bytes: %u", ecx.stats.total_bytes);
18361836
}
18371837

18381838
// Pad this, since something (LLVM, presumably) is cutting off the

branches/try/src/librustc/middle/borrowck/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ pub fn check_crate(
100100

101101
if tcx.sess.borrowck_stats() {
102102
io::println("--- borrowck stats ---");
103-
println!("paths requiring guarantees: {}",
104-
bccx.stats.guaranteed_paths);
105-
println!("paths requiring loans : {}",
106-
make_stat(bccx, bccx.stats.loaned_paths_same));
107-
println!("paths requiring imm loans : {}",
108-
make_stat(bccx, bccx.stats.loaned_paths_imm));
109-
println!("stable paths : {}",
110-
make_stat(bccx, bccx.stats.stable_paths));
111-
println!("paths requiring purity : {}",
112-
make_stat(bccx, bccx.stats.req_pure_paths));
103+
printfln!("paths requiring guarantees: %u",
104+
bccx.stats.guaranteed_paths);
105+
printfln!("paths requiring loans : %s",
106+
make_stat(bccx, bccx.stats.loaned_paths_same));
107+
printfln!("paths requiring imm loans : %s",
108+
make_stat(bccx, bccx.stats.loaned_paths_imm));
109+
printfln!("stable paths : %s",
110+
make_stat(bccx, bccx.stats.stable_paths));
111+
printfln!("paths requiring purity : %s",
112+
make_stat(bccx, bccx.stats.req_pure_paths));
113113
}
114114

115115
return (bccx.root_map, bccx.write_guard_map);

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl Drop for _InsnCtxt {
121121
}
122122

123123
pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
124-
debug2!("new InsnCtxt: {}", s);
124+
debug!("new InsnCtxt: %s", s);
125125
do local_data::modify(task_local_insn_key) |c| {
126126
do c.map_move |ctx| {
127127
let mut ctx = (*ctx).clone();
@@ -3156,30 +3156,30 @@ pub fn trans_crate(sess: session::Session,
31563156
write_metadata(ccx, crate);
31573157
if ccx.sess.trans_stats() {
31583158
io::println("--- trans stats ---");
3159-
println!("n_static_tydescs: {}", ccx.stats.n_static_tydescs);
3160-
println!("n_glues_created: {}", ccx.stats.n_glues_created);
3161-
println!("n_null_glues: {}", ccx.stats.n_null_glues);
3162-
println!("n_real_glues: {}", ccx.stats.n_real_glues);
3163-
3164-
println!("n_fns: {}", ccx.stats.n_fns);
3165-
println!("n_monos: {}", ccx.stats.n_monos);
3166-
println!("n_inlines: {}", ccx.stats.n_inlines);
3167-
println!("n_closures: {}", ccx.stats.n_closures);
3159+
printfln!("n_static_tydescs: %u", ccx.stats.n_static_tydescs);
3160+
printfln!("n_glues_created: %u", ccx.stats.n_glues_created);
3161+
printfln!("n_null_glues: %u", ccx.stats.n_null_glues);
3162+
printfln!("n_real_glues: %u", ccx.stats.n_real_glues);
3163+
3164+
printfln!("n_fns: %u", ccx.stats.n_fns);
3165+
printfln!("n_monos: %u", ccx.stats.n_monos);
3166+
printfln!("n_inlines: %u", ccx.stats.n_inlines);
3167+
printfln!("n_closures: %u", ccx.stats.n_closures);
31683168
io::println("fn stats:");
31693169
do sort::quick_sort(ccx.stats.fn_stats) |&(_, _, insns_a), &(_, _, insns_b)| {
31703170
insns_a > insns_b
31713171
}
31723172
for tuple in ccx.stats.fn_stats.iter() {
31733173
match *tuple {
31743174
(ref name, ms, insns) => {
3175-
println!("{} insns, {} ms, {}", insns, ms, *name);
3175+
printfln!("%u insns, %u ms, %s", insns, ms, *name);
31763176
}
31773177
}
31783178
}
31793179
}
31803180
if ccx.sess.count_llvm_insns() {
31813181
for (k, v) in ccx.stats.llvm_insns.iter() {
3182-
println!("{:7u} {}", *v, *k);
3182+
printfln!("%-7u %s", *v, *k);
31833183
}
31843184
}
31853185

branches/try/src/librustc/middle/trans/controlflow.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use syntax::ast;
2525
use syntax::ast::Name;
2626
use syntax::ast_util;
2727
use syntax::codemap::Span;
28+
use syntax::visit::Visitor;
2829

2930
pub fn trans_block(bcx: @mut Block, b: &ast::Block, dest: expr::Dest) -> @mut Block {
3031
let _icx = push_ctxt("trans_block");
@@ -64,12 +65,22 @@ pub fn trans_if(bcx: @mut Block,
6465
// Drop branches that are known to be impossible
6566
if is_const(cond_val) && !is_undef(cond_val) {
6667
if const_to_uint(cond_val) == 1 {
68+
match els {
69+
Some(elexpr) => {
70+
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx };
71+
trans.visit_expr(elexpr, ());
72+
}
73+
None => {}
74+
}
6775
// if true { .. } [else { .. }]
6876
return do with_scope(bcx, thn.info(), "if_true_then") |bcx| {
6977
let bcx_out = trans_block(bcx, thn, dest);
7078
trans_block_cleanups(bcx_out, block_cleanups(bcx))
7179
}
7280
} else {
81+
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx } ;
82+
trans.visit_block(thn, ());
83+
7384
match els {
7485
// if false { .. } else { .. }
7586
Some(elexpr) => {

branches/try/src/librustc/middle/trans/glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
646646
let llty = type_of(ccx, t);
647647

648648
if ccx.sess.count_type_sizes() {
649-
println!("{}\t{}", llsize_of_real(ccx, llty),
650-
ppaux::ty_to_str(ccx.tcx, t));
649+
printfln!("%u\t%s", llsize_of_real(ccx, llty),
650+
ppaux::ty_to_str(ccx.tcx, t));
651651
}
652652

653653
let has_header = match ty::get(t).sty {

branches/try/src/librustc/rustc.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ pub fn version(argv0: &str) {
130130
Some(vers) => vers,
131131
None => "unknown version"
132132
};
133-
println!("{} {}", argv0, vers);
134-
println!("host: {}", host_triple());
133+
printfln!("%s %s", argv0, vers);
134+
printfln!("host: %s", host_triple());
135135
}
136136

137137
pub fn usage(argv0: &str) {
138138
let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0);
139-
println!("{}\n\
139+
printfln!("%s\n\
140140
Additional help:
141141
-W help Print 'lint' options and default settings
142142
-Z help Print internal options for debugging rustc\n",
@@ -167,16 +167,16 @@ Available lint options:
167167
str::from_utf8(vec::from_elem(max - s.len(), ' ' as u8)) + s
168168
}
169169
println("\nAvailable lint checks:\n");
170-
println!(" {} {:7.7s} {}",
171-
padded(max_key, "name"), "default", "meaning");
172-
println!(" {} {:7.7s} {}\n",
173-
padded(max_key, "----"), "-------", "-------");
170+
printfln!(" %s %7.7s %s",
171+
padded(max_key, "name"), "default", "meaning");
172+
printfln!(" %s %7.7s %s\n",
173+
padded(max_key, "----"), "-------", "-------");
174174
for (spec, name) in lint_dict.move_iter() {
175175
let name = name.replace("_", "-");
176-
println!(" {} {:7.7s} {}",
177-
padded(max_key, name),
178-
lint::level_to_str(spec.default),
179-
spec.desc);
176+
printfln!(" %s %7.7s %s",
177+
padded(max_key, name),
178+
lint::level_to_str(spec.default),
179+
spec.desc);
180180
}
181181
io::println("");
182182
}
@@ -187,7 +187,7 @@ pub fn describe_debug_flags() {
187187
for tuple in r.iter() {
188188
match *tuple {
189189
(ref name, ref desc, _) => {
190-
println!(" -Z {:>20s} -- {}", *name, *desc);
190+
printfln!(" -Z %-20s -- %s", *name, *desc);
191191
}
192192
}
193193
}

branches/try/src/librustc/util/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn time<T>(do_it: bool, what: ~str, thunk: &fn() -> T) -> T {
2222
let start = extra::time::precise_time_s();
2323
let rv = thunk();
2424
let end = extra::time::precise_time_s();
25-
println!("time: {:3.3f} s\t{}", end - start, what);
25+
printfln!("time: %3.3f s\t%s", end - start, what);
2626
rv
2727
}
2828

branches/try/src/librusti/rusti.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
437437
if loaded_crates.is_empty() {
438438
println("no crates loaded");
439439
} else {
440-
println!("crates loaded: {}", loaded_crates.connect(", "));
440+
printfln!("crates loaded: %s", loaded_crates.connect(", "));
441441
}
442442
}
443443
~"{" => {

branches/try/src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn main() {
3434
}
3535

3636
if args[2] != ~"install" {
37-
println!("Warning: I don't know how to {}", args[2]);
37+
printfln!("Warning: I don't know how to %s", args[2]);
3838
return;
3939
}
4040

branches/try/src/libstd/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ pub trait Iterator<A> {
413413
/// use std::iter::count;
414414
///
415415
/// for i in count(0, 10) {
416-
/// println!("{}", i);
416+
/// printfln!("%d", i);
417417
/// }
418418
/// ```
419419
#[inline]

branches/try/src/libstd/logging.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
//! Logging
1212
13+
use fmt;
1314
use option::*;
1415
use os;
1516
use rt;
1617
use rt::logging::{Logger, StdErrLogger};
17-
use send_str::SendStrOwned;
1818

1919
/// Turns on logging to stdout globally
2020
pub fn console_on() {
@@ -37,7 +37,17 @@ pub fn console_off() {
3737
rt::logging::console_off();
3838
}
3939

40-
fn newsched_log_str(msg: ~str) {
40+
#[cfg(stage0)]
41+
#[doc(hidden)]
42+
pub fn log(_level: u32, s: ~str) {
43+
// this is a terrible approximation, but it gets the job done (for stage0 at
44+
// least)
45+
::io::println(s);
46+
}
47+
48+
#[allow(missing_doc)]
49+
#[cfg(not(stage0))]
50+
pub fn log(_level: u32, args: &fmt::Arguments) {
4151
use rt::task::Task;
4252
use rt::local::Local;
4353

@@ -46,20 +56,13 @@ fn newsched_log_str(msg: ~str) {
4656
match optional_task {
4757
Some(local) => {
4858
// Use the available logger
49-
(*local).logger.log(SendStrOwned(msg));
59+
(*local).logger.log(args);
5060
}
5161
None => {
5262
// There is no logger anywhere, just write to stderr
5363
let mut logger = StdErrLogger;
54-
logger.log(SendStrOwned(msg));
64+
logger.log(args);
5565
}
5666
}
5767
}
5868
}
59-
60-
// XXX: This will change soon to not require an allocation. This is an unstable
61-
// api which should not be used outside of the macros in ext/expand.
62-
#[doc(hidden)]
63-
pub fn log(_level: u32, msg: ~str) {
64-
newsched_log_str(msg);
65-
}

0 commit comments

Comments
 (0)