Fix damage done by the pretty-printer
This commit is contained in:
parent
df7f21db09
commit
6e2a7bff7f
77 changed files with 678 additions and 413 deletions
|
|
@ -340,10 +340,8 @@ fn build_link_meta(sess: &session::session, c: &ast::crate, output: &str,
|
|||
ret alt metas.name {
|
||||
some(v) { v }
|
||||
none. {
|
||||
let
|
||||
// FIXME: Remove this vec->ivec conversion.
|
||||
|
||||
name =
|
||||
// FIXME: Remove this vec->ivec conversion.
|
||||
let name =
|
||||
{
|
||||
let os_vec =
|
||||
str::split(fs::basename(output), '.' as u8);
|
||||
|
|
|
|||
|
|
@ -65,9 +65,8 @@ fn build_configuration(sess: session::session, argv0: str, input: str) ->
|
|||
// some default and generated configuration items
|
||||
let default_cfg = default_configuration(sess, argv0, input);
|
||||
let user_cfg = sess.get_opts().cfg;
|
||||
let
|
||||
// If the user wants a test runner, then add the test cfg
|
||||
gen_cfg =
|
||||
// If the user wants a test runner, then add the test cfg
|
||||
let gen_cfg =
|
||||
{
|
||||
if sess.get_opts().test && !attr::contains_name(user_cfg, "test")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,9 +101,7 @@ fn in_cfg(cfg: &ast::crate_cfg, attrs: &ast::attribute[]) -> bool {
|
|||
// Pull the inner meta_items from the #[cfg(meta_item, ...)] attributes,
|
||||
// so we can match against them. This is the list of configurations for
|
||||
// which the item is valid
|
||||
let
|
||||
|
||||
item_cfg_metas =
|
||||
let item_cfg_metas =
|
||||
{
|
||||
fn extract_metas(inner_items: &(@ast::meta_item)[],
|
||||
cfg_item: &@ast::meta_item) ->
|
||||
|
|
|
|||
|
|
@ -1395,11 +1395,10 @@ obj builder(B: BuilderRef, terminated: @mutable bool) {
|
|||
|
||||
fn is_terminated() -> bool {
|
||||
ret *terminated;
|
||||
}drop
|
||||
|
||||
{
|
||||
}
|
||||
drop {
|
||||
llvm::LLVMDisposeBuilder(B);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Memory-managed object interface to type handles. */
|
||||
|
|
|
|||
|
|
@ -122,22 +122,20 @@ fn find_library_crate(sess: &session::session, ident: &ast::ident,
|
|||
|
||||
attr::require_unique_names(sess, metas);
|
||||
|
||||
let
|
||||
// FIXME: Probably want a warning here since the user
|
||||
// is using the wrong type of meta item
|
||||
crate_name =
|
||||
{
|
||||
let name_items = attr::find_meta_items_by_name(metas, "name");
|
||||
alt ivec::last(name_items) {
|
||||
some(i) {
|
||||
alt attr::get_meta_item_value_str(i) {
|
||||
some(n) { n }
|
||||
_ { ident }
|
||||
}
|
||||
}
|
||||
none. { ident }
|
||||
// FIXME: Probably want a warning here since the user
|
||||
// is using the wrong type of meta item
|
||||
let crate_name = {
|
||||
let name_items = attr::find_meta_items_by_name(metas, "name");
|
||||
alt ivec::last(name_items) {
|
||||
some(i) {
|
||||
alt attr::get_meta_item_value_str(i) {
|
||||
some(n) { n }
|
||||
_ { ident }
|
||||
}
|
||||
};
|
||||
}
|
||||
none. { ident }
|
||||
}
|
||||
};
|
||||
|
||||
let nn = default_native_lib_naming(sess, sess.get_opts().static);
|
||||
let x =
|
||||
|
|
|
|||
|
|
@ -164,9 +164,8 @@ fn lookup_def(cnum: ast::crate_num, data: @u8[], did_: &ast::def_id) ->
|
|||
let item = lookup_item(did_.node, data);
|
||||
let kind_ch = item_kind(item);
|
||||
let did = {crate: cnum, node: did_.node};
|
||||
let
|
||||
// We treat references to tags as references to types.
|
||||
def =
|
||||
// We treat references to tags as references to types.
|
||||
let def =
|
||||
alt kind_ch as char {
|
||||
'c' { ast::def_const(did) }
|
||||
'f' { ast::def_fn(did, ast::impure_fn) }
|
||||
|
|
|
|||
|
|
@ -39,10 +39,9 @@ tag local_info { arg(ast::mode); objfield(ast::mutability); }
|
|||
type ctx = {tcx: ty::ctxt, local_map: std::map::hashmap[node_id, local_info]};
|
||||
|
||||
fn check_crate(tcx: ty::ctxt, crate: &@ast::crate) {
|
||||
let
|
||||
// Stores information about object fields and function
|
||||
// arguments that's otherwise not easily available.
|
||||
cx =
|
||||
// Stores information about object fields and function
|
||||
// arguments that's otherwise not easily available.
|
||||
let cx =
|
||||
@{tcx: tcx, local_map: std::map::new_int_hash()};
|
||||
let v =
|
||||
@{visit_fn: bind visit_fn(cx, _, _, _, _, _, _, _),
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ fn collect_freevars(def_map: &resolve::def_map, sess: &session::session,
|
|||
|
||||
let e: env =
|
||||
@{mutable refs: ~[], decls: decls, def_map: def_map, sess: sess};
|
||||
walker(visit::mk_simple_visitor(@{visit_local: bind walk_local(e, _),
|
||||
visit_pat: bind walk_pat(e, _),
|
||||
visit_expr: bind walk_expr(e, _),
|
||||
visit_fn: bind walk_fn(e, _, _, _, _, _)
|
||||
with
|
||||
*visit::default_simple_visitor()}));
|
||||
walker(visit::mk_simple_visitor
|
||||
(@{visit_local: bind walk_local(e, _),
|
||||
visit_pat: bind walk_pat(e, _),
|
||||
visit_expr: bind walk_expr(e, _),
|
||||
visit_fn: bind walk_fn(e, _, _, _, _, _)
|
||||
with *visit::default_simple_visitor()}));
|
||||
|
||||
// Calculate (refs - decls). This is the set of captured upvars.
|
||||
// We build a vec of the node ids of the uses and a set of the
|
||||
|
|
|
|||
|
|
@ -830,10 +830,9 @@ fn trans_malloc_boxed(cx: &@block_ctxt, t: ty::t) -> result {
|
|||
// size of; box_ptr is the type that's converted to a TypeRef and used as
|
||||
// the pointer cast target in trans_raw_malloc.
|
||||
|
||||
let
|
||||
// The mk_int here is the space being
|
||||
// reserved for the refcount.
|
||||
boxed_body =
|
||||
// The mk_int here is the space being
|
||||
// reserved for the refcount.
|
||||
let boxed_body =
|
||||
ty::mk_imm_tup(bcx_tcx(cx), ~[ty::mk_int(bcx_tcx(cx)), t]);
|
||||
let box_ptr = ty::mk_imm_box(bcx_tcx(cx), t);
|
||||
let sz = size_of(cx, boxed_body);
|
||||
|
|
@ -1243,21 +1242,20 @@ fn incr_refcnt_of_boxed(cx: &@block_ctxt, box_ptr: ValueRef) -> result {
|
|||
fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
|
||||
// NB: v is an *alias* of type t here, not a direct value.
|
||||
|
||||
let
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
// TODO: call upcall_kill
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
// TODO: call upcall_kill
|
||||
|
||||
|
||||
// Call through the obj's own fields-drop glue first.
|
||||
// Call through the obj's own fields-drop glue first.
|
||||
|
||||
// Then free the body.
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
// Call through the closure's own fields-drop glue first.
|
||||
// Then free the body.
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
// Call through the closure's own fields-drop glue first.
|
||||
|
||||
// Then free the body.
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
rs =
|
||||
// Then free the body.
|
||||
// FIXME: switch gc/non-gc on layer of the type.
|
||||
let rs =
|
||||
alt ty::struct(bcx_tcx(cx), t) {
|
||||
ty::ty_str. { let v = cx.build.Load(v0); trans_non_gc_free(cx, v) }
|
||||
ty::ty_vec(_) {
|
||||
|
|
@ -1361,9 +1359,7 @@ fn maybe_free_ivec_heap_part(cx: &@block_ctxt, v0: ValueRef, unit_ty: ty::t)
|
|||
fn make_drop_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
|
||||
// NB: v0 is an *alias* of type t here, not a direct value.
|
||||
let ccx = bcx_ccx(cx);
|
||||
let
|
||||
|
||||
rs =
|
||||
let rs =
|
||||
alt ty::struct(ccx.tcx, t) {
|
||||
ty::ty_str. { decr_refcnt_maybe_free(cx, v0, v0, t) }
|
||||
ty::ty_vec(_) { decr_refcnt_maybe_free(cx, v0, v0, t) }
|
||||
|
|
@ -1453,7 +1449,9 @@ fn trans_res_drop(cx: @block_ctxt, rs: ValueRef, did: &ast::def_id,
|
|||
// value here, but the dtor expects a type that still has opaque pointers
|
||||
// for type variables.
|
||||
let val_llty =
|
||||
lib::llvm::fn_ty_param_tys(llvm::LLVMGetElementType(llvm::LLVMTypeOf(dtor_addr))).(std::ivec::len(args));
|
||||
lib::llvm::fn_ty_param_tys(llvm::LLVMGetElementType
|
||||
(llvm::LLVMTypeOf(dtor_addr)))
|
||||
.(std::ivec::len(args));
|
||||
let val_cast = cx.build.BitCast(val.val, val_llty);
|
||||
cx.build.FastCall(dtor_addr, args + ~[val_cast]);
|
||||
|
||||
|
|
@ -3345,9 +3343,8 @@ mod ivec {
|
|||
maybe_on_heap_cx.build.PointerCast(vptr,
|
||||
T_ptr(T_ivec_heap(llunitty)));
|
||||
let heap_ptr_ptr =
|
||||
maybe_on_heap_cx.build.InBoundsGEP(stub_ptr,
|
||||
~[C_int(0),
|
||||
C_uint(abi::ivec_heap_stub_elt_ptr)]);
|
||||
maybe_on_heap_cx.build.InBoundsGEP
|
||||
(stub_ptr, ~[C_int(0), C_uint(abi::ivec_heap_stub_elt_ptr)]);
|
||||
let heap_ptr = maybe_on_heap_cx.build.Load(heap_ptr_ptr);
|
||||
let heap_ptr_is_nonnull =
|
||||
maybe_on_heap_cx.build.ICmp(lib::llvm::LLVMIntNE, heap_ptr,
|
||||
|
|
@ -3358,9 +3355,8 @@ mod ivec {
|
|||
|
||||
// Ok, the vector is on the heap. Copy the heap part.
|
||||
let alen_ptr =
|
||||
on_heap_cx.build.InBoundsGEP(stub_ptr,
|
||||
~[C_int(0),
|
||||
C_uint(abi::ivec_heap_stub_elt_alen)]);
|
||||
on_heap_cx.build.InBoundsGEP
|
||||
(stub_ptr, ~[C_int(0), C_uint(abi::ivec_heap_stub_elt_alen)]);
|
||||
let alen = on_heap_cx.build.Load(alen_ptr);
|
||||
|
||||
let heap_part_sz =
|
||||
|
|
@ -3598,17 +3594,15 @@ fn trans_if(cx: &@block_ctxt, cond: &@ast::expr, thn: &ast::blk,
|
|||
let then_cx = new_scope_block_ctxt(cx, "then");
|
||||
let then_res = trans_block(then_cx, thn, output);
|
||||
let else_cx = new_scope_block_ctxt(cx, "else");
|
||||
let
|
||||
// Synthesize a block here to act as the else block
|
||||
// containing an if expression. Needed in order for the
|
||||
// else scope to behave like a normal block scope. A tad
|
||||
// ugly.
|
||||
// Calling trans_block directly instead of trans_expr
|
||||
// because trans_expr will create another scope block
|
||||
// context for the block, but we've already got the
|
||||
// 'else' context
|
||||
|
||||
else_res =
|
||||
// Synthesize a block here to act as the else block
|
||||
// containing an if expression. Needed in order for the
|
||||
// else scope to behave like a normal block scope. A tad
|
||||
// ugly.
|
||||
// Calling trans_block directly instead of trans_expr
|
||||
// because trans_expr will create another scope block
|
||||
// context for the block, but we've already got the
|
||||
// 'else' context
|
||||
let else_res =
|
||||
alt els {
|
||||
some(elexpr) {
|
||||
alt elexpr.node {
|
||||
|
|
@ -4908,7 +4902,7 @@ fn trans_call(cx: &@block_ctxt, f: &@ast::expr,
|
|||
let llretslot = args_res.retslot;
|
||||
/*
|
||||
log "calling: " + val_str(bcx_ccx(cx).tn, faddr);
|
||||
|
||||
|
||||
for (ValueRef arg in llargs) {
|
||||
log "arg: " + val_str(bcx_ccx(cx).tn, arg);
|
||||
}
|
||||
|
|
@ -5334,9 +5328,9 @@ fn trans_expr_out(cx: &@block_ctxt, e: &@ast::expr, output: out_method) ->
|
|||
}
|
||||
_ {
|
||||
// The expression is an lvalue. Fall through.
|
||||
assert (ty::is_lval(e)); // make sure it really is and that we
|
||||
// didn't forget to add a case for a new expr!
|
||||
|
||||
assert (ty::is_lval(e));
|
||||
// make sure it really is and that we
|
||||
// didn't forget to add a case for a new expr!
|
||||
}
|
||||
}
|
||||
// lval cases fall through to trans_lval and then
|
||||
|
|
@ -6352,8 +6346,8 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, args: &ast::arg[],
|
|||
alt bcx.fcx.llargs.find(aarg.id) {
|
||||
some(x) { argval = x; }
|
||||
_ {
|
||||
bcx_ccx(bcx).sess.span_fatal(aarg.ty.span,
|
||||
"unbound arg ID in copy_args_to_allocas");
|
||||
bcx_ccx(bcx).sess.span_fatal
|
||||
(aarg.ty.span, "unbound arg ID in copy_args_to_allocas");
|
||||
}
|
||||
}
|
||||
bcx.build.Store(argval, a);
|
||||
|
|
@ -6374,8 +6368,8 @@ fn add_cleanups_for_args(bcx: &@block_ctxt, args: &ast::arg[],
|
|||
alt bcx.fcx.llargs.find(aarg.id) {
|
||||
some(x) { argval = x; }
|
||||
_ {
|
||||
bcx_ccx(bcx).sess.span_fatal(aarg.ty.span,
|
||||
"unbound arg ID in copy_args_to_allocas");
|
||||
bcx_ccx(bcx).sess.span_fatal
|
||||
(aarg.ty.span, "unbound arg ID in copy_args_to_allocas");
|
||||
}
|
||||
}
|
||||
add_clean(bcx, argval, arg_tys.(arg_n).ty);
|
||||
|
|
@ -7227,9 +7221,8 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
|
|||
let bcx = new_top_block_ctxt(fcx);
|
||||
let lltop = bcx.llbb;
|
||||
|
||||
let
|
||||
// Cast the tag to a type we can GEP into.
|
||||
llblobptr =
|
||||
// Cast the tag to a type we can GEP into.
|
||||
let llblobptr =
|
||||
if is_degen {
|
||||
fcx.llretptr
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -294,9 +294,8 @@ fn compile_submatch(bcx: @block_ctxt, m: &match, vals: ValueRef[],
|
|||
if ivec::len(ty::tag_variants(ccx.tcx, vdef.tg)) == 1u {
|
||||
kind = single;
|
||||
} else {
|
||||
let tagptr =
|
||||
bcx.build.PointerCast(val,
|
||||
trans_common::T_opaque_tag_ptr(ccx.tn));
|
||||
let tagptr = bcx.build.PointerCast
|
||||
(val, trans_common::T_opaque_tag_ptr(ccx.tn));
|
||||
let discrimptr = bcx.build.GEP(tagptr, ~[C_int(0), C_int(0)]);
|
||||
test_val = bcx.build.Load(discrimptr);
|
||||
kind = switch;
|
||||
|
|
|
|||
|
|
@ -159,9 +159,7 @@ fn relax_precond_block(fcx: &fn_ctxt, i: node_id, b: &blk) {
|
|||
fn quit(keepgoing: @mutable bool, i: &@item) { *keepgoing = false; }
|
||||
fn kg(keepgoing: @mutable bool) -> bool { ret *keepgoing; }
|
||||
|
||||
let
|
||||
|
||||
v =
|
||||
let v =
|
||||
{visit_block_pre: bind relax_precond_block_non_recursive(fcx, i, _),
|
||||
visit_expr_pre: bind relax_precond_expr(fcx, i, _),
|
||||
visit_stmt_pre: bind relax_precond_stmt(fcx, i, _),
|
||||
|
|
|
|||
|
|
@ -641,7 +641,7 @@ fn find_pre_post_block(fcx: &fn_ctxt, b: blk) {
|
|||
This will mean that:
|
||||
x = 0;
|
||||
break;
|
||||
|
||||
|
||||
won't have a postcondition that says x is initialized, but that's ok.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -1987,8 +1987,9 @@ mod unify {
|
|||
|
||||
let result_mode;
|
||||
if expected_input.mode != actual_input.mode {
|
||||
ret fn_common_res_err(ures_err(terr_mode_mismatch(expected_input.mode,
|
||||
actual_input.mode)));
|
||||
ret fn_common_res_err
|
||||
(ures_err(terr_mode_mismatch(expected_input.mode,
|
||||
actual_input.mode)));
|
||||
} else { result_mode = expected_input.mode; }
|
||||
let result = unify_step(cx, expected_input.ty, actual_input.ty);
|
||||
alt result {
|
||||
|
|
@ -2817,10 +2818,10 @@ fn ast_constr_to_constr[T](tcx: ty::ctxt, c: &@ast::constr_general[T]) ->
|
|||
{path: c.node.path, args: c.node.args, id: pred_id});
|
||||
}
|
||||
_ {
|
||||
tcx.sess.span_fatal(c.span,
|
||||
"Predicate " + path_to_str(c.node.path) +
|
||||
" is unbound or bound to a non-function or an \
|
||||
impure function");
|
||||
tcx.sess.span_fatal
|
||||
(c.span, "Predicate " + path_to_str(c.node.path) +
|
||||
" is unbound or bound to a non-function or an \
|
||||
impure function");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,14 +164,14 @@ fn instantiate_path(fcx: &@fn_ctxt, pth: &ast::path,
|
|||
if ty_substs_len > 0u {
|
||||
let param_var_len = ivec::len(ty_param_vars);
|
||||
if param_var_len == 0u {
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
"this item does not take type parameters");
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(sp, "this item does not take type parameters");
|
||||
} else if (ty_substs_len > param_var_len) {
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
"too many type parameter provided for this item");
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(sp, "too many type parameter provided for this item");
|
||||
} else if (ty_substs_len < param_var_len) {
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
"not enough type parameters provided for this item");
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(sp, "not enough type parameters provided for this item");
|
||||
}
|
||||
let ty_substs: ty::t[] = ~[];
|
||||
let i = 0u;
|
||||
|
|
@ -868,11 +868,10 @@ mod collect {
|
|||
let abi = @mutable none[ast::native_abi];
|
||||
let cx = @{tcx: tcx};
|
||||
let visit =
|
||||
visit::mk_simple_visitor(@{visit_item: bind convert(cx, abi, _),
|
||||
visit_native_item:
|
||||
bind convert_native(cx, abi, _)
|
||||
with
|
||||
*visit::default_simple_visitor()});
|
||||
visit::mk_simple_visitor
|
||||
(@{visit_item: bind convert(cx, abi, _),
|
||||
visit_native_item: bind convert_native(cx, abi, _)
|
||||
with *visit::default_simple_visitor()});
|
||||
visit::visit_crate(*crate, (), visit);
|
||||
}
|
||||
}
|
||||
|
|
@ -1426,14 +1425,13 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat,
|
|||
// TODO (issue #448): Wrap a #fmt string over multiple
|
||||
// lines...
|
||||
|
||||
fcx.ccx.tcx.sess.span_fatal(pat.span,
|
||||
#fmt("this pattern has %u field%s, \
|
||||
but the corresponding \
|
||||
variant has no fields",
|
||||
subpats_len,
|
||||
if subpats_len == 1u {
|
||||
""
|
||||
} else { "s" }));
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(pat.span, #fmt("this pattern has %u field%s, \
|
||||
but the corresponding \
|
||||
variant has no fields",
|
||||
subpats_len,
|
||||
if subpats_len == 1u { "" }
|
||||
else { "s" }));
|
||||
}
|
||||
write::ty_fixup(fcx, pat.id, path_tpot);
|
||||
}
|
||||
|
|
@ -1464,11 +1462,10 @@ fn check_pat(fcx: &@fn_ctxt, map: &ast::pat_id_map, pat: &@ast::pat,
|
|||
let f_count = ivec::len(fields);
|
||||
let ex_f_count = ivec::len(ex_fields);
|
||||
if ex_f_count < f_count || !etc && ex_f_count > f_count {
|
||||
fcx.ccx.tcx.sess.span_fatal(pat.span,
|
||||
#fmt("mismatched types: expected a record \
|
||||
with %u fields, found one with %u \
|
||||
fields",
|
||||
ex_f_count, f_count));
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(pat.span, #fmt("mismatched types: expected a record \
|
||||
with %u fields, found one with %u \
|
||||
fields", ex_f_count, f_count));
|
||||
}
|
||||
fn matches(name: &str, f: &ty::field) -> bool {
|
||||
ret str::eq(name, f.ident);
|
||||
|
|
@ -1521,8 +1518,8 @@ fn require_pure_call(ccx: @crate_ctxt, caller_purity: &ast::purity,
|
|||
alt ccx.tcx.def_map.find(callee.id) {
|
||||
some(ast::def_fn(_, ast::pure_fn.)) { ret; }
|
||||
_ {
|
||||
ccx.tcx.sess.span_fatal(sp,
|
||||
"Pure function calls function not known to be pure");
|
||||
ccx.tcx.sess.span_fatal
|
||||
(sp, "Pure function calls function not known to be pure");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1614,10 +1611,10 @@ fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) {
|
|||
arg_tys.(i).mode == mo_val {
|
||||
// For why the check is necessary, see the
|
||||
// none case in trans_bind_thunk
|
||||
fcx.ccx.tcx.sess.span_fatal(sp,
|
||||
call_kind_str(call_kind) +
|
||||
" arguments with types containing parameters \
|
||||
must be passed by alias");
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(sp, call_kind_str(call_kind) +
|
||||
" arguments with types containing parameters \
|
||||
must be passed by alias");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1785,10 +1782,10 @@ fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) {
|
|||
let variants = ty::tag_variants(fcx.ccx.tcx, id);
|
||||
if ivec::len(variants) != 1u ||
|
||||
ivec::len(variants.(0).args) != 1u {
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"can only dereference tags " +
|
||||
"with a single variant which has a "
|
||||
+ "single argument");
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(expr.span, "can only dereference tags " +
|
||||
"with a single variant which has a "
|
||||
+ "single argument");
|
||||
}
|
||||
oper_t =
|
||||
ty::substitute_type_params(fcx.ccx.tcx, tps,
|
||||
|
|
@ -1983,10 +1980,9 @@ fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) {
|
|||
ty::ty_ivec(vec_elt_ty) { elt_ty = vec_elt_ty.ty; }
|
||||
ty::ty_istr. { elt_ty = ty::mk_mach(fcx.ccx.tcx, ast::ty_u8); }
|
||||
_ {
|
||||
fcx.ccx.tcx.sess.span_fatal(expr.span,
|
||||
"mismatched types: expected vector or string but "
|
||||
+ "found " +
|
||||
ty_to_str(fcx.ccx.tcx, ety));
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(expr.span, "mismatched types: expected vector or string but "
|
||||
+ "found " + ty_to_str(fcx.ccx.tcx, ety));
|
||||
}
|
||||
}
|
||||
check_for_or_for_each(fcx, decl, elt_ty, body, id);
|
||||
|
|
@ -2440,10 +2436,9 @@ fn check_expr(fcx: &@fn_ctxt, expr: &@ast::expr) {
|
|||
_ {
|
||||
// The user is trying to extend a
|
||||
// non-object.
|
||||
fcx.ccx.tcx.sess.span_fatal(e.span,
|
||||
syntax::print::pprust::expr_to_str(e)
|
||||
+
|
||||
" does not have object type");
|
||||
fcx.ccx.tcx.sess.span_fatal
|
||||
(e.span, syntax::print::pprust::expr_to_str(e) +
|
||||
" does not have object type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,9 +329,9 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: vec[piece],
|
|||
let expected_nargs = n + 1u; // n conversions + the fmt string
|
||||
|
||||
if expected_nargs < nargs {
|
||||
cx.span_fatal(sp,
|
||||
#fmt("too many arguments to #fmt. found %u, expected %u",
|
||||
nargs, expected_nargs));
|
||||
cx.span_fatal
|
||||
(sp, #fmt("too many arguments to #fmt. found %u, expected %u",
|
||||
nargs, expected_nargs));
|
||||
}
|
||||
ret tmp_expr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,10 +317,9 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ {
|
|||
|
||||
ret {fields:
|
||||
alt ao.fields {
|
||||
option::none[anon_obj_field[]]. { ao.fields }
|
||||
option::some[anon_obj_field[]](v) {
|
||||
option::some[anon_obj_field[]](ivec::map(fold_anon_obj_field,
|
||||
v))
|
||||
option::none. { ao.fields }
|
||||
option::some(v) {
|
||||
option::some(ivec::map(fold_anon_obj_field, v))
|
||||
}
|
||||
},
|
||||
methods: ivec::map(fld.fold_method, ao.methods),
|
||||
|
|
|
|||
|
|
@ -1812,15 +1812,14 @@ fn parse_dtor(p: &parser) -> @ast::method {
|
|||
let b: ast::blk = parse_block(p);
|
||||
let inputs: ast::arg[] = ~[];
|
||||
let output: @ast::ty = @spanned(lo, lo, ast::ty_nil);
|
||||
let
|
||||
|
||||
// I guess dtors can't have constraints?
|
||||
d: ast::fn_decl =
|
||||
{inputs: inputs,
|
||||
output: output,
|
||||
purity: ast::impure_fn,
|
||||
cf: ast::return,
|
||||
constraints: ~[]};
|
||||
// I guess dtors can't have constraints?
|
||||
let d: ast::fn_decl = {
|
||||
inputs: inputs,
|
||||
output: output,
|
||||
purity: ast::impure_fn,
|
||||
cf: ast::return,
|
||||
constraints: ~[]
|
||||
};
|
||||
let f: ast::_fn = {decl: d, proto: ast::proto_fn, body: b};
|
||||
let m: ast::method_ = {ident: "drop", meth: f, id: p.get_id()};
|
||||
ret @spanned(lo, f.body.span.hi, m);
|
||||
|
|
@ -1877,9 +1876,8 @@ fn parse_item_res(p: &parser, lyr: ast::layer, attrs: &ast::attribute[]) ->
|
|||
|
||||
fn parse_mod_items(p: &parser, term: token::token,
|
||||
first_item_attrs: &ast::attribute[]) -> ast::_mod {
|
||||
let
|
||||
// Shouldn't be any view items since we've already parsed an item attr
|
||||
view_items =
|
||||
// Shouldn't be any view items since we've already parsed an item attr
|
||||
let view_items =
|
||||
if ivec::len(first_item_attrs) == 0u { parse_view(p) } else { ~[] };
|
||||
let items: (@ast::item)[] = ~[];
|
||||
let initial_attrs = first_item_attrs;
|
||||
|
|
@ -1960,11 +1958,10 @@ fn parse_native_item(p: &parser, attrs: &ast::attribute[]) ->
|
|||
}
|
||||
|
||||
fn parse_native_mod_items(p: &parser, native_name: &str, abi: ast::native_abi,
|
||||
first_item_attrs: &ast::attribute[]) ->
|
||||
ast::native_mod {
|
||||
let
|
||||
// Shouldn't be any view items since we've already parsed an item attr
|
||||
view_items =
|
||||
first_item_attrs: &ast::attribute[])
|
||||
-> ast::native_mod {
|
||||
// Shouldn't be any view items since we've already parsed an item attr
|
||||
let view_items =
|
||||
if ivec::len(first_item_attrs) == 0u {
|
||||
parse_native_view(p)
|
||||
} else { ~[] };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue