Skip to content

Commit 3eab89f

Browse files
committed
---
yaml --- r: 150003 b: refs/heads/try2 c: 0015cab h: refs/heads/master i: 150001: f5946aa 149999: f0cf737 v: v3
1 parent 6bb1862 commit 3eab89f

File tree

18 files changed

+64
-26
lines changed

18 files changed

+64
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 17ad504fef35191fe53874bd2fe77ffd14d8e1b9
8+
refs/heads/try2: 0015cab1fd7b4b47030c808a825bb5594cc1d4ac
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ DEPS_test := std collections getopts serialize term time
8282
DEPS_time := std serialize
8383
DEPS_rand := std
8484
DEPS_url := std collections
85-
DEPS_workcache := std serialize collections std
85+
DEPS_workcache := std serialize collections log
8686
DEPS_log := std sync
8787

8888
TOOL_DEPS_compiletest := test green rustuv getopts

branches/try2/src/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ li {list-style-type: none; }
5151
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
5252
* [The `url` library](url/index.html)
5353
* [The `workcache` library](workcache/index.html)
54+
* [The `log` library](log/index.html)
5455

5556
# Tooling
5657

branches/try2/src/libflate/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Simple compression
1818
#[crate_type = "rlib"];
1919
#[crate_type = "dylib"];
2020
#[license = "MIT/ASL2"];
21+
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2122
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2223
html_root_url = "http://static.rust-lang.org/doc/master")];
2324
#[feature(phase)];

branches/try2/src/liblog/lib.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,24 @@
1212
1313
Utilities for program-wide and customizable logging
1414
15-
This module is used by the compiler when emitting output for the logging family
16-
of macros. The methods of this module shouldn't necessarily be used directly,
17-
but rather through the logging macros defined.
15+
## Example
16+
17+
```
18+
#[feature(phase)];
19+
#[phase(syntax, link)] extern crate log;
20+
21+
fn main() {
22+
debug!("this is a debug {}", "message");
23+
error!("this is printed by default");
24+
25+
if log_enabled!(log::INFO) {
26+
let x = 3 * 4; // expensive computation
27+
info!("the answer was: {}", x);
28+
}
29+
}
30+
```
31+
32+
## Logging Macros
1833
1934
There are five macros that the logging subsystem uses:
2035

branches/try2/src/libnative/io/file_win32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl Drop for Inner {
238238
if self.close_on_drop && self.fd > libc::STDERR_FILENO {
239239
let n = unsafe { libc::close(self.fd) };
240240
if n != 0 {
241-
warn!("error {} when closing file descriptor {}", n, self.fd);
241+
println!("error {} when closing file descriptor {}", n, self.fd);
242242
}
243243
}
244244
}

branches/try2/src/librand/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ println!("{:?}", tuple_ptr)
7070
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
7171
html_root_url = "http://static.rust-lang.org/doc/master")];
7272

73-
#[feature(macro_rules, managed_boxes)];
73+
#[feature(macro_rules, managed_boxes, phase)];
7474
#[allow(deprecated_owned_vector)];
7575

76+
#[cfg(test)]
77+
#[phase(syntax, link)] extern crate log;
78+
7679
use std::cast;
7780
use std::kinds::marker;
7881
use std::local_data;

branches/try2/src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ pub fn monitor(f: proc()) {
410410
let xs = [
411411
~"the compiler hit an unexpected failure path. this is a bug.",
412412
"we would appreciate a bug report: " + BUG_REPORT_URL,
413-
~"run with `RUST_LOG=std::rt::backtrace` for a backtrace",
413+
~"run with `RUST_BACKTRACE=1` for a backtrace",
414414
];
415415
for note in xs.iter() {
416416
emitter.emit(None, *note, diagnostic::Note)

branches/try2/src/librustc/metadata/cstore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl CStore {
176176
RequireDynamic => src.dylib.clone(),
177177
RequireStatic => src.rlib.clone(),
178178
}))
179-
.collect();
179+
.collect::<Vec<(ast::CrateNum, Option<Path>)>>();
180180
libs.sort_by(|&(a, _), &(b, _)| {
181181
ordering.position_elem(&a).cmp(&ordering.position_elem(&b))
182182
});

branches/try2/src/libstd/os.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,10 +1155,7 @@ impl MemoryMap {
11551155
MapAddr(addr_) => { lpAddress = addr_ as LPVOID; },
11561156
MapFd(fd_) => { fd = fd_; },
11571157
MapOffset(offset_) => { offset = offset_; },
1158-
MapNonStandardFlags(f) => {
1159-
info!("MemoryMap::new: MapNonStandardFlags used on \
1160-
Windows: {}", f)
1161-
}
1158+
MapNonStandardFlags(..) => {}
11621159
}
11631160
}
11641161

@@ -1256,15 +1253,15 @@ impl Drop for MemoryMap {
12561253
MapVirtual => {
12571254
if libc::VirtualFree(self.data as *mut c_void, 0,
12581255
libc::MEM_RELEASE) == 0 {
1259-
error!("VirtualFree failed: {}", errno());
1256+
println!("VirtualFree failed: {}", errno());
12601257
}
12611258
},
12621259
MapFile(mapping) => {
12631260
if libc::UnmapViewOfFile(self.data as LPCVOID) == FALSE {
1264-
error!("UnmapViewOfFile failed: {}", errno());
1261+
println!("UnmapViewOfFile failed: {}", errno());
12651262
}
12661263
if libc::CloseHandle(mapping as HANDLE) == FALSE {
1267-
error!("CloseHandle failed: {}", errno());
1264+
println!("CloseHandle failed: {}", errno());
12681265
}
12691266
}
12701267
}

branches/try2/src/libstd/rt/backtrace.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,31 @@ use from_str::from_str;
1616
use io::{IoResult, Writer};
1717
use iter::Iterator;
1818
use option::{Some, None};
19+
use os;
1920
use result::{Ok, Err};
2021
use str::StrSlice;
22+
use sync::atomics;
2123

2224
pub use self::imp::write;
2325

24-
// This function is defined in this module so that the way to enable logging of
25-
// backtraces has the word 'backtrace' in it: std::rt::backtrace.
26+
// For now logging is turned off by default, and this function checks to see
27+
// whether the magical environment variable is present to see if it's turned on.
2628
pub fn log_enabled() -> bool {
27-
log_enabled!(::logging::DEBUG)
29+
static mut ENABLED: atomics::AtomicInt = atomics::INIT_ATOMIC_INT;
30+
unsafe {
31+
match ENABLED.load(atomics::SeqCst) {
32+
1 => return false,
33+
2 => return true,
34+
_ => {}
35+
}
36+
}
37+
38+
let val = match os::getenv("RUST_BACKTRACE") {
39+
Some(..) => 2,
40+
None => 1,
41+
};
42+
unsafe { ENABLED.store(val, atomics::SeqCst); }
43+
val == 2
2844
}
2945

3046
#[cfg(target_word_size = "64")] static HEX_WIDTH: uint = 18;

branches/try2/src/libstd/rt/unwind.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ fn begin_unwind_inner(msg: ~Any, file: &'static str, line: uint) -> ! {
398398
if backtrace::log_enabled() {
399399
let mut err = ::rt::util::Stderr;
400400
let _err = backtrace::write(&mut err);
401+
} else {
402+
rterrln!("run with `RUST_BACKTRACE=1` to see a backtrace");
401403
}
402404
unsafe { intrinsics::abort() }
403405
}

branches/try2/src/libsync/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
html_root_url = "http://static.rust-lang.org/doc/master")];
2222
#[feature(phase)];
2323

24-
#[cfg(test)] #[phase(syntax, link)] extern crate log;
25-
2624
#[allow(deprecated_owned_vector)];
2725

26+
#[cfg(test)] #[phase(syntax, link)] extern crate log;
27+
2828
pub use arc::{Arc, MutexArc, RWArc, RWWriteMode, RWReadMode, ArcCondvar, CowArc};
2929
pub use sync::{Mutex, RWLock, Condvar, Semaphore, RWLockWriteMode,
3030
RWLockReadMode, Barrier, one, mutex};

branches/try2/src/libworkcache/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1616
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
1717
html_root_url = "http://static.rust-lang.org/doc/master")];
18+
#[feature(phase)];
1819
#[allow(deprecated_owned_vector, visible_private_types)];
1920

21+
#[phase(syntax, link)] extern crate log;
2022
extern crate serialize;
2123
extern crate collections;
2224
extern crate sync;

branches/try2/src/test/run-pass/backtrace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ fn double() {
3737

3838
fn runtest(me: &str) {
3939
let mut env = os::env();
40-
match env.iter().position(|&(ref s, _)| "RUST_LOG" == *s) {
40+
match env.iter().position(|&(ref s, _)| "RUST_BACKTRACE" == *s) {
4141
Some(i) => { env.remove(i); }
4242
None => {}
4343
}
44-
env.push((~"RUST_LOG", ~"std::rt::backtrace"));
44+
env.push((~"RUST_BACKTRACE", ~"1"));
4545

4646
// Make sure that the stack trace is printed
4747
let mut p = Process::configure(ProcessConfig {

branches/try2/src/test/run-pass/comm.rs

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

2222
fn child(c: &Sender<int>) {
23-
error!("sending");
23+
println!("sending");
2424
c.send(10);
2525
println!("value sent");
2626
}

branches/try2/src/test/run-pass/dead-code-one-arm-if.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
12-
11+
// ignore-test #12920
1312

1413
pub fn main() { if 1 == 1 { return; } println!("Paul is dead"); }

branches/try2/src/test/run-pass/parse-fail.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#[allow(unreachable_code)];
1212

13+
// ignore-test #12920
14+
1315
fn dont_call_me() { fail!(); println!("{}", 1); }
1416

1517
pub fn main() { }

0 commit comments

Comments
 (0)