Skip to content

Commit 8fa8a4b

Browse files
committed
---
yaml --- r: 6752 b: refs/heads/master c: 1fe4bd0 h: refs/heads/master v: v3
1 parent 271d840 commit 8fa8a4b

Some content is hidden

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

66 files changed

+647
-1065
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: 1bf078f988498ddbdbbfd5c58f850bce14518db6
2+
refs/heads/master: 1fe4bd0f433553eacf8d81cdbe16ac6fe6f16c54

trunk/mk/stage0.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@ $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUNTIME): \
1313
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
1414
$(Q)touch $@
1515

16+
## FIXME temporary hack for snapshot transition
17+
CORELIB_DUMMY :=$(call CFG_LIB_NAME,core-dummy)
18+
STDLIB_DUMMY :=$(call CFG_LIB_NAME,std-dummy)
19+
1620
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_CORELIB): \
1721
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
1822
$(Q)touch $@
23+
$(foreach target,$(CFG_TARGET_TRIPLES),\
24+
$(shell touch $(CFG_HOST_TRIPLE)/stage0/lib/rustc/$(target)/lib/$(CORELIB_DUMMY)))
1925

2026
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_STDLIB): \
2127
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
2228
$(Q)touch $@
29+
$(foreach target,$(CFG_TARGET_TRIPLES),\
30+
$(shell touch $(CFG_HOST_TRIPLE)/stage0/lib/rustc/$(target)/lib/$(STDLIB_DUMMY)))
2331

2432
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUSTLLVM): \
2533
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)

trunk/mk/tests.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ tidy:
9393
$(STDLIB_INPUTS) \
9494
$(COMPILETEST_CRATE) \
9595
$(COMPILETEST_INPUTS) \
96-
$(CARGO_CRATE) \
97-
$(CARGO_INPUTS) \
9896
| xargs -n 10 python $(S)src/etc/tidy.py
9997
$(Q)echo \
10098
$(ALL_TEST_INPUTS) \

trunk/src/cargo/cargo.rs

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import rustc::syntax::parse::parser;
66
import std::fs;
77
import std::generic_os;
88
import std::io;
9-
import std::json;
109
import option;
1110
import option::{none, some};
1211
import std::os;
@@ -155,15 +154,13 @@ fn install_one_crate(c: cargo, _path: str, cf: str, _p: pkg) {
155154
name = str::slice(name, 0u, ri as uint);
156155
}
157156
log #fmt["Installing: %s", name];
158-
let old = fs::list_dir(".");
157+
let old = vec::map({|x| str::slice(x, 2u, str::byte_len(x))}, fs::list_dir("."));
159158
run::run_program("rustc", [name + ".rc"]);
160-
let new = fs::list_dir(".");
161-
let created =
162-
vec::filter::<str>(new, { |n| !vec::member::<str>(n, old) });
163-
let exec_suffix = os::exec_suffix();
159+
let new = vec::map({|x| str::slice(x, 2u, str::byte_len(x))}, fs::list_dir("."));
160+
let created = vec::filter::<str>({ |n| !vec::member::<str>(n, old) }, new);
164161
for ct: str in created {
165-
if (exec_suffix != "" && str::ends_with(ct, exec_suffix)) ||
166-
(exec_suffix == "" && !str::starts_with(ct, "lib")) {
162+
if (os::exec_suffix() != "" && str::ends_with(ct, os::exec_suffix())) ||
163+
(os::exec_suffix() == "" && !str::starts_with(ct, "lib")) {
167164
log #fmt[" bin: %s", ct];
168165
// FIXME: need libstd fs::copy or something
169166
run::run_program("cp", [ct, c.bindir]);
@@ -181,8 +178,7 @@ fn install_source(c: cargo, path: str) {
181178

182179
log #fmt["contents: %s", str::connect(contents, ", ")];
183180

184-
let cratefiles =
185-
vec::filter::<str>(contents, { |n| str::ends_with(n, ".rc") });
181+
let cratefiles = vec::filter::<str>({ |n| str::ends_with(n, ".rc") }, contents);
186182

187183
if vec::is_empty(cratefiles) {
188184
fail "This doesn't look like a rust package (no .rc files).";
@@ -210,36 +206,6 @@ fn install_file(c: cargo, wd: str, _path: str) {
210206
install_source(c, wd);
211207
}
212208

213-
fn install_resolved(c: cargo, wd: str, key: str) {
214-
fs::remove_dir(wd);
215-
let u = "https://rust-package-index.appspot.com/pkg/" + key;
216-
let p = run::program_output("curl", [u]);
217-
if p.status != 0 {
218-
fail #fmt["Fetch of %s failed: %s", u, p.err];
219-
}
220-
let j = json::from_str(p.out);
221-
alt j {
222-
some (json::dict(_j)) {
223-
alt _j.find("install") {
224-
some (json::string(g)) {
225-
log #fmt["Resolved: %s -> %s", key, g];
226-
cmd_install(c, ["cargo", "install", g]);
227-
}
228-
_ { fail #fmt["Bogus install: '%s'", p.out]; }
229-
}
230-
}
231-
_ { fail #fmt["Bad json: '%s'", p.out]; }
232-
}
233-
}
234-
235-
fn install_uuid(c: cargo, wd: str, uuid: str) {
236-
install_resolved(c, wd, "by-uuid/" + uuid);
237-
}
238-
239-
fn install_named(c: cargo, wd: str, name: str) {
240-
install_resolved(c, wd, "by-name/" + name);
241-
}
242-
243209
fn cmd_install(c: cargo, argv: [str]) {
244210
// cargo install <pkg>
245211
if vec::len(argv) < 3u {
@@ -260,11 +226,6 @@ fn cmd_install(c: cargo, argv: [str]) {
260226
} else if str::starts_with(argv[2], "file:") {
261227
let path = rest(argv[2], 5u);
262228
install_file(c, wd, path);
263-
} else if str::starts_with(argv[2], "uuid:") {
264-
let uuid = rest(argv[2], 5u);
265-
install_uuid(c, wd, uuid);
266-
} else {
267-
install_named(c, wd, argv[2]);
268229
}
269230
}
270231

trunk/src/comp/back/rpath.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn get_sysroot_absolute_rt_lib(sess: session::session) -> fs::path {
4747
}
4848

4949
fn rpaths_to_flags(rpaths: [str]) -> [str] {
50-
vec::map(rpaths, { |rpath| #fmt("-Wl,-rpath,%s",rpath)})
50+
vec::map({ |rpath| #fmt("-Wl,-rpath,%s",rpath)}, rpaths)
5151
}
5252

5353
fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
@@ -96,7 +96,7 @@ fn get_rpaths_relative_to_output(os: session::os,
9696
cwd: fs::path,
9797
output: fs::path,
9898
libs: [fs::path]) -> [str] {
99-
vec::map(libs, bind get_rpath_relative_to_output(os, cwd, output, _))
99+
vec::map(bind get_rpath_relative_to_output(os, cwd, output, _), libs)
100100
}
101101

102102
fn get_rpath_relative_to_output(os: session::os,
@@ -150,7 +150,7 @@ fn get_relative_to(abs1: fs::path, abs2: fs::path) -> fs::path {
150150
}
151151

152152
fn get_absolute_rpaths(cwd: fs::path, libs: [fs::path]) -> [str] {
153-
vec::map(libs, bind get_absolute_rpath(cwd, _))
153+
vec::map(bind get_absolute_rpath(cwd, _), libs)
154154
}
155155

156156
fn get_absolute_rpath(cwd: fs::path, &&lib: fs::path) -> str {

trunk/src/comp/driver/rustc.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
162162
bind middle::ast_map::map_crate(*crate));
163163
time(time_passes, "external crate/lib resolution",
164164
bind creader::read_crates(sess, *crate));
165-
let {def_map, ext_map, exp_map, impl_map} =
165+
let {def_map: def_map, ext_map: ext_map} =
166166
time(time_passes, "resolution",
167167
bind resolve::resolve_crate(sess, ast_map, crate));
168168
let freevars =
@@ -171,8 +171,7 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
171171
time(time_passes, "const checking",
172172
bind middle::check_const::check_crate(sess, crate));
173173
let ty_cx = ty::mk_ctxt(sess, def_map, ext_map, ast_map, freevars);
174-
let method_map = time(time_passes, "typechecking",
175-
bind typeck::check_crate(ty_cx, impl_map, crate));
174+
time(time_passes, "typechecking", bind typeck::check_crate(ty_cx, crate));
176175
time(time_passes, "block-use checking",
177176
bind middle::block_use::check_crate(ty_cx, crate));
178177
time(time_passes, "function usage",
@@ -190,17 +189,16 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
190189
let last_uses = time(time_passes, "last use finding",
191190
bind last_use::find_last_uses(crate, def_map, ref_map, ty_cx));
192191
time(time_passes, "kind checking",
193-
bind kind::check_crate(ty_cx, method_map, last_uses, crate));
192+
bind kind::check_crate(ty_cx, last_uses, crate));
194193
if sess.get_opts().no_trans { ret; }
195194

196195
let outputs = build_output_filenames(input, outdir, output, sess);
197196

198197
let (llmod, link_meta) =
199198
time(time_passes, "translation",
200199
bind trans::trans_crate(sess, crate, ty_cx,
201-
outputs.obj_filename, exp_map, ast_map,
202-
mut_map, copy_map, last_uses,
203-
method_map));
200+
outputs.obj_filename, ast_map,
201+
mut_map, copy_map, last_uses));
204202
time(time_passes, "LLVM passes",
205203
bind link::write::run_passes(sess, llmod, outputs.obj_filename));
206204

@@ -269,11 +267,11 @@ fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg, input: str,
269267
ppm_typed. {
270268
crate = syntax::ext::expand::expand_crate(sess, crate);
271269
let amap = middle::ast_map::map_crate(*crate);
272-
let {def_map, ext_map, impl_map, _} =
270+
let {def_map: def_map, ext_map: ext_map} =
273271
resolve::resolve_crate(sess, amap, crate);
274272
let freevars = freevars::annotate_freevars(def_map, crate);
275273
let ty_cx = ty::mk_ctxt(sess, def_map, ext_map, amap, freevars);
276-
typeck::check_crate(ty_cx, impl_map, crate);
274+
typeck::check_crate(ty_cx, crate);
277275
ann = {pre: ann_paren_for_expr, post: bind ann_typed_post(ty_cx, _)};
278276
}
279277
ppm_identified. {
@@ -650,9 +648,10 @@ fn main(args: [str]) {
650648
let ofile = getopts::opt_maybe_str(match, "o");
651649
let cfg = build_configuration(sess, binary, ifile);
652650
let pretty =
653-
option::map(getopts::opt_default(match, "pretty",
654-
"normal"),
655-
bind parse_pretty(sess, _));
651+
option::map::<str,
652+
pp_mode>(bind parse_pretty(sess, _),
653+
getopts::opt_default(match, "pretty",
654+
"normal"));
656655
alt pretty {
657656
some::<pp_mode>(ppm) { pretty_print_input(sess, cfg, ifile, ppm); ret; }
658657
none::<pp_mode>. {/* continue */ }

trunk/src/comp/front/attr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn find_attrs_by_name(attrs: [ast::attribute], name: ast::ident) ->
5050
option::some(a)
5151
} else { option::none }
5252
}(_, name);
53-
ret vec::filter_map(attrs, filter);
53+
ret vec::filter_map(filter, attrs);
5454
}
5555

5656
fn get_attr_name(attr: ast::attribute) -> ast::ident {
@@ -66,7 +66,7 @@ fn find_meta_items_by_name(metas: [@ast::meta_item], name: ast::ident) ->
6666
option::some(m)
6767
} else { option::none }
6868
}(_, name);
69-
ret vec::filter_map(metas, filter);
69+
ret vec::filter_map(filter, metas);
7070
}
7171

7272
fn get_meta_item_name(meta: @ast::meta_item) -> ast::ident {
@@ -186,7 +186,7 @@ fn remove_meta_items_by_name(items: [@ast::meta_item], name: str) ->
186186
} else { option::none }
187187
}(_, name);
188188

189-
ret vec::filter_map(items, filter);
189+
ret vec::filter_map(filter, items);
190190
}
191191

192192
fn require_unique_names(sess: session::session, metas: [@ast::meta_item]) {

trunk/src/comp/front/config.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ fn filter_item(cfg: ast::crate_cfg, &&item: @ast::item) ->
2929
fn fold_mod(cfg: ast::crate_cfg, m: ast::_mod, fld: fold::ast_fold) ->
3030
ast::_mod {
3131
let filter = bind filter_item(cfg, _);
32-
let filtered_items = vec::filter_map(m.items, filter);
33-
ret {view_items: vec::map(m.view_items, fld.fold_view_item),
34-
items: vec::map(filtered_items, fld.fold_item)};
32+
let filtered_items = vec::filter_map(filter, m.items);
33+
ret {view_items: vec::map(fld.fold_view_item, m.view_items),
34+
items: vec::map(fld.fold_item, filtered_items)};
3535
}
3636

3737
fn filter_native_item(cfg: ast::crate_cfg, &&item: @ast::native_item) ->
@@ -44,8 +44,8 @@ fn filter_native_item(cfg: ast::crate_cfg, &&item: @ast::native_item) ->
4444
fn fold_native_mod(cfg: ast::crate_cfg, nm: ast::native_mod,
4545
fld: fold::ast_fold) -> ast::native_mod {
4646
let filter = bind filter_native_item(cfg, _);
47-
let filtered_items = vec::filter_map(nm.items, filter);
48-
ret {view_items: vec::map(nm.view_items, fld.fold_view_item),
47+
let filtered_items = vec::filter_map(filter, nm.items);
48+
ret {view_items: vec::map(fld.fold_view_item, nm.view_items),
4949
items: filtered_items};
5050
}
5151

@@ -69,10 +69,10 @@ fn filter_stmt(cfg: ast::crate_cfg, &&stmt: @ast::stmt) ->
6969
fn fold_block(cfg: ast::crate_cfg, b: ast::blk_, fld: fold::ast_fold) ->
7070
ast::blk_ {
7171
let filter = bind filter_stmt(cfg, _);
72-
let filtered_stmts = vec::filter_map(b.stmts, filter);
72+
let filtered_stmts = vec::filter_map(filter, b.stmts);
7373
ret {view_items: b.view_items,
74-
stmts: vec::map(filtered_stmts, fld.fold_stmt),
75-
expr: option::map(b.expr, fld.fold_expr),
74+
stmts: vec::map(fld.fold_stmt, filtered_stmts),
75+
expr: option::map(fld.fold_expr, b.expr),
7676
id: b.id,
7777
rules: b.rules};
7878
}
@@ -99,8 +99,8 @@ fn metas_in_cfg(cfg: ast::crate_cfg, metas: [@ast::meta_item]) -> bool {
9999
// Pull the inner meta_items from the #[cfg(meta_item, ...)] attributes,
100100
// so we can match against them. This is the list of configurations for
101101
// which the item is valid
102-
let cfg_metas = vec::concat(vec::filter_map(cfg_metas,
103-
{|&&i| attr::get_meta_item_list(i)}));
102+
let cfg_metas = vec::concat(vec::filter_map(
103+
{|&&i| attr::get_meta_item_list(i)}, cfg_metas));
104104

105105
let has_cfg_metas = vec::len(cfg_metas) > 0u;
106106
if !has_cfg_metas { ret true; }

trunk/src/comp/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn fold_mod(_cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod {
6161
}
6262

6363
let mod_nomain =
64-
{view_items: m.view_items, items: vec::filter_map(m.items, nomain)};
64+
{view_items: m.view_items, items: vec::filter_map(nomain, m.items)};
6565
ret fold::noop_fold_mod(mod_nomain, fld);
6666
}
6767

@@ -126,8 +126,8 @@ fn is_test_fn(i: @ast::item) -> bool {
126126
fn is_ignored(cx: test_ctxt, i: @ast::item) -> bool {
127127
let ignoreattrs = attr::find_attrs_by_name(i.attrs, "ignore");
128128
let ignoreitems = attr::attr_metas(ignoreattrs);
129-
let cfg_metas = vec::concat(vec::filter_map(ignoreitems,
130-
{|&&i| attr::get_meta_item_list(i)}));
129+
let cfg_metas = vec::concat(vec::filter_map(
130+
{|&&i| attr::get_meta_item_list(i)}, ignoreitems));
131131
ret if vec::is_not_empty(ignoreitems) {
132132
config::metas_in_cfg(cx.crate.node.config, cfg_metas)
133133
} else {

trunk/src/comp/metadata/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ const tag_items_data_item_inlineness: uint = 0x27u;
6666

6767
const tag_crate_hash: uint = 0x28u;
6868

69-
const tag_mod_impl: uint = 0x30u;
70-
71-
const tag_impl_method: uint = 0x31u;
72-
7369
// djb's cdb hashes.
7470
fn hash_node_id(&&node_id: int) -> uint { ret 177573u ^ (node_id as uint); }
7571

trunk/src/comp/metadata/csearch.rs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,8 @@ fn get_type_param_count(cstore: cstore::cstore, def: ast::def_id) -> uint {
2323

2424
fn lookup_defs(cstore: cstore::cstore, cnum: ast::crate_num,
2525
path: [ast::ident]) -> [ast::def] {
26-
let result = [];
27-
for (c, data, def) in resolve_path(cstore, cnum, path) {
28-
result += [decoder::lookup_def(c, data, def)];
29-
}
30-
ret result;
31-
}
32-
33-
fn resolve_path(cstore: cstore::cstore, cnum: ast::crate_num,
34-
path: [ast::ident]) ->
35-
[(ast::crate_num, @[u8], ast::def_id)] {
36-
let cm = cstore::get_crate_data(cstore, cnum);
37-
log #fmt("resolve_path %s in crates[%d]:%s",
38-
str::connect(path, "::"), cnum, cm.name);
39-
let result = [];
40-
for def in decoder::resolve_path(path, cm.data) {
41-
if def.crate == ast::local_crate {
42-
result += [(cnum, cm.data, def)];
43-
} else {
44-
if cm.cnum_map.contains_key(def.crate) {
45-
// This reexport is itself a reexport from anther crate
46-
let next_cnum = cm.cnum_map.get(def.crate);
47-
let next_cm_data = cstore::get_crate_data(cstore, next_cnum);
48-
result += [(next_cnum, next_cm_data.data, def)];
49-
}
50-
}
51-
}
52-
ret result;
26+
let cdata = cstore::get_crate_data(cstore, cnum).data;
27+
ret decoder::lookup_defs(cdata, cnum, path);
5328
}
5429

5530
fn get_tag_variants(tcx: ty::ctxt, def: ast::def_id) -> [ty::variant_info] {

trunk/src/comp/metadata/cstore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn get_dep_hashes(cstore: cstore) -> [str] {
140140
log #fmt(" hash[%s]: %s", x.name, x.hash);
141141
}
142142
fn mapper(ch: crate_hash) -> str { ret ch.hash; }
143-
ret vec::map(sorted, mapper);
143+
ret vec::map(mapper, sorted);
144144
}
145145
// Local Variables:
146146
// mode: rust

trunk/src/comp/metadata/decoder.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ export get_tag_variants;
1515
export get_type;
1616
export get_type_param_count;
1717
export get_type_param_kinds;
18-
export lookup_def;
19-
export resolve_path;
18+
export lookup_defs;
2019
export get_crate_attributes;
2120
export list_crate_metadata;
2221
export crate_dep;
@@ -159,7 +158,14 @@ fn resolve_path(path: [ast::ident], data: @[u8]) -> [ast::def_id] {
159158
ret result;
160159
}
161160

162-
// FIXME doesn't yet handle renamed re-exported externals
161+
// Crate metadata queries
162+
fn lookup_defs(data: @[u8], cnum: ast::crate_num, path: [ast::ident]) ->
163+
[ast::def] {
164+
ret vec::map(bind lookup_def(cnum, data, _), resolve_path(path, data));
165+
}
166+
167+
168+
// FIXME doesn't yet handle re-exported externals
163169
fn lookup_def(cnum: ast::crate_num, data: @[u8], did_: ast::def_id) ->
164170
ast::def {
165171
let item = lookup_item(did_.node, data);

0 commit comments

Comments
 (0)