Skip to content

Commit a5891cd

Browse files
committed
---
yaml --- r: 6970 b: refs/heads/master c: 7e61136 h: refs/heads/master v: v3
1 parent ea19f53 commit a5891cd

39 files changed

+523
-613
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: ab2a643f278d09c3fcc140ecb4c7cecbf1aff3c4
2+
refs/heads/master: 7e611366bb07f1c26cf5692bccfdfa4fb1d96d25

trunk/doc/rust.texi

Lines changed: 97 additions & 262 deletions
Large diffs are not rendered by default.

trunk/mk/clean.mk

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,34 @@ clean-misc:
2929
$(Q)rm -f $(ML_DEPFILES:%.d=%.d.tmp)
3030
$(Q)rm -f $(C_DEPFILES:%.d=%.d.tmp)
3131
$(Q)rm -f $(CRATE_DEPFILES:%.d=%.d.tmp)
32-
$(Q)rm -f $(GENERATED)
32+
$(Q)rm -Rf $(DOCS)
33+
$(Q)rm -Rf $(GENERATED)
3334
$(Q)rm -f rustllvm/$(CFG_RUSTLLVM) rustllvm/rustllvmbits.a
3435
$(Q)rm -f rt/$(CFG_RUNTIME)
35-
$(Q)find rt -name '*.o' -delete
36-
$(Q)find rt -name '*.a' -delete
36+
$(Q)find rustllvm llvm rt -name '*.[odasS]' -delete
37+
$(Q)find rustllvm llvm rt -name '*.so' -delete
38+
$(Q)find rustllvm llvm rt -name '*.dylib' -delete
39+
$(Q)find rustllvm llvm rt -name '*.dll' -delete
40+
$(Q)find rustllvm rt -name '*.def' -delete
41+
$(Q)rm -Rf $(wildcard rt/*/libuv/Default)
3742
$(Q)rm -f test/run_pass_stage2.rc test/run_pass_stage2_driver.rs
3843
$(Q)rm -Rf $(PKG_NAME)-*.tar.gz dist
39-
$(Q)rm -f $(foreach ext,o a d bc s exe,$(wildcard stage*/*.$(ext)))
4044
$(Q)rm -Rf $(foreach ext,out out.tmp \
4145
stage0$(X) stage1$(X) stage2$(X) \
42-
bc o s exe dSYM, \
46+
bc o s so dll exe dSYM, \
4347
$(wildcard test/*.$(ext) \
4448
test/*/*.$(ext) \
4549
test/bench/*/*.$(ext)))
4650
$(Q)rm -Rf $(foreach ext, \
47-
aux cp fn ky log pdf html pg toc tp vr cps, \
48-
$(wildcard doc/*.$(ext)))
51+
css html js \
52+
aux cp fn ky log pdf pg toc tp vr cps, \
53+
$(wildcard doc/*.$(ext) \
54+
doc/*/*.$(ext) \
55+
doc/*/*/*.$(ext)))
56+
$(Q)rm -Rf doc/keywords.texi
4957
$(Q)rm -Rf doc/version.texi
58+
$(Q)rm -Rf $(foreach sub, index styles files search javascript, \
59+
$(wildcard doc/*/$(sub)))
5060
$(Q)rm -rf libuv
5161

5262
define CLEAN_HOST_STAGE_N
@@ -55,6 +65,7 @@ clean$(1)_H_$(2):
5565
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustc$(X)
5666
$(Q)rm -f $$(HBIN$(1)_H_$(2))/fuzzer$(X)
5767
$(Q)rm -f $$(HBIN$(1)_H_$(2))/cargo$(X)
68+
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustdoc$(X)
5869
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME)
5970
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_CORELIB)
6071
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_STDLIB)
@@ -76,6 +87,8 @@ define CLEAN_TARGET_STAGE_N
7687
clean$(1)_T_$(2)_H_$(3):
7788
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$(X)
7889
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/fuzzer$(X)
90+
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/cargo$(X)
91+
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustdoc$(X)
7992
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME)
8093
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB)
8194
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB)
@@ -86,7 +99,8 @@ clean$(1)_T_$(2)_H_$(3):
8699
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM)
87100
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
88101
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.bc
89-
102+
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll
103+
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
90104
endef
91105

92106
$(foreach host, $(CFG_TARGET_TRIPLES), \

trunk/mk/docs.mk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# Doc variables and rules
33
######################################################################
44

5-
docs: $(DOCS)
6-
75
doc/keywords.texi: $(S)doc/keywords.txt $(S)src/etc/gen-keywords-table.py
86
@$(call E, gen-keywords-table: $@)
97
$(Q)$(S)src/etc/gen-keywords-table.py
@@ -14,6 +12,8 @@ doc/version.texi: $(MKFILE_DEPS) rust.texi
1412
$(Q)echo "$(CFG_VERSION)" >>$@
1513
$(Q)echo "@end macro" >>$@
1614

15+
GENERATED += doc/keywords.texi doc/version.texi
16+
1717
doc/%.pdf: %.texi doc/version.texi doc/keywords.texi
1818
@$(call E, texi2pdf: $@)
1919
@# LC_COLLATE=C works around a bug in texi2dvi; see
@@ -47,7 +47,16 @@ nd/$(1)/lib.css: $(S)doc/lib.css
4747
@$$(call E, cp: $$@)
4848
$(Q)cp $$< $$@
4949

50+
GENERATED += nd/$(1)/Languages.txt \
51+
nd/$(1)/Topics.txt \
52+
nd/$(1)/Menu.txt \
53+
nd/$(1)/Data
54+
55+
DOCS += nd/$(1)/index.html nd/$(1)/lib.css
56+
5057
endef
5158

5259
$(eval $(call libdoc,core,$(CORELIB_CRATE) $(CORELIB_INPUTS)))
5360
$(eval $(call libdoc,std,$(STDLIB_CRATE) $(STDLIB_INPUTS)))
61+
62+
docs: $(DOCS)

trunk/src/comp/front/test.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item {
190190
let ret_ty = mk_test_desc_vec_ty(cx);
191191

192192
let decl: ast::fn_decl =
193-
{proto: ast::proto_bare,
194-
inputs: [],
193+
{inputs: [],
195194
output: ret_ty,
196195
purity: ast::impure_fn,
197196
cf: ast::return_val,
@@ -322,7 +321,6 @@ fn mk_test_wrapper(cx: test_ctxt,
322321
ast::stmt_expr(@call_expr, cx.sess.next_node_id()));
323322

324323
let wrapper_decl: ast::fn_decl = {
325-
proto: ast::proto_bare,
326324
inputs: [],
327325
output: @nospan(ast::ty_nil),
328326
purity: ast::impure_fn,
@@ -345,7 +343,8 @@ fn mk_test_wrapper(cx: test_ctxt,
345343

346344
let wrapper_expr: ast::expr = {
347345
id: cx.sess.next_node_id(),
348-
node: ast::expr_fn(wrapper_decl, wrapper_body, wrapper_capture),
346+
node: ast::expr_fn(ast::proto_bare, wrapper_decl,
347+
wrapper_body, wrapper_capture),
349348
span: span
350349
};
351350

@@ -366,8 +365,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
366365
let ret_ty = nospan(ast::ty_nil);
367366

368367
let decl: ast::fn_decl =
369-
{proto: ast::proto_bare,
370-
inputs: [args_arg],
368+
{inputs: [args_arg],
371369
output: @ret_ty,
372370
purity: ast::impure_fn,
373371
cf: ast::return_val,

trunk/src/comp/middle/alias.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> (copy_map, ref_map) {
6161
copy_map: std::map::new_int_hash(),
6262
ref_map: std::map::new_int_hash(),
6363
mutable silent: false};
64-
let v = @{visit_fn: bind visit_fn(cx, _, _, _, _, _, _, _, _),
64+
let v = @{visit_fn: bind visit_fn(cx, _, _, _, _, _, _, _),
6565
visit_expr: bind visit_expr(cx, _, _, _),
6666
visit_block: bind visit_block(cx, _, _, _)
6767
with *visit::default_visitor::<scope>()};
@@ -71,8 +71,8 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> (copy_map, ref_map) {
7171
ret (cx.copy_map, cx.ref_map);
7272
}
7373

74-
fn visit_fn(cx: @ctx, decl: ast::fn_decl, _ts: [ast::ty_param],
75-
body: ast::blk, sp: span, _name: ast::fn_ident,
74+
fn visit_fn(cx: @ctx, _fk: visit::fn_kind, decl: ast::fn_decl,
75+
body: ast::blk, sp: span,
7676
id: ast::node_id, sc: scope, v: vt<scope>) {
7777
visit::visit_fn_decl(decl, sc, v);
7878
let fty = ty::node_id_to_type(cx.tcx, id);

trunk/src/comp/middle/ast_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ fn map_crate(c: crate) -> map {
3232
(@{visit_item: bind map_item(cx, _),
3333
visit_native_item: bind map_native_item(cx, _),
3434
visit_expr: bind map_expr(cx, _),
35-
visit_fn: bind map_fn(cx, _, _, _, _, _, _),
35+
visit_fn: bind map_fn(cx, _, _, _, _, _),
3636
visit_local: bind map_local(cx, _),
3737
visit_arm: bind map_arm(cx, _)
3838
with *visit::default_simple_visitor()});
3939
visit::visit_crate(c, (), v_map);
4040
ret cx.map;
4141
}
4242

43-
fn map_fn(cx: ctx, decl: fn_decl, _tps: [ty_param], _body: blk,
44-
_sp: codemap::span, _n: fn_ident, _id: node_id) {
43+
fn map_fn(cx: ctx, _fk: visit::fn_kind, decl: fn_decl, _body: blk,
44+
_sp: codemap::span, _id: node_id) {
4545
for a in decl.inputs {
4646
cx.map.insert(a.id, node_arg(a, cx.local_id));
4747
cx.local_id += 1u;

trunk/src/comp/middle/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> {
736736
}
737737
ast_map::node_expr(expr) {
738738
alt expr.node {
739-
ast::expr_fn(decl, _, _) {
739+
ast::expr_fn(_, decl, _, _) {
740740
(dbg_cx.names.next("fn"), decl.output, expr.id)
741741
}
742742
ast::expr_fn_block(decl, _) {

trunk/src/comp/middle/freevars.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ fn collect_freevars(def_map: resolve::def_map, blk: ast::blk)
3838
let walk_expr =
3939
lambda (expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
4040
alt expr.node {
41-
ast::expr_fn(decl, _, captures) {
42-
if decl.proto != ast::proto_bare {
41+
ast::expr_fn(proto, decl, _, captures) {
42+
if proto != ast::proto_bare {
4343
visit::visit_expr(expr, depth + 1, v);
4444
}
4545
}
@@ -82,9 +82,8 @@ fn annotate_freevars(def_map: resolve::def_map, crate: @ast::crate) ->
8282
freevar_map {
8383
let freevars = new_int_hash();
8484

85-
let walk_fn = lambda (_decl: ast::fn_decl, _tps: [ast::ty_param],
86-
blk: ast::blk, _sp: span, _nm: ast::fn_ident,
87-
nid: ast::node_id) {
85+
let walk_fn = lambda (_fk: visit::fn_kind, _decl: ast::fn_decl,
86+
blk: ast::blk, _sp: span, nid: ast::node_id) {
8887
let vars = collect_freevars(def_map, blk);
8988
freevars.insert(nid, vars);
9089
};

trunk/src/comp/middle/kind.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ fn with_closure_check_fn(cx: ctx, id: node_id,
6767

6868
// Check that the free variables used in a shared/sendable closure conform
6969
// to the copy/move kind bounds. Then recursively check the function body.
70-
fn check_fn(decl: fn_decl, tps: [ty_param], body: blk, sp: span,
71-
i: fn_ident, id: node_id, cx: ctx, v: visit::vt<ctx>) {
70+
fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
71+
id: node_id, cx: ctx, v: visit::vt<ctx>) {
7272

7373
// n.b.: This could be the body of either a fn decl or a fn expr. In the
7474
// former case, the prototype will be proto_bare and no check occurs. In
@@ -88,7 +88,7 @@ fn check_fn(decl: fn_decl, tps: [ty_param], body: blk, sp: span,
8888
}
8989
}
9090

91-
visit::visit_fn(decl, tps, body, sp, i, id, cx, v);
91+
visit::visit_fn(fk, decl, body, sp, id, cx, v);
9292
}
9393

9494
fn check_fn_cap_clause(cx: ctx,
@@ -181,7 +181,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
181181
}
182182
}
183183
expr_ternary(_, a, b) { maybe_copy(cx, a); maybe_copy(cx, b); }
184-
expr_fn(_, _, cap_clause) {
184+
expr_fn(_, _, _, cap_clause) {
185185
check_fn_cap_clause(cx, e.id, *cap_clause);
186186
}
187187
_ { }

trunk/src/comp/middle/last_use.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import syntax::{visit, ast_util};
22
import syntax::ast::*;
33
import syntax::codemap::span;
4-
import std::list::{is_not_empty, list, nil, cons, tail};
4+
import std::list::{list, nil, cons, tail};
55
import core::{vec, option};
66
import std::list;
77

@@ -136,7 +136,7 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) {
136136
for arg in args {
137137
alt arg.node {
138138
//NDM--register captured as uses
139-
expr_fn(_, _, captured) { fns += [arg]; }
139+
expr_fn(_, _, _, captured) { fns += [arg]; }
140140
expr_fn_block(_, _) { fns += [arg]; }
141141
_ {
142142
alt arg_ts[i].mode {
@@ -153,19 +153,19 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) {
153153
}
154154
}
155155

156-
fn visit_fn(decl: fn_decl, tps: [ty_param], body: blk,
157-
sp: span, nm: fn_ident, id: node_id,
156+
fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
157+
sp: span, id: node_id,
158158
cx: ctx, v: visit::vt<ctx>) {
159159
let fty = ty::node_id_to_type(cx.tcx, id);
160160
let proto = ty::ty_fn_proto(cx.tcx, fty);
161161
if proto == proto_block {
162162
visit_block(func, cx, {||
163-
visit::visit_fn(decl, tps, body, sp, nm, id, cx, v);
163+
visit::visit_fn(fk, decl, body, sp, id, cx, v);
164164
});
165165
} else {
166166
let old = nil;
167167
cx.blocks <-> old;
168-
visit::visit_fn(decl, tps, body, sp, nm, id, cx, v);
168+
visit::visit_fn(fk, decl, body, sp, id, cx, v);
169169
cx.blocks <-> old;
170170
leave_fn(cx);
171171
}
@@ -177,9 +177,7 @@ fn visit_block(tp: block_type, cx: ctx, visit: block()) {
177177
visit();
178178
local.second = true;
179179
visit();
180-
let cx_blocks = cx.blocks;
181-
check is_not_empty(cx_blocks);
182-
cx.blocks = tail(cx_blocks);
180+
cx.blocks = tail(cx.blocks);
183181
cx.current = join_branches(local.exits);
184182
}
185183

trunk/src/comp/middle/resolve.rs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ fn map_crate(e: @env, c: @ast::crate) {
266266
let imp = follow_import(*e, sc, *path, vi.span);
267267
if option::is_some(imp) {
268268
let glob = {def: option::get(imp), item: vi};
269-
check list::is_not_empty(sc);
270269
alt list::head(sc) {
271270
scope_item(i) {
272271
e.mod_map.get(i.id).glob_imports += [glob];
@@ -337,7 +336,7 @@ fn resolve_names(e: @env, c: @ast::crate) {
337336
visit_expr: bind walk_expr(e, _, _, _),
338337
visit_ty: bind walk_ty(e, _, _, _),
339338
visit_constr: bind walk_constr(e, _, _, _, _, _),
340-
visit_fn: bind visit_fn_with_scope(e, _, _, _, _, _, _, _, _)
339+
visit_fn: bind visit_fn_with_scope(e, _, _, _, _, _, _, _)
341340
with *visit::default_visitor()};
342341
visit::visit_crate(*c, cons(scope_crate, @nil), visit::mk_vt(v));
343342
e.used_imports.track = false;
@@ -351,7 +350,7 @@ fn resolve_names(e: @env, c: @ast::crate) {
351350
lookup_path_strict(*e, sc, exp.span, p.node,
352351
ns_value));
353352
}
354-
ast::expr_fn(_, _, cap_clause) {
353+
ast::expr_fn(_, _, _, cap_clause) {
355354
let rci = bind resolve_capture_item(e, sc, _);
356355
vec::iter(cap_clause.copies, rci);
357356
vec::iter(cap_clause.moves, rci);
@@ -404,8 +403,9 @@ fn visit_item_with_scope(i: @ast::item, sc: scopes, v: vt<scopes>) {
404403
alt ifce { some(ty) { v.visit_ty(ty, sc, v); } _ {} }
405404
v.visit_ty(sty, sc, v);
406405
for m in methods {
407-
v.visit_fn(m.decl, tps + m.tps, m.body, m.span,
408-
some(m.ident), m.id, sc, v);
406+
v.visit_fn(visit::fk_method(m.ident, tps + m.tps),
407+
m.decl, m.body, m.span,
408+
m.id, sc, v);
409409
}
410410
}
411411
_ { visit::visit_item(i, sc, v); }
@@ -417,30 +417,35 @@ fn visit_native_item_with_scope(ni: @ast::native_item, sc: scopes,
417417
visit::visit_native_item(ni, cons(scope_native_item(ni), @sc), v);
418418
}
419419

420-
fn visit_fn_with_scope(e: @env, decl: ast::fn_decl, tp: [ast::ty_param],
421-
body: ast::blk, sp: span, name: fn_ident,
420+
fn visit_fn_with_scope(e: @env, fk: visit::fn_kind, decl: ast::fn_decl,
421+
body: ast::blk, sp: span,
422422
id: node_id, sc: scopes, v: vt<scopes>) {
423423
// is this a main fn declaration?
424-
alt name {
425-
some(nm) {
424+
alt fk {
425+
visit::fk_item_fn(nm, _) {
426426
if is_main_name([nm]) && !e.sess.building_library() {
427427
// This is a main function -- set it in the session
428428
// as the main ID
429429
e.sess.set_main_id(id);
430430
}
431431
}
432-
_ { }
432+
_ { /* fallthrough */ }
433433
}
434434

435435
// here's where we need to set up the mapping
436436
// for f's constrs in the table.
437437
for c: @ast::constr in decl.constraints { resolve_constr(e, c, sc, v); }
438-
let scope = alt decl.proto {
439-
ast::proto_bare. { scope_bare_fn(decl, id, tp) }
440-
_ { scope_fn_expr(decl, id, tp) }
438+
let scope = alt fk {
439+
visit::fk_item_fn(_, tps) | visit::fk_method(_, tps) |
440+
visit::fk_res(_, tps) {
441+
scope_bare_fn(decl, id, tps)
442+
}
443+
visit::fk_anon(_) | visit::fk_fn_block. {
444+
scope_fn_expr(decl, id, [])
445+
}
441446
};
442447

443-
visit::visit_fn(decl, tp, body, sp, name, id, cons(scope, @sc), v);
448+
visit::visit_fn(fk, decl, body, sp, id, cons(scope, @sc), v);
444449
}
445450

446451
fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {
@@ -456,7 +461,6 @@ fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {
456461
}
457462

458463
fn visit_decl_with_scope(d: @decl, sc: scopes, v: vt<scopes>) {
459-
check list::is_not_empty(sc);
460464
let loc_pos = alt list::head(sc) {
461465
scope_block(_, _, pos) { pos }
462466
_ { @mutable 0u }

0 commit comments

Comments
 (0)