librustc: Long lines. rs=rustbot

This commit is contained in:
Patrick Walton 2012-12-04 21:13:02 -08:00
parent 01cd53baf0
commit b8cfd5c414
26 changed files with 99 additions and 45 deletions

View File

@ -342,8 +342,8 @@ fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: input,
}
pprust::node_block(s, ref blk) => {
pp::space(s.s);
pprust::synth_comment(s,
~"block " + int::to_str((*blk).node.id, 10u));
pprust::synth_comment(
s, ~"block " + int::to_str((*blk).node.id, 10u));
}
pprust::node_expr(s, expr) => {
pp::space(s.s);

View File

@ -637,8 +637,13 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
encode_region_param(ecx, ebml_w, item);
}
encode_enum_variant_info(ecx, ebml_w, item.id,
(*enum_definition).variants, path, index, tps);
encode_enum_variant_info(ecx,
ebml_w,
item.id,
(*enum_definition).variants,
path,
index,
tps);
}
item_class(struct_def, tps) => {
/* First, encode the fields and methods

View File

@ -140,8 +140,10 @@ impl ctor : cmp::Eq {
match ((*self), (*other)) {
(single, single) => true,
(variant(did_self), variant(did_other)) => did_self == did_other,
(val(ref cv_self), val(ref cv_other)) => (*cv_self) == (*cv_other),
(range(ref cv0_self, ref cv1_self), range(ref cv0_other, ref cv1_other)) => {
(val(ref cv_self), val(ref cv_other)) =>
(*cv_self) == (*cv_other),
(range(ref cv0_self, ref cv1_self),
range(ref cv0_other, ref cv1_other)) => {
(*cv0_self) == (*cv0_other) && (*cv1_self) == (*cv1_other)
}
(single, _) | (variant(_), _) | (val(_), _) | (range(*), _) => {

View File

@ -156,7 +156,9 @@ impl LanguageItemCollector {
meta_name_value(ref key, literal) => {
match literal.node {
lit_str(value) => {
self.match_and_collect_item(item_def_id, (*key), *value);
self.match_and_collect_item(item_def_id,
(*key),
*value);
}
_ => {} // Skip.
}

View File

@ -1546,7 +1546,7 @@ impl Resolver {
in this module");
}
for (*path_list_idents).each |path_list_ident| {
for path_list_idents.each |path_list_ident| {
let ident = path_list_ident.node.name;
let id = path_list_ident.node.id;
module_.exported_names.insert(ident, id);
@ -3646,7 +3646,7 @@ impl Resolver {
self.resolve_type(argument.ty, visitor);
}
self.resolve_type((*ty_m).decl.output, visitor);
self.resolve_type(ty_m.decl.output, visitor);
}
}
provided(m) => {
@ -4894,7 +4894,7 @@ impl Resolver {
expr_fn(_, fn_decl, ref block, capture_clause) |
expr_fn_block(fn_decl, ref block, capture_clause) => {
self.resolve_function(FunctionRibKind(expr.id, (*block).node.id),
self.resolve_function(FunctionRibKind(expr.id, block.node.id),
Some(@fn_decl),
NoTypeParameters,
(*block),

View File

@ -1832,7 +1832,13 @@ fn trans_enum_def(ccx: @crate_ctxt, enum_definition: ast::enum_def,
variant.node.name, variant.node.id);
}
ast::enum_variant_kind(ref enum_definition) => {
trans_enum_def(ccx, (*enum_definition), id, tps, degen, path, vi,
trans_enum_def(ccx,
*enum_definition,
id,
tps,
degen,
path,
vi,
i);
}
}

View File

@ -622,7 +622,7 @@ fn trans_arg_expr(bcx: block,
Some(_) => {
match arg_expr.node {
ast::expr_loop_body(
blk @ @{node:ast::expr_fn_block(decl, ref body, cap), _}) =>
blk@@{node:ast::expr_fn_block(decl, ref body, cap), _}) =>
{
let scratch_ty = expr_ty(bcx, blk);
let scratch = alloc_ty(bcx, scratch_ty);

View File

@ -517,7 +517,8 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
controlflow::trans_block(bcx, (*blk), dest)
};
}
ast::expr_rec(ref fields, base) | ast::expr_struct(_, ref fields, base) => {
ast::expr_rec(ref fields, base) |
ast::expr_struct(_, ref fields, base) => {
return trans_rec_or_struct(bcx, (*fields), base, expr.id, dest);
}
ast::expr_tup(args) => {

View File

@ -667,8 +667,9 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
let llretptr = GEPi(bcx, llargbundle, [0u, n]);
let llretloc = Load(bcx, llretptr);
if (*x86_64).ret_ty.cast {
let tmp_ptr = BitCast(bcx, llretloc,
T_ptr((*x86_64).ret_ty.ty));
let tmp_ptr = BitCast(bcx,
llretloc,
T_ptr((*x86_64).ret_ty.ty));
Store(bcx, llretval, tmp_ptr);
} else {
Store(bcx, llretval, llretloc);

View File

@ -152,10 +152,13 @@ fn monomorphic_fn(ccx: @crate_ctxt,
});
let lldecl = match map_node {
ast_map::node_item(i@@{node: ast::item_fn(decl, _, _, ref body), _}, _) => {
ast_map::node_item(i@@{
node: ast::item_fn(decl, _, _, ref body),
_
}, _) => {
let d = mk_lldecl();
set_inline_hint_if_appr(i.attrs, d);
trans_fn(ccx, pt, decl, (*body), d, no_self, psubsts, fn_id.node, None);
trans_fn(ccx, pt, decl, *body, d, no_self, psubsts, fn_id.node, None);
d
}
ast_map::node_item(*) => {

View File

@ -68,7 +68,9 @@ fn traverse_def_id(cx: ctx, did: def_id) {
ast_map::node_foreign_item(item, _, _) => {
cx.rmap.insert(item.id, ());
}
ast_map::node_variant(ref v, _, _) => { cx.rmap.insert((*v).node.id, ()); }
ast_map::node_variant(ref v, _, _) => {
cx.rmap.insert((*v).node.id, ());
}
_ => ()
}
}

View File

@ -119,7 +119,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
// avoids creating more than one copy of the enum when one
// of the enum's variants refers to the enum itself.
common::T_named_struct(llvm_type_name(cx, an_enum, did, (*substs).tps))
common::T_named_struct(llvm_type_name(cx, an_enum, did, substs.tps))
}
ty::ty_estr(ty::vstore_box) => {
T_box_ptr(T_box(cx, T_vec(cx, T_i8())))
@ -184,7 +184,7 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
// in *after* placing it into the type cache. This prevents
// infinite recursion with recursive class types.
common::T_named_struct(llvm_type_name(cx, a_class, did, (*substs).tps))
common::T_named_struct(llvm_type_name(cx, a_class, did, substs.tps))
}
ty::ty_self => cx.tcx.sess.unimpl(~"type_of: ty_self"),
ty::ty_infer(*) => cx.tcx.sess.bug(~"type_of with ty_infer"),

View File

@ -3535,7 +3535,10 @@ fn store_trait_methods(cx: ctxt, id: ast::node_id, ms: @~[method]) {
fn provided_trait_methods(cx: ctxt, id: ast::def_id) -> ~[ast::ident] {
if is_local(id) {
match cx.items.find(id.node) {
Some(ast_map::node_item(@{node: item_trait(_, _, ref ms),_}, _)) =>
Some(ast_map::node_item(@{
node: item_trait(_, _, ref ms),
_
}, _)) =>
match ast_util::split_trait_methods((*ms)) {
(_, p) => p.map(|method| method.ident)
},
@ -3603,7 +3606,9 @@ fn impl_traits(cx: ctxt, id: ast::def_id, vstore: vstore) -> ~[t] {
fn vstoreify(cx: ctxt, ty: t, vstore: vstore) -> t {
match ty::get(ty).sty {
ty::ty_trait(_, _, trait_vstore) if vstore == trait_vstore => ty,
ty::ty_trait(did, ref substs, _) => mk_trait(cx, did, (*substs), vstore),
ty::ty_trait(did, ref substs, _) => {
mk_trait(cx, did, (*substs), vstore)
}
_ => cx.sess.bug(~"impl_traits: not a trait")
}
}
@ -3825,8 +3830,10 @@ fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[VariantInfo] {
expr, since check_enum_variants also updates the enum_var_cache
*/
match cx.items.get(id.node) {
ast_map::node_item(@{node: ast::item_enum(ref enum_definition, _), _},
_) => {
ast_map::node_item(@{
node: ast::item_enum(ref enum_definition, _),
_
}, _) => {
let variants = (*enum_definition).variants;
let mut disr_val = -1;
@vec::map(variants, |variant| {

View File

@ -883,9 +883,9 @@ impl LookupContext {
let candidates_same = match (&candidate_a.origin,
&candidate_b.origin) {
(&method_param(ref p1), &method_param(ref p2)) => {
let same_trait = (*p1).trait_id == (*p2).trait_id;
let same_method = (*p1).method_num == (*p2).method_num;
let same_param = (*p1).param_num == (*p2).param_num;
let same_trait = p1.trait_id == p2.trait_id;
let same_method = p1.method_num == p2.method_num;
let same_param = p1.param_num == p2.param_num;
// The bound number may be different because
// multiple bounds may lead to the same trait
// impl

View File

@ -3048,7 +3048,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
~"log10f32" => {
(0u, ~[arg(ast::by_copy, ty::mk_f32(tcx))],
ty::mk_f32(tcx))
}
}
~"log10f64" => {
(0u, ~[arg(ast::by_copy, ty::mk_f64(tcx))],
ty::mk_f64(tcx))

View File

@ -165,8 +165,11 @@ fn get_enum_variant_types(ccx: @crate_ctxt,
ccx, rp, struct_def, ty_params, tpt, variant.node.id);
}
ast::enum_variant_kind(ref enum_definition) => {
get_enum_variant_types(ccx, enum_ty, (*enum_definition).variants,
ty_params, rp);
get_enum_variant_types(ccx,
enum_ty,
enum_definition.variants,
ty_params,
rp);
result_ty = None;
}
};
@ -232,11 +235,16 @@ fn ensure_trait_methods(ccx: @crate_ctxt, id: ast::node_id, trait_ty: ty::t) {
let tcx = ccx.tcx;
let region_paramd = tcx.region_paramd_items.find(id);
match tcx.items.get(id) {
ast_map::node_item(@{node: ast::item_trait(params, _, ref ms), _}, _) => {
ast_map::node_item(@{
node: ast::item_trait(params, _, ref ms),
_
}, _) => {
store_methods::<ast::trait_method>(ccx, id, (*ms), |m| {
let def_id;
match *m {
ast::required(ref ty_method) => def_id = local_def((*ty_method).id),
ast::required(ref ty_method) => {
def_id = local_def((*ty_method).id)
}
ast::provided(method) => def_id = local_def(method.id)
}

View File

@ -211,7 +211,9 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
_ => false
},
ast::meta_name_value(ref na, va) => match b.node {
ast::meta_name_value(ref nb, vb) => (*na) == (*nb) && va.node == vb.node,
ast::meta_name_value(ref nb, vb) => {
(*na) == (*nb) && va.node == vb.node
}
_ => false
},
ast::meta_list(*) => {

View File

@ -311,7 +311,7 @@ pub impl CodeMap {
FssExternal(ref eloc) => {
{filename: /* FIXME (#2543) */ copy (*eloc).filename,
line: (*eloc).line + loc.line - 1u,
col: if loc.line == 1u {(*eloc).col + loc.col} else {loc.col},
col: if loc.line == 1 {eloc.col + loc.col} else {loc.col},
file: None}
}
}

View File

@ -283,7 +283,7 @@ fn expand_stmt(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
-> (stmt_, span)
{
let (mac, pth, tts, semi) = biased_match! (
(s) ~ (stmt_mac(ref mac, semi)) else return orig(s, sp, fld);
(s) ~ (stmt_mac(ref mac, semi)) else return orig(s, sp, fld);
((*mac).node) ~ (mac_invoc_tt(pth, ref tts)) else {
cx.span_bug((*mac).span, ~"naked syntactic bit")
};

View File

@ -422,7 +422,9 @@ fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
return match block_to_ident(blk) {
Some(id) => {
match follow_for_trans(cx, b.find(id), idx_path) {
Some(match_block(ref new_blk)) => ((*new_blk).node, (*new_blk).span),
Some(match_block(ref new_blk)) => {
((*new_blk).node, (*new_blk).span)
}
// possibly allow promotion of ident/path/expr to blocks?
Some(ref m) => match_error(cx, (*m), ~"a block"),

View File

@ -185,7 +185,9 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
match m {
{node: match_tok(_), span: _} => (),
{node: match_seq(ref more_ms, _, _, _, _), span: _} => {
for (*more_ms).each() |next_m| { n_rec(p_s, *next_m, res, ret_val) };
for (*more_ms).each() |next_m| {
n_rec(p_s, *next_m, res, ret_val)
};
}
{node: match_nonterminal(bind_name, _, idx), span: sp} => {
if ret_val.contains_key(bind_name) {

View File

@ -94,7 +94,9 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
@matched_nonterminal(nt_tt(@ref tt)) => {
match (*tt) {
// cut off delimiters; don't parse 'em
tt_delim(ref tts) => (*tts).slice(1u,(*tts).len()-1u),
tt_delim(ref tts) => {
(*tts).slice(1u,(*tts).len()-1u)
}
_ => cx.span_fatal(
sp, ~"macro rhs must be delimited")
}

View File

@ -199,8 +199,8 @@ fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
~"attempted to repeat an expression containing no syntax \
variables matched as repeating at this depth");
}
lis_contradiction(ref msg) => { /* FIXME #2887 blame macro invoker
instead*/
lis_contradiction(ref msg) => {
/* FIXME #2887 blame macro invoker instead*/
r.sp_diag.span_fatal(sp, (*msg));
}
lis_constraint(len, _) => {
@ -217,8 +217,13 @@ fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
} else {
r.repeat_len.push(len);
r.repeat_idx.push(0u);
r.cur = @{readme: (*tts), mut idx: 0u, dotdotdoted: true,
sep: (*sep), up: tt_frame_up(option::Some(r.cur))};
r.cur = @{
readme: (*tts),
mut idx: 0u,
dotdotdoted: true,
sep: (*sep),
up: tt_frame_up(option::Some(r.cur))
};
}
}
}

View File

@ -519,7 +519,8 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
ty_vec(mt) => ty_vec(fold_mt(mt, fld)),
ty_ptr(mt) => ty_ptr(fold_mt(mt, fld)),
ty_rptr(region, mt) => ty_rptr(region, fold_mt(mt, fld)),
ty_rec(ref fields) => ty_rec(vec::map((*fields), |f| fold_field(*f, fld))),
ty_rec(ref fields) =>
ty_rec(vec::map((*fields), |f| fold_field(*f, fld))),
ty_fn(f) =>
ty_fn(@TyFn {
proto: f.proto,

View File

@ -155,7 +155,9 @@ macro_rules! maybe_whole (
_ => ()
}) ;
(pair_empty $p:expr, $constructor:ident) => ( match copy $p.token {
INTERPOLATED(token::$constructor(ref x)) => { $p.bump(); return (~[], (*x)); }
INTERPOLATED(token::$constructor(ref x)) => {
$p.bump(); return (~[], (*x));
}
_ => ()
})

View File

@ -744,7 +744,8 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
/// expression arguments as expressions). It can be done! I think.
fn print_tt(s: ps, tt: ast::token_tree) {
match tt {
ast::tt_delim(ref tts) => for (*tts).each() |tt_elt| { print_tt(s, *tt_elt); },
ast::tt_delim(ref tts) =>
for (*tts).each() |tt_elt| { print_tt(s, *tt_elt); },
ast::tt_tok(_, ref tk) => {
match (*tk) {
parse::token::IDENT(*) => { // don't let idents run together