Skip to content

Commit 6ab3e91

Browse files
committed
---
yaml --- r: 138971 b: refs/heads/try2 c: 4d8ddff h: refs/heads/master i: 138969: 29b956f 138967: e140ba0 v: v3
1 parent 10e6e42 commit 6ab3e91

File tree

260 files changed

+1567
-1128
lines changed

Some content is hidden

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

260 files changed

+1567
-1128
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: 773fb1a861c18935f97c58943e11a6fda9af87a5
8+
refs/heads/try2: 4d8ddff52a60d3785052f1e0a231cb95c98fdc24
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 10 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ do drop
212212
else enum extern
213213
false fn for
214214
if impl
215-
let log loop
215+
let loop
216216
match mod mut
217217
priv pub pure
218218
ref return
@@ -805,21 +805,20 @@ Use declarations support a number of "convenience" notations:
805805
An example of `use` declarations:
806806

807807
~~~~
808-
use foo = core::info;
809808
use core::float::sin;
810809
use core::str::{slice, to_upper};
811810
use core::option::Some;
812811
813812
fn main() {
814-
// Equivalent to 'log(core::info, core::float::sin(1.0));'
815-
log(foo, sin(1.0));
813+
// Equivalent to 'info!(core::float::sin(1.0));'
814+
info!(sin(1.0));
816815
817-
// Equivalent to 'log(core::info, core::option::Some(1.0));'
818-
log(info, Some(1.0));
816+
// Equivalent to 'info!(core::option::Some(1.0));'
817+
info!(Some(1.0));
819818
820-
// Equivalent to 'log(core::info,
821-
// core::str::to_upper(core::str::slice("foo", 0, 1)));'
822-
log(info, to_upper(slice("foo", 0, 1)));
819+
// Equivalent to
820+
// 'info!(core::str::to_upper(core::str::slice("foo", 0, 1)));'
821+
info!(to_upper(slice("foo", 0, 1)));
823822
}
824823
~~~~
825824

@@ -990,7 +989,7 @@ output slot type would normally be. For example:
990989

991990
~~~~
992991
fn my_err(s: &str) -> ! {
993-
log(info, s);
992+
info!(s);
994993
fail!();
995994
}
996995
~~~~
@@ -2397,58 +2396,6 @@ fn max(a: int, b: int) -> int {
23972396
}
23982397
~~~~
23992398

2400-
### Log expressions
2401-
2402-
~~~~~~~~{.ebnf .gram}
2403-
log_expr : "log" '(' level ',' expr ')' ;
2404-
~~~~~~~~
2405-
2406-
Evaluating a `log` expression may, depending on runtime configuration, cause a
2407-
value to be appended to an internal diagnostic logging buffer provided by the
2408-
runtime or emitted to a system console. Log expressions are enabled or
2409-
disabled dynamically at run-time on a per-task and per-item basis. See
2410-
[logging system](#logging-system).
2411-
2412-
Each `log` expression must be provided with a *level* argument in
2413-
addition to the value to log. The logging level is a `u32` value, where
2414-
lower levels indicate more-urgent levels of logging. By default, the lowest
2415-
four logging levels (`1_u32 ... 4_u32`) are predefined as the constants
2416-
`error`, `warn`, `info` and `debug` in the `core` library.
2417-
2418-
Additionally, the macros `error!`, `warn!`, `info!` and `debug!` are defined
2419-
in the default syntax-extension namespace. These expand into calls to the
2420-
logging facility composed with calls to the `fmt!` string formatting
2421-
syntax-extension.
2422-
2423-
The following examples all produce the same output, logged at the `error`
2424-
logging level:
2425-
2426-
~~~~
2427-
# let filename = "bulbasaur";
2428-
2429-
// Full version, logging a value.
2430-
log(core::error, ~"file not found: " + filename);
2431-
2432-
// Log-level abbreviated, since core::* is used by default.
2433-
log(error, ~"file not found: " + filename);
2434-
2435-
// Formatting the message using a format-string and fmt!
2436-
log(error, fmt!("file not found: %s", filename));
2437-
2438-
// Using the error! macro, that expands to the previous call.
2439-
error!("file not found: %s", filename);
2440-
~~~~
2441-
2442-
A `log` expression is *not evaluated* when logging at the specified logging-level, module or task is disabled at runtime.
2443-
This makes inactive `log` expressions very cheap;
2444-
they should be used extensively in Rust code, as diagnostic aids,
2445-
as they add little overhead beyond a single integer-compare and branch at runtime.
2446-
2447-
Logging is presently implemented as a language built-in feature,
2448-
as it makes use of compiler-provided, per-module data tables and flags.
2449-
In the future, logging will move into a library, and will no longer be a core expression type.
2450-
It is therefore recommended to use the macro forms of logging (`error!`, `debug!`, etc.) to minimize disruption in code that uses logging.
2451-
24522399

24532400
# Type system
24542401

@@ -3149,7 +3096,7 @@ communication facilities.
31493096

31503097
The runtime contains a system for directing [logging
31513098
expressions](#log-expressions) to a logging console and/or internal logging
3152-
buffers. Logging expressions can be enabled per module.
3099+
buffers. Logging can be enabled per module.
31533100

31543101
Logging output is enabled by setting the `RUST_LOG` environment
31553102
variable. `RUST_LOG` accepts a logging specification made up of a

branches/try2/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ unit, `()`, as the empty tuple if you like).
744744
~~~~
745745
let mytup: (int, int, float) = (10, 20, 30.0);
746746
match mytup {
747-
(a, b, c) => log(info, a + b + (c as int))
747+
(a, b, c) => info!(a + b + (c as int))
748748
}
749749
~~~~
750750

@@ -760,7 +760,7 @@ For example:
760760
struct MyTup(int, int, float);
761761
let mytup: MyTup = MyTup(10, 20, 30.0);
762762
match mytup {
763-
MyTup(a, b, c) => log(info, a + b + (c as int))
763+
MyTup(a, b, c) => info!(a + b + (c as int))
764764
}
765765
~~~~
766766

branches/try2/mk/tests.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ ifeq ($(CFG_GDB),)
386386
CTEST_DISABLE_debuginfo = "no gdb found"
387387
endif
388388

389+
ifeq ($(CFG_OSTYPE),apple-darwin)
390+
CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
391+
endif
392+
389393
define DEF_CTEST_VARS
390394

391395
# All the per-stage build rules you might want to call from the

branches/try2/src/compiletest/runtest.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,15 @@ actual:\n\
225225
}
226226

227227
fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
228+
// do not optimize debuginfo tests
229+
let config = match config.rustcflags {
230+
Some(flags) => config {
231+
rustcflags: Some(str::replace(flags, ~"-O", ~"")),
232+
.. config
233+
},
234+
None => config
235+
};
236+
228237
// compile test file (it shoud have 'compile-flags:-g' in the header)
229238
let mut ProcRes = compile_test(config, props, testfile);
230239
if ProcRes.status != 0 {
@@ -267,8 +276,8 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
267276
}
268277
}
269278
if i != num_check_lines {
270-
fatal(fmt!("line not found in debugger output: %s",
271-
props.check_lines[i]));
279+
fatal_ProcRes(fmt!("line not found in debugger output: %s"
280+
props.check_lines[i]), ProcRes);
272281
}
273282
}
274283
}

branches/try2/src/compiletest/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ pub fn path_div() -> ~str { ~":" }
4646
pub fn path_div() -> ~str { ~";" }
4747
4848
pub fn logv(config: config, s: ~str) {
49-
log(debug, s);
49+
debug!("%s", s);
5050
if config.verbose { io::println(s); }
5151
}

branches/try2/src/libcore/core.rc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,17 @@ pub use clone::Clone;
216216
* more-verbosity. Error is the bottom level, default logging level is
217217
* warn-and-below.
218218
*/
219-
220219
/// The error log level
220+
#[cfg(stage0)]
221221
pub const error : u32 = 1_u32;
222222
/// The warning log level
223+
#[cfg(stage0)]
223224
pub const warn : u32 = 2_u32;
224225
/// The info log level
226+
#[cfg(stage0)]
225227
pub const info : u32 = 3_u32;
226228
/// The debug log level
229+
#[cfg(stage0)]
227230
pub const debug : u32 = 4_u32;
228231

229232

@@ -251,9 +254,13 @@ pub mod rt;
251254
// can be resolved within libcore.
252255
#[doc(hidden)] // FIXME #3538
253256
pub mod core {
257+
#[cfg(stage0)]
254258
pub const error : u32 = 1_u32;
259+
#[cfg(stage0)]
255260
pub const warn : u32 = 2_u32;
261+
#[cfg(stage0)]
256262
pub const info : u32 = 3_u32;
263+
#[cfg(stage0)]
257264
pub const debug : u32 = 4_u32;
258265

259266
pub use cmp;

branches/try2/src/libcore/io.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ impl Writer for *libc::FILE {
683683
*self);
684684
if nout != len as size_t {
685685
error!("error writing buffer");
686-
log(error, os::last_os_error());
686+
error!("%s", os::last_os_error());
687687
fail!();
688688
}
689689
}
@@ -733,7 +733,7 @@ impl Writer for fd_t {
733733
let nout = libc::write(*self, vb, len as size_t);
734734
if nout < 0 as ssize_t {
735735
error!("error writing buffer");
736-
log(error, os::last_os_error());
736+
error!("%s", os::last_os_error());
737737
fail!();
738738
}
739739
count += nout as uint;
@@ -1288,7 +1288,6 @@ pub mod fsync {
12881288

12891289
#[cfg(test)]
12901290
mod tests {
1291-
use debug;
12921291
use i32;
12931292
use io::{BytesWriter, SeekCur, SeekEnd, SeekSet};
12941293
use io;
@@ -1301,10 +1300,10 @@ mod tests {
13011300
#[test]
13021301
fn test_simple() {
13031302
let tmpfile = &Path("tmp/lib-io-test-simple.tmp");
1304-
log(debug, tmpfile);
1303+
debug!(tmpfile);
13051304
let frood: ~str =
13061305
~"A hoopy frood who really knows where his towel is.";
1307-
log(debug, copy frood);
1306+
debug!(copy frood);
13081307
{
13091308
let out: io::Writer =
13101309
result::get(
@@ -1313,7 +1312,7 @@ mod tests {
13131312
}
13141313
let inp: io::Reader = result::get(&io::file_reader(tmpfile));
13151314
let frood2: ~str = inp.read_c_str();
1316-
log(debug, copy frood2);
1315+
debug!(copy frood2);
13171316
fail_unless!(frood == frood2);
13181317
}
13191318

branches/try2/src/libcore/libc.rs

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,28 +1385,25 @@ pub mod funcs {
13851385
use libc::types::common::posix88::{DIR, dirent_t};
13861386
use libc::types::os::arch::c95::{c_char, c_int, c_long};
13871387

1388-
pub extern {
1389-
// default bindings for opendir and readdir in
1390-
// non-macos unix
1391-
#[cfg(target_os = "linux")]
1392-
#[cfg(target_os = "android")]
1393-
#[cfg(target_os = "freebsd")]
1394-
unsafe fn opendir(dirname: *c_char) -> *DIR;
1395-
#[cfg(target_os = "linux")]
1396-
#[cfg(target_os = "android")]
1397-
#[cfg(target_os = "freebsd")]
1398-
unsafe fn readdir(dirp: *DIR) -> *dirent_t;
1399-
// on OSX (particularly when running with a
1400-
// 64bit kernel), we have an issue where there
1401-
// are separate bindings for opendir and readdir,
1402-
// which we have to explicitly link, as below.
1403-
#[cfg(target_os = "macos")]
1404-
#[link_name = "opendir$INODE64"]
1405-
unsafe fn opendir(dirname: *c_char) -> *DIR;
1406-
#[cfg(target_os = "macos")]
1407-
#[link_name = "readdir$INODE64"]
1408-
unsafe fn readdir(dirp: *DIR) -> *dirent_t;
1388+
// NOTE: On OS X opendir and readdir have two versions,
1389+
// one for 32-bit kernelspace and one for 64.
1390+
// We should be linking to the 64-bit ones, called
1391+
// opendir$INODE64, etc. but for some reason rustc
1392+
// doesn't link it correctly on i686, so we're going
1393+
// through a C function that mysteriously does work.
1394+
pub unsafe fn opendir(dirname: *c_char) -> *DIR {
1395+
rust_opendir(dirname)
1396+
}
1397+
pub unsafe fn readdir(dirp: *DIR) -> *dirent_t {
1398+
rust_readdir(dirp)
1399+
}
14091400

1401+
extern {
1402+
unsafe fn rust_opendir(dirname: *c_char) -> *DIR;
1403+
unsafe fn rust_readdir(dirp: *DIR) -> *dirent_t;
1404+
}
1405+
1406+
pub extern {
14101407
unsafe fn closedir(dirp: *DIR) -> c_int;
14111408
unsafe fn rewinddir(dirp: *DIR);
14121409
unsafe fn seekdir(dirp: *DIR, loc: c_long);

0 commit comments

Comments
 (0)