Remove 'with'
This commit is contained in:
parent
ef880f2245
commit
200959d7ce
doc
src
cargo
fuzzer
libcore
libsyntax
rustc
front
metadata
middle
astencode.rsborrowck.rs
borrowck
check_alt.rscheck_const.rscheck_loop.rsconst_eval.rsfreevars.rskind.rslang_items.rslint.rsliveness.rsprivacy.rsregion.rsresolve.rstrans
ty.rstypeck
util
rustdoc
attr_pass.rsconfig.rsdesc_to_brief_pass.rsfold.rsmarkdown_index_pass.rsmarkdown_pass.rsmarkdown_writer.rspage_pass.rspath_pass.rsprune_hidden_pass.rsrustdoc.rssectionalize_pass.rssort_pass.rstext_pass.rstystr_pass.rs
test
@ -1595,9 +1595,9 @@ The order of the fields in a record expression is significant, and
|
||||
determines the type of the resulting value. `{a: u8, b: u8}` and `{b:
|
||||
u8, a: u8}` are two different fields.
|
||||
|
||||
A record expression can terminate with the word `with` followed by an
|
||||
A record expression can terminate with the syntax `..` followed by an
|
||||
expression to denote a functional update. The expression following
|
||||
`with` (the base) must be of a record type that includes at least all the
|
||||
`..` (the base) must be of a record type that includes at least all the
|
||||
fields mentioned in the record expression. A new record will be
|
||||
created, of the same type as the base expression, with the given
|
||||
values for the fields that were explicitly specified, and the values
|
||||
@ -1606,7 +1606,7 @@ such a record expression is not significant.
|
||||
|
||||
~~~~
|
||||
let base = {x: 1, y: 2, z: 3};
|
||||
{y: 0, z: 10 with base};
|
||||
{y: 0, z: 10, .. base};
|
||||
~~~~
|
||||
|
||||
### Field expressions
|
||||
|
@ -362,7 +362,7 @@ fn load_crate(filename: &Path) -> Option<crate> {
|
||||
let v = visit::mk_simple_visitor(@{
|
||||
visit_view_item: |a| goto_view_item(sess, e, a),
|
||||
visit_item: |a| goto_item(e, a),
|
||||
with *visit::default_simple_visitor()
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
|
||||
visit::visit_crate(*c, (), v);
|
||||
|
@ -132,8 +132,8 @@ fn steal(crate: ast::crate, tm: test_mode) -> stolen_stuff {
|
||||
let tys = @mut ~[];
|
||||
let v = visit::mk_simple_visitor(@{
|
||||
visit_expr: |a| stash_expr_if(safe_to_steal_expr, exprs, a, tm),
|
||||
visit_ty: |a| stash_ty_if(safe_to_steal_ty, tys, a, tm)
|
||||
with *visit::default_simple_visitor()
|
||||
visit_ty: |a| stash_ty_if(safe_to_steal_ty, tys, a, tm),
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
visit::visit_crate(crate, (), v);
|
||||
{exprs: *exprs, tys: *tys}
|
||||
@ -182,8 +182,8 @@ fn replace_expr_in_crate(crate: ast::crate, i: uint,
|
||||
let afp = @{
|
||||
fold_expr: fold::wrap(|a,b| {
|
||||
fold_expr_rep(j, i, newexpr.node, a, b, tm)
|
||||
})
|
||||
with *fold::default_ast_fold()
|
||||
}),
|
||||
.. *fold::default_ast_fold()
|
||||
};
|
||||
let af = fold::make_fold(afp);
|
||||
let crate2: @ast::crate = @af.fold_crate(crate);
|
||||
@ -205,8 +205,8 @@ fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::ty,
|
||||
} else { fold::noop_fold_ty(original, fld) }
|
||||
}
|
||||
let afp = @{
|
||||
fold_ty: fold::wrap(|a,b| fold_ty_rep(j, i, newty.node, a, b, tm) )
|
||||
with *fold::default_ast_fold()
|
||||
fold_ty: fold::wrap(|a,b| fold_ty_rep(j, i, newty.node, a, b, tm) ),
|
||||
.. *fold::default_ast_fold()
|
||||
};
|
||||
let af = fold::make_fold(afp);
|
||||
let crate2: @ast::crate = @af.fold_crate(crate);
|
||||
@ -452,8 +452,8 @@ fn has_raw_pointers(c: ast::crate) -> bool {
|
||||
}
|
||||
}
|
||||
let v =
|
||||
visit::mk_simple_visitor(@{visit_ty: |a| visit_ty(has_rp, a)
|
||||
with *visit::default_simple_visitor()});
|
||||
visit::mk_simple_visitor(@{visit_ty: |a| visit_ty(has_rp, a),
|
||||
.. *visit::default_simple_visitor()});
|
||||
visit::visit_crate(c, (), v);
|
||||
return *has_rp;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ priv impl TaskBuilder {
|
||||
fail ~"Cannot copy a task_builder"; // Fake move mode on self
|
||||
}
|
||||
self.consumed = true;
|
||||
TaskBuilder({ can_not_copy: None, mut consumed: false, with *self })
|
||||
TaskBuilder({ can_not_copy: None, mut consumed: false,.. *self })
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,9 +258,9 @@ impl TaskBuilder {
|
||||
*/
|
||||
fn unlinked() -> TaskBuilder {
|
||||
TaskBuilder({
|
||||
opts: { linked: false with self.opts },
|
||||
opts: { linked: false,.. self.opts },
|
||||
can_not_copy: None,
|
||||
with *self.consume()
|
||||
.. *self.consume()
|
||||
})
|
||||
}
|
||||
/**
|
||||
@ -270,9 +270,9 @@ impl TaskBuilder {
|
||||
*/
|
||||
fn supervised() -> TaskBuilder {
|
||||
TaskBuilder({
|
||||
opts: { linked: false, supervised: true with self.opts },
|
||||
opts: { linked: false, supervised: true,.. self.opts },
|
||||
can_not_copy: None,
|
||||
with *self.consume()
|
||||
.. *self.consume()
|
||||
})
|
||||
}
|
||||
/**
|
||||
@ -281,9 +281,9 @@ impl TaskBuilder {
|
||||
*/
|
||||
fn linked() -> TaskBuilder {
|
||||
TaskBuilder({
|
||||
opts: { linked: true, supervised: false with self.opts },
|
||||
opts: { linked: true, supervised: false,.. self.opts },
|
||||
can_not_copy: None,
|
||||
with *self.consume()
|
||||
.. *self.consume()
|
||||
})
|
||||
}
|
||||
|
||||
@ -326,18 +326,18 @@ impl TaskBuilder {
|
||||
|
||||
// Reconfigure self to use a notify channel.
|
||||
TaskBuilder({
|
||||
opts: { notify_chan: Some(ch) with self.opts },
|
||||
opts: { notify_chan: Some(ch),.. self.opts },
|
||||
can_not_copy: None,
|
||||
with *self.consume()
|
||||
.. *self.consume()
|
||||
})
|
||||
}
|
||||
/// Configure a custom scheduler mode for the task.
|
||||
fn sched_mode(mode: SchedMode) -> TaskBuilder {
|
||||
TaskBuilder({
|
||||
opts: { sched: Some({ mode: mode, foreign_stack_size: None})
|
||||
with self.opts },
|
||||
opts: { sched: Some({ mode: mode, foreign_stack_size: None}),
|
||||
.. self.opts },
|
||||
can_not_copy: None,
|
||||
with *self.consume()
|
||||
.. *self.consume()
|
||||
})
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ impl TaskBuilder {
|
||||
TaskBuilder({
|
||||
gen_body: |body| { wrapper(prev_gen_body(body)) },
|
||||
can_not_copy: None,
|
||||
with *self.consume()
|
||||
.. *self.consume()
|
||||
})
|
||||
}
|
||||
|
||||
@ -1560,8 +1560,8 @@ fn test_spawn_raw_simple() {
|
||||
#[ignore(cfg(windows))]
|
||||
fn test_spawn_raw_unsupervise() {
|
||||
let opts = {
|
||||
linked: false
|
||||
with default_task_opts()
|
||||
linked: false,
|
||||
.. default_task_opts()
|
||||
};
|
||||
do spawn_raw(opts) {
|
||||
fail;
|
||||
@ -1623,9 +1623,9 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails
|
||||
// they don't make sense (redundant with task().supervised()).
|
||||
let b0 = task();
|
||||
let b1 = TaskBuilder({
|
||||
opts: { linked: true, supervised: true with b0.opts },
|
||||
opts: { linked: true, supervised: true,.. b0.opts },
|
||||
can_not_copy: None,
|
||||
with *b0
|
||||
.. *b0
|
||||
});
|
||||
do b1.spawn { fail; }
|
||||
comm::recv(po); // We should get punted awake
|
||||
@ -1636,9 +1636,9 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails
|
||||
// they don't make sense (redundant with task().supervised()).
|
||||
let b0 = task();
|
||||
let b1 = TaskBuilder({
|
||||
opts: { linked: true, supervised: true with b0.opts },
|
||||
opts: { linked: true, supervised: true,.. b0.opts },
|
||||
can_not_copy: None,
|
||||
with *b0
|
||||
.. *b0
|
||||
});
|
||||
do b1.spawn { loop { task::yield(); } }
|
||||
fail; // *both* mechanisms would be wrong if this didn't kill the child...
|
||||
@ -1724,8 +1724,8 @@ fn test_spawn_raw_notify() {
|
||||
let notify_ch = comm::Chan(notify_po);
|
||||
|
||||
let opts = {
|
||||
notify_chan: Some(notify_ch)
|
||||
with default_task_opts()
|
||||
notify_chan: Some(notify_ch),
|
||||
.. default_task_opts()
|
||||
};
|
||||
do spawn_raw(opts) {
|
||||
comm::send(task_ch, get_task());
|
||||
@ -1735,8 +1735,8 @@ fn test_spawn_raw_notify() {
|
||||
|
||||
let opts = {
|
||||
linked: false,
|
||||
notify_chan: Some(notify_ch)
|
||||
with default_task_opts()
|
||||
notify_chan: Some(notify_ch),
|
||||
.. default_task_opts()
|
||||
};
|
||||
do spawn_raw(opts) {
|
||||
comm::send(task_ch, get_task());
|
||||
@ -2042,7 +2042,7 @@ fn test_unkillable() {
|
||||
let ch = po.chan();
|
||||
|
||||
// We want to do this after failing
|
||||
do spawn_raw({ linked: false with default_task_opts() }) {
|
||||
do spawn_raw({ linked: false,.. default_task_opts() }) {
|
||||
for iter::repeat(10u) { yield() }
|
||||
ch.send(());
|
||||
}
|
||||
@ -2078,7 +2078,7 @@ fn test_unkillable_nested() {
|
||||
let ch = po.chan();
|
||||
|
||||
// We want to do this after failing
|
||||
do spawn_raw({ linked: false with default_task_opts() }) {
|
||||
do spawn_raw({ linked: false,.. default_task_opts() }) {
|
||||
for iter::repeat(10u) { yield() }
|
||||
ch.send(());
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ fn mk_ast_map_visitor() -> vt {
|
||||
visit_local: map_local,
|
||||
visit_arm: map_arm,
|
||||
visit_view_item: map_view_item,
|
||||
visit_block: map_block
|
||||
with *visit::default_visitor()
|
||||
visit_block: map_block,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,8 @@ fn expand(cx: ext_ctxt,
|
||||
}
|
||||
|
||||
fn filter_attrs(item: @ast::item) -> @ast::item {
|
||||
@{attrs: vec::filter(item.attrs, not_auto_serialize)
|
||||
with *item}
|
||||
@{attrs: vec::filter(item.attrs, not_auto_serialize),
|
||||
.. *item}
|
||||
}
|
||||
|
||||
do vec::flat_map(in_items) |in_item| {
|
||||
@ -281,8 +281,8 @@ impl ext_ctxt: ext_ctxt_helpers {
|
||||
|
||||
fn clone_folder() -> fold::ast_fold {
|
||||
fold::make_fold(@{
|
||||
new_id: |_id| self.next_id()
|
||||
with *fold::default_ast_fold()
|
||||
new_id: |_id| self.next_id(),
|
||||
.. *fold::default_ast_fold()
|
||||
})
|
||||
}
|
||||
|
||||
@ -311,8 +311,8 @@ impl ext_ctxt: ext_ctxt_helpers {
|
||||
}
|
||||
|
||||
let fld = fold::make_fold(@{
|
||||
new_span: |a| repl_sp(a, ast_util::dummy_sp(), span)
|
||||
with *fold::default_ast_fold()
|
||||
new_span: |a| repl_sp(a, ast_util::dummy_sp(), span),
|
||||
.. *fold::default_ast_fold()
|
||||
});
|
||||
|
||||
fld.fold_expr(expr)
|
||||
@ -799,8 +799,8 @@ fn mk_deser_fn(cx: ext_ctxt, span: span,
|
||||
vec::map(tps, |tp| {
|
||||
let cloned = cx.clone_ty_param(tp);
|
||||
{bounds: @(vec::append(*cloned.bounds,
|
||||
~[ast::bound_copy]))
|
||||
with cloned}
|
||||
~[ast::bound_copy])),
|
||||
.. cloned}
|
||||
}));
|
||||
|
||||
let deser_blk = cx.expr_blk(f(cx, tps_map, #ast[expr]{__d}));
|
||||
|
@ -160,7 +160,7 @@ fn expand_mod_items(exts: hashmap<~str, syntax_extension>, cx: ext_ctxt,
|
||||
}
|
||||
};
|
||||
|
||||
return {items: new_items with module_};
|
||||
return {items: new_items,.. module_};
|
||||
}
|
||||
|
||||
|
||||
@ -259,8 +259,8 @@ fn expand_crate(parse_sess: parse::parse_sess,
|
||||
@{fold_expr: |a,b,c| expand_expr(exts, cx, a, b, c, afp.fold_expr),
|
||||
fold_mod: |a,b| expand_mod_items(exts, cx, a, b, afp.fold_mod),
|
||||
fold_item: |a,b| expand_item(exts, cx, a, b, afp.fold_item),
|
||||
new_span: |a|new_span(cx, a)
|
||||
with *afp};
|
||||
new_span: |a|new_span(cx, a),
|
||||
.. *afp};
|
||||
let f = make_fold(f_pre);
|
||||
let cm = parse_expr_from_source_str(~"<core-macros>",
|
||||
@core_macros(),
|
||||
|
@ -35,13 +35,13 @@ trait append_types {
|
||||
|
||||
impl @ast::path: append_types {
|
||||
fn add_ty(ty: @ast::ty) -> @ast::path {
|
||||
@{types: vec::append_one(self.types, ty)
|
||||
with *self}
|
||||
@{types: vec::append_one(self.types, ty),
|
||||
.. *self}
|
||||
}
|
||||
|
||||
fn add_tys(+tys: ~[@ast::ty]) -> @ast::path {
|
||||
@{types: vec::append(self.types, tys)
|
||||
with *self}
|
||||
@{types: vec::append(self.types, tys),
|
||||
.. *self}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,8 @@ impl @ast::pat: qq_helper {
|
||||
fn gather_anti_quotes<N: qq_helper>(lo: uint, node: N) -> aq_ctxt
|
||||
{
|
||||
let v = @{visit_expr: |node, &&cx, v| visit_aq(node, ~"from_expr", cx, v),
|
||||
visit_ty: |node, &&cx, v| visit_aq(node, ~"from_ty", cx, v)
|
||||
with *default_visitor()};
|
||||
visit_ty: |node, &&cx, v| visit_aq(node, ~"from_ty", cx, v),
|
||||
.. *default_visitor()};
|
||||
let cx = @{lo:lo, gather: DVec()};
|
||||
node.visit(cx, mk_vt(v));
|
||||
// FIXME (#2250): Maybe this is an overkill (merge_sort), it might
|
||||
@ -301,8 +301,8 @@ fn replace<T>(node: T, repls: ~[fragment], ff: fn (ast_fold, T) -> T)
|
||||
let f_pre = @{fold_expr: |a,b,c|replace_expr(repls, a, b, c,
|
||||
aft.fold_expr),
|
||||
fold_ty: |a,b,c|replace_ty(repls, a, b, c,
|
||||
aft.fold_ty)
|
||||
with *aft};
|
||||
aft.fold_ty),
|
||||
.. *aft};
|
||||
return ff(make_fold(f_pre), node);
|
||||
}
|
||||
fn fold_crate(f: ast_fold, &&n: @ast::crate) -> @ast::crate {
|
||||
|
@ -196,8 +196,8 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
|
||||
map_exprs: |x,y|
|
||||
transcribe_exprs(cx, b, idx_path, x, y)
|
||||
,
|
||||
new_id: |x|new_id(x, cx)
|
||||
with *afp};
|
||||
new_id: |x|new_id(x, cx),
|
||||
.. *afp};
|
||||
let f = make_fold(f_pre);
|
||||
let result = f.fold_expr(body);
|
||||
return result;
|
||||
@ -246,8 +246,8 @@ fn free_vars(b: bindings, e: @expr, it: fn(ident)) {
|
||||
// using fold is a hack: we want visit, but it doesn't hit idents ) :
|
||||
// solve this with macros
|
||||
let f_pre =
|
||||
@{fold_ident: |x,y|mark_ident(x, y, b, idents)
|
||||
with *default_ast_fold()};
|
||||
@{fold_ident: |x,y|mark_ident(x, y, b, idents),
|
||||
.. *default_ast_fold()};
|
||||
let f = make_fold(f_pre);
|
||||
f.fold_expr(e); // ignore result
|
||||
for idents.each_key |x| { it(x); };
|
||||
|
@ -278,10 +278,10 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold)
|
||||
node: {
|
||||
body: fld.fold_block(constructor.node.body),
|
||||
dec: fold_fn_decl(constructor.node.dec, fld),
|
||||
id: fld.new_id(constructor.node.id)
|
||||
with constructor.node
|
||||
}
|
||||
with constructor
|
||||
id: fld.new_id(constructor.node.id),
|
||||
.. constructor.node
|
||||
},
|
||||
.. constructor
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -289,8 +289,8 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold)
|
||||
let dtor_body = fld.fold_block(dtor.node.body);
|
||||
let dtor_id = fld.new_id(dtor.node.id);
|
||||
{node: {body: dtor_body,
|
||||
id: dtor_id with dtor.node}
|
||||
with dtor}};
|
||||
id: dtor_id,.. dtor.node},
|
||||
.. dtor}};
|
||||
return @{
|
||||
traits: vec::map(struct_def.traits, |p| fold_trait_ref(p, fld)),
|
||||
fields: vec::map(struct_def.fields, |f| fold_struct_field(f, fld)),
|
||||
@ -467,14 +467,14 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||
expr_fn(proto, fold_fn_decl(decl, fld),
|
||||
fld.fold_block(body),
|
||||
@((*captures).map(|cap_item| {
|
||||
@({id: fld.new_id((*cap_item).id)
|
||||
with *cap_item})})))
|
||||
@({id: fld.new_id((*cap_item).id),
|
||||
.. *cap_item})})))
|
||||
}
|
||||
expr_fn_block(decl, body, captures) => {
|
||||
expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block(body),
|
||||
@((*captures).map(|cap_item| {
|
||||
@({id: fld.new_id((*cap_item).id)
|
||||
with *cap_item})})))
|
||||
@({id: fld.new_id((*cap_item).id),
|
||||
.. *cap_item})})))
|
||||
}
|
||||
expr_block(blk) => expr_block(fld.fold_block(blk)),
|
||||
expr_move(el, er) => {
|
||||
@ -575,8 +575,8 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ {
|
||||
let dtor_body = fld.fold_block(dtor.node.body);
|
||||
let dtor_id = fld.new_id(dtor.node.id);
|
||||
{node: {body: dtor_body,
|
||||
id: dtor_id with dtor.node}
|
||||
with dtor}};
|
||||
id: dtor_id,.. dtor.node},
|
||||
.. dtor}};
|
||||
kind = struct_variant_kind(@{
|
||||
traits: ~[],
|
||||
fields: vec::map(struct_def.fields,
|
||||
|
@ -776,7 +776,7 @@ struct parser {
|
||||
|
||||
return @{span: mk_sp(lo, tps.span.hi),
|
||||
rp: rp,
|
||||
types: tps.node with *path};
|
||||
types: tps.node,.. *path};
|
||||
}
|
||||
|
||||
fn parse_mutability() -> mutability {
|
||||
@ -1000,11 +1000,9 @@ struct parser {
|
||||
self.bump();
|
||||
let mut fields = ~[];
|
||||
vec::push(fields, self.parse_field(token::COLON));
|
||||
while self.token != token::RBRACE &&
|
||||
!self.is_keyword(~"with") {
|
||||
while self.token != token::RBRACE {
|
||||
self.expect(token::COMMA);
|
||||
if self.token == token::RBRACE ||
|
||||
self.is_keyword(~"with") ||
|
||||
self.token == token::DOTDOT {
|
||||
// Accept an optional trailing comma.
|
||||
break;
|
||||
@ -1013,7 +1011,7 @@ struct parser {
|
||||
}
|
||||
|
||||
let base;
|
||||
if self.eat_keyword(~"with") || self.eat(token::DOTDOT) {
|
||||
if self.eat(token::DOTDOT) {
|
||||
base = Some(self.parse_expr());
|
||||
} else {
|
||||
base = None;
|
||||
@ -1572,8 +1570,8 @@ struct parser {
|
||||
let last_arg = self.mk_expr(block.span.lo, block.span.hi,
|
||||
ctor(block));
|
||||
let args = vec::append(args, ~[last_arg]);
|
||||
@{node: expr_call(f, args, true)
|
||||
with *e}
|
||||
@{node: expr_call(f, args, true),
|
||||
.. *e}
|
||||
}
|
||||
expr_path(*) | expr_field(*) | expr_call(*) => {
|
||||
let block = self.parse_lambda_block_expr();
|
||||
@ -1661,18 +1659,6 @@ struct parser {
|
||||
base = Some(self.parse_expr()); break;
|
||||
}
|
||||
|
||||
// XXX: Remove "with" after all code is converted over and there's
|
||||
// a snapshot.
|
||||
|
||||
// optional comma before "with"
|
||||
if self.token == token::COMMA
|
||||
&& self.token_is_keyword(~"with",
|
||||
self.look_ahead(1u)) {
|
||||
self.bump();
|
||||
}
|
||||
if self.eat_keyword(~"with") {
|
||||
base = Some(self.parse_expr()); break;
|
||||
}
|
||||
self.expect(token::COMMA);
|
||||
if self.token == token::RBRACE {
|
||||
// record ends by an optional trailing comma
|
||||
@ -2230,7 +2216,7 @@ struct parser {
|
||||
token::SEMI => {
|
||||
self.bump();
|
||||
push(stmts,
|
||||
@{node: stmt_semi(e, stmt_id) with *stmt});
|
||||
@{node: stmt_semi(e, stmt_id),.. *stmt});
|
||||
}
|
||||
token::RBRACE => {
|
||||
expr = Some(e);
|
||||
@ -2741,8 +2727,8 @@ struct parser {
|
||||
let lo = self.last_span.lo;
|
||||
let (decl_, _) = self.parse_fn_decl(|p| p.parse_arg());
|
||||
let decl = {output: @{id: self.get_id(),
|
||||
node: result_ty, span: decl_.output.span}
|
||||
with decl_};
|
||||
node: result_ty, span: decl_.output.span},
|
||||
.. decl_};
|
||||
let body = self.parse_block();
|
||||
ctor_decl(decl, attrs, body, mk_sp(lo, self.last_span.hi))
|
||||
}
|
||||
|
@ -388,8 +388,7 @@ fn contextual_keyword_table() -> hashmap<~str, ()> {
|
||||
~"move",
|
||||
~"priv", ~"pub",
|
||||
~"self", ~"send", ~"static",
|
||||
~"use",
|
||||
~"with"
|
||||
~"use"
|
||||
];
|
||||
for keys.each |word| {
|
||||
words.insert(word, ());
|
||||
|
@ -26,8 +26,8 @@ fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
|
||||
let precursor =
|
||||
@{fold_mod: |a,b| fold_mod(ctxt, a, b),
|
||||
fold_block: fold::wrap(|a,b| fold_block(ctxt, a, b) ),
|
||||
fold_foreign_mod: |a,b| fold_foreign_mod(ctxt, a, b)
|
||||
with *fold::default_ast_fold()};
|
||||
fold_foreign_mod: |a,b| fold_foreign_mod(ctxt, a, b),
|
||||
.. *fold::default_ast_fold()};
|
||||
|
||||
let fold = fold::make_fold(precursor);
|
||||
let res = @fold.fold_crate(*crate);
|
||||
|
@ -44,6 +44,6 @@ fn inject_libcore_ref(sess: session,
|
||||
|
||||
let vis = vec::append(~[vi1, vi2], crate.node.module.view_items);
|
||||
|
||||
return @{node: {module: { view_items: vis with crate.node.module }
|
||||
with crate.node} with *crate }
|
||||
return @{node: {module: { view_items: vis,.. crate.node.module },
|
||||
.. crate.node},.. *crate }
|
||||
}
|
||||
|
@ -24,6 +24,6 @@ fn inject_intrinsic(sess: session,
|
||||
|
||||
let items = vec::append(~[item], crate.node.module.items);
|
||||
|
||||
return @{node: {module: { items: items with crate.node.module }
|
||||
with crate.node} with *crate }
|
||||
return @{node: {module: { items: items ,.. crate.node.module }
|
||||
,.. crate.node} ,.. *crate }
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ fn generate_test_harness(sess: session::session,
|
||||
let precursor =
|
||||
@{fold_crate: fold::wrap(|a,b| fold_crate(cx, a, b) ),
|
||||
fold_item: |a,b| fold_item(cx, a, b),
|
||||
fold_mod: |a,b| fold_mod(cx, a, b) with *fold::default_ast_fold()};
|
||||
fold_mod: |a,b| fold_mod(cx, a, b),.. *fold::default_ast_fold()};
|
||||
|
||||
let fold = fold::make_fold(precursor);
|
||||
let res = @fold.fold_crate(*crate);
|
||||
@ -92,7 +92,7 @@ fn fold_crate(cx: test_ctxt, c: ast::crate_, fld: fold::ast_fold) ->
|
||||
|
||||
// Add a special __test module to the crate that will contain code
|
||||
// generated for the test harness
|
||||
return {module: add_test_module(cx, folded.module) with folded};
|
||||
return {module: add_test_module(cx, folded.module),.. folded};
|
||||
}
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ fn should_fail(i: @ast::item) -> bool {
|
||||
|
||||
fn add_test_module(cx: test_ctxt, m: ast::_mod) -> ast::_mod {
|
||||
let testmod = mk_test_module(cx);
|
||||
return {items: vec::append_one(m.items, testmod) with m};
|
||||
return {items: vec::append_one(m.items, testmod),.. m};
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@ fn read_crates(diag: span_handler, crate: ast::crate,
|
||||
visit::mk_simple_visitor(@{visit_view_item:
|
||||
|a| visit_view_item(e, a),
|
||||
visit_item: |a| visit_item(e, a)
|
||||
with *visit::default_simple_visitor()});
|
||||
,.. *visit::default_simple_visitor()});
|
||||
visit::visit_crate(crate, (), v);
|
||||
dump_crates(e.crate_cache);
|
||||
warn_if_multiple_versions(e, diag, e.crate_cache.get());
|
||||
|
@ -858,7 +858,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::Writer,
|
||||
_ => fail ~"bad foreign item"
|
||||
}
|
||||
}
|
||||
with *visit::default_visitor()
|
||||
,.. *visit::default_visitor()
|
||||
}));
|
||||
ebml_w.end_tag();
|
||||
return *index;
|
||||
|
@ -294,7 +294,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
|
||||
match st.tcx.rcache.find({cnum: st.crate, pos: pos, len: len}) {
|
||||
Some(tt) => return tt,
|
||||
None => {
|
||||
let ps = @{pos: pos with *st};
|
||||
let ps = @{pos: pos ,.. *st};
|
||||
let tt = parse_ty(ps, conv);
|
||||
st.tcx.rcache.insert({cnum: st.crate, pos: pos, len: len}, tt);
|
||||
return tt;
|
||||
|
@ -247,13 +247,13 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
|
||||
ast::stmt_decl(@{node: ast::decl_item(_), span: _}, _) => false
|
||||
}
|
||||
};
|
||||
let blk_sans_items = { stmts: stmts_sans_items with blk };
|
||||
let blk_sans_items = { stmts: stmts_sans_items,.. blk };
|
||||
fold::noop_fold_block(blk_sans_items, fld)
|
||||
}
|
||||
|
||||
let fld = fold::make_fold(@{
|
||||
fold_block: fold::wrap(drop_nested_items)
|
||||
with *fold::default_ast_fold()
|
||||
fold_block: fold::wrap(drop_nested_items),
|
||||
.. *fold::default_ast_fold()
|
||||
});
|
||||
|
||||
match ii {
|
||||
@ -269,15 +269,15 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
|
||||
ast::ii_ctor(ctor, nm, tps, parent_id) => {
|
||||
let ctor_body = fld.fold_block(ctor.node.body);
|
||||
let ctor_decl = fold::fold_fn_decl(ctor.node.dec, fld);
|
||||
ast::ii_ctor({node: {body: ctor_body, dec: ctor_decl
|
||||
with ctor.node}
|
||||
with ctor}, nm, tps, parent_id)
|
||||
ast::ii_ctor({node: {body: ctor_body, dec: ctor_decl,
|
||||
.. ctor.node},
|
||||
.. ctor}, nm, tps, parent_id)
|
||||
}
|
||||
ast::ii_dtor(dtor, nm, tps, parent_id) => {
|
||||
let dtor_body = fld.fold_block(dtor.node.body);
|
||||
ast::ii_dtor({node: {body: dtor_body
|
||||
with dtor.node}
|
||||
with dtor}, nm, tps, parent_id)
|
||||
ast::ii_dtor({node: {body: dtor_body,
|
||||
.. dtor.node},
|
||||
.. dtor}, nm, tps, parent_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -292,8 +292,8 @@ fn renumber_ast(xcx: extended_decode_ctxt, ii: ast::inlined_item)
|
||||
-> ast::inlined_item {
|
||||
let fld = fold::make_fold(@{
|
||||
new_id: |a| xcx.tr_id(a),
|
||||
new_span: |a| xcx.tr_span(a)
|
||||
with *fold::default_ast_fold()
|
||||
new_span: |a| xcx.tr_span(a),
|
||||
.. *fold::default_ast_fold()
|
||||
});
|
||||
|
||||
match ii {
|
||||
@ -314,9 +314,9 @@ fn renumber_ast(xcx: extended_decode_ctxt, ii: ast::inlined_item)
|
||||
let ctor_id = fld.new_id(ctor.node.id);
|
||||
let new_parent = xcx.tr_def_id(parent_id);
|
||||
ast::ii_ctor({node: {body: ctor_body, attrs: ctor_attrs,
|
||||
dec: ctor_decl, id: ctor_id
|
||||
with ctor.node}
|
||||
with ctor}, nm, new_params, new_parent)
|
||||
dec: ctor_decl, id: ctor_id,
|
||||
.. ctor.node},
|
||||
.. ctor}, nm, new_params, new_parent)
|
||||
}
|
||||
ast::ii_dtor(dtor, nm, tps, parent_id) => {
|
||||
let dtor_body = fld.fold_block(dtor.node.body);
|
||||
@ -326,8 +326,8 @@ fn renumber_ast(xcx: extended_decode_ctxt, ii: ast::inlined_item)
|
||||
let new_parent = xcx.tr_def_id(parent_id);
|
||||
let new_self = fld.new_id(dtor.node.self_id);
|
||||
ast::ii_dtor({node: {id: dtor_id, attrs: dtor_attrs,
|
||||
self_id: new_self, body: dtor_body}
|
||||
with dtor},
|
||||
self_id: new_self, body: dtor_body},
|
||||
.. dtor},
|
||||
nm, new_params, new_parent)
|
||||
}
|
||||
}
|
||||
@ -432,7 +432,7 @@ impl method_origin: tr {
|
||||
typeck::method_static(did.tr(xcx))
|
||||
}
|
||||
typeck::method_param(mp) => {
|
||||
typeck::method_param({trait_id:mp.trait_id.tr(xcx) with mp})
|
||||
typeck::method_param({trait_id:mp.trait_id.tr(xcx),.. mp})
|
||||
}
|
||||
typeck::method_trait(did, m) => {
|
||||
typeck::method_trait(did.tr(xcx), m)
|
||||
|
@ -443,7 +443,7 @@ impl borrowck_ctxt {
|
||||
}
|
||||
|
||||
fn cat_discr(cmt: cmt, alt_id: ast::node_id) -> cmt {
|
||||
return @{cat:cat_discr(cmt, alt_id) with *cmt};
|
||||
return @{cat:cat_discr(cmt, alt_id),.. *cmt};
|
||||
}
|
||||
|
||||
fn cat_pattern(cmt: cmt, pat: @ast::pat, op: fn(cmt, @ast::pat)) {
|
||||
|
@ -67,8 +67,8 @@ fn check_loans(bccx: borrowck_ctxt,
|
||||
let vt = visit::mk_vt(@{visit_expr: check_loans_in_expr,
|
||||
visit_local: check_loans_in_local,
|
||||
visit_block: check_loans_in_block,
|
||||
visit_fn: check_loans_in_fn
|
||||
with *visit::default_visitor()});
|
||||
visit_fn: check_loans_in_fn,
|
||||
.. *visit::default_visitor()});
|
||||
visit::visit_crate(*crate, clcx, vt);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ fn gather_loans(bccx: borrowck_ctxt, crate: @ast::crate) -> req_maps {
|
||||
mut root_ub: 0});
|
||||
let v = visit::mk_vt(@{visit_expr: req_loans_in_expr,
|
||||
visit_fn: req_loans_in_fn,
|
||||
with *visit::default_visitor()});
|
||||
.. *visit::default_visitor()});
|
||||
visit::visit_crate(*crate, glcx, v);
|
||||
return glcx.req_maps;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ priv impl &preserve_ctxt {
|
||||
debug!("base.mutbl = %?", self.bccx.mut_to_str(base.mutbl));
|
||||
if base.mutbl == m_imm {
|
||||
let non_rooting_ctxt =
|
||||
preserve_ctxt({root_managed_data: false with **self});
|
||||
preserve_ctxt({root_managed_data: false,.. **self});
|
||||
match (&non_rooting_ctxt).preserve(base) {
|
||||
Ok(pc_ok) => {
|
||||
Ok(pc_ok)
|
||||
@ -232,8 +232,8 @@ priv impl &preserve_ctxt {
|
||||
// in the *arm* vs the *alt*.
|
||||
|
||||
let alt_rooting_ctxt =
|
||||
preserve_ctxt({scope_region: ty::re_scope(alt_id)
|
||||
with **self});
|
||||
preserve_ctxt({scope_region: ty::re_scope(alt_id),
|
||||
.. **self});
|
||||
(&alt_rooting_ctxt).preserve(base)
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ use std::map::hashmap;
|
||||
fn check_crate(tcx: ty::ctxt, crate: @crate) {
|
||||
visit::visit_crate(*crate, (), visit::mk_vt(@{
|
||||
visit_expr: |a,b,c| check_expr(tcx, a, b, c),
|
||||
visit_local: |a,b,c| check_local(tcx, a, b, c)
|
||||
with *visit::default_visitor::<()>()
|
||||
visit_local: |a,b,c| check_local(tcx, a, b, c),
|
||||
.. *visit::default_visitor::<()>()
|
||||
}));
|
||||
tcx.sess.abort_if_errors();
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ fn check_crate(sess: session, crate: @crate, ast_map: ast_map::map,
|
||||
visit_item: |a,b,c| check_item(sess, ast_map, def_map, a, b, c),
|
||||
visit_pat: check_pat,
|
||||
visit_expr: |a,b,c|
|
||||
check_expr(sess, def_map, method_map, tcx, a, b, c)
|
||||
with *visit::default_visitor()
|
||||
check_expr(sess, def_map, method_map, tcx, a, b, c),
|
||||
.. *visit::default_visitor()
|
||||
}));
|
||||
sess.abort_if_errors();
|
||||
}
|
||||
@ -163,8 +163,8 @@ fn check_item_recursion(sess: session, ast_map: ast_map::map,
|
||||
|
||||
let visitor = visit::mk_vt(@{
|
||||
visit_item: visit_item,
|
||||
visit_expr: visit_expr
|
||||
with *visit::default_visitor()
|
||||
visit_expr: visit_expr,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visitor.visit_item(it, env, visitor);
|
||||
|
||||
|
@ -13,10 +13,10 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
|
||||
match e.node {
|
||||
expr_while(e, b) => {
|
||||
v.visit_expr(e, cx, v);
|
||||
v.visit_block(b, {in_loop: true with cx}, v);
|
||||
v.visit_block(b, {in_loop: true,.. cx}, v);
|
||||
}
|
||||
expr_loop(b, _) => {
|
||||
v.visit_block(b, {in_loop: true with cx}, v);
|
||||
v.visit_block(b, {in_loop: true,.. cx}, v);
|
||||
}
|
||||
expr_fn(_, _, _, _) => {
|
||||
visit::visit_expr(e, {in_loop: false, can_ret: true}, v);
|
||||
@ -47,7 +47,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
|
||||
}
|
||||
_ => visit::visit_expr(e, cx, v)
|
||||
}
|
||||
}
|
||||
with *visit::default_visitor()
|
||||
},
|
||||
.. *visit::default_visitor()
|
||||
}));
|
||||
}
|
||||
|
@ -171,8 +171,8 @@ fn process_crate(crate: @ast::crate,
|
||||
def_map: resolve::DefMap,
|
||||
tcx: ty::ctxt) {
|
||||
let v = visit::mk_simple_visitor(@{
|
||||
visit_expr_post: |e| { classify(e, def_map, tcx); }
|
||||
with *visit::default_simple_visitor()
|
||||
visit_expr_post: |e| { classify(e, def_map, tcx); },
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, (), v);
|
||||
tcx.sess.abort_if_errors();
|
||||
|
@ -74,8 +74,8 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
|
||||
}
|
||||
};
|
||||
|
||||
let v = visit::mk_vt(@{visit_item: ignore_item, visit_expr: walk_expr
|
||||
with *visit::default_visitor()});
|
||||
let v = visit::mk_vt(@{visit_item: ignore_item, visit_expr: walk_expr,
|
||||
.. *visit::default_visitor()});
|
||||
v.visit_block(blk, 1, v);
|
||||
return @*refs;
|
||||
}
|
||||
@ -96,8 +96,8 @@ fn annotate_freevars(def_map: resolve::DefMap, crate: @ast::crate) ->
|
||||
};
|
||||
|
||||
let visitor =
|
||||
visit::mk_simple_visitor(@{visit_fn: walk_fn
|
||||
with *visit::default_simple_visitor()});
|
||||
visit::mk_simple_visitor(@{visit_fn: walk_fn,
|
||||
.. *visit::default_simple_visitor()});
|
||||
visit::visit_crate(*crate, (), visitor);
|
||||
|
||||
return freevars;
|
||||
|
@ -81,9 +81,9 @@ fn check_crate(tcx: ty::ctxt,
|
||||
visit_fn: check_fn,
|
||||
visit_ty: check_ty,
|
||||
visit_item: fn@(i: @item, cx: ctx, v: visit::vt<ctx>) {
|
||||
visit::visit_item(i, {current_item: i.id with cx}, v);
|
||||
}
|
||||
with *visit::default_visitor()
|
||||
visit::visit_item(i, {current_item: i.id,.. cx}, v);
|
||||
},
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, ctx, visit);
|
||||
tcx.sess.abort_if_errors();
|
||||
|
@ -165,8 +165,8 @@ struct LanguageItemCollector {
|
||||
.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
with *default_simple_visitor()
|
||||
},
|
||||
.. *default_simple_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ impl ctxt {
|
||||
new_ctxt =
|
||||
ctxt_({is_default: false,
|
||||
curr: c,
|
||||
with *new_ctxt});
|
||||
.. *new_ctxt});
|
||||
new_ctxt.set_level(lint.lint, level);
|
||||
}
|
||||
}
|
||||
@ -362,11 +362,11 @@ fn build_settings_crate(sess: session::session, crate: @ast::crate) {
|
||||
sess.lint_settings.default_settings.insert(k, v);
|
||||
}
|
||||
|
||||
let cx = ctxt_({is_default: true with *cx});
|
||||
let cx = ctxt_({is_default: true,.. *cx});
|
||||
|
||||
let visit = visit::mk_vt(@{
|
||||
visit_item: build_settings_item
|
||||
with *visit::default_visitor()
|
||||
visit_item: build_settings_item,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, cx, visit);
|
||||
}
|
||||
@ -387,7 +387,7 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
|
||||
// not traverse into subitems, since that is handled by the outer
|
||||
// lint visitor.
|
||||
fn item_stopping_visitor<E>(v: visit::vt<E>) -> visit::vt<E> {
|
||||
visit::mk_vt(@{visit_item: |_i, _e, _v| { } with **v})
|
||||
visit::mk_vt(@{visit_item: |_i, _e, _v| { },.. **v})
|
||||
}
|
||||
|
||||
fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {
|
||||
@ -407,8 +407,8 @@ fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
with *visit::default_simple_visitor()
|
||||
},
|
||||
.. *visit::default_simple_visitor()
|
||||
}));
|
||||
visit::visit_item(it, (), visit);
|
||||
}
|
||||
@ -519,8 +519,8 @@ fn check_item_heap(cx: ty::ctxt, it: @ast::item) {
|
||||
visit_expr: fn@(e: @ast::expr) {
|
||||
let ty = ty::expr_ty(cx, e);
|
||||
check_type(cx, e.id, it.id, e.span, ty);
|
||||
}
|
||||
with *visit::default_simple_visitor()
|
||||
},
|
||||
.. *visit::default_simple_visitor()
|
||||
}));
|
||||
visit::visit_item(it, (), visit);
|
||||
}
|
||||
@ -540,8 +540,8 @@ fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
with *visit::default_simple_visitor()
|
||||
},
|
||||
.. *visit::default_simple_visitor()
|
||||
}));
|
||||
visit::visit_item(it, (), visit);
|
||||
}
|
||||
@ -681,7 +681,7 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) {
|
||||
check_fn(tcx, fk, decl, body, span, id),
|
||||
visit_pat: |pat|
|
||||
check_pat(tcx, pat),
|
||||
with *visit::default_simple_visitor()
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, (), v);
|
||||
|
||||
|
@ -185,7 +185,7 @@ fn check_crate(tcx: ty::ctxt,
|
||||
visit_local: visit_local,
|
||||
visit_expr: visit_expr,
|
||||
visit_arm: visit_arm,
|
||||
with *visit::default_visitor()
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
|
||||
let last_use_map = int_hash();
|
||||
@ -457,7 +457,7 @@ fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
|
||||
visit_local: check_local,
|
||||
visit_expr: check_expr,
|
||||
visit_arm: check_arm,
|
||||
with *visit::default_visitor()
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
check_vt.visit_block(body, lsets, check_vt);
|
||||
lsets.check_ret(id, sp, fk, entry_ln);
|
||||
|
@ -67,8 +67,8 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) {
|
||||
}
|
||||
|
||||
visit::visit_expr(expr, env, visitor);
|
||||
}
|
||||
with *visit::default_visitor()
|
||||
},
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, (), visitor);
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ fn resolve_block(blk: ast::blk, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
record_parent(cx, blk.node.id);
|
||||
|
||||
// Descend.
|
||||
let new_cx: ctxt = ctxt {parent: Some(blk.node.id) with cx};
|
||||
let new_cx: ctxt = ctxt {parent: Some(blk.node.id),.. cx};
|
||||
visit::visit_block(blk, new_cx, visitor);
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ fn resolve_local(local: @ast::local, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
|
||||
fn resolve_item(item: @ast::item, cx: ctxt, visitor: visit::vt<ctxt>) {
|
||||
// Items create a new outer block scope as far as we're concerned.
|
||||
let new_cx: ctxt = ctxt {parent: None with cx};
|
||||
let new_cx: ctxt = ctxt {parent: None,.. cx};
|
||||
visit::visit_item(item, new_cx, visitor);
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ fn resolve_fn(fk: visit::fn_kind, decl: ast::fn_decl, body: ast::blk,
|
||||
visit::fk_item_fn(*) | visit::fk_method(*) |
|
||||
visit::fk_ctor(*) | visit::fk_dtor(*) => {
|
||||
// Top-level functions are a root scope.
|
||||
ctxt {parent: Some(id) with cx}
|
||||
ctxt {parent: Some(id),.. cx}
|
||||
}
|
||||
|
||||
visit::fk_anon(*) | visit::fk_fn_block(*) => {
|
||||
@ -340,8 +340,8 @@ fn resolve_crate(sess: session, def_map: resolve::DefMap,
|
||||
visit_pat: resolve_pat,
|
||||
visit_stmt: resolve_stmt,
|
||||
visit_expr: resolve_expr,
|
||||
visit_local: resolve_local
|
||||
with *visit::default_visitor()
|
||||
visit_local: resolve_local,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, cx, visitor);
|
||||
return cx.region_map;
|
||||
@ -771,7 +771,7 @@ fn determine_rp_in_crate(sess: session,
|
||||
visit_ty: determine_rp_in_ty,
|
||||
visit_ty_method: determine_rp_in_ty_method,
|
||||
visit_struct_field: determine_rp_in_struct_field,
|
||||
with *visit::default_visitor()
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, cx, visitor);
|
||||
|
||||
|
@ -777,9 +777,9 @@ struct Resolver {
|
||||
visit_block: |block, context, visitor|
|
||||
(*this).build_reduced_graph_for_block(block,
|
||||
context,
|
||||
visitor)
|
||||
visitor),
|
||||
|
||||
with *default_visitor()
|
||||
.. *default_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
@ -3025,8 +3025,8 @@ struct Resolver {
|
||||
visit_local: |local, _context, visitor|
|
||||
self.resolve_local(local, visitor),
|
||||
visit_ty: |ty, _context, visitor|
|
||||
self.resolve_type(ty, visitor)
|
||||
with *default_visitor()
|
||||
self.resolve_type(ty, visitor),
|
||||
.. *default_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -140,8 +140,8 @@ fn expand_nested_bindings(bcx: block, m: match_, col: uint, val: ValueRef)
|
||||
mode: mode,
|
||||
ty: node_id_type(bcx,
|
||||
br.pats[col].id)
|
||||
}}])
|
||||
with *br});
|
||||
}}]),
|
||||
.. *br});
|
||||
}
|
||||
_ => vec::push(result, br)
|
||||
}
|
||||
@ -174,7 +174,7 @@ fn enter_match(bcx: block, dm: DefMap, m: match_, col: uint, val: ValueRef,
|
||||
}
|
||||
_ => br.bound
|
||||
};
|
||||
vec::push(result, @{pats: pats, bound: bound with *br});
|
||||
vec::push(result, @{pats: pats, bound: bound,.. *br});
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
|
@ -2841,7 +2841,7 @@ fn trans_lval(cx: block, e: @ast::expr) -> lval_result {
|
||||
let root_loc = alloca_zeroed(lv.bcx, type_of(cx.ccx(), ty));
|
||||
let bcx = store_temp_expr(lv.bcx, INIT, root_loc, lv, ty, false);
|
||||
add_root_cleanup(bcx, scope_id, root_loc, ty);
|
||||
{bcx: bcx with lv}
|
||||
{bcx: bcx,.. lv}
|
||||
}
|
||||
};
|
||||
|
||||
@ -3335,7 +3335,7 @@ fn body_contains_ret(body: ast::blk) -> bool {
|
||||
_ => visit::visit_expr(e, cx, v),
|
||||
}
|
||||
}
|
||||
} with *visit::default_visitor()
|
||||
} ,.. *visit::default_visitor()
|
||||
}));
|
||||
cx.found
|
||||
}
|
||||
@ -4883,7 +4883,7 @@ fn copy_args_to_allocas(fcx: fn_ctxt, bcx: block, args: ~[ast::arg],
|
||||
if slf.is_owned {
|
||||
let self_val = PointerCast(bcx, slf.v,
|
||||
T_ptr(type_of(bcx.ccx(), slf.t)));
|
||||
fcx.llself = Some({v: self_val with slf});
|
||||
fcx.llself = Some({v: self_val,.. slf});
|
||||
add_clean(bcx, self_val, slf.t);
|
||||
}
|
||||
}
|
||||
@ -5667,8 +5667,8 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
|
||||
|
||||
fn trans_constants(ccx: @crate_ctxt, crate: @ast::crate) {
|
||||
visit::visit_crate(*crate, (), visit::mk_simple_visitor(@{
|
||||
visit_item: |a| trans_constant(ccx, a)
|
||||
with *visit::default_simple_visitor()
|
||||
visit_item: |a| trans_constant(ccx, a),
|
||||
.. *visit::default_simple_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
@ -5775,8 +5775,8 @@ fn gather_local_rtcalls(ccx: @crate_ctxt, crate: @ast::crate) {
|
||||
}
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
with *visit::default_simple_visitor()
|
||||
},
|
||||
.. *visit::default_simple_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -120,8 +120,8 @@ fn trans_method_callee(bcx: block, callee_id: ast::node_id,
|
||||
|
||||
let {bcx, val} = trans_self_arg(bcx, self, mentry);
|
||||
{env: self_env(val, node_id_type(bcx, self.id), None,
|
||||
mentry.self_mode)
|
||||
with lval_static_fn(bcx, did, callee_id)}
|
||||
mentry.self_mode),
|
||||
.. lval_static_fn(bcx, did, callee_id)}
|
||||
}
|
||||
typeck::method_param({trait_id:trait_id, method_num:off,
|
||||
param_num:p, bound_num:b}) => {
|
||||
@ -186,8 +186,8 @@ fn trans_static_method_callee(bcx: block, method_id: ast::def_id,
|
||||
Some(sub_origins));
|
||||
{env: null_env,
|
||||
val: PointerCast(bcx, lval.val, T_ptr(type_of_fn_from_ty(
|
||||
ccx, node_id_type(bcx, callee_id))))
|
||||
with lval}
|
||||
ccx, node_id_type(bcx, callee_id)))),
|
||||
.. lval}
|
||||
}
|
||||
_ => {
|
||||
fail ~"vtable_param left in monomorphized function's vtable substs";
|
||||
@ -255,8 +255,8 @@ fn trans_monomorphized_callee(bcx: block, callee_id: ast::node_id,
|
||||
{env: self_env(val, node_id_type(bcx, base.id),
|
||||
None, mentry.self_mode),
|
||||
val: PointerCast(bcx, lval.val, T_ptr(type_of_fn_from_ty(
|
||||
ccx, node_id_type(bcx, callee_id))))
|
||||
with lval}
|
||||
ccx, node_id_type(bcx, callee_id)))),
|
||||
.. lval}
|
||||
}
|
||||
typeck::vtable_trait(*) => {
|
||||
let {bcx, val} = trans_temp_expr(bcx, base);
|
||||
|
@ -144,7 +144,7 @@ fn traverse_public_item(cx: ctx, item: @item) {
|
||||
}
|
||||
|
||||
fn mk_ty_visitor() -> visit::vt<ctx> {
|
||||
visit::mk_vt(@{visit_ty: traverse_ty with *visit::default_visitor()})
|
||||
visit::mk_vt(@{visit_ty: traverse_ty,.. *visit::default_visitor()})
|
||||
}
|
||||
|
||||
fn traverse_ty(ty: @ty, cx: ctx, v: visit::vt<ctx>) {
|
||||
@ -199,8 +199,8 @@ fn traverse_inline_body(cx: ctx, body: blk) {
|
||||
}
|
||||
visit::visit_block(body, cx, visit::mk_vt(@{
|
||||
visit_expr: traverse_expr,
|
||||
visit_item: traverse_item
|
||||
with *visit::default_visitor()
|
||||
visit_item: traverse_item,
|
||||
.. *visit::default_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
@ -218,8 +218,8 @@ fn traverse_all_resources_and_impls(cx: ctx, crate_mod: _mod) {
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
with *visit::default_visitor()
|
||||
},
|
||||
.. *visit::default_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -287,8 +287,8 @@ fn handle_body(cx: ctx, body: blk) {
|
||||
node_type_needs(cx, use_repr, e.id);
|
||||
}
|
||||
},
|
||||
visit_item: |_i, _cx, _v| { }
|
||||
with *visit::default_visitor()
|
||||
visit_item: |_i, _cx, _v| { },
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
v.visit_block(body, cx, v);
|
||||
}
|
||||
|
@ -1011,7 +1011,7 @@ fn fold_sty(sty: &sty, fldop: fn(t) -> t) -> sty {
|
||||
{mode: a.mode, ty: new_ty}
|
||||
});
|
||||
let new_output = fldop(f.output);
|
||||
ty_fn({inputs: new_args, output: new_output with *f})
|
||||
ty_fn({inputs: new_args, output: new_output,.. *f})
|
||||
}
|
||||
ty_rptr(r, tm) => {
|
||||
ty_rptr(r, {ty: fldop(tm.ty), mutbl: tm.mutbl})
|
||||
@ -1110,7 +1110,7 @@ fn fold_regions_and_ty(
|
||||
ty::mk_fn(cx, {
|
||||
inputs: new_args,
|
||||
output: new_output,
|
||||
proto: new_proto with f
|
||||
proto: new_proto,.. f
|
||||
})
|
||||
}
|
||||
ref sty => {
|
||||
@ -2915,7 +2915,7 @@ fn substd_enum_variants(cx: ctxt,
|
||||
|
||||
let substd_ctor_ty = subst(cx, substs, variant_info.ctor_ty);
|
||||
|
||||
@{args: substd_args, ctor_ty: substd_ctor_ty with *variant_info}
|
||||
@{args: substd_args, ctor_ty: substd_ctor_ty,.. *variant_info}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,8 +188,8 @@ impl isr_alist: get_and_find_region {
|
||||
|
||||
fn check_item_types(ccx: @crate_ctxt, crate: @ast::crate) {
|
||||
let visit = visit::mk_simple_visitor(@{
|
||||
visit_item: |a| check_item(ccx, a)
|
||||
with *visit::default_simple_visitor()
|
||||
visit_item: |a| check_item(ccx, a),
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, (), visit);
|
||||
}
|
||||
@ -286,7 +286,7 @@ fn check_fn(ccx: @crate_ctxt,
|
||||
let ty = method::transform_self_type_for_method(
|
||||
fcx.tcx(), self_region,
|
||||
info.self_ty, info.explicit_self.node);
|
||||
Some({self_ty: ty with info})
|
||||
Some({self_ty: ty,.. info})
|
||||
}
|
||||
};
|
||||
|
||||
@ -405,8 +405,8 @@ fn check_fn(ccx: @crate_ctxt,
|
||||
visit_pat: visit_pat,
|
||||
visit_fn: visit_fn,
|
||||
visit_item: visit_item,
|
||||
visit_block: visit_block
|
||||
with *visit::default_visitor()});
|
||||
visit_block: visit_block,
|
||||
.. *visit::default_visitor()});
|
||||
|
||||
visit.visit_block(body, (), visit);
|
||||
}
|
||||
@ -1649,7 +1649,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||
fcx.infcx().ty_to_str(fty.output)));
|
||||
}
|
||||
}
|
||||
ty::mk_fn(tcx, {output: ty::mk_nil(tcx) with fty})
|
||||
ty::mk_fn(tcx, {output: ty::mk_nil(tcx),.. fty})
|
||||
}
|
||||
_ => {
|
||||
tcx.sess.span_fatal(expr.span, ~"a `loop` function's last \
|
||||
@ -1672,8 +1672,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||
fcx, expr.span, fcx.node_ty(b.id));
|
||||
match ty::get(block_ty).struct {
|
||||
ty::ty_fn(fty) => {
|
||||
fcx.write_ty(expr.id, ty::mk_fn(tcx, {output: ty::mk_bool(tcx)
|
||||
with fty}));
|
||||
fcx.write_ty(expr.id, ty::mk_fn(tcx, {output: ty::mk_bool(tcx),
|
||||
.. fty}));
|
||||
}
|
||||
_ => fail ~"expected fn type"
|
||||
}
|
||||
@ -2113,8 +2113,8 @@ fn check_block_no_value(fcx: @fn_ctxt, blk: ast::blk) -> bool {
|
||||
|
||||
fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool {
|
||||
let fcx = match blk.node.rules {
|
||||
ast::unchecked_blk => @fn_ctxt {purity: ast::impure_fn with *fcx0},
|
||||
ast::unsafe_blk => @fn_ctxt {purity: ast::unsafe_fn with *fcx0},
|
||||
ast::unchecked_blk => @fn_ctxt {purity: ast::impure_fn,.. *fcx0},
|
||||
ast::unsafe_blk => @fn_ctxt {purity: ast::unsafe_fn,.. *fcx0},
|
||||
ast::default_blk => fcx0
|
||||
};
|
||||
do fcx.with_region_lb(blk.node.id) {
|
||||
|
@ -324,8 +324,8 @@ struct lookup {
|
||||
// (where the self type is not permitted), or from a trait
|
||||
// type (in which case methods that refer to self are not
|
||||
// permitted).
|
||||
let substs = {self_ty: Some(self.self_ty)
|
||||
with bound_substs};
|
||||
let substs = {self_ty: Some(self.self_ty),
|
||||
.. bound_substs};
|
||||
|
||||
self.add_candidates_from_m(
|
||||
inner_ty,
|
||||
@ -371,8 +371,8 @@ struct lookup {
|
||||
// Note: although it is illegal to invoke a method that uses self
|
||||
// through a trait instance, we use a dummy subst here so that we
|
||||
// can soldier on with the compilation.
|
||||
let substs = {self_ty: Some(self.self_ty)
|
||||
with trait_substs};
|
||||
let substs = {self_ty: Some(self.self_ty),
|
||||
.. trait_substs};
|
||||
|
||||
self.add_candidates_from_m(
|
||||
inner_ty, mode, substs, m, method_trait(did, i));
|
||||
@ -411,7 +411,7 @@ struct lookup {
|
||||
match ty::get(ty::lookup_item_type(self.tcx(), did).ty).struct {
|
||||
ty::ty_fn(fty) => {
|
||||
ty::mk_fn(self.tcx(),
|
||||
{proto: ty::proto_vstore(ty::vstore_box) with fty})
|
||||
{proto: ty::proto_vstore(ty::vstore_box),.. fty})
|
||||
}
|
||||
_ => fail ~"ty_from_did: not function ty"
|
||||
}
|
||||
@ -534,7 +534,7 @@ struct lookup {
|
||||
}
|
||||
Some(_) => self_substs.self_r
|
||||
};
|
||||
let self_substs = {self_r: self_r with self_substs};
|
||||
let self_substs = {self_r: self_r,.. self_substs};
|
||||
|
||||
// Before we can be sure we succeeded we need to match the
|
||||
// self type against the impl type that we get when we apply
|
||||
@ -551,8 +551,8 @@ struct lookup {
|
||||
|
||||
// a bit hokey, but the method unbound has a bare protocol, whereas
|
||||
// a.b has a protocol like fn@() (perhaps eventually fn&()):
|
||||
let fty = ty::mk_fn(tcx, {proto: ty::proto_vstore(ty::vstore_box)
|
||||
with m.fty});
|
||||
let fty = ty::mk_fn(tcx, {proto: ty::proto_vstore(ty::vstore_box),
|
||||
.. m.fty});
|
||||
|
||||
self.candidates.push(
|
||||
{self_ty: self.self_ty,
|
||||
@ -689,8 +689,8 @@ struct lookup {
|
||||
}
|
||||
};
|
||||
|
||||
let all_substs = {tps: vec::append(cand.self_substs.tps, m_substs)
|
||||
with cand.self_substs};
|
||||
let all_substs = {tps: vec::append(cand.self_substs.tps, m_substs),
|
||||
.. cand.self_substs};
|
||||
|
||||
self.fcx.write_ty_substs(self.node_id, cand.fty, all_substs);
|
||||
|
||||
|
@ -112,8 +112,8 @@ fn regionck_visitor() -> rvt {
|
||||
visit_stmt: visit_stmt,
|
||||
visit_expr: visit_expr,
|
||||
visit_block: visit_block,
|
||||
visit_local: visit_local
|
||||
with *visit::default_visitor()})
|
||||
visit_local: visit_local,
|
||||
.. *visit::default_visitor()})
|
||||
}
|
||||
|
||||
fn visit_item(_item: @ast::item, &&_rcx: @rcx, _v: rvt) {
|
||||
|
@ -16,7 +16,7 @@ fn replace_bound_regions_in_fn_ty(
|
||||
// Take self_info apart; the self_ty part is the only one we want
|
||||
// to update here.
|
||||
let (self_ty, rebuild_self_info) = match self_info {
|
||||
Some(s) => (Some(s.self_ty), |t| Some({self_ty: t with s})),
|
||||
Some(s) => (Some(s.self_ty), |t| Some({self_ty: t,.. s})),
|
||||
None => (None, |_t| None)
|
||||
};
|
||||
|
||||
|
@ -464,8 +464,8 @@ fn resolve_in_block(fcx: @fn_ctxt, bl: ast::blk) {
|
||||
visit::visit_block(bl, fcx, visit::mk_vt(@{
|
||||
visit_expr: resolve_expr,
|
||||
visit_item: fn@(_i: @ast::item, &&_e: @fn_ctxt,
|
||||
_v: visit::vt<@fn_ctxt>) {}
|
||||
with *visit::default_visitor()
|
||||
_v: visit::vt<@fn_ctxt>) {},
|
||||
.. *visit::default_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -185,8 +185,8 @@ fn mk_visitor() -> visit::vt<wb_ctxt> {
|
||||
visit_expr: visit_expr,
|
||||
visit_block: visit_block,
|
||||
visit_pat: visit_pat,
|
||||
visit_local: visit_local
|
||||
with *visit::default_visitor()})
|
||||
visit_local: visit_local,
|
||||
.. *visit::default_visitor()})
|
||||
}
|
||||
|
||||
fn resolve_type_vars_in_expr(fcx: @fn_ctxt, e: @ast::expr) -> bool {
|
||||
|
@ -212,8 +212,8 @@ struct CoherenceChecker {
|
||||
// Nothing to do.
|
||||
}
|
||||
};
|
||||
}
|
||||
with *default_simple_visitor()
|
||||
},
|
||||
.. *default_simple_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
@ -237,8 +237,8 @@ struct CoherenceChecker {
|
||||
// Nothing to do.
|
||||
}
|
||||
};
|
||||
}
|
||||
with *default_simple_visitor()
|
||||
},
|
||||
.. *default_simple_visitor()
|
||||
}));
|
||||
|
||||
// Check trait coherence.
|
||||
@ -501,8 +501,8 @@ struct CoherenceChecker {
|
||||
visit_item(item, (), visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
with *default_visitor()
|
||||
},
|
||||
.. *default_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -66,8 +66,8 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) {
|
||||
|
||||
visit::visit_crate(*crate, (), visit::mk_simple_visitor(@{
|
||||
visit_item: |a|convert(ccx, a),
|
||||
visit_foreign_item: |a|convert_foreign(ccx, a)
|
||||
with *visit::default_simple_visitor()
|
||||
visit_foreign_item: |a|convert_foreign(ccx, a),
|
||||
.. *visit::default_simple_visitor()
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ trait lattice_ops {
|
||||
impl Lub: lattice_ops {
|
||||
fn bnd(b: bounds<ty::t>) -> Option<ty::t> { b.ub }
|
||||
fn with_bnd(b: bounds<ty::t>, t: ty::t) -> bounds<ty::t> {
|
||||
{ub: Some(t) with b}
|
||||
{ub: Some(t),.. b}
|
||||
}
|
||||
fn ty_bot(t: ty::t) -> cres<ty::t> {
|
||||
Ok(t)
|
||||
@ -27,7 +27,7 @@ impl Lub: lattice_ops {
|
||||
impl Glb: lattice_ops {
|
||||
fn bnd(b: bounds<ty::t>) -> Option<ty::t> { b.lb }
|
||||
fn with_bnd(b: bounds<ty::t>, t: ty::t) -> bounds<ty::t> {
|
||||
{lb: Some(t) with b}
|
||||
{lb: Some(t),.. b}
|
||||
}
|
||||
fn ty_bot(_t: ty::t) -> cres<ty::t> {
|
||||
Ok(ty::mk_bot(self.infcx.tcx))
|
||||
|
@ -15,14 +15,14 @@ impl Sub: combine {
|
||||
|
||||
fn contratys(a: ty::t, b: ty::t) -> cres<ty::t> {
|
||||
let opp = combine_fields {
|
||||
a_is_expected: !self.a_is_expected, with *self
|
||||
a_is_expected: !self.a_is_expected,.. *self
|
||||
};
|
||||
Sub(opp).tys(b, a)
|
||||
}
|
||||
|
||||
fn contraregions(a: ty::region, b: ty::region) -> cres<ty::region> {
|
||||
let opp = combine_fields {
|
||||
a_is_expected: !self.a_is_expected, with *self
|
||||
a_is_expected: !self.a_is_expected,.. *self
|
||||
};
|
||||
Sub(opp).regions(b, a)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ fn loop_query(b: ast::blk, p: fn@(ast::expr_) -> bool) -> bool {
|
||||
}
|
||||
};
|
||||
let v = visit::mk_vt(@{visit_expr: visit_expr
|
||||
with *visit::default_visitor()});
|
||||
,.. *visit::default_visitor()});
|
||||
visit::visit_block(b, rs, v);
|
||||
return *rs;
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ fn run(
|
||||
fold_item: fold_item,
|
||||
fold_enum: fold_enum,
|
||||
fold_trait: fold_trait,
|
||||
fold_impl: fold_impl
|
||||
with *fold::default_any_fold(srv)
|
||||
fold_impl: fold_impl,
|
||||
.. *fold::default_any_fold(srv)
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -52,10 +52,10 @@ fn fold_crate(
|
||||
{
|
||||
topmod: doc::moddoc_({
|
||||
item: {
|
||||
name: option::get_default(attrs.name, doc.topmod.name())
|
||||
with doc.topmod.item
|
||||
}
|
||||
with *doc.topmod
|
||||
name: option::get_default(attrs.name, doc.topmod.name()),
|
||||
.. doc.topmod.item
|
||||
},
|
||||
.. *doc.topmod
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -84,8 +84,8 @@ fn fold_item(
|
||||
};
|
||||
|
||||
{
|
||||
desc: desc
|
||||
with doc
|
||||
desc: desc,
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,11 +162,11 @@ fn fold_enum(
|
||||
};
|
||||
|
||||
{
|
||||
desc: desc
|
||||
with variant
|
||||
desc: desc,
|
||||
.. variant
|
||||
}
|
||||
}
|
||||
with doc
|
||||
},
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,8 +191,8 @@ fn fold_trait(
|
||||
let doc = fold::default_seq_fold_trait(fold, doc);
|
||||
|
||||
{
|
||||
methods: merge_method_attrs(srv, doc.id(), doc.methods)
|
||||
with doc
|
||||
methods: merge_method_attrs(srv, doc.id(), doc.methods),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,8 +235,8 @@ fn merge_method_attrs(
|
||||
let desc = attrs.second();
|
||||
|
||||
{
|
||||
desc: desc
|
||||
with doc
|
||||
desc: desc,
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -266,8 +266,8 @@ fn fold_impl(
|
||||
let doc = fold::default_seq_fold_impl(fold, doc);
|
||||
|
||||
{
|
||||
methods: merge_method_attrs(srv, doc.id(), doc.methods)
|
||||
with doc
|
||||
methods: merge_method_attrs(srv, doc.id(), doc.methods),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,8 @@ fn config_from_opts(
|
||||
let output_dir = getopts::opt_maybe_str(matches, opt_output_dir());
|
||||
let output_dir = option::map(output_dir, |s| Path(s));
|
||||
result::Ok({
|
||||
output_dir: option::get_default(output_dir, config.output_dir)
|
||||
with config
|
||||
output_dir: option::get_default(output_dir, config.output_dir),
|
||||
.. config
|
||||
})
|
||||
};
|
||||
let result = do result::chain(result) |config| {
|
||||
@ -154,8 +154,8 @@ fn config_from_opts(
|
||||
|output_format| {
|
||||
|
||||
result::Ok({
|
||||
output_format: output_format
|
||||
with config
|
||||
output_format: output_format,
|
||||
.. config
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -168,8 +168,8 @@ fn config_from_opts(
|
||||
do result::chain(parse_output_style(output_style))
|
||||
|output_style| {
|
||||
result::Ok({
|
||||
output_style: output_style
|
||||
with config
|
||||
output_style: output_style,
|
||||
.. config
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -180,8 +180,8 @@ fn config_from_opts(
|
||||
config, pandoc_cmd, program_output);
|
||||
do result::chain(pandoc_cmd) |pandoc_cmd| {
|
||||
result::Ok({
|
||||
pandoc_cmd: pandoc_cmd
|
||||
with config
|
||||
pandoc_cmd: pandoc_cmd,
|
||||
.. config
|
||||
})
|
||||
}
|
||||
};
|
||||
@ -241,8 +241,8 @@ fn maybe_find_pandoc(
|
||||
#[test]
|
||||
fn should_find_pandoc() {
|
||||
let config = {
|
||||
output_format: pandoc_html
|
||||
with default_config(&Path("test"))
|
||||
output_format: pandoc_html,
|
||||
.. default_config(&Path("test"))
|
||||
};
|
||||
let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> {
|
||||
status: int, out: ~str, err: ~str
|
||||
@ -258,8 +258,8 @@ fn should_find_pandoc() {
|
||||
#[test]
|
||||
fn should_error_with_no_pandoc() {
|
||||
let config = {
|
||||
output_format: pandoc_html
|
||||
with default_config(&Path("test"))
|
||||
output_format: pandoc_html,
|
||||
.. default_config(&Path("test"))
|
||||
};
|
||||
let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> {
|
||||
status: int, out: ~str, err: ~str
|
||||
|
@ -23,8 +23,8 @@ fn run(
|
||||
let fold = fold::fold({
|
||||
fold_item: fold_item,
|
||||
fold_trait: fold_trait,
|
||||
fold_impl: fold_impl
|
||||
with *fold::default_any_fold(())
|
||||
fold_impl: fold_impl,
|
||||
.. *fold::default_any_fold(())
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -33,8 +33,8 @@ fn fold_item(fold: fold::fold<()>, doc: doc::itemdoc) -> doc::itemdoc {
|
||||
let doc = fold::default_seq_fold_item(fold, doc);
|
||||
|
||||
{
|
||||
brief: extract(doc.desc)
|
||||
with doc
|
||||
brief: extract(doc.desc),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,10 +43,10 @@ fn fold_trait(fold: fold::fold<()>, doc: doc::traitdoc) -> doc::traitdoc {
|
||||
|
||||
{
|
||||
methods: par::map(doc.methods, |doc| {
|
||||
brief: extract(doc.desc)
|
||||
with doc
|
||||
})
|
||||
with doc
|
||||
brief: extract(doc.desc),
|
||||
.. doc
|
||||
}),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,10 +55,10 @@ fn fold_impl(fold: fold::fold<()>, doc: doc::impldoc) -> doc::impldoc {
|
||||
|
||||
{
|
||||
methods: par::map(doc.methods, |doc| {
|
||||
brief: extract(doc.desc)
|
||||
with doc
|
||||
})
|
||||
with doc
|
||||
brief: extract(doc.desc),
|
||||
.. doc
|
||||
}),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,8 +142,8 @@ fn default_seq_fold_doc<T>(fold: fold<T>, doc: doc::doc) -> doc::doc {
|
||||
doc::itempage(fold_itemtag(fold, doc))
|
||||
}
|
||||
}
|
||||
}
|
||||
with *doc
|
||||
},
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
@ -171,8 +171,8 @@ fn default_any_fold_mod<T:send copy>(
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
items: par::map(doc.items, |itemtag, copy fold| {
|
||||
fold_itemtag(fold, itemtag)
|
||||
})
|
||||
with *doc
|
||||
}),
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
@ -184,8 +184,8 @@ fn default_seq_fold_mod<T>(
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
items: vec::map(doc.items, |itemtag| {
|
||||
fold_itemtag(fold, itemtag)
|
||||
})
|
||||
with *doc
|
||||
}),
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
@ -197,8 +197,8 @@ fn default_par_fold_mod<T:send copy>(
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
items: par::map(doc.items, |itemtag, copy fold| {
|
||||
fold_itemtag(fold, itemtag)
|
||||
})
|
||||
with *doc
|
||||
}),
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
@ -210,8 +210,8 @@ fn default_any_fold_nmod<T:send copy>(
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
fns: par::map(doc.fns, |fndoc, copy fold| {
|
||||
fold.fold_fn(fold, fndoc)
|
||||
})
|
||||
with doc
|
||||
}),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,8 +223,8 @@ fn default_seq_fold_nmod<T>(
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
fns: vec::map(doc.fns, |fndoc| {
|
||||
fold.fold_fn(fold, fndoc)
|
||||
})
|
||||
with doc
|
||||
}),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,8 +236,8 @@ fn default_par_fold_nmod<T:send copy>(
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
fns: par::map(doc.fns, |fndoc, copy fold| {
|
||||
fold.fold_fn(fold, fndoc)
|
||||
})
|
||||
with doc
|
||||
}),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,8 +275,8 @@ fn default_seq_fold_fn<T>(
|
||||
doc: doc::fndoc
|
||||
) -> doc::fndoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,8 +285,8 @@ fn default_seq_fold_const<T>(
|
||||
doc: doc::constdoc
|
||||
) -> doc::constdoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,8 +295,8 @@ fn default_seq_fold_enum<T>(
|
||||
doc: doc::enumdoc
|
||||
) -> doc::enumdoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,8 +305,8 @@ fn default_seq_fold_trait<T>(
|
||||
doc: doc::traitdoc
|
||||
) -> doc::traitdoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,8 +315,8 @@ fn default_seq_fold_impl<T>(
|
||||
doc: doc::impldoc
|
||||
) -> doc::impldoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,8 +325,8 @@ fn default_seq_fold_type<T>(
|
||||
doc: doc::tydoc
|
||||
) -> doc::tydoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@ fn run(
|
||||
) -> doc::doc {
|
||||
let fold = fold::fold({
|
||||
fold_mod: fold_mod,
|
||||
fold_nmod: fold_nmod
|
||||
with *fold::default_any_fold(config)
|
||||
fold_nmod: fold_nmod,
|
||||
.. *fold::default_any_fold(config)
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -34,8 +34,8 @@ fn fold_mod(
|
||||
let doc = fold::default_any_fold_mod(fold, doc);
|
||||
|
||||
doc::moddoc_({
|
||||
index: Some(build_mod_index(doc, fold.ctxt))
|
||||
with *doc
|
||||
index: Some(build_mod_index(doc, fold.ctxt)),
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ fn fold_nmod(
|
||||
let doc = fold::default_any_fold_nmod(fold, doc);
|
||||
|
||||
{
|
||||
index: Some(build_nmod_index(doc, fold.ctxt))
|
||||
with doc
|
||||
index: Some(build_nmod_index(doc, fold.ctxt)),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,8 +229,8 @@ mod test {
|
||||
fn mk_doc(output_style: config::output_style, source: ~str) -> doc::doc {
|
||||
do astsrv::from_str(source) |srv| {
|
||||
let config = {
|
||||
output_style: output_style
|
||||
with config::default_config(&Path("whatever"))
|
||||
output_style: output_style,
|
||||
.. config::default_config(&Path("whatever"))
|
||||
};
|
||||
let doc = extract::from_srv(srv, ~"");
|
||||
let doc = attr_pass::mk_pass().f(srv, doc);
|
||||
|
@ -537,12 +537,12 @@ fn should_correctly_indent_fn_signature() {
|
||||
doc::cratepage({
|
||||
topmod: doc::moddoc_({
|
||||
items: ~[doc::fntag({
|
||||
sig: Some(~"line 1\nline 2")
|
||||
with doc.cratemod().fns()[0]
|
||||
})]
|
||||
with *doc.cratemod()
|
||||
})
|
||||
with doc.cratedoc()
|
||||
sig: Some(~"line 1\nline 2"),
|
||||
.. doc.cratemod().fns()[0]
|
||||
})],
|
||||
.. *doc.cratemod()
|
||||
}),
|
||||
.. doc.cratedoc()
|
||||
})
|
||||
]
|
||||
});
|
||||
@ -784,8 +784,8 @@ mod test {
|
||||
do astsrv::from_str(source) |srv| {
|
||||
|
||||
let config = {
|
||||
output_style: config::doc_per_crate
|
||||
with config::default_config(&Path("whatever"))
|
||||
output_style: config::doc_per_crate,
|
||||
.. config::default_config(&Path("whatever"))
|
||||
};
|
||||
|
||||
let doc = extract::from_srv(srv, ~"");
|
||||
|
@ -205,8 +205,8 @@ fn should_use_markdown_file_name_based_off_crate() {
|
||||
let config = {
|
||||
output_dir: Path("output/dir"),
|
||||
output_format: config::markdown,
|
||||
output_style: config::doc_per_crate
|
||||
with config::default_config(&Path("input/test.rc"))
|
||||
output_style: config::doc_per_crate,
|
||||
.. config::default_config(&Path("input/test.rc"))
|
||||
};
|
||||
let doc = test::mk_doc(~"test", ~"");
|
||||
let page = doc::cratepage(doc.cratedoc());
|
||||
@ -219,8 +219,8 @@ fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
|
||||
let config = {
|
||||
output_dir: Path("output/dir"),
|
||||
output_format: config::pandoc_html,
|
||||
output_style: config::doc_per_mod
|
||||
with config::default_config(&Path("input/test.rc"))
|
||||
output_style: config::doc_per_mod,
|
||||
.. config::default_config(&Path("input/test.rc"))
|
||||
};
|
||||
let doc = test::mk_doc(~"", ~"");
|
||||
let page = doc::cratepage(doc.cratedoc());
|
||||
@ -233,8 +233,8 @@ fn should_name_mod_file_names_by_path() {
|
||||
let config = {
|
||||
output_dir: Path("output/dir"),
|
||||
output_format: config::pandoc_html,
|
||||
output_style: config::doc_per_mod
|
||||
with config::default_config(&Path("input/test.rc"))
|
||||
output_style: config::doc_per_mod,
|
||||
.. config::default_config(&Path("input/test.rc"))
|
||||
};
|
||||
let doc = test::mk_doc(~"", ~"mod a { mod b { } }");
|
||||
let modb = doc.cratemod().mods()[0].mods()[0];
|
||||
|
@ -60,8 +60,8 @@ fn find_pages(doc: doc::doc, page_chan: page_chan) {
|
||||
let fold = fold::fold({
|
||||
fold_crate: fold_crate,
|
||||
fold_mod: fold_mod,
|
||||
fold_nmod: fold_nmod
|
||||
with *fold::default_any_fold(page_chan)
|
||||
fold_nmod: fold_nmod,
|
||||
.. *fold::default_any_fold(page_chan)
|
||||
});
|
||||
fold.fold_doc(fold, doc);
|
||||
|
||||
@ -76,8 +76,8 @@ fn fold_crate(
|
||||
let doc = fold::default_seq_fold_crate(fold, doc);
|
||||
|
||||
let page = doc::cratepage({
|
||||
topmod: strip_mod(doc.topmod)
|
||||
with doc
|
||||
topmod: strip_mod(doc.topmod),
|
||||
.. doc
|
||||
});
|
||||
|
||||
comm::send(fold.ctxt, Some(page));
|
||||
@ -110,8 +110,8 @@ fn strip_mod(doc: doc::moddoc) -> doc::moddoc {
|
||||
doc::nmodtag(_) => false,
|
||||
_ => true
|
||||
}
|
||||
}
|
||||
with *doc
|
||||
},
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -26,16 +26,16 @@ fn run(srv: astsrv::srv, doc: doc::doc) -> doc::doc {
|
||||
let fold = fold::fold({
|
||||
fold_item: fold_item,
|
||||
fold_mod: fold_mod,
|
||||
fold_nmod: fold_nmod
|
||||
with *fold::default_any_fold(ctxt)
|
||||
fold_nmod: fold_nmod,
|
||||
.. *fold::default_any_fold(ctxt)
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
|
||||
fn fold_item(fold: fold::fold<ctxt>, doc: doc::itemdoc) -> doc::itemdoc {
|
||||
{
|
||||
path: fold.ctxt.path
|
||||
with doc
|
||||
path: fold.ctxt.path,
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@ fn fold_mod(fold: fold::fold<ctxt>, doc: doc::moddoc) -> doc::moddoc {
|
||||
if !is_topmod { vec::pop(fold.ctxt.path); }
|
||||
|
||||
doc::moddoc_({
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with *doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
@ -59,8 +59,8 @@ fn fold_nmod(fold: fold::fold<ctxt>, doc: doc::nmoddoc) -> doc::nmoddoc {
|
||||
vec::pop(fold.ctxt.path);
|
||||
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item)
|
||||
with doc
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ fn mk_pass() -> pass {
|
||||
|
||||
fn run(srv: astsrv::srv, doc: doc::doc) -> doc::doc {
|
||||
let fold = fold::fold({
|
||||
fold_mod: fold_mod
|
||||
with *fold::default_any_fold(srv)
|
||||
fold_mod: fold_mod,
|
||||
.. *fold::default_any_fold(srv)
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -28,8 +28,8 @@ fn fold_mod(
|
||||
doc::moddoc_({
|
||||
items: vec::filter(doc.items, |itemtag| {
|
||||
!is_hidden(fold.ctxt, itemtag.item())
|
||||
})
|
||||
with *doc
|
||||
}),
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,8 @@ fn test_run_passes() {
|
||||
doc::cratepage({
|
||||
topmod: doc::moddoc_({
|
||||
item: {
|
||||
name: doc.cratemod().name() + ~"two"
|
||||
with doc.cratemod().item
|
||||
name: doc.cratemod().name() + ~"two",
|
||||
.. doc.cratemod().item
|
||||
},
|
||||
items: ~[],
|
||||
index: None
|
||||
@ -72,8 +72,8 @@ fn test_run_passes() {
|
||||
doc::cratepage({
|
||||
topmod: doc::moddoc_({
|
||||
item: {
|
||||
name: doc.cratemod().name() + ~"three"
|
||||
with doc.cratemod().item
|
||||
name: doc.cratemod().name() + ~"three",
|
||||
.. doc.cratemod().item
|
||||
},
|
||||
items: ~[],
|
||||
index: None
|
||||
|
@ -15,8 +15,8 @@ fn run(_srv: astsrv::srv, doc: doc::doc) -> doc::doc {
|
||||
let fold = fold::fold({
|
||||
fold_item: fold_item,
|
||||
fold_trait: fold_trait,
|
||||
fold_impl: fold_impl
|
||||
with *fold::default_any_fold(())
|
||||
fold_impl: fold_impl,
|
||||
.. *fold::default_any_fold(())
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -27,8 +27,8 @@ fn fold_item(fold: fold::fold<()>, doc: doc::itemdoc) -> doc::itemdoc {
|
||||
|
||||
{
|
||||
desc: desc,
|
||||
sections: sections
|
||||
with doc
|
||||
sections: sections,
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,11 +41,11 @@ fn fold_trait(fold: fold::fold<()>, doc: doc::traitdoc) -> doc::traitdoc {
|
||||
|
||||
{
|
||||
desc: desc,
|
||||
sections: sections
|
||||
with method
|
||||
sections: sections,
|
||||
..method
|
||||
}
|
||||
}
|
||||
with doc
|
||||
},
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,11 +58,11 @@ fn fold_impl(fold: fold::fold<()>, doc: doc::impldoc) -> doc::impldoc {
|
||||
|
||||
{
|
||||
desc: desc,
|
||||
sections: sections
|
||||
with method
|
||||
sections: sections,
|
||||
.. method
|
||||
}
|
||||
}
|
||||
with doc
|
||||
},
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,8 +109,8 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::section]) {
|
||||
match copy current_section {
|
||||
Some(section) => {
|
||||
current_section = Some({
|
||||
body: section.body + ~"\n" + line
|
||||
with section
|
||||
body: section.body + ~"\n" + line,
|
||||
.. section
|
||||
});
|
||||
}
|
||||
None => {
|
||||
|
@ -23,8 +23,8 @@ fn run(
|
||||
lteq: item_lteq
|
||||
) -> doc::doc {
|
||||
let fold = fold::fold({
|
||||
fold_mod: fold_mod
|
||||
with *fold::default_any_fold(lteq)
|
||||
fold_mod: fold_mod,
|
||||
.. *fold::default_any_fold(lteq)
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -36,8 +36,8 @@ fn fold_mod(
|
||||
) -> doc::moddoc {
|
||||
let doc = fold::default_any_fold_mod(fold, doc);
|
||||
doc::moddoc_({
|
||||
items: sort::merge_sort(fold.ctxt, doc.items)
|
||||
with *doc
|
||||
items: sort::merge_sort(fold.ctxt, doc.items),
|
||||
.. *doc
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ fn run(
|
||||
fold_item: fold_item,
|
||||
fold_enum: fold_enum,
|
||||
fold_trait: fold_trait,
|
||||
fold_impl: fold_impl
|
||||
with *fold::default_any_fold(op)
|
||||
fold_impl: fold_impl,
|
||||
.. *fold::default_any_fold(op)
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -41,8 +41,8 @@ fn fold_item(fold: fold::fold<op>, doc: doc::itemdoc) -> doc::itemdoc {
|
||||
{
|
||||
brief: maybe_apply_op(fold.ctxt, doc.brief),
|
||||
desc: maybe_apply_op(fold.ctxt, doc.desc),
|
||||
sections: apply_to_sections(fold.ctxt, doc.sections)
|
||||
with doc
|
||||
sections: apply_to_sections(fold.ctxt, doc.sections),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,11 +59,11 @@ fn fold_enum(fold: fold::fold<op>, doc: doc::enumdoc) -> doc::enumdoc {
|
||||
{
|
||||
variants: do par::map(doc.variants) |variant, copy fold| {
|
||||
{
|
||||
desc: maybe_apply_op(fold.ctxt, variant.desc)
|
||||
with variant
|
||||
desc: maybe_apply_op(fold.ctxt, variant.desc),
|
||||
.. variant
|
||||
}
|
||||
}
|
||||
with doc
|
||||
},
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ fn fold_trait(fold: fold::fold<op>, doc: doc::traitdoc) -> doc::traitdoc {
|
||||
let doc = fold::default_seq_fold_trait(fold, doc);
|
||||
|
||||
{
|
||||
methods: apply_to_methods(fold.ctxt, doc.methods)
|
||||
with doc
|
||||
methods: apply_to_methods(fold.ctxt, doc.methods),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,8 +81,8 @@ fn apply_to_methods(op: op, docs: ~[doc::methoddoc]) -> ~[doc::methoddoc] {
|
||||
{
|
||||
brief: maybe_apply_op(op, doc.brief),
|
||||
desc: maybe_apply_op(op, doc.desc),
|
||||
sections: apply_to_sections(op, doc.sections)
|
||||
with doc
|
||||
sections: apply_to_sections(op, doc.sections),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,8 +91,8 @@ fn fold_impl(fold: fold::fold<op>, doc: doc::impldoc) -> doc::impldoc {
|
||||
let doc = fold::default_seq_fold_impl(fold, doc);
|
||||
|
||||
{
|
||||
methods: apply_to_methods(fold.ctxt, doc.methods)
|
||||
with doc
|
||||
methods: apply_to_methods(fold.ctxt, doc.methods),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ fn run(
|
||||
fold_enum: fold_enum,
|
||||
fold_trait: fold_trait,
|
||||
fold_impl: fold_impl,
|
||||
fold_type: fold_type
|
||||
with *fold::default_any_fold(srv)
|
||||
fold_type: fold_type,
|
||||
.. *fold::default_any_fold(srv)
|
||||
});
|
||||
fold.fold_doc(fold, doc)
|
||||
}
|
||||
@ -40,8 +40,8 @@ fn fold_fn(
|
||||
let srv = fold.ctxt;
|
||||
|
||||
{
|
||||
sig: get_fn_sig(srv, doc.id())
|
||||
with doc
|
||||
sig: get_fn_sig(srv, doc.id()),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,8 +91,8 @@ fn fold_const(
|
||||
}
|
||||
_ => fail ~"fold_const: id not bound to a const item"
|
||||
}
|
||||
})
|
||||
with doc
|
||||
}),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,11 +128,11 @@ fn fold_enum(
|
||||
};
|
||||
|
||||
{
|
||||
sig: Some(sig)
|
||||
with variant
|
||||
sig: Some(sig),
|
||||
.. variant
|
||||
}
|
||||
}
|
||||
with doc
|
||||
},
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,8 +147,8 @@ fn fold_trait(
|
||||
doc: doc::traitdoc
|
||||
) -> doc::traitdoc {
|
||||
{
|
||||
methods: merge_methods(fold.ctxt, doc.id(), doc.methods)
|
||||
with doc
|
||||
methods: merge_methods(fold.ctxt, doc.id(), doc.methods),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,8 +159,8 @@ fn merge_methods(
|
||||
) -> ~[doc::methoddoc] {
|
||||
do par::map(docs) |doc| {
|
||||
{
|
||||
sig: get_method_sig(srv, item_id, doc.name)
|
||||
with doc
|
||||
sig: get_method_sig(srv, item_id, doc.name),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -258,8 +258,8 @@ fn fold_impl(
|
||||
{
|
||||
trait_types: trait_types,
|
||||
self_ty: self_ty,
|
||||
methods: merge_methods(fold.ctxt, doc.id(), doc.methods)
|
||||
with doc
|
||||
methods: merge_methods(fold.ctxt, doc.id(), doc.methods),
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,8 +311,8 @@ fn fold_type(
|
||||
}
|
||||
_ => fail ~"expected type"
|
||||
}
|
||||
}
|
||||
with doc
|
||||
},
|
||||
.. doc
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,5 +7,5 @@ type point = {x: int, y: int};
|
||||
fn main() {
|
||||
let origin: point = {x: 0, y: 0};
|
||||
|
||||
let origin3d: point = {z: 0 with origin};
|
||||
let origin3d: point = {z: 0,.. origin};
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ type point = {x: int, y: int};
|
||||
|
||||
fn main() {
|
||||
let mut origin: point;
|
||||
origin = {x: 10 with origin}; //~ ERROR use of possibly uninitialized variable: `origin`
|
||||
origin = {x: 10,.. origin}; //~ ERROR use of possibly uninitialized variable: `origin`
|
||||
copy origin;
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ fn main() {
|
||||
|
||||
let a = {foo: 0i};
|
||||
|
||||
let b = {foo: true with a};
|
||||
let b = {foo: true,.. a};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ struct my_resource {
|
||||
fn main() {
|
||||
{
|
||||
let a = {x: 0, y: my_resource(20)};
|
||||
let b = {x: 2 with a};
|
||||
let b = {x: 2,.. a};
|
||||
log(error, (a, b));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// error-pattern:beep boop
|
||||
fn main() {
|
||||
let origin = {x: 0, y: 0};
|
||||
let f: {x:int,y:int} = {x: (fail ~"beep boop") with origin};
|
||||
let f: {x:int,y:int} = {x: (fail ~"beep boop"),.. origin};
|
||||
}
|
||||
|
@ -8,12 +8,12 @@ fn main() {
|
||||
let y = {
|
||||
f: 1,
|
||||
g: 1,
|
||||
with x
|
||||
.. x
|
||||
};
|
||||
|
||||
let z = {
|
||||
f: 1,
|
||||
with x
|
||||
.. x
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ type biggy = {
|
||||
|
||||
fn getbig(i: biggy) {
|
||||
if i.a00 != 0u64 {
|
||||
getbig({a00: i.a00 - 1u64 with i});
|
||||
getbig({a00: i.a00 - 1u64,.. i});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ type point = {x: int, y: int};
|
||||
|
||||
fn main() {
|
||||
let origin: point = {x: 0, y: 0};
|
||||
let right: point = {x: origin.x + 10 with origin};
|
||||
let up: point = {y: origin.y + 10 with origin};
|
||||
let right: point = {x: origin.x + 10,.. origin};
|
||||
let up: point = {y: origin.y + 10,.. origin};
|
||||
assert (origin.x == 0);
|
||||
assert (origin.y == 0);
|
||||
assert (right.x == 10);
|
||||
|
Loading…
x
Reference in New Issue
Block a user