auto merge of #5293 : brson/rust/logging, r=brson
r? @graydon This removes `log` from the language. Because we can't quite implement it as a syntax extension (probably need globals at the least) it simply renames the keyword to `__log` and hides it behind macros. After this the only way to log is with `debug!`, `info!`, etc. I figure that if there is demand for `log!` we can add it back later. I am not sure that we ever agreed on this course of action, though I *think* there is consensus that `log` shouldn't be a statement.
This commit is contained in:
commit
695e9fd13c
73
doc/rust.md
73
doc/rust.md
@ -212,7 +212,7 @@ do drop
|
||||
else enum extern
|
||||
false fn for
|
||||
if impl
|
||||
let log loop
|
||||
let loop
|
||||
match mod mut
|
||||
priv pub pure
|
||||
ref return
|
||||
@ -805,21 +805,20 @@ Use declarations support a number of "convenience" notations:
|
||||
An example of `use` declarations:
|
||||
|
||||
~~~~
|
||||
use foo = core::info;
|
||||
use core::float::sin;
|
||||
use core::str::{slice, to_upper};
|
||||
use core::option::Some;
|
||||
|
||||
fn main() {
|
||||
// Equivalent to 'log(core::info, core::float::sin(1.0));'
|
||||
log(foo, sin(1.0));
|
||||
// Equivalent to 'info!(core::float::sin(1.0));'
|
||||
info!(sin(1.0));
|
||||
|
||||
// Equivalent to 'log(core::info, core::option::Some(1.0));'
|
||||
log(info, Some(1.0));
|
||||
// Equivalent to 'info!(core::option::Some(1.0));'
|
||||
info!(Some(1.0));
|
||||
|
||||
// Equivalent to 'log(core::info,
|
||||
// core::str::to_upper(core::str::slice("foo", 0, 1)));'
|
||||
log(info, to_upper(slice("foo", 0, 1)));
|
||||
// Equivalent to
|
||||
// 'info!(core::str::to_upper(core::str::slice("foo", 0, 1)));'
|
||||
info!(to_upper(slice("foo", 0, 1)));
|
||||
}
|
||||
~~~~
|
||||
|
||||
@ -990,7 +989,7 @@ output slot type would normally be. For example:
|
||||
|
||||
~~~~
|
||||
fn my_err(s: &str) -> ! {
|
||||
log(info, s);
|
||||
info!(s);
|
||||
fail!();
|
||||
}
|
||||
~~~~
|
||||
@ -2397,58 +2396,6 @@ fn max(a: int, b: int) -> int {
|
||||
}
|
||||
~~~~
|
||||
|
||||
### Log expressions
|
||||
|
||||
~~~~~~~~{.ebnf .gram}
|
||||
log_expr : "log" '(' level ',' expr ')' ;
|
||||
~~~~~~~~
|
||||
|
||||
Evaluating a `log` expression may, depending on runtime configuration, cause a
|
||||
value to be appended to an internal diagnostic logging buffer provided by the
|
||||
runtime or emitted to a system console. Log expressions are enabled or
|
||||
disabled dynamically at run-time on a per-task and per-item basis. See
|
||||
[logging system](#logging-system).
|
||||
|
||||
Each `log` expression must be provided with a *level* argument in
|
||||
addition to the value to log. The logging level is a `u32` value, where
|
||||
lower levels indicate more-urgent levels of logging. By default, the lowest
|
||||
four logging levels (`1_u32 ... 4_u32`) are predefined as the constants
|
||||
`error`, `warn`, `info` and `debug` in the `core` library.
|
||||
|
||||
Additionally, the macros `error!`, `warn!`, `info!` and `debug!` are defined
|
||||
in the default syntax-extension namespace. These expand into calls to the
|
||||
logging facility composed with calls to the `fmt!` string formatting
|
||||
syntax-extension.
|
||||
|
||||
The following examples all produce the same output, logged at the `error`
|
||||
logging level:
|
||||
|
||||
~~~~
|
||||
# let filename = "bulbasaur";
|
||||
|
||||
// Full version, logging a value.
|
||||
log(core::error, ~"file not found: " + filename);
|
||||
|
||||
// Log-level abbreviated, since core::* is used by default.
|
||||
log(error, ~"file not found: " + filename);
|
||||
|
||||
// Formatting the message using a format-string and fmt!
|
||||
log(error, fmt!("file not found: %s", filename));
|
||||
|
||||
// Using the error! macro, that expands to the previous call.
|
||||
error!("file not found: %s", filename);
|
||||
~~~~
|
||||
|
||||
A `log` expression is *not evaluated* when logging at the specified logging-level, module or task is disabled at runtime.
|
||||
This makes inactive `log` expressions very cheap;
|
||||
they should be used extensively in Rust code, as diagnostic aids,
|
||||
as they add little overhead beyond a single integer-compare and branch at runtime.
|
||||
|
||||
Logging is presently implemented as a language built-in feature,
|
||||
as it makes use of compiler-provided, per-module data tables and flags.
|
||||
In the future, logging will move into a library, and will no longer be a core expression type.
|
||||
It is therefore recommended to use the macro forms of logging (`error!`, `debug!`, etc.) to minimize disruption in code that uses logging.
|
||||
|
||||
|
||||
# Type system
|
||||
|
||||
@ -3149,7 +3096,7 @@ communication facilities.
|
||||
|
||||
The runtime contains a system for directing [logging
|
||||
expressions](#log-expressions) to a logging console and/or internal logging
|
||||
buffers. Logging expressions can be enabled per module.
|
||||
buffers. Logging can be enabled per module.
|
||||
|
||||
Logging output is enabled by setting the `RUST_LOG` environment
|
||||
variable. `RUST_LOG` accepts a logging specification made up of a
|
||||
|
@ -744,7 +744,7 @@ unit, `()`, as the empty tuple if you like).
|
||||
~~~~
|
||||
let mytup: (int, int, float) = (10, 20, 30.0);
|
||||
match mytup {
|
||||
(a, b, c) => log(info, a + b + (c as int))
|
||||
(a, b, c) => info!(a + b + (c as int))
|
||||
}
|
||||
~~~~
|
||||
|
||||
@ -760,7 +760,7 @@ For example:
|
||||
struct MyTup(int, int, float);
|
||||
let mytup: MyTup = MyTup(10, 20, 30.0);
|
||||
match mytup {
|
||||
MyTup(a, b, c) => log(info, a + b + (c as int))
|
||||
MyTup(a, b, c) => info!(a + b + (c as int))
|
||||
}
|
||||
~~~~
|
||||
|
||||
|
@ -46,6 +46,6 @@ pub fn path_div() -> ~str { ~":" }
|
||||
pub fn path_div() -> ~str { ~";" }
|
||||
|
||||
pub fn logv(config: config, s: ~str) {
|
||||
log(debug, s);
|
||||
debug!("%s", s);
|
||||
if config.verbose { io::println(s); }
|
||||
}
|
||||
|
@ -216,14 +216,17 @@ pub use clone::Clone;
|
||||
* more-verbosity. Error is the bottom level, default logging level is
|
||||
* warn-and-below.
|
||||
*/
|
||||
|
||||
/// The error log level
|
||||
#[cfg(stage0)]
|
||||
pub const error : u32 = 1_u32;
|
||||
/// The warning log level
|
||||
#[cfg(stage0)]
|
||||
pub const warn : u32 = 2_u32;
|
||||
/// The info log level
|
||||
#[cfg(stage0)]
|
||||
pub const info : u32 = 3_u32;
|
||||
/// The debug log level
|
||||
#[cfg(stage0)]
|
||||
pub const debug : u32 = 4_u32;
|
||||
|
||||
|
||||
@ -251,9 +254,13 @@ pub mod rt;
|
||||
// can be resolved within libcore.
|
||||
#[doc(hidden)] // FIXME #3538
|
||||
pub mod core {
|
||||
#[cfg(stage0)]
|
||||
pub const error : u32 = 1_u32;
|
||||
#[cfg(stage0)]
|
||||
pub const warn : u32 = 2_u32;
|
||||
#[cfg(stage0)]
|
||||
pub const info : u32 = 3_u32;
|
||||
#[cfg(stage0)]
|
||||
pub const debug : u32 = 4_u32;
|
||||
|
||||
pub use cmp;
|
||||
|
@ -683,7 +683,7 @@ fn write(&self, v: &[const u8]) {
|
||||
*self);
|
||||
if nout != len as size_t {
|
||||
error!("error writing buffer");
|
||||
log(error, os::last_os_error());
|
||||
error!("%s", os::last_os_error());
|
||||
fail!();
|
||||
}
|
||||
}
|
||||
@ -733,7 +733,7 @@ fn write(&self, v: &[const u8]) {
|
||||
let nout = libc::write(*self, vb, len as size_t);
|
||||
if nout < 0 as ssize_t {
|
||||
error!("error writing buffer");
|
||||
log(error, os::last_os_error());
|
||||
error!("%s", os::last_os_error());
|
||||
fail!();
|
||||
}
|
||||
count += nout as uint;
|
||||
@ -1288,7 +1288,6 @@ pub fn obj_sync(o: FSyncable, opt_level: Option<Level>,
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use debug;
|
||||
use i32;
|
||||
use io::{BytesWriter, SeekCur, SeekEnd, SeekSet};
|
||||
use io;
|
||||
@ -1301,10 +1300,10 @@ mod tests {
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
let tmpfile = &Path("tmp/lib-io-test-simple.tmp");
|
||||
log(debug, tmpfile);
|
||||
debug!(tmpfile);
|
||||
let frood: ~str =
|
||||
~"A hoopy frood who really knows where his towel is.";
|
||||
log(debug, copy frood);
|
||||
debug!(copy frood);
|
||||
{
|
||||
let out: io::Writer =
|
||||
result::get(
|
||||
@ -1313,7 +1312,7 @@ fn test_simple() {
|
||||
}
|
||||
let inp: io::Reader = result::get(&io::file_reader(tmpfile));
|
||||
let frood2: ~str = inp.read_c_str();
|
||||
log(debug, copy frood2);
|
||||
debug!(copy frood2);
|
||||
fail_unless!(frood == frood2);
|
||||
}
|
||||
|
||||
|
@ -208,8 +208,8 @@ unsafe fn get_env_pairs() -> ~[~str] {
|
||||
let mut result = ~[];
|
||||
ptr::array_each(environ, |e| {
|
||||
let env_pair = str::raw::from_c_str(e);
|
||||
log(debug, fmt!("get_env_pairs: %s",
|
||||
env_pair));
|
||||
debug!("get_env_pairs: %s",
|
||||
env_pair);
|
||||
result.push(env_pair);
|
||||
});
|
||||
result
|
||||
@ -219,9 +219,8 @@ fn env_convert(input: ~[~str]) -> ~[(~str, ~str)] {
|
||||
let mut pairs = ~[];
|
||||
for input.each |p| {
|
||||
let vs = str::splitn_char(*p, '=', 1);
|
||||
log(debug,
|
||||
fmt!("splitting: len: %u",
|
||||
vs.len()));
|
||||
debug!("splitting: len: %u",
|
||||
vs.len());
|
||||
fail_unless!(vs.len() == 2);
|
||||
pairs.push((copy vs[0], copy vs[1]));
|
||||
}
|
||||
@ -682,10 +681,10 @@ unsafe fn rust_list_dir_val(ptr: *dirent_t)
|
||||
let input = p.to_str();
|
||||
let mut strings = ~[];
|
||||
let input_ptr = ::cast::transmute(&input[0]);
|
||||
log(debug, "os::list_dir -- BEFORE OPENDIR");
|
||||
debug!("os::list_dir -- BEFORE OPENDIR");
|
||||
let dir_ptr = opendir(input_ptr);
|
||||
if (dir_ptr as uint != 0) {
|
||||
log(debug, "os::list_dir -- opendir() SUCCESS");
|
||||
debug!("os::list_dir -- opendir() SUCCESS");
|
||||
let mut entry_ptr = readdir(dir_ptr);
|
||||
while (entry_ptr as uint != 0) {
|
||||
strings.push(
|
||||
@ -697,11 +696,11 @@ unsafe fn rust_list_dir_val(ptr: *dirent_t)
|
||||
closedir(dir_ptr);
|
||||
}
|
||||
else {
|
||||
log(debug, "os::list_dir -- opendir() FAILURE");
|
||||
debug!("os::list_dir -- opendir() FAILURE");
|
||||
}
|
||||
log(debug,
|
||||
fmt!("os::list_dir -- AFTER -- #: %?",
|
||||
strings.len()));
|
||||
debug!(
|
||||
"os::list_dir -- AFTER -- #: %?",
|
||||
strings.len());
|
||||
strings
|
||||
}
|
||||
#[cfg(windows)]
|
||||
@ -1258,7 +1257,6 @@ pub mod mips {
|
||||
#[cfg(test)]
|
||||
#[allow(non_implicitly_copyable_typarams)]
|
||||
mod tests {
|
||||
use debug;
|
||||
use libc::{c_int, c_void, size_t};
|
||||
use libc;
|
||||
use option::{None, Option, Some};
|
||||
@ -1274,7 +1272,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
pub fn last_os_error() {
|
||||
log(debug, os::last_os_error());
|
||||
debug!(os::last_os_error());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1320,7 +1318,7 @@ fn test_getenv_big() {
|
||||
while i < 100 { s += ~"aaaaaaaaaa"; i += 1; }
|
||||
let n = make_rand_name();
|
||||
setenv(n, s);
|
||||
log(debug, copy s);
|
||||
debug!(copy s);
|
||||
fail_unless!(getenv(n) == option::Some(s));
|
||||
}
|
||||
|
||||
@ -1329,7 +1327,7 @@ fn test_self_exe_path() {
|
||||
let path = os::self_exe_path();
|
||||
fail_unless!(path.is_some());
|
||||
let path = path.get();
|
||||
log(debug, copy path);
|
||||
debug!(copy path);
|
||||
|
||||
// Hard to test this function
|
||||
fail_unless!(path.is_absolute);
|
||||
@ -1342,7 +1340,7 @@ fn test_env_getenv() {
|
||||
fail_unless!(vec::len(e) > 0u);
|
||||
for vec::each(e) |p| {
|
||||
let (n, v) = copy *p;
|
||||
log(debug, copy n);
|
||||
debug!(copy n);
|
||||
let v2 = getenv(n);
|
||||
// MingW seems to set some funky environment variables like
|
||||
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
|
||||
@ -1367,10 +1365,10 @@ fn test_env_setenv() {
|
||||
fn test() {
|
||||
fail_unless!((!Path("test-path").is_absolute));
|
||||
|
||||
log(debug, ~"Current working directory: " + getcwd().to_str());
|
||||
debug!(~"Current working directory: " + getcwd().to_str());
|
||||
|
||||
log(debug, make_absolute(&Path("test-path")));
|
||||
log(debug, make_absolute(&Path("/usr/bin")));
|
||||
debug!(make_absolute(&Path("test-path")));
|
||||
debug!(make_absolute(&Path("/usr/bin")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1433,7 +1431,7 @@ fn list_dir() {
|
||||
fail_unless!((vec::len(dirs) > 0u));
|
||||
|
||||
for vec::each(dirs) |dir| {
|
||||
log(debug, copy *dir);
|
||||
debug!(copy *dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,18 +82,3 @@
|
||||
pub use u8;
|
||||
pub use uint;
|
||||
pub use vec;
|
||||
|
||||
/*
|
||||
* Export the log levels as global constants. Higher levels mean
|
||||
* more-verbosity. Error is the bottom level, default logging level is
|
||||
* warn-and-below.
|
||||
*/
|
||||
|
||||
/// The error log level
|
||||
pub const error : u32 = 1_u32;
|
||||
/// The warning log level
|
||||
pub const warn : u32 = 2_u32;
|
||||
/// The info log level
|
||||
pub const info : u32 = 3_u32;
|
||||
/// The debug log level
|
||||
pub const debug : u32 = 4_u32;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#[cfg(test)] use vec;
|
||||
#[cfg(test)] use str;
|
||||
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||
use debug;
|
||||
use uint;
|
||||
|
||||
pub mod libc_ {
|
||||
@ -191,7 +190,7 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: int, count: uint) {
|
||||
SAFETY NOTE: Pointer-arithmetic. Dragons be here.
|
||||
*/
|
||||
pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: &fn(*T)) {
|
||||
log(debug, "array_each_with_len: before iterate");
|
||||
debug!("array_each_with_len: before iterate");
|
||||
if (arr as uint == 0) {
|
||||
fail!(~"ptr::array_each_with_len failure: arr input is null pointer");
|
||||
}
|
||||
@ -201,7 +200,7 @@ pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: &fn(*T)) {
|
||||
cb(*n);
|
||||
true
|
||||
});
|
||||
log(debug, "array_each_with_len: after iterate");
|
||||
debug!("array_each_with_len: after iterate");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,8 +217,8 @@ pub unsafe fn array_each<T>(arr: **T, cb: &fn(*T)) {
|
||||
fail!(~"ptr::array_each_with_len failure: arr input is null pointer");
|
||||
}
|
||||
let len = buf_len(arr);
|
||||
log(debug, fmt!("array_each inferred len: %u",
|
||||
len));
|
||||
debug!("array_each inferred len: %u",
|
||||
len);
|
||||
array_each_with_len(arr, len, cb);
|
||||
}
|
||||
|
||||
@ -434,7 +433,6 @@ pub fn test_is_null() {
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod ptr_tests {
|
||||
use debug;
|
||||
use ptr;
|
||||
use str;
|
||||
use libc;
|
||||
@ -460,9 +458,9 @@ pub fn test_ptr_array_each_with_len() {
|
||||
|e| {
|
||||
let actual = str::raw::from_c_str(e);
|
||||
let expected = copy expected_arr[ctr];
|
||||
log(debug,
|
||||
fmt!("test_ptr_array_each e: %s, a: %s",
|
||||
expected, actual));
|
||||
debug!(
|
||||
"test_ptr_array_each e: %s, a: %s",
|
||||
expected, actual);
|
||||
fail_unless!(actual == expected);
|
||||
ctr += 1;
|
||||
iteration_count += 1;
|
||||
@ -492,9 +490,9 @@ pub fn test_ptr_array_each() {
|
||||
ptr::array_each(arr_ptr, |e| {
|
||||
let actual = str::raw::from_c_str(e);
|
||||
let expected = copy expected_arr[ctr];
|
||||
log(debug,
|
||||
fmt!("test_ptr_array_each e: %s, a: %s",
|
||||
expected, actual));
|
||||
debug!(
|
||||
"test_ptr_array_each e: %s, a: %s",
|
||||
expected, actual);
|
||||
fail_unless!(actual == expected);
|
||||
ctr += 1;
|
||||
iteration_count += 1;
|
||||
|
@ -494,7 +494,6 @@ pub fn random() -> uint {
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use debug;
|
||||
use option::{None, Option, Some};
|
||||
use rand;
|
||||
|
||||
@ -563,7 +562,7 @@ pub fn gen_float() {
|
||||
let r = rand::Rng();
|
||||
let a = r.gen_float();
|
||||
let b = r.gen_float();
|
||||
log(debug, (a, b));
|
||||
debug!((a, b));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -576,9 +575,9 @@ pub fn gen_weighted_bool() {
|
||||
#[test]
|
||||
pub fn gen_str() {
|
||||
let r = rand::Rng();
|
||||
log(debug, r.gen_str(10u));
|
||||
log(debug, r.gen_str(10u));
|
||||
log(debug, r.gen_str(10u));
|
||||
debug!(r.gen_str(10u));
|
||||
debug!(r.gen_str(10u));
|
||||
debug!(r.gen_str(10u));
|
||||
fail_unless!(r.gen_str(0u).len() == 0u);
|
||||
fail_unless!(r.gen_str(10u).len() == 10u);
|
||||
fail_unless!(r.gen_str(16u).len() == 16u);
|
||||
|
@ -458,7 +458,6 @@ fn WEXITSTATUS(status: i32) -> i32 {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use debug;
|
||||
use option::{None, Some};
|
||||
use os;
|
||||
use run::{readclose, writeclose};
|
||||
@ -494,8 +493,8 @@ pub fn test_pipes() {
|
||||
readclose(pipe_err.in);
|
||||
os::waitpid(pid);
|
||||
|
||||
log(debug, copy expected);
|
||||
log(debug, copy actual);
|
||||
debug!(copy expected);
|
||||
debug!(copy actual);
|
||||
fail_unless!((expected == actual));
|
||||
}
|
||||
|
||||
|
@ -2437,7 +2437,6 @@ fn push_char(&mut self, c: char) {
|
||||
mod tests {
|
||||
use char;
|
||||
use option::Some;
|
||||
use debug;
|
||||
use libc::c_char;
|
||||
use libc;
|
||||
use ptr;
|
||||
@ -2523,7 +2522,7 @@ fn test_pop_char_fail() {
|
||||
#[test]
|
||||
fn test_split_char() {
|
||||
fn t(s: &str, c: char, u: &[~str]) {
|
||||
log(debug, ~"split_byte: " + s);
|
||||
debug!(~"split_byte: " + s);
|
||||
let v = split_char(s, c);
|
||||
debug!("split_byte to: %?", v);
|
||||
fail_unless!(vec::all2(v, u, |a,b| a == b));
|
||||
@ -2552,7 +2551,7 @@ fn test_split_char_2() {
|
||||
#[test]
|
||||
fn test_splitn_char() {
|
||||
fn t(s: &str, c: char, n: uint, u: &[~str]) {
|
||||
log(debug, ~"splitn_byte: " + s);
|
||||
debug!(~"splitn_byte: " + s);
|
||||
let v = splitn_char(s, c, n);
|
||||
debug!("split_byte to: %?", v);
|
||||
debug!("comparing vs. %?", u);
|
||||
@ -3192,8 +3191,8 @@ fn vec_str_conversions() {
|
||||
while i < n1 {
|
||||
let a: u8 = s1[i];
|
||||
let b: u8 = s2[i];
|
||||
log(debug, a);
|
||||
log(debug, b);
|
||||
debug!(a);
|
||||
debug!(b);
|
||||
fail_unless!((a == b));
|
||||
i += 1u;
|
||||
}
|
||||
|
@ -930,8 +930,8 @@ pub unsafe fn tcp_connect(connect_ptr: *uv_connect_t,
|
||||
addr_ptr: *sockaddr_in,
|
||||
after_connect_cb: *u8)
|
||||
-> libc::c_int {
|
||||
log(debug, fmt!("b4 foreign tcp_connect--addr port: %u cb: %u",
|
||||
(*addr_ptr).sin_port as uint, after_connect_cb as uint));
|
||||
debug!("b4 foreign tcp_connect--addr port: %u cb: %u",
|
||||
(*addr_ptr).sin_port as uint, after_connect_cb as uint);
|
||||
return rustrt::rust_uv_tcp_connect(connect_ptr, tcp_handle_ptr,
|
||||
after_connect_cb, addr_ptr);
|
||||
}
|
||||
@ -1021,20 +1021,20 @@ pub unsafe fn async_send(async_handle: *uv_async_t) {
|
||||
pub unsafe fn buf_init(input: *u8, len: uint) -> uv_buf_t {
|
||||
let out_buf = uv_buf_t { base: ptr::null(), len: 0 as libc::size_t };
|
||||
let out_buf_ptr = ptr::addr_of(&out_buf);
|
||||
log(debug, fmt!("buf_init - input %u len %u out_buf: %u",
|
||||
debug!("buf_init - input %u len %u out_buf: %u",
|
||||
input as uint,
|
||||
len as uint,
|
||||
out_buf_ptr as uint));
|
||||
out_buf_ptr as uint);
|
||||
// yuck :/
|
||||
rustrt::rust_uv_buf_init(out_buf_ptr, input, len as size_t);
|
||||
//let result = rustrt::rust_uv_buf_init_2(input, len as size_t);
|
||||
log(debug, ~"after rust_uv_buf_init");
|
||||
debug!("after rust_uv_buf_init");
|
||||
let res_base = get_base_from_buf(out_buf);
|
||||
let res_len = get_len_from_buf(out_buf);
|
||||
//let res_base = get_base_from_buf(result);
|
||||
log(debug, fmt!("buf_init - result %u len %u",
|
||||
debug!("buf_init - result %u len %u",
|
||||
res_base as uint,
|
||||
res_len as uint));
|
||||
res_len as uint);
|
||||
return out_buf;
|
||||
//return result;
|
||||
}
|
||||
@ -1078,8 +1078,8 @@ pub unsafe fn ip6_name(src: &sockaddr_in6) -> ~str {
|
||||
0u8,0u8,0u8,0u8,0u8,0u8];
|
||||
do vec::as_imm_buf(dst) |dst_buf, size| {
|
||||
let src_unsafe_ptr = to_unsafe_ptr(src);
|
||||
log(debug, fmt!("val of src *sockaddr_in6: %? sockaddr_in6: %?",
|
||||
src_unsafe_ptr, src));
|
||||
debug!("val of src *sockaddr_in6: %? sockaddr_in6: %?",
|
||||
src_unsafe_ptr, src);
|
||||
let result = rustrt::rust_uv_ip6_name(src_unsafe_ptr,
|
||||
dst_buf, size as libc::size_t);
|
||||
match result {
|
||||
@ -1257,20 +1257,20 @@ struct request_wrapper {
|
||||
}
|
||||
|
||||
extern fn after_close_cb(handle: *libc::c_void) {
|
||||
log(debug, fmt!("after uv_close! handle ptr: %?",
|
||||
handle));
|
||||
debug!("after uv_close! handle ptr: %?",
|
||||
handle);
|
||||
}
|
||||
|
||||
extern fn on_alloc_cb(handle: *libc::c_void,
|
||||
suggested_size: libc::size_t)
|
||||
-> uv_buf_t {
|
||||
unsafe {
|
||||
log(debug, ~"on_alloc_cb!");
|
||||
debug!("on_alloc_cb!");
|
||||
let char_ptr = malloc_buf_base_of(suggested_size);
|
||||
log(debug, fmt!("on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
||||
debug!("on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
||||
handle,
|
||||
char_ptr as uint,
|
||||
suggested_size as uint));
|
||||
suggested_size as uint);
|
||||
return buf_init(char_ptr, suggested_size as uint);
|
||||
}
|
||||
}
|
||||
@ -1280,11 +1280,11 @@ struct request_wrapper {
|
||||
++buf: uv_buf_t) {
|
||||
unsafe {
|
||||
let nread = nread as int;
|
||||
log(debug, fmt!("CLIENT entering on_read_cb nred: %d",
|
||||
nread));
|
||||
debug!("CLIENT entering on_read_cb nred: %d",
|
||||
nread);
|
||||
if (nread > 0) {
|
||||
// we have data
|
||||
log(debug, fmt!("CLIENT read: data! nread: %d", nread));
|
||||
debug!("CLIENT read: data! nread: %d", nread);
|
||||
read_stop(stream);
|
||||
let client_data =
|
||||
get_data_for_uv_handle(stream as *libc::c_void)
|
||||
@ -1298,65 +1298,65 @@ struct request_wrapper {
|
||||
}
|
||||
else if (nread == -1) {
|
||||
// err .. possibly EOF
|
||||
log(debug, ~"read: eof!");
|
||||
debug!("read: eof!");
|
||||
}
|
||||
else {
|
||||
// nread == 0 .. do nothing, just free buf as below
|
||||
log(debug, ~"read: do nothing!");
|
||||
debug!("read: do nothing!");
|
||||
}
|
||||
// when we're done
|
||||
free_base_of_buf(buf);
|
||||
log(debug, ~"CLIENT exiting on_read_cb");
|
||||
debug!("CLIENT exiting on_read_cb");
|
||||
}
|
||||
}
|
||||
|
||||
extern fn on_write_complete_cb(write_req: *uv_write_t,
|
||||
status: libc::c_int) {
|
||||
unsafe {
|
||||
log(debug,
|
||||
fmt!("CLIENT beginning on_write_complete_cb status: %d",
|
||||
status as int));
|
||||
debug!(
|
||||
"CLIENT beginning on_write_complete_cb status: %d",
|
||||
status as int);
|
||||
let stream = get_stream_handle_from_write_req(write_req);
|
||||
log(debug,
|
||||
fmt!("CLIENT on_write_complete_cb: tcp:%d write_handle:%d",
|
||||
stream as int, write_req as int));
|
||||
debug!(
|
||||
"CLIENT on_write_complete_cb: tcp:%d write_handle:%d",
|
||||
stream as int, write_req as int);
|
||||
let result = read_start(stream, on_alloc_cb, on_read_cb);
|
||||
log(debug,
|
||||
fmt!("CLIENT ending on_write_complete_cb .. status: %d",
|
||||
result as int));
|
||||
debug!(
|
||||
"CLIENT ending on_write_complete_cb .. status: %d",
|
||||
result as int);
|
||||
}
|
||||
}
|
||||
|
||||
extern fn on_connect_cb(connect_req_ptr: *uv_connect_t,
|
||||
status: libc::c_int) {
|
||||
unsafe {
|
||||
log(debug, fmt!("beginning on_connect_cb .. status: %d",
|
||||
status as int));
|
||||
debug!("beginning on_connect_cb .. status: %d",
|
||||
status as int);
|
||||
let stream =
|
||||
get_stream_handle_from_connect_req(connect_req_ptr);
|
||||
if (status == 0i32) {
|
||||
log(debug, ~"on_connect_cb: in status=0 if..");
|
||||
debug!("on_connect_cb: in status=0 if..");
|
||||
let client_data = get_data_for_req(
|
||||
connect_req_ptr as *libc::c_void)
|
||||
as *request_wrapper;
|
||||
let write_handle = (*client_data).write_req;
|
||||
log(debug, fmt!("on_connect_cb: tcp: %d write_hdl: %d",
|
||||
stream as int, write_handle as int));
|
||||
debug!("on_connect_cb: tcp: %d write_hdl: %d",
|
||||
stream as int, write_handle as int);
|
||||
let write_result = write(write_handle,
|
||||
stream as *libc::c_void,
|
||||
(*client_data).req_buf,
|
||||
on_write_complete_cb);
|
||||
log(debug, fmt!("on_connect_cb: write() status: %d",
|
||||
write_result as int));
|
||||
debug!("on_connect_cb: write() status: %d",
|
||||
write_result as int);
|
||||
}
|
||||
else {
|
||||
let test_loop = get_loop_for_uv_handle(
|
||||
stream as *libc::c_void);
|
||||
let err_msg = get_last_err_info(test_loop);
|
||||
log(debug, err_msg);
|
||||
debug!("%?", err_msg);
|
||||
fail_unless!(false);
|
||||
}
|
||||
log(debug, ~"finishing on_connect_cb");
|
||||
debug!("finishing on_connect_cb");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1376,7 +1376,7 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
// data field in our uv_connect_t struct
|
||||
let req_str_bytes = str::to_bytes(req_str);
|
||||
let req_msg_ptr: *u8 = vec::raw::to_ptr(req_str_bytes);
|
||||
log(debug, fmt!("req_msg ptr: %u", req_msg_ptr as uint));
|
||||
debug!("req_msg ptr: %u", req_msg_ptr as uint);
|
||||
let req_msg = ~[
|
||||
buf_init(req_msg_ptr, vec::len(req_str_bytes))
|
||||
];
|
||||
@ -1384,9 +1384,9 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
// this to C..
|
||||
let write_handle = write_t();
|
||||
let write_handle_ptr = ptr::addr_of(&write_handle);
|
||||
log(debug, fmt!("tcp req: tcp stream: %d write_handle: %d",
|
||||
debug!("tcp req: tcp stream: %d write_handle: %d",
|
||||
tcp_handle_ptr as int,
|
||||
write_handle_ptr as int));
|
||||
write_handle_ptr as int);
|
||||
let client_data = request_wrapper {
|
||||
write_req: write_handle_ptr,
|
||||
req_buf: ptr::addr_of(&req_msg),
|
||||
@ -1396,18 +1396,18 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
let tcp_init_result = tcp_init(
|
||||
test_loop as *libc::c_void, tcp_handle_ptr);
|
||||
if (tcp_init_result == 0i32) {
|
||||
log(debug, ~"sucessful tcp_init_result");
|
||||
debug!("sucessful tcp_init_result");
|
||||
|
||||
log(debug, ~"building addr...");
|
||||
debug!("building addr...");
|
||||
let addr = ip4_addr(ip, port);
|
||||
// FIXME ref #2064
|
||||
let addr_ptr = ptr::addr_of(&addr);
|
||||
log(debug, fmt!("after build addr in rust. port: %u",
|
||||
addr.sin_port as uint));
|
||||
debug!("after build addr in rust. port: %u",
|
||||
addr.sin_port as uint);
|
||||
|
||||
// this should set up the connection request..
|
||||
log(debug, fmt!("b4 call tcp_connect connect cb: %u ",
|
||||
on_connect_cb as uint));
|
||||
debug!("b4 call tcp_connect connect cb: %u ",
|
||||
on_connect_cb as uint);
|
||||
let tcp_connect_result = tcp_connect(
|
||||
connect_req_ptr, tcp_handle_ptr,
|
||||
addr_ptr, on_connect_cb);
|
||||
@ -1420,17 +1420,17 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
set_data_for_uv_handle(
|
||||
tcp_handle_ptr as *libc::c_void,
|
||||
ptr::addr_of(&client_data) as *libc::c_void);
|
||||
log(debug, ~"before run tcp req loop");
|
||||
debug!("before run tcp req loop");
|
||||
run(test_loop);
|
||||
log(debug, ~"after run tcp req loop");
|
||||
debug!("after run tcp req loop");
|
||||
}
|
||||
else {
|
||||
log(debug, ~"tcp_connect() failure");
|
||||
debug!("tcp_connect() failure");
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, ~"tcp_init() failure");
|
||||
debug!("tcp_init() failure");
|
||||
fail_unless!(false);
|
||||
}
|
||||
loop_delete(test_loop);
|
||||
@ -1439,15 +1439,15 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
|
||||
extern fn server_after_close_cb(handle: *libc::c_void) {
|
||||
unsafe {
|
||||
log(debug, fmt!("SERVER server stream closed, should exit. h: %?",
|
||||
handle));
|
||||
debug!("SERVER server stream closed, should exit. h: %?",
|
||||
handle);
|
||||
}
|
||||
}
|
||||
|
||||
extern fn client_stream_after_close_cb(handle: *libc::c_void) {
|
||||
unsafe {
|
||||
log(debug,
|
||||
~"SERVER: closed client stream, now closing server stream");
|
||||
debug!(
|
||||
"SERVER: closed client stream, now closing server stream");
|
||||
let client_data = get_data_for_uv_handle(
|
||||
handle) as
|
||||
*tcp_server_data;
|
||||
@ -1460,7 +1460,7 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
unsafe {
|
||||
let client_stream_ptr =
|
||||
get_stream_handle_from_write_req(req);
|
||||
log(debug, ~"SERVER: resp sent... closing client stream");
|
||||
debug!("SERVER: resp sent... closing client stream");
|
||||
close(client_stream_ptr as *libc::c_void,
|
||||
client_stream_after_close_cb)
|
||||
}
|
||||
@ -1473,15 +1473,15 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
let nread = nread as int;
|
||||
if (nread > 0) {
|
||||
// we have data
|
||||
log(debug, fmt!("SERVER read: data! nread: %d", nread));
|
||||
debug!("SERVER read: data! nread: %d", nread);
|
||||
|
||||
// pull out the contents of the write from the client
|
||||
let buf_base = get_base_from_buf(buf);
|
||||
let buf_len = get_len_from_buf(buf) as uint;
|
||||
log(debug, fmt!("SERVER buf base: %u, len: %u, nread: %d",
|
||||
debug!("SERVER buf base: %u, len: %u, nread: %d",
|
||||
buf_base as uint,
|
||||
buf_len as uint,
|
||||
nread));
|
||||
nread);
|
||||
let bytes = vec::from_buf(buf_base, nread as uint);
|
||||
let request_str = str::from_bytes(bytes);
|
||||
|
||||
@ -1491,8 +1491,8 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
let server_kill_msg = copy (*client_data).server_kill_msg;
|
||||
let write_req = (*client_data).server_write_req;
|
||||
if str::contains(request_str, server_kill_msg) {
|
||||
log(debug, ~"SERVER: client req contains kill_msg!");
|
||||
log(debug, ~"SERVER: sending response to client");
|
||||
debug!("SERVER: client req contains kill_msg!");
|
||||
debug!("SERVER: sending response to client");
|
||||
read_stop(client_stream_ptr);
|
||||
let server_chan = (*client_data).server_chan.clone();
|
||||
server_chan.send(request_str);
|
||||
@ -1501,31 +1501,31 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
client_stream_ptr as *libc::c_void,
|
||||
(*client_data).server_resp_buf,
|
||||
after_server_resp_write);
|
||||
log(debug, fmt!("SERVER: resp write result: %d",
|
||||
write_result as int));
|
||||
debug!("SERVER: resp write result: %d",
|
||||
write_result as int);
|
||||
if (write_result != 0i32) {
|
||||
log(debug, ~"bad result for server resp write()");
|
||||
log(debug, get_last_err_info(
|
||||
debug!("bad result for server resp write()");
|
||||
debug!("%s", get_last_err_info(
|
||||
get_loop_for_uv_handle(client_stream_ptr
|
||||
as *libc::c_void)));
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, ~"SERVER: client req !contain kill_msg!");
|
||||
debug!("SERVER: client req !contain kill_msg!");
|
||||
}
|
||||
}
|
||||
else if (nread == -1) {
|
||||
// err .. possibly EOF
|
||||
log(debug, ~"read: eof!");
|
||||
debug!("read: eof!");
|
||||
}
|
||||
else {
|
||||
// nread == 0 .. do nothing, just free buf as below
|
||||
log(debug, ~"read: do nothing!");
|
||||
debug!("read: do nothing!");
|
||||
}
|
||||
// when we're done
|
||||
free_base_of_buf(buf);
|
||||
log(debug, ~"SERVER exiting on_read_cb");
|
||||
debug!("SERVER exiting on_read_cb");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1533,13 +1533,13 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
*uv_stream_t,
|
||||
status: libc::c_int) {
|
||||
unsafe {
|
||||
log(debug, ~"client connecting!");
|
||||
debug!("client connecting!");
|
||||
let test_loop = get_loop_for_uv_handle(
|
||||
server_stream_ptr as *libc::c_void);
|
||||
if status != 0i32 {
|
||||
let err_msg = get_last_err_info(test_loop);
|
||||
log(debug, fmt!("server_connect_cb: non-zero status: %?",
|
||||
err_msg));
|
||||
debug!("server_connect_cb: non-zero status: %?",
|
||||
err_msg);
|
||||
return;
|
||||
}
|
||||
let server_data = get_data_for_uv_handle(
|
||||
@ -1551,7 +1551,7 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
client_stream_ptr as *libc::c_void,
|
||||
server_data as *libc::c_void);
|
||||
if (client_init_result == 0i32) {
|
||||
log(debug, ~"successfully initialized client stream");
|
||||
debug!("successfully initialized client stream");
|
||||
let accept_result = accept(server_stream_ptr as
|
||||
*libc::c_void,
|
||||
client_stream_ptr as
|
||||
@ -1563,23 +1563,23 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
|
||||
on_alloc_cb,
|
||||
on_server_read_cb);
|
||||
if (read_result == 0i32) {
|
||||
log(debug, ~"successful server read start");
|
||||
debug!("successful server read start");
|
||||
}
|
||||
else {
|
||||
log(debug, fmt!("server_connection_cb: bad read:%d",
|
||||
read_result as int));
|
||||
debug!("server_connection_cb: bad read:%d",
|
||||
read_result as int);
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, fmt!("server_connection_cb: bad accept: %d",
|
||||
accept_result as int));
|
||||
debug!("server_connection_cb: bad accept: %d",
|
||||
accept_result as int);
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, fmt!("server_connection_cb: bad client init: %d",
|
||||
client_init_result as int));
|
||||
debug!("server_connection_cb: bad client init: %d",
|
||||
client_init_result as int);
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
@ -1599,8 +1599,8 @@ struct async_handle_data {
|
||||
}
|
||||
|
||||
extern fn async_close_cb(handle: *libc::c_void) {
|
||||
log(debug, fmt!("SERVER: closing async cb... h: %?",
|
||||
handle));
|
||||
debug!("SERVER: closing async cb... h: %?",
|
||||
handle);
|
||||
}
|
||||
|
||||
extern fn continue_async_cb(async_handle: *uv_async_t,
|
||||
@ -1638,7 +1638,7 @@ fn impl_uv_tcp_server(server_ip: &str,
|
||||
|
||||
let resp_str_bytes = str::to_bytes(server_resp_msg);
|
||||
let resp_msg_ptr: *u8 = vec::raw::to_ptr(resp_str_bytes);
|
||||
log(debug, fmt!("resp_msg ptr: %u", resp_msg_ptr as uint));
|
||||
debug!("resp_msg ptr: %u", resp_msg_ptr as uint);
|
||||
let resp_msg = ~[
|
||||
buf_init(resp_msg_ptr, vec::len(resp_str_bytes))
|
||||
];
|
||||
@ -1674,7 +1674,7 @@ fn impl_uv_tcp_server(server_ip: &str,
|
||||
let bind_result = tcp_bind(tcp_server_ptr,
|
||||
server_addr_ptr);
|
||||
if (bind_result == 0i32) {
|
||||
log(debug, ~"successful uv_tcp_bind, listening");
|
||||
debug!("successful uv_tcp_bind, listening");
|
||||
|
||||
// uv_listen()
|
||||
let listen_result = listen(tcp_server_ptr as
|
||||
@ -1694,29 +1694,29 @@ fn impl_uv_tcp_server(server_ip: &str,
|
||||
async_send(continue_async_handle_ptr);
|
||||
// uv_run()
|
||||
run(test_loop);
|
||||
log(debug, ~"server uv::run() has returned");
|
||||
debug!("server uv::run() has returned");
|
||||
}
|
||||
else {
|
||||
log(debug, fmt!("uv_async_init failure: %d",
|
||||
async_result as int));
|
||||
debug!("uv_async_init failure: %d",
|
||||
async_result as int);
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, fmt!("non-zero result on uv_listen: %d",
|
||||
listen_result as int));
|
||||
debug!("non-zero result on uv_listen: %d",
|
||||
listen_result as int);
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, fmt!("non-zero result on uv_tcp_bind: %d",
|
||||
bind_result as int));
|
||||
debug!("non-zero result on uv_tcp_bind: %d",
|
||||
bind_result as int);
|
||||
fail_unless!(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, fmt!("non-zero result on uv_tcp_init: %d",
|
||||
tcp_init_result as int));
|
||||
debug!("non-zero result on uv_tcp_init: %d",
|
||||
tcp_init_result as int);
|
||||
fail_unless!(false);
|
||||
}
|
||||
loop_delete(test_loop);
|
||||
@ -1751,9 +1751,9 @@ pub fn impl_uv_tcp_server_and_request() {
|
||||
};
|
||||
|
||||
// block until the server up is.. possibly a race?
|
||||
log(debug, ~"before receiving on server continue_port");
|
||||
debug!("before receiving on server continue_port");
|
||||
continue_port.recv();
|
||||
log(debug, ~"received on continue port, set up tcp client");
|
||||
debug!("received on continue port, set up tcp client");
|
||||
|
||||
let kill_server_msg_copy = copy kill_server_msg;
|
||||
do task::spawn_sched(task::ManualThreads(1u)) {
|
||||
@ -1808,7 +1808,7 @@ fn struct_size_check_common<TStruct>(t_name: ~str,
|
||||
let output = fmt!(
|
||||
"STRUCT_SIZE FAILURE: %s -- actual: %u expected: %u",
|
||||
t_name, rust_size, foreign_size as uint);
|
||||
log(debug, output);
|
||||
debug!("%s", output);
|
||||
}
|
||||
fail_unless!(sizes_match);
|
||||
}
|
||||
@ -1869,7 +1869,7 @@ fn test_uv_ll_struct_size_sockaddr_in6() {
|
||||
let rust_handle_size = sys::size_of::<sockaddr_in6>();
|
||||
let output = fmt!("sockaddr_in6 -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
debug!(output);
|
||||
// FIXME #1645 .. rust appears to pad structs to the nearest
|
||||
// byte..?
|
||||
// .. can't get the uv::ll::sockaddr_in6 to == 28 :/
|
||||
@ -1888,7 +1888,7 @@ fn test_uv_ll_struct_size_addr_in() {
|
||||
let rust_handle_size = sys::size_of::<addr_in>();
|
||||
let output = fmt!("addr_in -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
debug!(output);
|
||||
// FIXME #1645 .. see note above about struct padding
|
||||
fail_unless!((4u+foreign_handle_size as uint) ==
|
||||
rust_handle_size);
|
||||
|
@ -289,10 +289,10 @@ pub fn check_variants_T<T: Copy>(
|
||||
|
||||
if L < 100 {
|
||||
do under(uint::min(L, 20)) |i| {
|
||||
log(error, ~"Replacing... #" + uint::to_str(i));
|
||||
error!("Replacing... #%?", uint::to_str(i));
|
||||
let fname = str::from_slice(filename.to_str());
|
||||
do under(uint::min(L, 30)) |j| {
|
||||
log(error, ~"With... " + stringifier(@things[j], intr));
|
||||
error!("With... %?", stringifier(@things[j], intr));
|
||||
let crate2 = @replacer(crate, i, things[j], cx.mode);
|
||||
// It would be best to test the *crate* for stability, but
|
||||
// testing the string for stability is easier and ok for now.
|
||||
@ -363,8 +363,8 @@ pub fn check_whole_compiler(code: ~str, suggested_filename_prefix: &Path,
|
||||
removeDirIfExists(&suggested_filename_prefix.with_filetype("dSYM"));
|
||||
}
|
||||
failed(s) => {
|
||||
log(error, ~"check_whole_compiler failure: " + s);
|
||||
log(error, ~"Saved as: " + filename.to_str());
|
||||
error!("check_whole_compiler failure: %?", s);
|
||||
error!("Saved as: %?", filename.to_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -387,7 +387,7 @@ pub fn check_running(exe_filename: &Path) -> happiness {
|
||||
~[exe_filename.to_str()]);
|
||||
let comb = p.out + ~"\n" + p.err;
|
||||
if str::len(comb) > 1u {
|
||||
log(error, ~"comb comb comb: " + comb);
|
||||
error!("comb comb comb: %?", comb);
|
||||
}
|
||||
|
||||
if contains(comb, ~"Assertion failed:") {
|
||||
@ -433,21 +433,21 @@ pub fn check_compiling(filename: &Path) -> happiness {
|
||||
if contains(p.err, ~"error:") {
|
||||
cleanly_rejected(~"rejected with span_error")
|
||||
} else {
|
||||
log(error, ~"Stderr: " + p.err);
|
||||
error!("Stderr: %?", p.err);
|
||||
failed(~"Unfamiliar error message")
|
||||
}
|
||||
} else if contains(p.out, ~"Assertion") && contains(p.out, ~"failed") {
|
||||
log(error, ~"Stdout: " + p.out);
|
||||
error!("Stdout: %?", p.out);
|
||||
failed(~"Looks like an llvm assertion failure")
|
||||
} else if contains(p.out, ~"internal compiler error unimplemented") {
|
||||
known_bug(~"Something unimplemented")
|
||||
} else if contains(p.out, ~"internal compiler error") {
|
||||
log(error, ~"Stdout: " + p.out);
|
||||
error!("Stdout: %?", p.out);
|
||||
failed(~"internal compiler error")
|
||||
|
||||
} else {
|
||||
log(error, p.status);
|
||||
log(error, ~"!Stdout: " + p.out);
|
||||
error!("%?", p.status);
|
||||
error!("!Stdout: %?", p.out);
|
||||
failed(~"What happened?")
|
||||
}
|
||||
}
|
||||
@ -609,7 +609,7 @@ pub fn check_variants(files: &[Path], cx: Context) {
|
||||
|
||||
let file_str = file.to_str();
|
||||
|
||||
log(error, ~"check_variants: " + file_str);
|
||||
error!("check_variants: %?", file_str);
|
||||
let sess = parse::new_parse_sess(option::None);
|
||||
let crate =
|
||||
parse::parse_crate_from_source_str(
|
||||
|
@ -758,7 +758,7 @@ fn unlib(config: @session::config, +stem: ~str) -> ~str {
|
||||
/*bad*/copy *out_filename
|
||||
};
|
||||
|
||||
log(debug, ~"output: " + output.to_str());
|
||||
debug!("output: %s", output.to_str());
|
||||
|
||||
// The default library location, we need this to find the runtime.
|
||||
// The location of crates will be determined as needed.
|
||||
|
@ -803,12 +803,12 @@ pub fn invoke(bcx: block, llfn: ValueRef, +llargs: ~[ValueRef]) -> block {
|
||||
let _icx = bcx.insn_ctxt("invoke_");
|
||||
if bcx.unreachable { return bcx; }
|
||||
if need_invoke(bcx) {
|
||||
log(debug, ~"invoking");
|
||||
debug!("invoking");
|
||||
let normal_bcx = sub_block(bcx, ~"normal return");
|
||||
Invoke(bcx, llfn, llargs, normal_bcx.llbb, get_landing_pad(bcx));
|
||||
return normal_bcx;
|
||||
} else {
|
||||
log(debug, ~"calling");
|
||||
debug!("calling");
|
||||
Call(bcx, llfn, llargs);
|
||||
return bcx;
|
||||
}
|
||||
@ -1487,7 +1487,7 @@ pub fn alloc_ty(bcx: block, t: ty::t) -> ValueRef {
|
||||
let _icx = bcx.insn_ctxt("alloc_ty");
|
||||
let ccx = bcx.ccx();
|
||||
let llty = type_of::type_of(ccx, t);
|
||||
if ty::type_has_params(t) { log(error, ty_to_str(ccx.tcx, t)); }
|
||||
if ty::type_has_params(t) { error!("%s", ty_to_str(ccx.tcx, t)); }
|
||||
fail_unless!(!ty::type_has_params(t));
|
||||
let val = alloca(bcx, llty);
|
||||
return val;
|
||||
|
@ -848,7 +848,7 @@ pub fn add_span_comment(bcx: block, sp: span, text: &str) {
|
||||
let ccx = bcx.ccx();
|
||||
if !ccx.sess.no_asm_comments() {
|
||||
let s = fmt!("%s (%s)", text, ccx.sess.codemap.span_to_str(sp));
|
||||
log(debug, copy s);
|
||||
debug!("%s", copy s);
|
||||
add_comment(bcx, s);
|
||||
}
|
||||
}
|
||||
|
@ -806,10 +806,10 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
|
||||
let dbg_cx = (/*bad*/copy cx.dbg_cx).get();
|
||||
|
||||
debug!("~~");
|
||||
log(debug, fcx.id);
|
||||
debug!("%?", fcx.id);
|
||||
|
||||
let sp = fcx.span.get();
|
||||
log(debug, cx.sess.codemap.span_to_str(sp));
|
||||
debug!("%s", cx.sess.codemap.span_to_str(sp));
|
||||
|
||||
let (ident, ret_ty, id) = match cx.tcx.items.get(&fcx.id) {
|
||||
ast_map::node_item(item, _) => {
|
||||
@ -841,8 +841,8 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
|
||||
sort of node")
|
||||
};
|
||||
|
||||
log(debug, ident);
|
||||
log(debug, id);
|
||||
debug!("%?", ident);
|
||||
debug!("%?", id);
|
||||
|
||||
let cache = get_cache(cx);
|
||||
match cached_metadata::<@Metadata<SubProgramMetadata>>(
|
||||
|
@ -708,7 +708,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
|
||||
free_glue: None,
|
||||
visit_glue: None
|
||||
};
|
||||
log(debug, ~"--- declare_tydesc " + ppaux::ty_to_str(ccx.tcx, t));
|
||||
debug!("--- declare_tydesc %s", ppaux::ty_to_str(ccx.tcx, t));
|
||||
return inf;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ struct Bored {
|
||||
}
|
||||
|
||||
impl Drop for Bored {
|
||||
fn finalize(&self) { log(error, self.bored); }
|
||||
fn finalize(&self) { }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ pub fn run_passes(
|
||||
) -> doc::Doc {
|
||||
let mut passno = 0;
|
||||
do vec::foldl(doc, passes) |doc, pass| {
|
||||
log(debug, fmt!("pass #%d", passno));
|
||||
debug!("pass #%d", passno);
|
||||
passno += 1;
|
||||
do time(copy pass.name) {
|
||||
(pass.f)(srv.clone(), copy doc)
|
||||
|
@ -509,7 +509,7 @@ pub fn manually_share_arc() {
|
||||
|
||||
fail_unless!((*arc::get(&arc_v))[2] == 3);
|
||||
|
||||
log(info, arc_v);
|
||||
info!(arc_v);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -116,7 +116,6 @@ mod tests {
|
||||
use super::*;
|
||||
use core::cmp::Eq;
|
||||
use core::kinds::{Durable, Copy};
|
||||
use core::prelude::debug;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
@ -128,21 +127,21 @@ fn test_simple() {
|
||||
fail_unless!(d.len() == 3u);
|
||||
d.add_back(137);
|
||||
fail_unless!(d.len() == 4u);
|
||||
log(debug, d.peek_front());
|
||||
debug!(d.peek_front());
|
||||
fail_unless!(*d.peek_front() == 42);
|
||||
log(debug, d.peek_back());
|
||||
debug!(d.peek_back());
|
||||
fail_unless!(*d.peek_back() == 137);
|
||||
let mut i: int = d.pop_front();
|
||||
log(debug, i);
|
||||
debug!(i);
|
||||
fail_unless!(i == 42);
|
||||
i = d.pop_back();
|
||||
log(debug, i);
|
||||
debug!(i);
|
||||
fail_unless!(i == 137);
|
||||
i = d.pop_back();
|
||||
log(debug, i);
|
||||
debug!(i);
|
||||
fail_unless!(i == 137);
|
||||
i = d.pop_back();
|
||||
log(debug, i);
|
||||
debug!(i);
|
||||
fail_unless!(i == 17);
|
||||
fail_unless!(d.len() == 0u);
|
||||
d.add_back(3);
|
||||
@ -153,10 +152,10 @@ fn test_simple() {
|
||||
fail_unless!(d.len() == 3u);
|
||||
d.add_front(1);
|
||||
fail_unless!(d.len() == 4u);
|
||||
log(debug, d.get(0));
|
||||
log(debug, d.get(1));
|
||||
log(debug, d.get(2));
|
||||
log(debug, d.get(3));
|
||||
debug!(d.get(0));
|
||||
debug!(d.get(1));
|
||||
debug!(d.get(2));
|
||||
debug!(d.get(3));
|
||||
fail_unless!(*d.get(0) == 1);
|
||||
fail_unless!(*d.get(1) == 2);
|
||||
fail_unless!(*d.get(2) == 3);
|
||||
|
@ -881,7 +881,7 @@ pub fn test_optflag_long_arg() {
|
||||
let rs = getopts(args, opts);
|
||||
match rs {
|
||||
Err(copy f) => {
|
||||
log(error, fail_str(f));
|
||||
error!(fail_str(f));
|
||||
check_fail_type(f, UnexpectedArgument_);
|
||||
}
|
||||
_ => fail!()
|
||||
|
@ -117,7 +117,7 @@ pub fn get_addr(node: &str, iotask: &iotask)
|
||||
do str::as_buf(node) |node_ptr, len| {
|
||||
let output_ch = output_ch.swap_unwrap();
|
||||
unsafe {
|
||||
log(debug, fmt!("slice len %?", len));
|
||||
debug!("slice len %?", len);
|
||||
let handle = create_uv_getaddrinfo_t();
|
||||
let handle_ptr = ptr::addr_of(&handle);
|
||||
let handle_data = GetAddrData {
|
||||
@ -228,8 +228,8 @@ pub fn try_parse_addr(ip: &str) -> result::Result<IpAddr,ParseAddrErr> {
|
||||
|
||||
let new_addr = uv_ip4_addr(str::from_slice(ip), 22);
|
||||
let reformatted_name = uv_ip4_name(&new_addr);
|
||||
log(debug, fmt!("try_parse_addr: input ip: %s reparsed ip: %s",
|
||||
ip, reformatted_name));
|
||||
debug!("try_parse_addr: input ip: %s reparsed ip: %s",
|
||||
ip, reformatted_name);
|
||||
let ref_ip_rep_result = parse_to_ipv4_rep(reformatted_name);
|
||||
if result::is_err(&ref_ip_rep_result) {
|
||||
let err_str = result::get_err(&ref_ip_rep_result);
|
||||
@ -282,8 +282,8 @@ pub fn try_parse_addr(ip: &str) -> result::Result<IpAddr,ParseAddrErr> {
|
||||
// need to figure out how to establish a parse failure..
|
||||
let new_addr = uv_ip6_addr(str::from_slice(ip), 22);
|
||||
let reparsed_name = uv_ip6_name(&new_addr);
|
||||
log(debug, fmt!("v6::try_parse_addr ip: '%s' reparsed '%s'",
|
||||
ip, reparsed_name));
|
||||
debug!("v6::try_parse_addr ip: '%s' reparsed '%s'",
|
||||
ip, reparsed_name);
|
||||
// '::' appears to be uv_ip6_name() returns for bogus
|
||||
// parses..
|
||||
if ip != &"::" && reparsed_name == ~"::" {
|
||||
@ -303,14 +303,14 @@ struct GetAddrData {
|
||||
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||
res: *addrinfo) {
|
||||
unsafe {
|
||||
log(debug, ~"in get_addr_cb");
|
||||
debug!("in get_addr_cb");
|
||||
let handle_data = get_data_for_req(handle) as
|
||||
*GetAddrData;
|
||||
let output_ch = (*handle_data).output_ch.clone();
|
||||
if status == 0i32 {
|
||||
if res != (ptr::null::<addrinfo>()) {
|
||||
let mut out_vec = ~[];
|
||||
log(debug, fmt!("initial addrinfo: %?", res));
|
||||
debug!("initial addrinfo: %?", res);
|
||||
let mut curr_addr = res;
|
||||
loop {
|
||||
let new_ip_addr = if ll::is_ipv4_addrinfo(curr_addr) {
|
||||
@ -322,8 +322,8 @@ struct GetAddrData {
|
||||
*ll::addrinfo_as_sockaddr_in6(curr_addr))))
|
||||
}
|
||||
else {
|
||||
log(debug, ~"curr_addr is not of family AF_INET or "+
|
||||
~"AF_INET6. Error.");
|
||||
debug!("curr_addr is not of family AF_INET or \
|
||||
AF_INET6. Error.");
|
||||
output_ch.send(
|
||||
result::Err(GetAddrUnknownError));
|
||||
break;
|
||||
@ -332,33 +332,33 @@ struct GetAddrData {
|
||||
|
||||
let next_addr = ll::get_next_addrinfo(curr_addr);
|
||||
if next_addr == ptr::null::<addrinfo>() as *addrinfo {
|
||||
log(debug, ~"null next_addr encountered. no mas");
|
||||
debug!("null next_addr encountered. no mas");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
curr_addr = next_addr;
|
||||
log(debug, fmt!("next_addr addrinfo: %?", curr_addr));
|
||||
debug!("next_addr addrinfo: %?", curr_addr);
|
||||
}
|
||||
}
|
||||
log(debug, fmt!("successful process addrinfo result, len: %?",
|
||||
vec::len(out_vec)));
|
||||
debug!("successful process addrinfo result, len: %?",
|
||||
vec::len(out_vec));
|
||||
output_ch.send(result::Ok(out_vec));
|
||||
}
|
||||
else {
|
||||
log(debug, ~"addrinfo pointer is NULL");
|
||||
debug!("addrinfo pointer is NULL");
|
||||
output_ch.send(
|
||||
result::Err(GetAddrUnknownError));
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(debug, ~"status != 0 error in get_addr_cb");
|
||||
debug!("status != 0 error in get_addr_cb");
|
||||
output_ch.send(
|
||||
result::Err(GetAddrUnknownError));
|
||||
}
|
||||
if res != (ptr::null::<addrinfo>()) {
|
||||
uv_freeaddrinfo(res);
|
||||
}
|
||||
log(debug, ~"leaving get_addr_cb");
|
||||
debug!("leaving get_addr_cb");
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,15 +384,15 @@ fn test_ip_ipv4_parse_and_format_ip() {
|
||||
fn test_ip_ipv6_parse_and_format_ip() {
|
||||
let localhost_str = ~"::1";
|
||||
let format_result = format_addr(&v6::parse_addr(localhost_str));
|
||||
log(debug, fmt!("results: expected: '%s' actual: '%s'",
|
||||
localhost_str, format_result));
|
||||
debug!("results: expected: '%s' actual: '%s'",
|
||||
localhost_str, format_result);
|
||||
fail_unless!(format_result == localhost_str);
|
||||
}
|
||||
#[test]
|
||||
fn test_ip_ipv4_bad_parse() {
|
||||
match v4::try_parse_addr(~"b4df00d") {
|
||||
result::Err(ref err_info) => {
|
||||
log(debug, fmt!("got error as expected %?", err_info));
|
||||
debug!("got error as expected %?", err_info);
|
||||
fail_unless!(true);
|
||||
}
|
||||
result::Ok(ref addr) => {
|
||||
@ -405,7 +405,7 @@ fn test_ip_ipv4_bad_parse() {
|
||||
fn test_ip_ipv6_bad_parse() {
|
||||
match v6::try_parse_addr(~"::,~2234k;") {
|
||||
result::Err(ref err_info) => {
|
||||
log(debug, fmt!("got error as expected %?", err_info));
|
||||
debug!("got error as expected %?", err_info);
|
||||
fail_unless!(true);
|
||||
}
|
||||
result::Ok(ref addr) => {
|
||||
@ -425,15 +425,15 @@ fn test_ip_get_addr() {
|
||||
// note really sure how to realiably test/assert
|
||||
// this.. mostly just wanting to see it work, atm.
|
||||
let results = result::unwrap(ga_result);
|
||||
log(debug, fmt!("test_get_addr: Number of results for %s: %?",
|
||||
localhost_name, vec::len(results)));
|
||||
debug!("test_get_addr: Number of results for %s: %?",
|
||||
localhost_name, vec::len(results));
|
||||
for vec::each(results) |r| {
|
||||
let ipv_prefix = match *r {
|
||||
Ipv4(_) => ~"IPv4",
|
||||
Ipv6(_) => ~"IPv6"
|
||||
};
|
||||
log(debug, fmt!("test_get_addr: result %s: '%s'",
|
||||
ipv_prefix, format_addr(r)));
|
||||
debug!("test_get_addr: result %s: '%s'",
|
||||
ipv_prefix, format_addr(r));
|
||||
}
|
||||
// at least one result.. this is going to vary from system
|
||||
// to system, based on stuff like the contents of /etc/hosts
|
||||
|
@ -559,14 +559,14 @@ pub fn accept(new_conn: TcpNewConnection)
|
||||
server_handle_ptr);
|
||||
match uv::ll::tcp_init(loop_ptr, client_stream_handle_ptr) {
|
||||
0i32 => {
|
||||
log(debug, ~"uv_tcp_init successful for \
|
||||
debug!("uv_tcp_init successful for \
|
||||
client stream");
|
||||
match uv::ll::accept(
|
||||
server_handle_ptr as *libc::c_void,
|
||||
client_stream_handle_ptr as *libc::c_void) {
|
||||
0i32 => {
|
||||
log(debug,
|
||||
~"successfully accepted client \
|
||||
debug!(
|
||||
"successfully accepted client \
|
||||
connection");
|
||||
uv::ll::set_data_for_uv_handle(
|
||||
client_stream_handle_ptr,
|
||||
@ -575,7 +575,7 @@ pub fn accept(new_conn: TcpNewConnection)
|
||||
result_ch.send(None);
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"failed to accept client conn");
|
||||
debug!("failed to accept client conn");
|
||||
result_ch.send(Some(
|
||||
uv::ll::get_last_err_data(
|
||||
loop_ptr).to_tcp_err()));
|
||||
@ -583,7 +583,7 @@ pub fn accept(new_conn: TcpNewConnection)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"failed to accept client stream");
|
||||
debug!("failed to accept client stream");
|
||||
result_ch.send(Some(
|
||||
uv::ll::get_last_err_data(
|
||||
loop_ptr).to_tcp_err()));
|
||||
@ -694,7 +694,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
let addr_str = ip::format_addr(&loc_ip);
|
||||
let bind_result = match loc_ip {
|
||||
ip::Ipv4(ref addr) => {
|
||||
log(debug, fmt!("addr: %?", addr));
|
||||
debug!("addr: %?", addr);
|
||||
let in_addr = uv::ll::ip4_addr(
|
||||
addr_str,
|
||||
port as int);
|
||||
@ -702,7 +702,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
ptr::addr_of(&in_addr))
|
||||
}
|
||||
ip::Ipv6(ref addr) => {
|
||||
log(debug, fmt!("addr: %?", addr));
|
||||
debug!("addr: %?", addr);
|
||||
let in_addr = uv::ll::ip6_addr(
|
||||
addr_str,
|
||||
port as int);
|
||||
@ -718,8 +718,8 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
tcp_lfc_on_connection_cb) {
|
||||
0i32 => setup_ch.send(None),
|
||||
_ => {
|
||||
log(debug,
|
||||
~"failure to uv_tcp_init");
|
||||
debug!(
|
||||
"failure to uv_tcp_init");
|
||||
let err_data =
|
||||
uv::ll::get_last_err_data(
|
||||
loop_ptr);
|
||||
@ -728,7 +728,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"failure to uv_tcp_bind");
|
||||
debug!("failure to uv_tcp_bind");
|
||||
let err_data = uv::ll::get_last_err_data(
|
||||
loop_ptr);
|
||||
setup_ch.send(Some(err_data));
|
||||
@ -736,7 +736,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"failure to uv_tcp_bind");
|
||||
debug!("failure to uv_tcp_bind");
|
||||
let err_data = uv::ll::get_last_err_data(
|
||||
loop_ptr);
|
||||
setup_ch.send(Some(err_data));
|
||||
@ -751,9 +751,9 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
Some(ref err_data) => {
|
||||
do iotask::interact(iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
log(debug,
|
||||
fmt!("tcp::listen post-kill recv hl interact %?",
|
||||
loop_ptr));
|
||||
debug!(
|
||||
"tcp::listen post-kill recv hl interact %?",
|
||||
loop_ptr);
|
||||
(*server_data_ptr).active = false;
|
||||
uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
|
||||
}
|
||||
@ -761,16 +761,16 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
stream_closed_po.recv();
|
||||
match err_data.err_name {
|
||||
~"EACCES" => {
|
||||
log(debug, ~"Got EACCES error");
|
||||
debug!("Got EACCES error");
|
||||
result::Err(AccessDenied)
|
||||
}
|
||||
~"EADDRINUSE" => {
|
||||
log(debug, ~"Got EADDRINUSE error");
|
||||
debug!("Got EADDRINUSE error");
|
||||
result::Err(AddressInUse)
|
||||
}
|
||||
_ => {
|
||||
log(debug, fmt!("Got '%s' '%s' libuv error",
|
||||
err_data.err_name, err_data.err_msg));
|
||||
debug!("Got '%s' '%s' libuv error",
|
||||
err_data.err_name, err_data.err_msg);
|
||||
result::Err(
|
||||
GenericListenErr(err_data.err_name,
|
||||
err_data.err_msg))
|
||||
@ -782,9 +782,9 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||
let kill_result = kill_po.recv();
|
||||
do iotask::interact(iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
log(debug,
|
||||
fmt!("tcp::listen post-kill recv hl interact %?",
|
||||
loop_ptr));
|
||||
debug!(
|
||||
"tcp::listen post-kill recv hl interact %?",
|
||||
loop_ptr);
|
||||
(*server_data_ptr).active = false;
|
||||
uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
|
||||
}
|
||||
@ -981,9 +981,9 @@ pub fn write(&self, data: &[const u8]) {
|
||||
).to_vec());
|
||||
if w_result.is_err() {
|
||||
let err_data = w_result.get_err();
|
||||
log(debug,
|
||||
fmt!("ERROR sock_buf as io::writer.writer err: %? %?",
|
||||
err_data.err_name, err_data.err_msg));
|
||||
debug!(
|
||||
"ERROR sock_buf as io::writer.writer err: %? %?",
|
||||
err_data.err_name, err_data.err_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1015,9 +1015,9 @@ fn tear_down_socket_data(socket_data: @TcpSocketData) {
|
||||
let stream_handle_ptr = (*socket_data).stream_handle_ptr;
|
||||
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
log(debug,
|
||||
fmt!("interact dtor for tcp_socket stream %? loop %?",
|
||||
stream_handle_ptr, loop_ptr));
|
||||
debug!(
|
||||
"interact dtor for tcp_socket stream %? loop %?",
|
||||
stream_handle_ptr, loop_ptr);
|
||||
uv::ll::set_data_for_uv_handle(stream_handle_ptr,
|
||||
close_data_ptr);
|
||||
uv::ll::close(stream_handle_ptr, tcp_socket_dtor_close_cb);
|
||||
@ -1028,7 +1028,7 @@ fn tear_down_socket_data(socket_data: @TcpSocketData) {
|
||||
//log(debug, fmt!("about to free socket_data at %?", socket_data));
|
||||
rustrt::rust_uv_current_kernel_free(stream_handle_ptr
|
||||
as *libc::c_void);
|
||||
log(debug, ~"exiting dtor for tcp_socket");
|
||||
debug!("exiting dtor for tcp_socket");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1038,7 +1038,7 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
|
||||
unsafe {
|
||||
use timer;
|
||||
|
||||
log(debug, ~"starting tcp::read");
|
||||
debug!("starting tcp::read");
|
||||
let iotask = &(*socket_data).iotask;
|
||||
let rs_result = read_start_common_impl(socket_data);
|
||||
if result::is_err(&rs_result) {
|
||||
@ -1046,17 +1046,17 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
|
||||
result::Err(err_data)
|
||||
}
|
||||
else {
|
||||
log(debug, ~"tcp::read before recv_timeout");
|
||||
debug!("tcp::read before recv_timeout");
|
||||
let read_result = if timeout_msecs > 0u {
|
||||
timer::recv_timeout(
|
||||
iotask, timeout_msecs, result::unwrap(rs_result))
|
||||
} else {
|
||||
Some(result::get(&rs_result).recv())
|
||||
};
|
||||
log(debug, ~"tcp::read after recv_timeout");
|
||||
debug!("tcp::read after recv_timeout");
|
||||
match read_result {
|
||||
None => {
|
||||
log(debug, ~"tcp::read: timed out..");
|
||||
debug!("tcp::read: timed out..");
|
||||
let err_data = TcpErrData {
|
||||
err_name: ~"TIMEOUT",
|
||||
err_msg: ~"req timed out"
|
||||
@ -1065,7 +1065,7 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
|
||||
result::Err(err_data)
|
||||
}
|
||||
Some(data_result) => {
|
||||
log(debug, ~"tcp::read got data");
|
||||
debug!("tcp::read got data");
|
||||
read_stop_common_impl(socket_data);
|
||||
data_result
|
||||
}
|
||||
@ -1082,15 +1082,15 @@ fn read_stop_common_impl(socket_data: *TcpSocketData) ->
|
||||
let (stop_po, stop_ch) = stream::<Option<TcpErrData>>();
|
||||
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
log(debug, ~"in interact cb for tcp::read_stop");
|
||||
debug!("in interact cb for tcp::read_stop");
|
||||
match uv::ll::read_stop(stream_handle_ptr
|
||||
as *uv::ll::uv_stream_t) {
|
||||
0i32 => {
|
||||
log(debug, ~"successfully called uv_read_stop");
|
||||
debug!("successfully called uv_read_stop");
|
||||
stop_ch.send(None);
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"failure in calling uv_read_stop");
|
||||
debug!("failure in calling uv_read_stop");
|
||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||
stop_ch.send(Some(err_data.to_tcp_err()));
|
||||
}
|
||||
@ -1111,21 +1111,21 @@ fn read_start_common_impl(socket_data: *TcpSocketData)
|
||||
unsafe {
|
||||
let stream_handle_ptr = (*socket_data).stream_handle_ptr;
|
||||
let (start_po, start_ch) = stream::<Option<uv::ll::uv_err_data>>();
|
||||
log(debug, ~"in tcp::read_start before interact loop");
|
||||
debug!("in tcp::read_start before interact loop");
|
||||
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
log(debug, fmt!("in tcp::read_start interact cb %?",
|
||||
loop_ptr));
|
||||
debug!("in tcp::read_start interact cb %?",
|
||||
loop_ptr);
|
||||
match uv::ll::read_start(stream_handle_ptr
|
||||
as *uv::ll::uv_stream_t,
|
||||
on_alloc_cb,
|
||||
on_tcp_read_cb) {
|
||||
0i32 => {
|
||||
log(debug, ~"success doing uv_read_start");
|
||||
debug!("success doing uv_read_start");
|
||||
start_ch.send(None);
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"error attempting uv_read_start");
|
||||
debug!("error attempting uv_read_start");
|
||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||
start_ch.send(Some(err_data));
|
||||
}
|
||||
@ -1164,19 +1164,19 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData,
|
||||
let write_data_ptr = ptr::addr_of(&write_data);
|
||||
do iotask::interact(&(*socket_data_ptr).iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
log(debug, fmt!("in interact cb for tcp::write %?",
|
||||
loop_ptr));
|
||||
debug!("in interact cb for tcp::write %?",
|
||||
loop_ptr);
|
||||
match uv::ll::write(write_req_ptr,
|
||||
stream_handle_ptr,
|
||||
write_buf_vec_ptr,
|
||||
tcp_write_complete_cb) {
|
||||
0i32 => {
|
||||
log(debug, ~"uv_write() invoked successfully");
|
||||
debug!("uv_write() invoked successfully");
|
||||
uv::ll::set_data_for_req(write_req_ptr,
|
||||
write_data_ptr);
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"error invoking uv_write()");
|
||||
debug!("error invoking uv_write()");
|
||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||
let result_ch = (*write_data_ptr).result_ch.clone();
|
||||
result_ch.send(TcpWriteError(err_data.to_tcp_err()));
|
||||
@ -1281,8 +1281,8 @@ fn to_tcp_err(&self) -> TcpErrData {
|
||||
nread: libc::ssize_t,
|
||||
++buf: uv::ll::uv_buf_t) {
|
||||
unsafe {
|
||||
log(debug, fmt!("entering on_tcp_read_cb stream: %? nread: %?",
|
||||
stream, nread));
|
||||
debug!("entering on_tcp_read_cb stream: %? nread: %?",
|
||||
stream, nread);
|
||||
let loop_ptr = uv::ll::get_loop_for_uv_handle(stream);
|
||||
let socket_data_ptr = uv::ll::get_data_for_uv_handle(stream)
|
||||
as *TcpSocketData;
|
||||
@ -1290,8 +1290,8 @@ fn to_tcp_err(&self) -> TcpErrData {
|
||||
// incoming err.. probably eof
|
||||
-1 => {
|
||||
let err_data = uv::ll::get_last_err_data(loop_ptr).to_tcp_err();
|
||||
log(debug, fmt!("on_tcp_read_cb: incoming err.. name %? msg %?",
|
||||
err_data.err_name, err_data.err_msg));
|
||||
debug!("on_tcp_read_cb: incoming err.. name %? msg %?",
|
||||
err_data.err_name, err_data.err_msg);
|
||||
let reader_ch = &(*socket_data_ptr).reader_ch;
|
||||
reader_ch.send(result::Err(err_data));
|
||||
}
|
||||
@ -1300,7 +1300,7 @@ fn to_tcp_err(&self) -> TcpErrData {
|
||||
// have data
|
||||
_ => {
|
||||
// we have data
|
||||
log(debug, fmt!("tcp on_read_cb nread: %d", nread as int));
|
||||
debug!("tcp on_read_cb nread: %d", nread as int);
|
||||
let reader_ch = &(*socket_data_ptr).reader_ch;
|
||||
let buf_base = uv::ll::get_base_from_buf(buf);
|
||||
let new_bytes = vec::from_buf(buf_base, nread as uint);
|
||||
@ -1308,7 +1308,7 @@ fn to_tcp_err(&self) -> TcpErrData {
|
||||
}
|
||||
}
|
||||
uv::ll::free_base_of_buf(buf);
|
||||
log(debug, ~"exiting on_tcp_read_cb");
|
||||
debug!("exiting on_tcp_read_cb");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1316,12 +1316,12 @@ fn to_tcp_err(&self) -> TcpErrData {
|
||||
suggested_size: size_t)
|
||||
-> uv::ll::uv_buf_t {
|
||||
unsafe {
|
||||
log(debug, ~"tcp read on_alloc_cb!");
|
||||
debug!("tcp read on_alloc_cb!");
|
||||
let char_ptr = uv::ll::malloc_buf_base_of(suggested_size);
|
||||
log(debug, fmt!("tcp read on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
||||
debug!("tcp read on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
||||
handle,
|
||||
char_ptr as uint,
|
||||
suggested_size as uint));
|
||||
suggested_size as uint);
|
||||
uv::ll::buf_init(char_ptr, suggested_size as uint)
|
||||
}
|
||||
}
|
||||
@ -1336,7 +1336,7 @@ struct TcpSocketCloseData {
|
||||
as *TcpSocketCloseData;
|
||||
let closed_ch = (*data).closed_ch.clone();
|
||||
closed_ch.send(());
|
||||
log(debug, ~"tcp_socket_dtor_close_cb exiting..");
|
||||
debug!("tcp_socket_dtor_close_cb exiting..");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1346,7 +1346,7 @@ struct TcpSocketCloseData {
|
||||
let write_data_ptr = uv::ll::get_data_for_req(write_req)
|
||||
as *WriteReqData;
|
||||
if status == 0i32 {
|
||||
log(debug, ~"successful write complete");
|
||||
debug!("successful write complete");
|
||||
let result_ch = (*write_data_ptr).result_ch.clone();
|
||||
result_ch.send(TcpWriteSuccess);
|
||||
} else {
|
||||
@ -1354,7 +1354,7 @@ struct TcpSocketCloseData {
|
||||
write_req);
|
||||
let loop_ptr = uv::ll::get_loop_for_uv_handle(stream_handle_ptr);
|
||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||
log(debug, ~"failure to write");
|
||||
debug!("failure to write");
|
||||
let result_ch = (*write_data_ptr).result_ch.clone();
|
||||
result_ch.send(TcpWriteError(err_data.to_tcp_err()));
|
||||
}
|
||||
@ -1376,13 +1376,13 @@ struct ConnectReqData {
|
||||
*ConnectReqData;
|
||||
let closed_signal_ch = (*data).closed_signal_ch.clone();
|
||||
closed_signal_ch.send(());
|
||||
log(debug, fmt!("exiting steam_error_close_cb for %?", handle));
|
||||
debug!("exiting steam_error_close_cb for %?", handle);
|
||||
}
|
||||
}
|
||||
|
||||
extern fn tcp_connect_close_cb(handle: *uv::ll::uv_tcp_t) {
|
||||
unsafe {
|
||||
log(debug, fmt!("closed client tcp handle %?", handle));
|
||||
debug!("closed client tcp handle %?", handle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1392,27 +1392,27 @@ struct ConnectReqData {
|
||||
let conn_data_ptr = (uv::ll::get_data_for_req(connect_req_ptr)
|
||||
as *ConnectReqData);
|
||||
let result_ch = (*conn_data_ptr).result_ch.clone();
|
||||
log(debug, fmt!("tcp_connect result_ch %?", result_ch));
|
||||
debug!("tcp_connect result_ch %?", result_ch);
|
||||
let tcp_stream_ptr =
|
||||
uv::ll::get_stream_handle_from_connect_req(connect_req_ptr);
|
||||
match status {
|
||||
0i32 => {
|
||||
log(debug, ~"successful tcp connection!");
|
||||
debug!("successful tcp connection!");
|
||||
result_ch.send(ConnSuccess);
|
||||
}
|
||||
_ => {
|
||||
log(debug, ~"error in tcp_connect_on_connect_cb");
|
||||
debug!("error in tcp_connect_on_connect_cb");
|
||||
let loop_ptr = uv::ll::get_loop_for_uv_handle(tcp_stream_ptr);
|
||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||
log(debug, fmt!("err_data %? %?", err_data.err_name,
|
||||
err_data.err_msg));
|
||||
debug!("err_data %? %?", err_data.err_name,
|
||||
err_data.err_msg);
|
||||
result_ch.send(ConnFailure(err_data));
|
||||
uv::ll::set_data_for_uv_handle(tcp_stream_ptr,
|
||||
conn_data_ptr);
|
||||
uv::ll::close(tcp_stream_ptr, stream_error_close_cb);
|
||||
}
|
||||
}
|
||||
log(debug, ~"leaving tcp_connect_on_connect_cb");
|
||||
debug!("leaving tcp_connect_on_connect_cb");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1758,10 +1758,10 @@ pub fn impl_gl_tcp_ipv4_server_client_reader_writer() {
|
||||
};
|
||||
|
||||
let actual_req = server_result_po.recv();
|
||||
log(debug, fmt!("REQ: expected: '%s' actual: '%s'",
|
||||
expected_req, actual_req));
|
||||
log(debug, fmt!("RESP: expected: '%s' actual: '%s'",
|
||||
expected_resp, actual_resp));
|
||||
debug!("REQ: expected: '%s' actual: '%s'",
|
||||
expected_req, actual_req);
|
||||
debug!("RESP: expected: '%s' actual: '%s'",
|
||||
expected_resp, actual_resp);
|
||||
fail_unless!(str::contains(actual_req, expected_req));
|
||||
fail_unless!(str::contains(actual_resp, expected_resp));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||
|
||||
let len = xs.len();
|
||||
if len < min_granularity {
|
||||
log(info, ~"small slice");
|
||||
info!("small slice");
|
||||
// This is a small vector, fall back on the normal map.
|
||||
~[f()(0u, xs)]
|
||||
}
|
||||
@ -52,7 +52,7 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||
|
||||
let mut futures = ~[];
|
||||
let mut base = 0u;
|
||||
log(info, ~"spawning tasks");
|
||||
info!("spawning tasks");
|
||||
while base < len {
|
||||
let end = uint::min(len, base + items_per_task);
|
||||
do vec::as_imm_buf(xs) |p, _len| {
|
||||
@ -63,11 +63,11 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||
let len = end - base;
|
||||
let slice = (ptr::offset(p, base),
|
||||
len * sys::size_of::<A>());
|
||||
log(info, fmt!("pre-slice: %?", (base, slice)));
|
||||
info!("pre-slice: %?", (base, slice));
|
||||
let slice : &[A] =
|
||||
cast::reinterpret_cast(&slice);
|
||||
log(info, fmt!("slice: %?",
|
||||
(base, vec::len(slice), end - base)));
|
||||
info!("slice: %?",
|
||||
(base, vec::len(slice), end - base));
|
||||
fail_unless!((vec::len(slice) == end - base));
|
||||
f(base, slice)
|
||||
}
|
||||
@ -76,9 +76,9 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||
};
|
||||
base += items_per_task;
|
||||
}
|
||||
log(info, ~"tasks spawned");
|
||||
info!("tasks spawned");
|
||||
|
||||
log(info, fmt!("num_tasks: %?", (num_tasks, futures.len())));
|
||||
info!("num_tasks: %?", (num_tasks, futures.len()));
|
||||
fail_unless!((num_tasks == futures.len()));
|
||||
|
||||
let r = do futures.map() |ys| {
|
||||
@ -114,7 +114,7 @@ pub fn mapi<A:Copy + Owned,B:Copy + Owned>(
|
||||
result
|
||||
});
|
||||
let r = vec::concat(slices);
|
||||
log(info, (r.len(), xs.len()));
|
||||
info!("%?", (r.len(), xs.len()));
|
||||
fail_unless!((r.len() == xs.len()));
|
||||
r
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ pub fn check_sort(v1: &mut [int], v2: &mut [int]) {
|
||||
quick_sort3::<int>(v1);
|
||||
let mut i = 0;
|
||||
while i < len {
|
||||
log(debug, v2[i]);
|
||||
debug!(v2[i]);
|
||||
fail_unless!((v2[i] == v1[i]));
|
||||
i += 1;
|
||||
}
|
||||
@ -768,7 +768,7 @@ pub fn check_sort(v1: &mut [int], v2: &mut [int]) {
|
||||
quick_sort::<int>(v1, leual);
|
||||
let mut i = 0u;
|
||||
while i < len {
|
||||
log(debug, v2[i]);
|
||||
debug!(v2[i]);
|
||||
fail_unless!((v2[i] == v1[i]));
|
||||
i += 1;
|
||||
}
|
||||
@ -834,7 +834,7 @@ pub fn check_sort(v1: &[int], v2: &[int]) {
|
||||
let v3 = merge_sort::<int>(v1, f);
|
||||
let mut i = 0u;
|
||||
while i < len {
|
||||
log(debug, v3[i]);
|
||||
debug!(v3[i]);
|
||||
fail_unless!((v3[i] == v2[i]));
|
||||
i += 1;
|
||||
}
|
||||
@ -918,7 +918,7 @@ fn check_sort(v1: &mut [int], v2: &mut [int]) {
|
||||
tim_sort::<int>(v1);
|
||||
let mut i = 0u;
|
||||
while i < len {
|
||||
log(debug, v2[i]);
|
||||
debug!(v2[i]);
|
||||
fail_unless!((v2[i] == v1[i]));
|
||||
i += 1u;
|
||||
}
|
||||
|
@ -142,8 +142,8 @@ pub fn recv_timeout<T:Copy + Owned>(iotask: &IoTask,
|
||||
extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t,
|
||||
status: libc::c_int) {
|
||||
unsafe {
|
||||
log(debug,
|
||||
fmt!("delayed_send_cb handle %? status %?", handle, status));
|
||||
debug!(
|
||||
"delayed_send_cb handle %? status %?", handle, status);
|
||||
// Faking a borrowed pointer to our ~SharedChan
|
||||
let timer_done_ch_ptr: &*c_void = &uv::ll::get_data_for_uv_handle(
|
||||
handle);
|
||||
@ -163,7 +163,7 @@ pub fn recv_timeout<T:Copy + Owned>(iotask: &IoTask,
|
||||
|
||||
extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) {
|
||||
unsafe {
|
||||
log(debug, fmt!("delayed_send_close_cb handle %?", handle));
|
||||
debug!("delayed_send_close_cb handle %?", handle);
|
||||
let timer_done_ch_ptr = uv::ll::get_data_for_uv_handle(handle);
|
||||
let timer_done_ch = transmute::<*c_void, ~SharedChan<()>>(
|
||||
timer_done_ch_ptr);
|
||||
|
@ -136,26 +136,25 @@ mod test {
|
||||
timer_ptr as *libc::c_void);
|
||||
let exit_ch = transmute::<*c_void, ~Chan<bool>>(exit_ch_ptr);
|
||||
exit_ch.send(true);
|
||||
log(debug,
|
||||
fmt!("EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?",
|
||||
exit_ch_ptr));
|
||||
debug!("EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?",
|
||||
exit_ch_ptr);
|
||||
}
|
||||
}
|
||||
extern fn simple_timer_cb(timer_ptr: *ll::uv_timer_t,
|
||||
_status: libc::c_int) {
|
||||
unsafe {
|
||||
log(debug, ~"in simple timer cb");
|
||||
debug!(~"in simple timer cb");
|
||||
ll::timer_stop(timer_ptr);
|
||||
let hl_loop = &get_gl();
|
||||
do iotask::interact(hl_loop) |_loop_ptr| {
|
||||
log(debug, ~"closing timer");
|
||||
debug!(~"closing timer");
|
||||
unsafe {
|
||||
ll::close(timer_ptr, simple_timer_close_cb);
|
||||
}
|
||||
log(debug, ~"about to deref exit_ch_ptr");
|
||||
log(debug, ~"after msg sent on deref'd exit_ch");
|
||||
debug!(~"about to deref exit_ch_ptr");
|
||||
debug!(~"after msg sent on deref'd exit_ch");
|
||||
};
|
||||
log(debug, ~"exiting simple timer cb");
|
||||
debug!(~"exiting simple timer cb");
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,13 +162,13 @@ fn impl_uv_hl_simple_timer(iotask: &IoTask) {
|
||||
unsafe {
|
||||
let (exit_po, exit_ch) = stream::<bool>();
|
||||
let exit_ch_ptr: *libc::c_void = transmute(~exit_ch);
|
||||
log(debug, fmt!("EXIT_CH_PTR newly created exit_ch_ptr: %?",
|
||||
exit_ch_ptr));
|
||||
debug!("EXIT_CH_PTR newly created exit_ch_ptr: %?",
|
||||
exit_ch_ptr);
|
||||
let timer_handle = ll::timer_t();
|
||||
let timer_ptr = ptr::addr_of(&timer_handle);
|
||||
do iotask::interact(iotask) |loop_ptr| {
|
||||
unsafe {
|
||||
log(debug, ~"user code inside interact loop!!!");
|
||||
debug!(~"user code inside interact loop!!!");
|
||||
let init_status = ll::timer_init(loop_ptr, timer_ptr);
|
||||
if(init_status == 0i32) {
|
||||
ll::set_data_for_uv_handle(
|
||||
@ -188,7 +187,7 @@ fn impl_uv_hl_simple_timer(iotask: &IoTask) {
|
||||
}
|
||||
};
|
||||
exit_po.recv();
|
||||
log(debug,
|
||||
debug!(
|
||||
~"global_loop timer test: msg recv on exit_po, done..");
|
||||
}
|
||||
}
|
||||
@ -225,7 +224,7 @@ fn test_stress_gl_uv_global_loop_high_level_global_timer() {
|
||||
for iter::repeat(cycles) {
|
||||
exit_po.recv();
|
||||
};
|
||||
log(debug, ~"test_stress_gl_uv_global_loop_high_level_global_timer"+
|
||||
debug!(~"test_stress_gl_uv_global_loop_high_level_global_timer"+
|
||||
~" exiting sucessfully!");
|
||||
}
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ fn run_loop(iotask_ch: &Chan<IoTask>) {
|
||||
};
|
||||
iotask_ch.send(iotask);
|
||||
|
||||
log(debug, ~"about to run uv loop");
|
||||
debug!("about to run uv loop");
|
||||
// enter the loop... this blocks until the loop is done..
|
||||
ll::run(loop_ptr);
|
||||
log(debug, ~"uv loop ended");
|
||||
debug!("uv loop ended");
|
||||
ll::loop_delete(loop_ptr);
|
||||
}
|
||||
}
|
||||
@ -158,8 +158,8 @@ fn send_msg(iotask: &IoTask,
|
||||
extern fn wake_up_cb(async_handle: *ll::uv_async_t,
|
||||
status: int) {
|
||||
|
||||
log(debug, fmt!("wake_up_cb extern.. handle: %? status: %?",
|
||||
async_handle, status));
|
||||
debug!("wake_up_cb extern.. handle: %? status: %?",
|
||||
async_handle, status);
|
||||
|
||||
unsafe {
|
||||
let loop_ptr = ll::get_loop_for_uv_handle(async_handle);
|
||||
@ -178,13 +178,13 @@ fn send_msg(iotask: &IoTask,
|
||||
|
||||
fn begin_teardown(data: *IoTaskLoopData) {
|
||||
unsafe {
|
||||
log(debug, ~"iotask begin_teardown() called, close async_handle");
|
||||
debug!("iotask begin_teardown() called, close async_handle");
|
||||
let async_handle = (*data).async_handle;
|
||||
ll::close(async_handle as *c_void, tear_down_close_cb);
|
||||
}
|
||||
}
|
||||
extern fn tear_down_walk_cb(handle: *libc::c_void, arg: *libc::c_void) {
|
||||
log(debug, ~"IN TEARDOWN WALK CB");
|
||||
debug!("IN TEARDOWN WALK CB");
|
||||
// pretty much, if we still have an active handle and it is *not*
|
||||
// the async handle that facilities global loop communication, we
|
||||
// want to barf out and fail
|
||||
@ -194,7 +194,7 @@ fn begin_teardown(data: *IoTaskLoopData) {
|
||||
extern fn tear_down_close_cb(handle: *ll::uv_async_t) {
|
||||
unsafe {
|
||||
let loop_ptr = ll::get_loop_for_uv_handle(handle);
|
||||
log(debug, ~"in tear_down_close_cb");
|
||||
debug!("in tear_down_close_cb");
|
||||
ll::walk(loop_ptr, tear_down_walk_cb, handle as *libc::c_void);
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ fn begin_teardown(data: *IoTaskLoopData) {
|
||||
#[cfg(test)]
|
||||
extern fn async_close_cb(handle: *ll::uv_async_t) {
|
||||
unsafe {
|
||||
log(debug, fmt!("async_close_cb handle %?", handle));
|
||||
debug!("async_close_cb handle %?", handle);
|
||||
let exit_ch = &(*(ll::get_data_for_uv_handle(handle)
|
||||
as *AhData)).exit_ch;
|
||||
let exit_ch = exit_ch.clone();
|
||||
@ -213,8 +213,7 @@ fn begin_teardown(data: *IoTaskLoopData) {
|
||||
#[cfg(test)]
|
||||
extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int) {
|
||||
unsafe {
|
||||
log(debug,
|
||||
fmt!("async_handle_cb handle %? status %?",handle,status));
|
||||
debug!("async_handle_cb handle %? status %?",handle,status);
|
||||
ll::close(handle, async_close_cb);
|
||||
}
|
||||
}
|
||||
@ -269,15 +268,15 @@ unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask {
|
||||
#[cfg(test)]
|
||||
extern fn lifetime_handle_close(handle: *libc::c_void) {
|
||||
unsafe {
|
||||
log(debug, fmt!("lifetime_handle_close ptr %?", handle));
|
||||
debug!("lifetime_handle_close ptr %?", handle);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
extern fn lifetime_async_callback(handle: *libc::c_void,
|
||||
status: libc::c_int) {
|
||||
log(debug, fmt!("lifetime_handle_close ptr %? status %?",
|
||||
handle, status));
|
||||
debug!("lifetime_handle_close ptr %? status %?",
|
||||
handle, status);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -311,9 +310,9 @@ fn test_uv_iotask_async() {
|
||||
debug!("waiting");
|
||||
work_exit_po.recv();
|
||||
};
|
||||
log(debug, ~"sending teardown_loop msg..");
|
||||
debug!(~"sending teardown_loop msg..");
|
||||
exit(iotask);
|
||||
exit_po.recv();
|
||||
log(debug, ~"after recv on exit_po.. exiting..");
|
||||
debug!(~"after recv on exit_po.. exiting..");
|
||||
}
|
||||
}
|
||||
|
@ -411,34 +411,34 @@ macro_rules! ignore (($($x:tt)*) => (()))
|
||||
|
||||
macro_rules! error (
|
||||
($arg:expr) => (
|
||||
log(::core::error, fmt!( \"%?\", $arg ))
|
||||
__log(1u32, fmt!( \"%?\", $arg ))
|
||||
);
|
||||
($( $arg:expr ),+) => (
|
||||
log(::core::error, fmt!( $($arg),+ ))
|
||||
__log(1u32, fmt!( $($arg),+ ))
|
||||
)
|
||||
)
|
||||
macro_rules! warn (
|
||||
($arg:expr) => (
|
||||
log(::core::warn, fmt!( \"%?\", $arg ))
|
||||
__log(2u32, fmt!( \"%?\", $arg ))
|
||||
);
|
||||
($( $arg:expr ),+) => (
|
||||
log(::core::warn, fmt!( $($arg),+ ))
|
||||
__log(2u32, fmt!( $($arg),+ ))
|
||||
)
|
||||
)
|
||||
macro_rules! info (
|
||||
($arg:expr) => (
|
||||
log(::core::info, fmt!( \"%?\", $arg ))
|
||||
__log(3u32, fmt!( \"%?\", $arg ))
|
||||
);
|
||||
($( $arg:expr ),+) => (
|
||||
log(::core::info, fmt!( $($arg),+ ))
|
||||
__log(3u32, fmt!( $($arg),+ ))
|
||||
)
|
||||
)
|
||||
macro_rules! debug (
|
||||
($arg:expr) => (
|
||||
log(::core::debug, fmt!( \"%?\", $arg ))
|
||||
__log(4u32, fmt!( \"%?\", $arg ))
|
||||
);
|
||||
($( $arg:expr ),+) => (
|
||||
log(::core::debug, fmt!( $($arg),+ ))
|
||||
__log(4u32, fmt!( $($arg),+ ))
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -37,8 +37,7 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
|
||||
expr_to_str(cx, args[0],
|
||||
~"first argument to fmt! must be a string literal.");
|
||||
let fmtspan = args[0].span;
|
||||
debug!("Format string:");
|
||||
log(debug, fmt);
|
||||
debug!("Format string: %s", fmt);
|
||||
fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: &str) -> ! {
|
||||
cx.span_fatal(sp, msg);
|
||||
}
|
||||
@ -223,7 +222,7 @@ fn is_signed_type(cnv: Conv) -> bool {
|
||||
}
|
||||
fn log_conv(c: Conv) {
|
||||
match c.param {
|
||||
Some(p) => { log(debug, ~"param: " + p.to_str()); }
|
||||
Some(p) => { debug!("param: %s", p.to_str()); }
|
||||
_ => debug!("param: none")
|
||||
}
|
||||
for c.flags.each |f| {
|
||||
@ -236,18 +235,18 @@ fn log_conv(c: Conv) {
|
||||
}
|
||||
}
|
||||
match c.width {
|
||||
CountIs(i) => log(
|
||||
debug, ~"width: count is " + i.to_str()),
|
||||
CountIsParam(i) => log(
|
||||
debug, ~"width: count is param " + i.to_str()),
|
||||
CountIs(i) =>
|
||||
debug!("width: count is %s", i.to_str()),
|
||||
CountIsParam(i) =>
|
||||
debug!("width: count is param %s", i.to_str()),
|
||||
CountIsNextParam => debug!("width: count is next param"),
|
||||
CountImplied => debug!("width: count is implied")
|
||||
}
|
||||
match c.precision {
|
||||
CountIs(i) => log(
|
||||
debug, ~"prec: count is " + i.to_str()),
|
||||
CountIsParam(i) => log(
|
||||
debug, ~"prec: count is param " + i.to_str()),
|
||||
CountIs(i) =>
|
||||
debug!("prec: count is %s", i.to_str()),
|
||||
CountIsParam(i) =>
|
||||
debug!("prec: count is param %s", i.to_str()),
|
||||
CountIsNextParam => debug!("prec: count is next param"),
|
||||
CountImplied => debug!("prec: count is implied")
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ fn read_line_comments(rdr: @mut StringReader, code_to_the_left: bool,
|
||||
let mut lines: ~[~str] = ~[];
|
||||
while rdr.curr == '/' && nextch(rdr) == '/' {
|
||||
let line = read_one_line_comment(rdr);
|
||||
log(debug, line);
|
||||
debug!("%s", line);
|
||||
if is_doc_comment(line) { // doc-comments are not put in comments
|
||||
break;
|
||||
}
|
||||
@ -221,7 +221,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
|
||||
s1 = str::slice(s, col, len);
|
||||
} else { s1 = ~""; }
|
||||
} else { s1 = /*bad*/ copy s; }
|
||||
log(debug, ~"pushing line: " + s1);
|
||||
debug!("pushing line: %s", s1);
|
||||
lines.push(s1);
|
||||
}
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ fn parse_bottom_expr(&self) -> @expr {
|
||||
}
|
||||
}
|
||||
hi = self.span.hi;
|
||||
} else if self.eat_keyword(&~"log") {
|
||||
} else if self.eat_keyword(&~"__log") {
|
||||
self.expect(&token::LPAREN);
|
||||
let lvl = self.parse_expr();
|
||||
self.expect(&token::COMMA);
|
||||
|
@ -495,7 +495,7 @@ pub fn strict_keyword_table() -> HashMap<~str, ()> {
|
||||
~"else", ~"enum", ~"extern",
|
||||
~"false", ~"fn", ~"for",
|
||||
~"if", ~"impl",
|
||||
~"let", ~"log", ~"loop",
|
||||
~"let", ~"__log", ~"loop",
|
||||
~"match", ~"mod", ~"mut",
|
||||
~"once",
|
||||
~"priv", ~"pub", ~"pure",
|
||||
|
@ -472,7 +472,7 @@ fn print_str(&mut self, s: ~str) {
|
||||
fn print(&mut self, x: token, L: int) {
|
||||
debug!("print %s %d (remaining line space=%d)", tok_str(x), L,
|
||||
self.space);
|
||||
log(debug, buf_str(copy self.token,
|
||||
debug!("%s", buf_str(copy self.token,
|
||||
copy self.size,
|
||||
self.left,
|
||||
self.right,
|
||||
|
@ -22,6 +22,6 @@ fn main() {
|
||||
|
||||
for uint::range(0u, n) |i| {
|
||||
let x = uint::to_str(i);
|
||||
log(debug, x);
|
||||
debug!(x);
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ fn is_gray(c: &color) -> bool {
|
||||
let mut i = 0;
|
||||
while vec::any(colors, is_gray) {
|
||||
// Do the BFS.
|
||||
log(info, fmt!("PBFS iteration %?", i));
|
||||
info!("PBFS iteration %?", i);
|
||||
i += 1;
|
||||
colors = do colors.mapi() |i, c| {
|
||||
let c : color = *c;
|
||||
@ -257,7 +257,7 @@ fn is_gray_factory() -> ~fn(c: &color) -> bool {
|
||||
let mut i = 0;
|
||||
while par::any(colors, is_gray_factory) {
|
||||
// Do the BFS.
|
||||
log(info, fmt!("PBFS iteration %?", i));
|
||||
info!("PBFS iteration %?", i);
|
||||
i += 1;
|
||||
let old_len = colors.len();
|
||||
|
||||
@ -320,7 +320,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||
// parent chains back to the root. While we do this, we also
|
||||
// compute the levels for each node.
|
||||
|
||||
log(info, ~"Verifying tree structure...");
|
||||
info!(~"Verifying tree structure...");
|
||||
|
||||
let mut status = true;
|
||||
let level = do tree.map() |parent| {
|
||||
@ -352,7 +352,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||
// 2. Each tree edge connects vertices whose BFS levels differ by
|
||||
// exactly one.
|
||||
|
||||
log(info, ~"Verifying tree edges...");
|
||||
info!(~"Verifying tree edges...");
|
||||
|
||||
let status = do tree.alli() |k, parent| {
|
||||
if *parent != root && *parent != -1i64 {
|
||||
@ -368,7 +368,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||
// 3. Every edge in the input list has vertices with levels that
|
||||
// differ by at most one or that both are not in the BFS tree.
|
||||
|
||||
log(info, ~"Verifying graph edges...");
|
||||
info!(~"Verifying graph edges...");
|
||||
|
||||
let status = do edges.all() |e| {
|
||||
let (u, v) = *e;
|
||||
@ -385,7 +385,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||
// 5. A node and its parent are joined by an edge of the original
|
||||
// graph.
|
||||
|
||||
log(info, ~"Verifying tree and graph edges...");
|
||||
info!(~"Verifying tree and graph edges...");
|
||||
|
||||
let status = do par::alli(tree) {
|
||||
let edges = copy edges;
|
||||
|
@ -16,6 +16,6 @@
|
||||
fn main() {
|
||||
match true { false => { my_fail(); } true => { } }
|
||||
|
||||
log(debug, x); //~ ERROR unresolved name: `x`.
|
||||
debug!(x); //~ ERROR unresolved name: `x`.
|
||||
let x: int;
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
// Check that bogus field access is non-fatal
|
||||
fn main() {
|
||||
let x = 0;
|
||||
log(debug, x.foo); //~ ERROR attempted access of field
|
||||
log(debug, x.bar); //~ ERROR attempted access of field
|
||||
debug!(x.foo); //~ ERROR attempted access of field
|
||||
debug!(x.bar); //~ ERROR attempted access of field
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ fn main() {
|
||||
let a: clam = clam{x: @1, y: @2};
|
||||
let b: clam = clam{x: @10, y: @20};
|
||||
let z: int = a.x + b.y;
|
||||
log(debug, z);
|
||||
debug!(z);
|
||||
fail_unless!((z == 21));
|
||||
let forty: fish = fish{a: @40};
|
||||
let two: fish = fish{a: @2};
|
||||
let answer: int = forty.a + two.a;
|
||||
log(debug, answer);
|
||||
debug!(answer);
|
||||
fail_unless!((answer == 42));
|
||||
}
|
||||
|
@ -11,4 +11,4 @@
|
||||
// error-pattern:expected `~str` but found `int`
|
||||
|
||||
const i: str = 10i;
|
||||
fn main() { log(debug, i); }
|
||||
fn main() { debug!(i); }
|
||||
|
@ -18,6 +18,6 @@ fn compute1() -> float {
|
||||
|
||||
fn main() {
|
||||
let x = compute1();
|
||||
log(debug, x);
|
||||
debug!(x);
|
||||
fail_unless!((x == -4f));
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ fn fn_id(+f: extern fn()) -> extern fn() { return f }
|
||||
|
||||
fn main() {
|
||||
let i = 8;
|
||||
let f = coerce(|| log(error, i) );
|
||||
let f = coerce(|| error!(i) );
|
||||
f();
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ fn main() {
|
||||
let x: int = 3;
|
||||
let y: &mut int = &mut x; //~ ERROR illegal borrow
|
||||
*y = 5;
|
||||
log (debug, *y);
|
||||
debug!(*y);
|
||||
}
|
||||
|
@ -26,5 +26,5 @@ fn main() {
|
||||
let x = foo(10);
|
||||
let _y = copy x;
|
||||
//~^ ERROR copying a value of non-copyable type `foo`
|
||||
log(error, x);
|
||||
error!(x);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
// error-pattern: dead
|
||||
|
||||
fn f(caller: str) { log(debug, caller); }
|
||||
fn f(caller: str) { debug!(caller); }
|
||||
|
||||
fn main() { return f("main"); debug!("Paul is dead"); }
|
||||
|
||||
|
@ -12,5 +12,5 @@
|
||||
|
||||
fn main() {
|
||||
let a = if true { true };
|
||||
log(debug, a);
|
||||
debug!(a);
|
||||
}
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
fn main() {
|
||||
let z = ();
|
||||
log(debug, z[0]); //~ ERROR cannot index a value of type `()`
|
||||
debug!(z[0]); //~ ERROR cannot index a value of type `()`
|
||||
}
|
||||
|
@ -9,5 +9,5 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
log(error, x); //~ ERROR unresolved name: `x`.
|
||||
error!(x); //~ ERROR unresolved name: `x`.
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
fn main() {
|
||||
for vec::each(fail!()) |i| {
|
||||
log (debug, i * 2);
|
||||
debug!(i * 2);
|
||||
//~^ ERROR the type of this value must be known
|
||||
};
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ struct cat {
|
||||
|
||||
fn main() {
|
||||
let kitty : cat = cat { x: () };
|
||||
log (error, *kitty);
|
||||
error!(*kitty);
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ struct cat {
|
||||
|
||||
fn main() {
|
||||
let nyan = cat { foo: () };
|
||||
log (error, *nyan);
|
||||
error!(*nyan);
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
enum test { thing = 3u } //~ ERROR mismatched types
|
||||
//~^ ERROR expected signed integer constant
|
||||
fn main() {
|
||||
log(error, thing as int);
|
||||
error!(thing as int);
|
||||
fail_unless!((thing as int == 3));
|
||||
}
|
||||
|
@ -19,13 +19,13 @@ fn main()
|
||||
{
|
||||
|
||||
let _z = match g(1, 2) {
|
||||
g(x, x) => { log(debug, x + x); }
|
||||
g(x, x) => { debug!(x + x); }
|
||||
//~^ ERROR Identifier x is bound more than once in the same pattern
|
||||
};
|
||||
|
||||
let _z = match i(l(1, 2), m(3, 4)) {
|
||||
i(l(x, _), m(_, x)) //~ ERROR Identifier x is bound more than once in the same pattern
|
||||
=> { log(error, x + x); }
|
||||
=> { error!(x + x); }
|
||||
};
|
||||
|
||||
let _z = match (1, 2) {
|
||||
|
@ -13,5 +13,5 @@ fn main() {
|
||||
|
||||
const y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant
|
||||
|
||||
log(error, y);
|
||||
error!(y);
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ enum Stuff {
|
||||
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
|
||||
}
|
||||
|
||||
log(error, Bar);
|
||||
error!(Bar);
|
||||
}
|
||||
|
@ -16,10 +16,10 @@
|
||||
fn main() {
|
||||
let i = 0;
|
||||
let ctr: @fn() -> int = || { f2(|| i = i + 1 ); i };
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, i);
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(i);
|
||||
}
|
||||
|
@ -13,10 +13,10 @@
|
||||
fn main() {
|
||||
let i = 0;
|
||||
let ctr: @fn() -> int = || { i = i + 1; i };
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, ctr());
|
||||
log(error, i);
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(ctr());
|
||||
error!(i);
|
||||
}
|
||||
|
@ -11,6 +11,6 @@
|
||||
fn main() {
|
||||
let i: int;
|
||||
|
||||
log(debug, false && { i = 5; true });
|
||||
log(debug, i); //~ ERROR use of possibly uninitialized variable: `i`
|
||||
debug!(false && { i = 5; true });
|
||||
debug!(i); //~ ERROR use of possibly uninitialized variable: `i`
|
||||
}
|
||||
|
@ -12,6 +12,6 @@
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
// error-pattern: some control paths may return
|
||||
|
||||
fn bad_bang(i: uint) -> ! { log(debug, 3); }
|
||||
fn bad_bang(i: uint) -> ! { debug!(3); }
|
||||
|
||||
fn main() { bad_bang(5u); }
|
||||
|
@ -12,6 +12,6 @@
|
||||
fn main() {
|
||||
let x: int;
|
||||
force(|| {
|
||||
log(debug, x); //~ ERROR capture of possibly uninitialized variable: `x`
|
||||
debug!(x); //~ ERROR capture of possibly uninitialized variable: `x`
|
||||
});
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ fn foo() -> int {
|
||||
x = 0; //~ WARNING unreachable statement
|
||||
}
|
||||
|
||||
log(debug, x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||
debug!(x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||
|
||||
return 17;
|
||||
}
|
||||
|
||||
fn main() { log(debug, foo()); }
|
||||
fn main() { debug!(foo()); }
|
||||
|
@ -16,9 +16,9 @@ fn foo() -> int {
|
||||
x = 0; //~ WARNING unreachable statement
|
||||
}
|
||||
|
||||
log(debug, x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||
debug!(x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||
|
||||
return 17;
|
||||
}
|
||||
|
||||
fn main() { log(debug, foo()); }
|
||||
fn main() { debug!(foo()); }
|
||||
|
@ -9,4 +9,4 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn force(f: &fn() -> int) -> int { f() }
|
||||
fn main() { log(debug, force(|| {})); } //~ ERROR mismatched types
|
||||
fn main() { debug!(force(|| {})); } //~ ERROR mismatched types
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn foo(x: int) { log(debug, x); }
|
||||
fn foo(x: int) { debug!(x); }
|
||||
|
||||
fn main() {
|
||||
let x: int; if 1 > 2 { x = 10; }
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn foo(x: int) { log(debug, x); }
|
||||
fn foo(x: int) { debug!(x); }
|
||||
|
||||
fn main() {
|
||||
let x: int;
|
||||
|
@ -13,5 +13,5 @@ fn main() {
|
||||
let i: int;
|
||||
i //~ ERROR use of possibly uninitialized variable: `i`
|
||||
};
|
||||
log(error, f());
|
||||
error!(f());
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ fn main() {
|
||||
let y: ~int = ~42;
|
||||
let mut x: ~int;
|
||||
loop {
|
||||
log(debug, y);
|
||||
debug!(y);
|
||||
loop {
|
||||
loop {
|
||||
loop {
|
||||
|
@ -13,7 +13,7 @@ fn main() {
|
||||
let y: ~int = ~42;
|
||||
let mut x: ~int;
|
||||
loop {
|
||||
log(debug, y);
|
||||
debug!(y);
|
||||
// tjc: not sure why it prints the same error twice
|
||||
while true { while true { while true { x = y; copy x; } } }
|
||||
//~^ ERROR use of moved value: `y`
|
||||
|
@ -11,6 +11,6 @@
|
||||
fn main() {
|
||||
let i: int;
|
||||
|
||||
log(debug, false || { i = 5; true });
|
||||
log(debug, i); //~ ERROR use of possibly uninitialized variable: `i`
|
||||
debug!(false || { i = 5; true });
|
||||
debug!(i); //~ ERROR use of possibly uninitialized variable: `i`
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn foo(x: int) { log(debug, x); }
|
||||
fn foo(x: int) { debug!(x); }
|
||||
|
||||
fn main() {
|
||||
let x: int;
|
||||
|
@ -11,6 +11,6 @@
|
||||
fn main() {
|
||||
let x = ~5;
|
||||
let y = x;
|
||||
log(debug, *x); //~ ERROR use of moved value: `x`
|
||||
debug!(*x); //~ ERROR use of moved value: `x`
|
||||
copy y;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
// except according to those terms.
|
||||
|
||||
fn send<T:Owned>(ch: _chan<T>, -data: T) {
|
||||
log(debug, ch);
|
||||
log(debug, data);
|
||||
debug!(ch);
|
||||
debug!(data);
|
||||
fail!();
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ fn send<T:Owned>(ch: _chan<T>, -data: T) {
|
||||
// message after the send deinitializes it
|
||||
fn test00_start(ch: _chan<~int>, message: ~int, _count: ~int) {
|
||||
send(ch, message);
|
||||
log(debug, message); //~ ERROR use of moved value: `message`
|
||||
debug!(message); //~ ERROR use of moved value: `message`
|
||||
}
|
||||
|
||||
fn main() { fail!(); }
|
||||
|
@ -24,5 +24,5 @@ fn main() {
|
||||
|
||||
fail_unless!((*arc::get(&arc_v))[2] == 3);
|
||||
|
||||
log(info, arc_v);
|
||||
info!(arc_v);
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ fn main() {
|
||||
|
||||
fail_unless!((*arc::get(&arc_v))[2] == 3); //~ ERROR use of moved value: `arc_v`
|
||||
|
||||
log(info, arc_v);
|
||||
info!(arc_v);
|
||||
}
|
||||
|
@ -31,6 +31,6 @@ fn foo(x: Port<()>) -> foo {
|
||||
|
||||
do task::spawn {
|
||||
let y = x.take(); //~ ERROR value has non-owned type
|
||||
log(error, y);
|
||||
error!(y);
|
||||
}
|
||||
}
|
||||
|
@ -39,5 +39,5 @@ fn foo(i:int) -> foo {
|
||||
fn main() {
|
||||
let x = foo(10);
|
||||
let _y = copy x; //~ ERROR copying a value of non-copyable type
|
||||
log(error, x);
|
||||
error!(x);
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ struct foo {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
log(debug, foo{ x: 1 } as int);
|
||||
debug!(foo{ x: 1 } as int);
|
||||
}
|
||||
|
@ -10,4 +10,4 @@
|
||||
|
||||
// error-pattern:literal out of range
|
||||
|
||||
fn main() { log(debug, 300u8); }
|
||||
fn main() { debug!(300u8); }
|
||||
|
@ -18,7 +18,7 @@ enum bar { t1((), Option<~[int]>), t2, }
|
||||
fn foo(t: bar) {
|
||||
match t {
|
||||
t1(_, Some::<int>(x)) => {
|
||||
log(debug, x);
|
||||
debug!(x);
|
||||
}
|
||||
_ => { fail!(); }
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ struct A { y: r }
|
||||
// Can't do this copy
|
||||
let x = ~~~A {y: r(i)};
|
||||
let _z = copy x; //~ ERROR copying a value of non-copyable type
|
||||
log(debug, x);
|
||||
debug!(x);
|
||||
}
|
||||
log(error, *i);
|
||||
error!(*i);
|
||||
}
|
||||
|
@ -14,5 +14,5 @@ fn test(f: @fn(uint) -> uint) -> uint {
|
||||
|
||||
fn main() {
|
||||
let f: ~fn(x: uint) -> uint = |x| 4u;
|
||||
log(debug, test(f)); //~ ERROR expected @ closure, found ~ closure
|
||||
debug!(test(f)); //~ ERROR expected @ closure, found ~ closure
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ fn finalize(&self) {}
|
||||
fn main() {
|
||||
let i = ~r { b: true };
|
||||
let _j = copy i; //~ ERROR copying a value of non-copyable type
|
||||
log(debug, i);
|
||||
debug!(i);
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ fn main() {
|
||||
f(copy r1, copy r2);
|
||||
//~^ ERROR copying a value of non-copyable type
|
||||
//~^^ ERROR copying a value of non-copyable type
|
||||
log(debug, (r2, *i1));
|
||||
log(debug, (r1, *i2));
|
||||
debug!((r2, *i1));
|
||||
debug!((r1, *i2));
|
||||
}
|
||||
|
@ -12,5 +12,5 @@
|
||||
fn main() {
|
||||
loop{}
|
||||
// red herring to make sure compilation fails
|
||||
log(error, 42 == 'c');
|
||||
error!(42 == 'c');
|
||||
}
|
||||
|
@ -11,5 +11,5 @@
|
||||
// error-pattern:unsupported cast
|
||||
|
||||
fn main() {
|
||||
log(debug, 1.0 as *libc::FILE); // Can't cast float to foreign.
|
||||
debug!(1.0 as *libc::FILE); // Can't cast float to foreign.
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
fn f() {
|
||||
let v = ~[1i];
|
||||
log(debug, v.some_field_name); //type error
|
||||
debug!(v.some_field_name); //type error
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -25,5 +25,5 @@ fn main() {
|
||||
let i = ~[r(0)];
|
||||
let j = ~[r(1)];
|
||||
let k = i + j;
|
||||
log(debug, j);
|
||||
debug!(j);
|
||||
}
|
||||
|
@ -17,4 +17,4 @@ fn cmp() -> int {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() { log(error, cmp()); }
|
||||
fn main() { error!(cmp()); }
|
||||
|
@ -9,5 +9,5 @@
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn my_err(s: ~str) -> ! { log(error, s); fail!(~"quux"); }
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||
fn main() { 3u == my_err(~"bye"); }
|
||||
|
@ -9,5 +9,5 @@
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn my_err(s: ~str) -> ! { log(error, s); fail!(~"quux"); }
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||
fn main() { 3u == my_err(~"bye"); }
|
||||
|
@ -9,6 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:woe
|
||||
fn f(a: int) { log(debug, a); }
|
||||
fn f(a: int) { debug!(a); }
|
||||
|
||||
fn main() { f(fail!(~"woe")); }
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
fn foo(x: uint) {
|
||||
if even(x) {
|
||||
log(debug, x);
|
||||
debug!(x);
|
||||
} else {
|
||||
fail!(~"Number is odd");
|
||||
}
|
||||
|
@ -9,5 +9,5 @@
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:quux
|
||||
fn my_err(s: ~str) -> ! { log(error, s); fail!(~"quux"); }
|
||||
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||
fn main() { if my_err(~"bye") { } }
|
||||
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:roflcopter
|
||||
fn main() {
|
||||
log (fail!(~"roflcopter"), 2);
|
||||
}
|
@ -10,5 +10,5 @@
|
||||
|
||||
// error-pattern:get called on error result: ~"kitty"
|
||||
fn main() {
|
||||
log(error, result::get(&result::Err::<int,~str>(~"kitty")));
|
||||
error!(result::get(&result::Err::<int,~str>(~"kitty")));
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
// error-pattern:whatever
|
||||
|
||||
fn main() {
|
||||
log(error, ~"whatever");
|
||||
error!(~"whatever");
|
||||
// Setting the exit status only works when the scheduler terminates
|
||||
// normally. In this case we're going to fail, so instead of of
|
||||
// returning 50 the process will return the typical rt failure code.
|
||||
|
@ -30,7 +30,7 @@ fn r(x:int) -> r {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
log(error, ~"whatever");
|
||||
error!(~"whatever");
|
||||
do task::spawn {
|
||||
let i = r(5);
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
// error-pattern:whatever
|
||||
|
||||
fn main() {
|
||||
log(error, ~"whatever");
|
||||
error!(~"whatever");
|
||||
// 101 is the code the runtime uses on task failure and the value
|
||||
// compiletest expects run-fail tests to return.
|
||||
os::set_exit_status(101);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user