Skip to content

Commit 459982d

Browse files
committed
---
yaml --- r: 6943 b: refs/heads/master c: 900bc12 h: refs/heads/master i: 6941: 286353c 6939: f12056a 6935: 258d8d6 6927: 469fa4d 6911: 3446f80 v: v3
1 parent 4f83ff3 commit 459982d

File tree

364 files changed

+7353
-2425
lines changed

Some content is hidden

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

364 files changed

+7353
-2425
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: d812d06bc8d8f5c655b206838b64b133c83a7975
2+
refs/heads/master: 900bc1298df011bfb094858b11cdfd8d6b01418c

trunk/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ config.mk
5858
/rustllvm/
5959
/test/
6060
/build/
61+
/inst/
6162
/mingw-build/
6263
src/.DS_Store
6364
/stage0/

trunk/doc/rust.texi

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3046,7 +3046,51 @@ Executing a @code{log} expression may, depending on runtime configuration,
30463046
cause a value to be appended to an internal diagnostic logging buffer provided
30473047
by the runtime or emitted to a system console. Log expressions are enabled or
30483048
disabled dynamically at run-time on a per-task and per-item
3049-
basis. @xref{Ref.Run.Log}.
3049+
basis. @xref{Ref.Run.Log}.
3050+
3051+
Each @code{log} expression must be provided with a @emph{level} argument in
3052+
addition to the value to log. The logging level is a @code{u32} value, where
3053+
lower levels indicate more-urgent levels of logging. By default, the lowest
3054+
four logging levels (@code{0_u32 ... 3_u32}) are predefined as the constants
3055+
@code{error}, @code{warn}, @code{info} and @code{debug} in the @code{core}
3056+
library.
3057+
3058+
Additionally, the macros @code{#error}, @code{#warn}, @code{#info} and
3059+
@code{#debug} are defined in the default syntax-extension namespace. These
3060+
expand into calls to the logging facility composed with calls to the
3061+
@code{#fmt} string formatting syntax-extension.
3062+
3063+
The following examples all produce the same output, logged at the @code{error}
3064+
logging level:
3065+
3066+
@example
3067+
// Full version, logging a value.
3068+
log(core::error, "file not found: " + filename);
3069+
3070+
// Log-level abbreviated, since core::* is imported by default.
3071+
log(error, "file not found: " + filename);
3072+
3073+
// Formatting the message using a format-string and #fmt
3074+
log(error, #fmt("file not found: %s", filename));
3075+
3076+
// Using the #error macro, that expands to the previous call.
3077+
#error("file not found: %s", filename);
3078+
@end example
3079+
3080+
A @code{log} expression is @emph{not evaluated} when logging at the specified
3081+
logging-level, module or task is disabled at runtime. This makes inactive
3082+
@code{log} expressions very cheap; they should be used extensively in Rust
3083+
code, as diagnostic aids, as they add little overhead beyond a single
3084+
integer-compare and branch at runtime.
3085+
3086+
Logging is presently implemented as a language built-in feature, as it makes
3087+
use of compiler-provided logic for allocating the associated per-module
3088+
logging-control structures visible to the runtime, and lazily evaluating
3089+
arguments. In the future, as more of the supporting compiler-provided logic is
3090+
moved into libraries, logging is likely to move to a component of the core
3091+
library. It is best to use the macro forms of logging (@emph{#error},
3092+
@emph{#debug}, etc.) to minimize disruption to code using the logging facility
3093+
when it is changed.
30503094

30513095
@example
30523096
@end example

trunk/src/cargo/cargo.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fn try_parse_sources(filename: str, sources: map::hashmap<str, source>) {
203203
some(json::dict(_j)) {
204204
_j.items { |k, v|
205205
sources.insert(k, parse_source(k, v));
206-
log #fmt["source: %s", k];
206+
#debug("source: %s", k);
207207
}
208208
}
209209
_ { fail "malformed sources.json"; }
@@ -269,11 +269,11 @@ fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
269269
ref: ref,
270270
tags: tags
271271
});
272-
log " Loaded package: " + src.name + "/" + name;
272+
log(debug, " Loaded package: " + src.name + "/" + name);
273273
}
274274

275275
fn load_source_packages(&c: cargo, &src: source) {
276-
log "Loading source: " + src.name;
276+
log(debug, "Loading source: " + src.name);
277277
let dir = fs::connect(c.sourcedir, src.name);
278278
let pkgfile = fs::connect(dir, "packages.json");
279279
if !fs::path_exists(pkgfile) { ret; }
@@ -356,7 +356,7 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
356356
if ri != -1 {
357357
name = str::slice(name, 0u, ri as uint);
358358
}
359-
log #fmt["Installing: %s", name];
359+
#debug("Installing: %s", name);
360360
let old = fs::list_dir(".");
361361
let p = run::program_output("rustc", [name + ".rc"]);
362362
if p.status != 0 {
@@ -370,22 +370,22 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
370370
for ct: str in created {
371371
if (exec_suffix != "" && str::ends_with(ct, exec_suffix)) ||
372372
(exec_suffix == "" && !str::starts_with(ct, "./lib")) {
373-
log #fmt[" bin: %s", ct];
373+
#debug(" bin: %s", ct);
374374
// FIXME: need libstd fs::copy or something
375375
run::run_program("cp", [ct, c.bindir]);
376376
} else {
377-
log #fmt[" lib: %s", ct];
377+
#debug(" lib: %s", ct);
378378
run::run_program("cp", [ct, c.libdir]);
379379
}
380380
}
381381
}
382382

383383
fn install_source(c: cargo, path: str) {
384-
log #fmt["source: %s", path];
384+
#debug("source: %s", path);
385385
fs::change_dir(path);
386386
let contents = fs::list_dir(".");
387387

388-
log #fmt["contents: %s", str::connect(contents, ", ")];
388+
#debug("contents: %s", str::connect(contents, ", "));
389389

390390
let cratefiles =
391391
vec::filter::<str>(contents, { |n| str::ends_with(n, ".rc") });

trunk/src/cargo/sources.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
},
1111
"brson": {
1212
"url": "https://raw.github.com/brson/rust-packages/master/packages.json"
13+
},
14+
"erickt": {
15+
"url": "https://raw.github.com/erickt/rust-packages/master/packages.json"
1316
}
1417
}

trunk/src/comp/back/link.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -588,15 +588,15 @@ fn link_binary(sess: session::session,
588588
let long_libname =
589589
std::os::dylib_filename(#fmt("%s-%s-%s",
590590
lm.name, lm.extras_hash, lm.vers));
591-
log "link_meta.name: " + lm.name;
592-
log "long_libname: " + long_libname;
593-
log "out_filename: " + out_filename;
594-
log "dirname(out_filename): " + fs::dirname(out_filename);
591+
#debug("link_meta.name: %s", lm.name);
592+
#debug("long_libname: %s", long_libname);
593+
#debug("out_filename: %s", out_filename);
594+
#debug("dirname(out_filename): %s", fs::dirname(out_filename));
595595

596596
fs::connect(fs::dirname(out_filename), long_libname)
597597
} else { out_filename };
598598

599-
log "output: " + output;
599+
log(debug, "output: " + output);
600600

601601
// The default library location, we need this to find the runtime.
602602
// The location of crates will be determined as needed.
@@ -670,7 +670,7 @@ fn link_binary(sess: session::session,
670670

671671
gcc_args += rpath::get_rpath_flags(sess, output);
672672

673-
log #fmt("gcc link args: %s", str::connect(gcc_args, " "));
673+
#debug("gcc link args: %s", str::connect(gcc_args, " "));
674674
// We run 'gcc' here
675675
let prog = run::program_output(prog, gcc_args);
676676
if 0 != prog.status {

trunk/src/comp/back/rpath.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
2121
ret [];
2222
}
2323

24-
log "preparing the RPATH!";
24+
#debug("preparing the RPATH!");
2525

2626
let cwd = os::getcwd();
2727
let sysroot = sess.filesearch().sysroot();
@@ -52,14 +52,14 @@ fn rpaths_to_flags(rpaths: [str]) -> [str] {
5252
fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
5353
output: fs::path, libs: [fs::path],
5454
target_triple: str) -> [str] {
55-
log #fmt("cwd: %s", cwd);
56-
log #fmt("sysroot: %s", sysroot);
57-
log #fmt("output: %s", output);
58-
log #fmt("libs:");
55+
#debug("cwd: %s", cwd);
56+
#debug("sysroot: %s", sysroot);
57+
#debug("output: %s", output);
58+
#debug("libs:");
5959
for libpath in libs {
60-
log #fmt(" %s", libpath);
60+
#debug(" %s", libpath);
6161
}
62-
log #fmt("target_triple: %s", target_triple);
62+
#debug("target_triple: %s", target_triple);
6363

6464
// Use relative paths to the libraries. Binaries can be moved
6565
// as long as they maintain the relative relationship to the
@@ -74,9 +74,9 @@ fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
7474
let fallback_rpaths = [get_install_prefix_rpath(cwd, target_triple)];
7575

7676
fn log_rpaths(desc: str, rpaths: [str]) {
77-
log #fmt("%s rpaths:", desc);
77+
#debug("%s rpaths:", desc);
7878
for rpath in rpaths {
79-
log #fmt(" %s", rpath);
79+
#debug(" %s", rpath);
8080
}
8181
}
8282

@@ -117,8 +117,8 @@ fn get_rpath_relative_to_output(os: session::os,
117117
fn get_relative_to(abs1: fs::path, abs2: fs::path) -> fs::path {
118118
assert fs::path_is_absolute(abs1);
119119
assert fs::path_is_absolute(abs2);
120-
log #fmt("finding relative path from %s to %s",
121-
abs1, abs2);
120+
#debug("finding relative path from %s to %s",
121+
abs1, abs2);
122122
let normal1 = fs::normalize(abs1);
123123
let normal2 = fs::normalize(abs2);
124124
let split1 = str::split(normal1, os_fs::path_sep as u8);

trunk/src/comp/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ fn time<T>(do_it: bool, what: str, thunk: fn@() -> T) -> T {
105105
let start = std::time::precise_time_s();
106106
let rv = thunk();
107107
let end = std::time::precise_time_s();
108-
log_err #fmt["time: %s took %s s", what,
109-
float::to_str(end - start, 3u)];
108+
#error("time: %s took %s s", what,
109+
float::to_str(end - start, 3u));
110110
ret rv;
111111
}
112112

trunk/src/comp/front/attr.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn find_linkage_metas(attrs: [ast::attribute]) -> [@ast::meta_item] {
3434
for attr: ast::attribute in find_attrs_by_name(attrs, "link") {
3535
alt attr.node.value.node {
3636
ast::meta_list(_, items) { metas += items; }
37-
_ { log "ignoring link attribute that has incorrect type"; }
37+
_ { #debug("ignoring link attribute that has incorrect type"); }
3838
}
3939
}
4040
ret metas;
@@ -135,14 +135,14 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
135135
}
136136

137137
fn contains(haystack: [@ast::meta_item], needle: @ast::meta_item) -> bool {
138-
log #fmt["looking for %s",
139-
syntax::print::pprust::meta_item_to_str(*needle)];
138+
#debug("looking for %s",
139+
syntax::print::pprust::meta_item_to_str(*needle));
140140
for item: @ast::meta_item in haystack {
141-
log #fmt["looking in %s",
142-
syntax::print::pprust::meta_item_to_str(*item)];
143-
if eq(item, needle) { log "found it!"; ret true; }
141+
#debug("looking in %s",
142+
syntax::print::pprust::meta_item_to_str(*item));
143+
if eq(item, needle) { #debug("found it!"); ret true; }
144144
}
145-
log "found it not :(";
145+
#debug("found it not :(");
146146
ret false;
147147
}
148148

0 commit comments

Comments
 (0)