Skip to content

Commit 2df10f3

Browse files
committed
---
yaml --- r: 83494 b: refs/heads/try c: 99c1fb8 h: refs/heads/master v: v3
1 parent 9ea5e29 commit 2df10f3

File tree

20 files changed

+153
-98
lines changed

20 files changed

+153
-98
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: 1434b4bfcafe90cffa6627e3be18a9e5b6501ad1
5+
refs/heads/try: 99c1fb8c661134e80df9e87e6c8fd5b4258293e9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ endif
141141

142142
# version-string calculation
143143
CFG_GIT_DIR := $(CFG_SRC_DIR).git
144-
CFG_RELEASE = 0.8
144+
CFG_RELEASE = 0.9-pre
145145
CFG_VERSION = $(CFG_RELEASE)
146146
# windows exe's need numeric versions - don't use anything but
147147
# numbers and dots here
148-
CFG_VERSION_WIN = 0.8
148+
CFG_VERSION_WIN = 0.9
149149

150150
ifneq ($(wildcard $(CFG_GIT)),)
151151
ifneq ($(wildcard $(CFG_GIT_DIR)),)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
88
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
99
]>
10-
<language name="Rust" version="0.8" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
10+
<language name="Rust" version="0.9-pre" kateversion="2.4" section="Sources" extensions="*.rs;*.rc" mimetype="text/x-rust" priority="15">
1111
<highlighting>
1212
<list name="fn">
1313
<item> fn </item>

branches/try/src/libextra/extra.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Rust extras are part of the standard Rust distribution.
2121
*/
2222

2323
#[link(name = "extra",
24-
vers = "0.8",
24+
vers = "0.9-pre",
2525
uuid = "122bed0b-c19b-4b82-b0b7-7ae8aead7297",
2626
url = "https://github.com/mozilla/rust/tree/master/src/libextra")];
2727

branches/try/src/librust/rust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// FIXME #2238 Make run only accept source that emits an executable
1414

1515
#[link(name = "rust",
16-
vers = "0.8",
16+
vers = "0.9-pre",
1717
uuid = "4a24da33-5cc8-4037-9352-2cbe9bd9d27c",
1818
url = "https://github.com/mozilla/rust/tree/master/src/rust")];
1919

branches/try/src/librustc/front/std_inject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use syntax::fold::ast_fold;
2020
use syntax::fold;
2121
use syntax::opt_vec;
2222

23-
static STD_VERSION: &'static str = "0.8";
23+
static STD_VERSION: &'static str = "0.9-pre";
2424

2525
pub fn maybe_inject_libstd_ref(sess: Session, crate: @ast::Crate)
2626
-> @ast::Crate {

branches/try/src/librustc/front/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ fn mk_std(cx: &TestCtxt) -> ast::view_item {
279279
path_node(~[id_extra]),
280280
ast::DUMMY_NODE_ID))])
281281
} else {
282-
let mi = attr::mk_name_value_item_str(@"vers", @"0.8");
282+
let mi = attr::mk_name_value_item_str(@"vers", @"0.9-pre");
283283
ast::view_item_extern_mod(id_extra, None, ~[mi], ast::DUMMY_NODE_ID)
284284
};
285285
ast::view_item {

branches/try/src/librustc/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#[link(name = "rustc",
12-
vers = "0.8",
12+
vers = "0.9-pre",
1313
uuid = "0ce89b41-2f92-459e-bbc1-8f5fe32f16cf",
1414
url = "https://github.com/mozilla/rust/tree/master/src/rustc")];
1515

branches/try/src/librustdoc/rustdoc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#[link(name = "rustdoc",
12-
vers = "0.8",
12+
vers = "0.9-pre",
1313
uuid = "8c6e4598-1596-4aa5-a24c-b811914bbbc6",
1414
url = "https://github.com/mozilla/rust/tree/master/src/librustdoc")];
1515

branches/try/src/librusti/rusti.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
*/
6060

6161
#[link(name = "rusti",
62-
vers = "0.8",
62+
vers = "0.9-pre",
6363
uuid = "7fb5bf52-7d45-4fee-8325-5ad3311149fc",
6464
url = "https://github.com/mozilla/rust/tree/master/src/rusti")];
6565

branches/try/src/librustpkg/rustpkg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// rustpkg - a package manager and build system for Rust
1212

1313
#[link(name = "rustpkg",
14-
vers = "0.8",
14+
vers = "0.9-pre",
1515
uuid = "25de5e6e-279e-4a20-845c-4cabae92daaf",
1616
url = "https://github.com/mozilla/rust/tree/master/src/librustpkg")];
1717

branches/try/src/libstd/logging.rs

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

1111
//! Logging
1212
13-
use fmt;
1413
use option::*;
1514
use os;
1615
use rt;
1716
use rt::logging::{Logger, StdErrLogger};
17+
use send_str::SendStrOwned;
1818

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

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) {
40+
fn newsched_log_str(msg: ~str) {
5141
use rt::task::Task;
5242
use rt::local::Local;
5343

@@ -56,13 +46,20 @@ pub fn log(_level: u32, args: &fmt::Arguments) {
5646
match optional_task {
5747
Some(local) => {
5848
// Use the available logger
59-
(*local).logger.log(args);
49+
(*local).logger.log(SendStrOwned(msg));
6050
}
6151
None => {
6252
// There is no logger anywhere, just write to stderr
6353
let mut logger = StdErrLogger;
64-
logger.log(args);
54+
logger.log(SendStrOwned(msg));
6555
}
6656
}
6757
}
6858
}
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/logging.rs

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
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;
1210
use from_str::from_str;
13-
use libc::{uintptr_t, exit};
11+
use libc::{uintptr_t, exit, STDERR_FILENO};
1412
use option::{Some, None, Option};
15-
use rt;
1613
use rt::util::dumb_println;
1714
use rt::crate_map::{ModEntry, iter_crate_map};
1815
use rt::crate_map::get_crate_map;
@@ -21,6 +18,7 @@ use str::raw::from_c_str;
2118
use u32;
2219
use vec::ImmutableVector;
2320
use cast::transmute;
21+
use send_str::{SendStr, SendStrOwned, SendStrStatic};
2422

2523
struct LogDirective {
2624
name: Option<~str>,
@@ -173,33 +171,44 @@ fn update_log_settings(crate_map: *u8, settings: ~str) {
173171
}
174172

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

179177
pub struct StdErrLogger;
180178

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

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);
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+
}
198210
}
199-
200-
fn flush(&mut self) {}
201211
}
202-
203212
/// Configure logging by traversing the crate map and setting the
204213
/// per-module global logging flags based on the logging spec
205214
pub fn init() {

branches/try/src/libstd/std.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ they contained the following prologue:
4949

5050

5151
#[link(name = "std",
52-
vers = "0.8",
52+
vers = "0.9-pre",
5353
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
5454
url = "https://github.com/mozilla/rust/tree/master/src/libstd")];
5555

@@ -67,7 +67,7 @@ they contained the following prologue:
6767
#[deny(missing_doc)];
6868

6969
// Make extra accessible for benchmarking
70-
#[cfg(test)] extern mod extra(vers="0.8");
70+
#[cfg(test)] extern mod extra(vers="0.9-pre");
7171

7272
// Make std testable by not duplicating lang items. See #2912
7373
#[cfg(test)] extern mod realstd(name = "std");
@@ -223,5 +223,4 @@ mod std {
223223
pub use os;
224224
pub use fmt;
225225
pub use to_bytes;
226-
pub use logging;
227226
}

branches/try/src/libstd/sys.rs

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -125,56 +125,37 @@ impl FailWithCause for &'static str {
125125
}
126126
}
127127

128-
// This stage0 version is incredibly wrong.
129-
#[cfg(stage0)]
130-
pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
131-
use option::{Some, None};
132-
use rt::in_green_task_context;
133-
use rt::task::Task;
134-
use rt::local::Local;
135-
use rt::logging::Logger;
136-
use str::Str;
137-
138-
unsafe {
139-
let msg = str::raw::from_c_str(msg);
140-
let file = str::raw::from_c_str(file);
141-
if in_green_task_context() {
142-
rterrln!("task failed at '%s', %s:%i", msg, file, line as int);
143-
} else {
144-
rterrln!("failed in non-task context at '%s', %s:%i",
145-
msg, file, line as int);
146-
}
147-
148-
let task: *mut Task = Local::unsafe_borrow();
149-
if (*task).unwinder.unwinding {
150-
rtabort!("unwinding again");
151-
}
152-
(*task).unwinder.begin_unwind();
153-
}
154-
}
155-
156128
// FIXME #4427: Temporary until rt::rt_fail_ goes away
157-
#[cfg(not(stage0))]
158129
pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
130+
use option::{Some, None};
159131
use rt::in_green_task_context;
160132
use rt::task::Task;
161133
use rt::local::Local;
162134
use rt::logging::Logger;
135+
use send_str::SendStrOwned;
163136
use str::Str;
164137

165138
unsafe {
166139
// XXX: Bad re-allocations. fail! needs some refactoring
167140
let msg = str::raw::from_c_str(msg);
168141
let file = str::raw::from_c_str(file);
169142

143+
// XXX: Logging doesn't work correctly in non-task context because it
144+
// invokes the local heap
170145
if in_green_task_context() {
171-
// Be careful not to allocate in this block, if we're failing we may
172-
// have been failing due to a lack of memory in the first place...
146+
// XXX: Logging doesn't work here - the check to call the log
147+
// function never passes - so calling the log function directly.
173148
do Local::borrow |task: &mut Task| {
174-
let n = task.name.map(|n| n.as_slice()).unwrap_or("<unnamed>");
175-
format_args!(|args| { task.logger.log(args) },
176-
"task '{}' failed at '{}', {}:{}",
177-
n, msg.as_slice(), file.as_slice(), line);
149+
let msg = match task.name {
150+
Some(ref name) =>
151+
fmt!("task '%s' failed at '%s', %s:%i",
152+
name.as_slice(), msg, file, line as int),
153+
None =>
154+
fmt!("task <unnamed> failed at '%s', %s:%i",
155+
msg, file, line as int)
156+
};
157+
158+
task.logger.log(SendStrOwned(msg));
178159
}
179160
} else {
180161
rterrln!("failed in non-task context at '%s', %s:%i",

branches/try/src/libsyntax/ext/expand.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -813,17 +813,13 @@ pub fn std_macros() -> @str {
813813
($lvl:expr, $arg:expr) => ({
814814
let lvl = $lvl;
815815
if lvl <= __log_level() {
816-
format_args!(|args| {
817-
::std::logging::log(lvl, args)
818-
}, \"{}\", fmt!(\"%?\", $arg))
816+
::std::logging::log(lvl, fmt!(\"%?\", $arg))
819817
}
820818
});
821819
($lvl:expr, $($arg:expr),+) => ({
822820
let lvl = $lvl;
823821
if lvl <= __log_level() {
824-
format_args!(|args| {
825-
::std::logging::log(lvl, args)
826-
}, \"{}\", fmt!($($arg),+))
822+
::std::logging::log(lvl, fmt!($($arg),+))
827823
}
828824
})
829825
)
@@ -838,9 +834,7 @@ pub fn std_macros() -> @str {
838834
($lvl:expr, $($arg:tt)+) => ({
839835
let lvl = $lvl;
840836
if lvl <= __log_level() {
841-
format_args!(|args| {
842-
::std::logging::log(lvl, args)
843-
}, $($arg)+)
837+
::std::logging::log(lvl, format!($($arg)+))
844838
}
845839
})
846840
)

branches/try/src/libsyntax/syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
#[link(name = "syntax",
17-
vers = "0.8",
17+
vers = "0.9-pre",
1818
uuid = "9311401b-d6ea-4cd9-a1d9-61f89499c645")];
1919

2020
#[license = "MIT/ASL2"];

branches/try/src/test/compile-fail/issue-2823.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ impl Drop for C {
2020

2121
fn main() {
2222
let c = C{ x: 2};
23-
let _d = c.clone(); //~ ERROR does not implement any method in scope
23+
let d = c.clone(); //~ ERROR does not implement any method in scope
24+
error!("%?", d.x);
2425
}

0 commit comments

Comments
 (0)