Skip to content

Commit 8c54f20

Browse files
committed
---
yaml --- r: 83500 b: refs/heads/try c: fe9b1e2 h: refs/heads/master v: v3
1 parent 6c06a3f commit 8c54f20

File tree

21 files changed

+160
-197
lines changed

21 files changed

+160
-197
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: c0e1c09783422870e4d6e5862459d45036bb24d7
5+
refs/heads/try: fe9b1e29fc9cc1983fdf17355d7b8956b63d9b55
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/etc/emacs/rust-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
(defconst rust-mode-keywords
128128
'("as"
129129
"break"
130+
"continue"
130131
"do"
131132
"else" "enum" "extern"
132133
"false" "fn" "for"

branches/try/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<keyword>assert</keyword>
4040
<keyword>break</keyword>
4141
<keyword>const</keyword>
42+
<keyword>continue</keyword>
4243
<keyword>do</keyword>
4344
<keyword>drop</keyword>
4445
<keyword>else</keyword>

branches/try/src/etc/kate/rust.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<list name="keywords">
1919
<item> as </item>
2020
<item> break </item>
21+
<item> continue </item>
2122
<item> do </item>
2223
<item> drop </item>
2324
<item> else </item>

branches/try/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ syn keyword rustOperator as
1818

1919
syn match rustAssert "\<assert\(\w\)*!" contained
2020
syn match rustFail "\<fail\(\w\)*!" contained
21-
syn keyword rustKeyword break do extern
21+
syn keyword rustKeyword break continue do extern
2222
syn keyword rustKeyword in if impl let log
2323
syn keyword rustKeyword for impl let log
2424
syn keyword rustKeyword loop mod once priv pub

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -564,19 +564,19 @@ impl<'self> EachItemContext<'self> {
564564
}
565565
}
566566

567-
let mut continue = (self.callback)(*self.path_builder, def_like, vis);
567+
let mut continue_ = (self.callback)(*self.path_builder, def_like, vis);
568568

569569
let family = item_family(doc);
570570
if family == ForeignMod {
571571
// These are unnamed; pop the name now.
572572
self.pop_name(old_len)
573573
}
574574

575-
if continue {
575+
if continue_ {
576576
// Recurse if necessary.
577577
match family {
578578
Mod | ForeignMod | Trait | Impl => {
579-
continue = self.each_item_of_module(def_id);
579+
continue_ = self.each_item_of_module(def_id);
580580
}
581581
ImmStatic | MutStatic | Struct | UnsafeFn | Fn | ForeignFn |
582582
UnsafeStaticMethod | StaticMethod | Type | ForeignType |
@@ -589,7 +589,7 @@ impl<'self> EachItemContext<'self> {
589589
self.pop_name(old_len)
590590
}
591591

592-
continue
592+
continue_
593593
}
594594

595595
fn each_item_of_module(&mut self, def_id: ast::DefId) -> bool {
@@ -612,7 +612,7 @@ impl<'self> EachItemContext<'self> {
612612
}
613613

614614
fn each_child_of_module_or_crate(&mut self, item_doc: ebml::Doc) -> bool {
615-
let mut continue = true;
615+
let mut continue_ = true;
616616

617617
// Iterate over all children.
618618
do reader::tagged_docs(item_doc, tag_mod_child) |child_info_doc| {
@@ -654,16 +654,16 @@ impl<'self> EachItemContext<'self> {
654654
// Process this item.
655655

656656
let vis = item_visibility(child_item_doc);
657-
continue = self.process_item_and_pop_name(child_item_doc,
657+
continue_ = self.process_item_and_pop_name(child_item_doc,
658658
child_def_id,
659659
old_len,
660660
vis);
661661
}
662662
}
663-
continue
663+
continue_
664664
};
665665

666-
if !continue {
666+
if !continue_ {
667667
return false
668668
}
669669

@@ -705,18 +705,18 @@ impl<'self> EachItemContext<'self> {
705705
match maybe_find_item(def_id.node, other_crates_items) {
706706
None => { self.pop_name(old_len); }
707707
Some(reexported_item_doc) => {
708-
continue = self.process_item_and_pop_name(
708+
continue_ = self.process_item_and_pop_name(
709709
reexported_item_doc,
710710
def_id,
711711
old_len,
712712
ast::public);
713713
}
714714
}
715715

716-
continue
716+
continue_
717717
};
718718

719-
continue
719+
continue_
720720
}
721721
}
722722

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,12 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
521521
/// * For newtype structs, iterates through the node ID of the constructor.
522522
fn each_auxiliary_node_id(item: @item, callback: &fn(NodeId) -> bool)
523523
-> bool {
524-
let mut continue = true;
524+
let mut continue_ = true;
525525
match item.node {
526526
item_enum(ref enum_def, _) => {
527527
for variant in enum_def.variants.iter() {
528-
continue = callback(variant.node.id);
529-
if !continue {
528+
continue_ = callback(variant.node.id);
529+
if !continue_ {
530530
break
531531
}
532532
}
@@ -537,15 +537,15 @@ fn each_auxiliary_node_id(item: @item, callback: &fn(NodeId) -> bool)
537537
Some(ctor_id) if struct_def.fields.len() > 0 &&
538538
struct_def.fields[0].node.kind ==
539539
ast::unnamed_field => {
540-
continue = callback(ctor_id);
540+
continue_ = callback(ctor_id);
541541
}
542542
_ => {}
543543
}
544544
}
545545
_ => {}
546546
}
547547

548-
continue
548+
continue_
549549
}
550550

551551
fn encode_reexports(ecx: &EncodeContext,

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-
}

branches/try/src/libstd/rt/io/mem.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use vec;
2222

2323
/// Writes to an owned, growable byte vector
2424
pub struct MemWriter {
25-
buf: ~[u8]
25+
priv buf: ~[u8]
2626
}
2727

2828
impl MemWriter {
@@ -66,8 +66,8 @@ impl Decorator<~[u8]> for MemWriter {
6666

6767
/// Reads from an owned byte vector
6868
pub struct MemReader {
69-
buf: ~[u8],
70-
pos: uint
69+
priv buf: ~[u8],
70+
priv pos: uint
7171
}
7272

7373
impl MemReader {
@@ -129,8 +129,8 @@ impl Decorator<~[u8]> for MemReader {
129129

130130
/// Writes to a fixed-size byte slice
131131
pub struct BufWriter<'self> {
132-
buf: &'self mut [u8],
133-
pos: uint
132+
priv buf: &'self mut [u8],
133+
priv pos: uint
134134
}
135135

136136
impl<'self> BufWriter<'self> {
@@ -157,8 +157,8 @@ impl<'self> Seek for BufWriter<'self> {
157157

158158
/// Reads from a fixed-size byte slice
159159
pub struct BufReader<'self> {
160-
buf: &'self [u8],
161-
pos: uint
160+
priv buf: &'self [u8],
161+
priv pos: uint
162162
}
163163

164164
impl<'self> BufReader<'self> {
@@ -199,9 +199,9 @@ impl<'self> Seek for BufReader<'self> {
199199
///Calls a function with a MemWriter and returns
200200
///the writer's stored vector.
201201
pub fn with_mem_writer(writeFn:&fn(&mut MemWriter)) -> ~[u8] {
202-
let mut writer = MemWriter::new();
203-
writeFn(&mut writer);
204-
writer.inner()
202+
let mut writer = MemWriter::new();
203+
writeFn(&mut writer);
204+
writer.inner()
205205
}
206206

207207
#[cfg(test)]

branches/try/src/libstd/rt/io/net/ip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use from_str::FromStr;
1515
use option::{Option, None, Some};
1616

1717

18-
type Port = u16;
18+
pub type Port = u16;
1919

2020
#[deriving(Eq, TotalEq, Clone)]
2121
pub enum IpAddr {

branches/try/src/libstd/rt/logging.rs

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10+
11+
use fmt;
1012
use from_str::from_str;
11-
use libc::{uintptr_t, exit, STDERR_FILENO};
13+
use libc::{uintptr_t, exit};
1214
use option::{Some, None, Option};
15+
use rt;
1316
use rt::util::dumb_println;
1417
use rt::crate_map::{ModEntry, iter_crate_map};
1518
use rt::crate_map::get_crate_map;
@@ -18,7 +21,6 @@ use str::raw::from_c_str;
1821
use u32;
1922
use vec::ImmutableVector;
2023
use cast::transmute;
21-
use send_str::{SendStr, SendStrOwned, SendStrStatic};
2224

2325
struct LogDirective {
2426
name: Option<~str>,
@@ -171,44 +173,33 @@ fn update_log_settings(crate_map: *u8, settings: ~str) {
171173
}
172174

173175
pub trait Logger {
174-
fn log(&mut self, msg: SendStr);
176+
fn log(&mut self, args: &fmt::Arguments);
175177
}
176178

177179
pub struct StdErrLogger;
178180

179181
impl Logger for StdErrLogger {
180-
fn log(&mut self, msg: SendStr) {
181-
use io::{Writer, WriterUtil};
182-
183-
if !should_log_console() {
184-
return;
182+
fn log(&mut self, args: &fmt::Arguments) {
183+
if should_log_console() {
184+
fmt::write(self as &mut rt::io::Writer, args);
185185
}
186+
}
187+
}
186188

187-
let s: &str = match msg {
188-
SendStrOwned(ref s) => {
189-
let slc: &str = *s;
190-
slc
191-
},
192-
SendStrStatic(s) => s,
193-
};
194-
195-
// Truncate the string
196-
let buf_bytes = 2048;
197-
if s.len() > buf_bytes {
198-
let s = s.slice(0, buf_bytes) + "[...]";
199-
print(s);
200-
} else {
201-
print(s)
202-
};
203-
204-
fn print(s: &str) {
205-
let dbg = STDERR_FILENO as ::io::fd_t;
206-
dbg.write_str(s);
207-
dbg.write_str("\n");
208-
dbg.flush();
209-
}
189+
impl rt::io::Writer for StdErrLogger {
190+
fn write(&mut self, buf: &[u8]) {
191+
// Nothing like swapping between I/O implementations! In theory this
192+
// could use the libuv bindings for writing to file descriptors, but
193+
// that may not necessarily be desirable because logging should work
194+
// outside of the uv loop. (modify with caution)
195+
use io::Writer;
196+
let dbg = ::libc::STDERR_FILENO as ::io::fd_t;
197+
dbg.write(buf);
210198
}
199+
200+
fn flush(&mut self) {}
211201
}
202+
212203
/// Configure logging by traversing the crate map and setting the
213204
/// per-module global logging flags based on the logging spec
214205
pub fn init() {

branches/try/src/libstd/std.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,5 @@ mod std {
223223
pub use os;
224224
pub use fmt;
225225
pub use to_bytes;
226+
pub use logging;
226227
}

0 commit comments

Comments
 (0)