diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-18 22:37:22 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-18 23:17:34 -0800 |
| commit | 04a2887f8791bb080b4e76a55949a7c1954dbb97 (patch) | |
| tree | f072b2cc1e0b41270041a3a10a4fc313d3fa1a89 /src/comp/middle | |
| parent | ca7cfbe3d0251766217e5d4e559903e655e7549b (diff) | |
| download | rust-04a2887f8791bb080b4e76a55949a7c1954dbb97.tar.gz rust-04a2887f8791bb080b4e76a55949a7c1954dbb97.zip | |
Remove '.' after nullary tags in patterns
Does what it says on the tin. The next commit will remove support for this syntax.
Diffstat (limited to 'src/comp/middle')
29 files changed, 724 insertions, 724 deletions
diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index 93239ec116e..c799e9956b0 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -90,10 +90,10 @@ fn visit_fn(cx: @ctx, _fk: visit::fn_kind, decl: ast::fn_decl, // be called multiple times. let proto = ty::ty_fn_proto(cx.tcx, fty); alt proto { - ast::proto_block. | ast::proto_any. { + ast::proto_block | ast::proto_any { check_loop(*cx, sc) {|| v.visit_block(body, sc, v);} } - ast::proto_box. | ast::proto_uniq. | ast::proto_bare. { + ast::proto_box | ast::proto_uniq | ast::proto_bare { let sc = {bs: [], invalid: @mutable list::nil}; v.visit_block(body, sc, v); } @@ -156,7 +156,7 @@ fn visit_block(cx: @ctx, b: ast::blk, sc: scope, v: vt<scope>) { check_lval(cx, init.expr, sc, v); } } - none. { } + none { } } } } @@ -197,9 +197,9 @@ fn add_bindings_for_let(cx: ctx, &bs: [binding], loc: @ast::local) { fn cant_copy(cx: ctx, b: binding) -> bool { alt b.copied { - not_allowed. { ret true; } - copied. { ret false; } - not_copied. {} + not_allowed { ret true; } + copied { ret false; } + not_copied {} } let ty = ty::node_id_to_type(cx.tcx, b.node_id); if ty::type_allows_implicit_copy(cx.tcx, ty) { @@ -240,8 +240,8 @@ fn check_call(cx: ctx, sc: scope, f: @ast::expr, args: [@ast::expr]) local_id: 0u, unsafe_tys: unsafe_set(root.mut), mutable copied: alt arg_t.mode { - ast::by_move. | ast::by_copy. { copied } - ast::by_mut_ref. { not_allowed } + ast::by_move | ast::by_copy { copied } + ast::by_mut_ref { not_allowed } _ { not_copied } }}]; i += 1u; @@ -306,7 +306,7 @@ fn check_call(cx: ctx, sc: scope, f: @ast::expr, args: [@ast::expr]) break; } } - none. { } + none { } } } i += 1u; @@ -335,7 +335,7 @@ fn check_alt(cx: ctx, input: @ast::expr, arms: [ast::arm], sc: scope, let canon_id = pat_id_map.get(proot.name); alt vec::find(binding_info, {|x| x.id == canon_id}) { some(s) { s.unsafe_tys += unsafe_set(proot.mut); } - none. { + none { binding_info += [ {id: canon_id, mutable unsafe_tys: unsafe_set(proot.mut), @@ -466,8 +466,8 @@ fn test_scope(cx: ctx, sc: scope, b: binding, p: @ast::path) { if !is_none(prob) && cant_copy(cx, b) { let i = option::get(prob); let msg = alt i.reason { - overwritten. { "overwriting " + ast_util::path_name(i.path) } - val_taken. { "taking the value of " + ast_util::path_name(i.path) } + overwritten { "overwriting " + ast_util::path_name(i.path) } + val_taken { "taking the value of " + ast_util::path_name(i.path) } }; err(cx, i.sp, msg + " will invalidate reference " + ast_util::path_name(p) + ", which is still used"); @@ -523,7 +523,7 @@ fn ty_can_unsafely_include(cx: ctx, needle: unsafe_ty, haystack: ty::t, for t in ts { if helper(tcx, needle, t, mut) { ret true; } } ret false; } - ty::ty_fn({proto: ast::proto_bare., _}) { ret false; } + ty::ty_fn({proto: ast::proto_bare, _}) { ret false; } // These may contain anything. ty::ty_fn(_) | ty::ty_iface(_, _) { ret true; } // A type param may include everything, but can only be @@ -557,13 +557,13 @@ fn local_id_of_node(cx: ctx, id: node_id) -> uint { fn copy_is_expensive(tcx: ty::ctxt, ty: ty::t) -> bool { fn score_ty(tcx: ty::ctxt, ty: ty::t) -> uint { ret alt ty::struct(tcx, ty) { - ty::ty_nil. | ty::ty_bot. | ty::ty_bool. | ty::ty_int(_) | - ty::ty_uint(_) | ty::ty_float(_) | ty::ty_type. | ty::ty_native(_) | + ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_int(_) | + ty::ty_uint(_) | ty::ty_float(_) | ty::ty_type | ty::ty_native(_) | ty::ty_ptr(_) { 1u } ty::ty_box(_) | ty::ty_iface(_, _) { 3u } ty::ty_constr(t, _) | ty::ty_res(_, t, _) { score_ty(tcx, t) } ty::ty_fn(_) | ty::ty_native_fn(_, _) { 4u } - ty::ty_str. | ty::ty_vec(_) | ty::ty_param(_, _) { 50u } + ty::ty_str | ty::ty_vec(_) | ty::ty_param(_, _) { 50u } ty::ty_uniq(mt) { 1u + score_ty(tcx, mt.ty) } ty::ty_tag(_, ts) | ty::ty_tup(ts) { let sum = 0u; @@ -590,7 +590,7 @@ fn pattern_roots(tcx: ty::ctxt, mut: option::t<unsafe_ty>, pat: @ast::pat) fn walk(tcx: ty::ctxt, mut: option::t<unsafe_ty>, pat: @ast::pat, &set: [pattern_root]) { alt normalize_pat(tcx, pat).node { - ast::pat_wild. | ast::pat_lit(_) | ast::pat_range(_, _) {} + ast::pat_wild | ast::pat_lit(_) | ast::pat_range(_, _) {} ast::pat_ident(nm, sub) { set += [{id: pat.id, name: path_to_ident(nm), mut: mut, span: pat.span}]; @@ -648,7 +648,7 @@ fn find_invalid(id: node_id, lst: list<@invalid>) let cur = lst; while true { alt cur { - list::nil. { break; } + list::nil { break; } list::cons(head, tail) { if head.node_id == id { ret some(head); } cur = *tail; diff --git a/src/comp/middle/capture.rs b/src/comp/middle/capture.rs index b9e9a02c0f0..9fb600d41c7 100644 --- a/src/comp/middle/capture.rs +++ b/src/comp/middle/capture.rs @@ -75,11 +75,11 @@ fn check_capture_clause(tcx: ty::ctxt, }; alt fn_proto { - ast::proto_any. | ast::proto_block. { + ast::proto_any | ast::proto_block { check_block_captures(cap_clause.copies); check_block_captures(cap_clause.moves); } - ast::proto_bare. | ast::proto_box. | ast::proto_uniq. { + ast::proto_bare | ast::proto_box | ast::proto_uniq { vec::iter(cap_clause.copies, check_capture_item); vec::iter(cap_clause.moves, check_capture_item); vec::iter(cap_clause.moves, check_not_upvar); @@ -113,15 +113,15 @@ fn compute_capture_vars(tcx: ty::ctxt, } let implicit_mode = alt fn_proto { - ast::proto_any. | ast::proto_block. { cap_ref } - ast::proto_bare. | ast::proto_box. | ast::proto_uniq. { cap_copy } + ast::proto_any | ast::proto_block { cap_ref } + ast::proto_bare | ast::proto_box | ast::proto_uniq { cap_copy } }; vec::iter(*freevars) { |fvar| let fvar_def_id = ast_util::def_id_of_def(fvar.def).node; alt cap_map.find(fvar_def_id) { option::some(_) { /* was explicitly named, do nothing */ } - option::none. { + option::none { cap_map.insert(fvar_def_id, {def:fvar.def, mode:implicit_mode}); } } diff --git a/src/comp/middle/check_alt.rs b/src/comp/middle/check_alt.rs index e32866e5749..15b4a074b37 100644 --- a/src/comp/middle/check_alt.rs +++ b/src/comp/middle/check_alt.rs @@ -73,7 +73,7 @@ fn pattern_supersedes(tcx: ty::ctxt, a: @pat, b: @pat) -> bool { alt a.node { pat_ident(_, some(p)) { pattern_supersedes(tcx, p, b) } - pat_wild. | pat_ident(_, none.) { true } + pat_wild | pat_ident(_, none) { true } pat_lit(la) { alt b.node { pat_lit(lb) { lit_expr_eq(la, lb) } @@ -142,7 +142,7 @@ fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool { pat_box(sub) | pat_uniq(sub) | pat_ident(_, some(sub)) { is_refutable(tcx, sub) } - pat_wild. | pat_ident(_, none.) { false } + pat_wild | pat_ident(_, none) { false } pat_lit(_) { true } pat_rec(fields, _) { for field: field_pat in fields { diff --git a/src/comp/middle/check_const.rs b/src/comp/middle/check_const.rs index 943c9184fe2..b623bfc1795 100644 --- a/src/comp/middle/check_const.rs +++ b/src/comp/middle/check_const.rs @@ -45,7 +45,7 @@ fn check_expr(sess: session, e: @expr, &&is_const: bool, v: visit::vt<bool>) { if is_const { alt e.node { expr_unary(box(_), _) | expr_unary(uniq(_), _) | - expr_unary(deref., _){ + expr_unary(deref, _){ sess.span_err(e.span, "disallowed operator in constant expression"); ret; diff --git a/src/comp/middle/debuginfo.rs b/src/comp/middle/debuginfo.rs index e7401fb888b..0a0259ec584 100644 --- a/src/comp/middle/debuginfo.rs +++ b/src/comp/middle/debuginfo.rs @@ -160,7 +160,7 @@ fn create_compile_unit(cx: @crate_ctxt, full_path: str) alt cached_metadata::<@metadata<compile_unit_md>>(cache, tg, {|md| md.data.path == full_path}) { option::some(md) { ret md; } - option::none. {} + option::none {} } let work_dir = cx.sess.working_dir; @@ -202,7 +202,7 @@ fn create_file(cx: @crate_ctxt, full_path: str) -> @metadata<file_md> { alt cached_metadata::<@metadata<file_md>>( cache, tg, {|md| md.data.path == full_path}) { option::some(md) { ret md; } - option::none. {} + option::none {} } let fname = fs::basename(full_path); @@ -234,17 +234,17 @@ fn create_block(cx: @block_ctxt) -> @metadata<block_md> { cache, tg, {|md| start == md.data.start && end == md.data.end}) { option::some(md) { ret md; } - option::none. {} + option::none {} } let parent = alt cx.parent { - trans_common::parent_none. { create_function(cx.fcx).node } + trans_common::parent_none { create_function(cx.fcx).node } trans_common::parent_some(bcx) { create_block(cx).node } }; let file_node = create_file(bcx_ccx(cx), fname); let unique_id = alt cache.find(LexicalBlockTag) { option::some(v) { vec::len(v) as int } - option::none. { 0 } + option::none { 0 } }; let lldata = [lltag(tg), parent, @@ -270,30 +270,30 @@ fn create_basic_type(cx: @crate_ctxt, t: ty::t, ty: @ast::ty) alt cached_metadata::<@metadata<tydesc_md>>( cache, tg, {|md| t == md.data.hash}) { option::some(md) { ret md; } - option::none. {} + option::none {} } let (name, (size, align), encoding) = alt ty.node { - ast::ty_bool. {("bool", size_and_align_of::<bool>(), DW_ATE_boolean)} + ast::ty_bool {("bool", size_and_align_of::<bool>(), DW_ATE_boolean)} ast::ty_int(m) { alt m { - ast::ty_char. {("char", size_and_align_of::<char>(), DW_ATE_unsigned)} - ast::ty_i. {("int", size_and_align_of::<int>(), DW_ATE_signed)} - ast::ty_i8. {("i8", size_and_align_of::<i8>(), DW_ATE_signed_char)} - ast::ty_i16. {("i16", size_and_align_of::<i16>(), DW_ATE_signed)} - ast::ty_i32. {("i32", size_and_align_of::<i32>(), DW_ATE_signed)} - ast::ty_i64. {("i64", size_and_align_of::<i64>(), DW_ATE_signed)} + ast::ty_char {("char", size_and_align_of::<char>(), DW_ATE_unsigned)} + ast::ty_i {("int", size_and_align_of::<int>(), DW_ATE_signed)} + ast::ty_i8 {("i8", size_and_align_of::<i8>(), DW_ATE_signed_char)} + ast::ty_i16 {("i16", size_and_align_of::<i16>(), DW_ATE_signed)} + ast::ty_i32 {("i32", size_and_align_of::<i32>(), DW_ATE_signed)} + ast::ty_i64 {("i64", size_and_align_of::<i64>(), DW_ATE_signed)} }} ast::ty_uint(m) { alt m { - ast::ty_u. {("uint", size_and_align_of::<uint>(), DW_ATE_unsigned)} - ast::ty_u8. {("u8", size_and_align_of::<u8>(), DW_ATE_unsigned_char)} - ast::ty_u16. {("u16", size_and_align_of::<u16>(), DW_ATE_unsigned)} - ast::ty_u32. {("u32", size_and_align_of::<u32>(), DW_ATE_unsigned)} - ast::ty_u64. {("u64", size_and_align_of::<u64>(), DW_ATE_unsigned)} + ast::ty_u {("uint", size_and_align_of::<uint>(), DW_ATE_unsigned)} + ast::ty_u8 {("u8", size_and_align_of::<u8>(), DW_ATE_unsigned_char)} + ast::ty_u16 {("u16", size_and_align_of::<u16>(), DW_ATE_unsigned)} + ast::ty_u32 {("u32", size_and_align_of::<u32>(), DW_ATE_unsigned)} + ast::ty_u64 {("u64", size_and_align_of::<u64>(), DW_ATE_unsigned)} }} ast::ty_float(m) { alt m { - ast::ty_f. {("float", size_and_align_of::<float>(), DW_ATE_float)} - ast::ty_f32. {("f32", size_and_align_of::<f32>(), DW_ATE_float)} - ast::ty_f64. {("f64", size_and_align_of::<f64>(), DW_ATE_float)} + ast::ty_f {("float", size_and_align_of::<float>(), DW_ATE_float)} + ast::ty_f32 {("f32", size_and_align_of::<f32>(), DW_ATE_float)} + ast::ty_f64 {("f64", size_and_align_of::<f64>(), DW_ATE_float)} }} }; @@ -325,7 +325,7 @@ fn create_pointer_type(cx: @crate_ctxt, t: ty::t, span: codemap::span, alt cached_metadata::<@metadata<tydesc_md>>( cache, tg, {|md| ty::hash_ty(t) == ty::hash_ty(md.data.hash)}) { option::some(md) { ret md; } - option::none. {} + option::none {} }*/ let (size, align) = size_and_align_of::<ctypes::intptr_t>(); let fname = filename_from_span(cx, span); @@ -418,7 +418,7 @@ fn create_boxed_type(cx: @crate_ctxt, outer: ty::t, _inner: ty::t, alt cached_metadata::<@metadata<tydesc_md>>( cache, tg, {|md| ty::hash_ty(outer) == ty::hash_ty(md.data.hash)}) { option::some(md) { ret md; } - option::none. {} + option::none {} }*/ let fname = filename_from_span(cx, span); let file_node = create_file(cx, fname); @@ -492,24 +492,24 @@ fn create_vec(cx: @crate_ctxt, vec_t: ty::t, elem_t: ty::t, vec_ty: @ast::ty) fn member_size_and_align(ty: @ast::ty) -> (int, int) { alt ty.node { - ast::ty_bool. { size_and_align_of::<bool>() } + ast::ty_bool { size_and_align_of::<bool>() } ast::ty_int(m) { alt m { - ast::ty_char. { size_and_align_of::<char>() } - ast::ty_i. { size_and_align_of::<int>() } - ast::ty_i8. { size_and_align_of::<i8>() } - ast::ty_i16. { size_and_align_of::<i16>() } - ast::ty_i32. { size_and_align_of::<i32>() } + ast::ty_char { size_and_align_of::<char>() } + ast::ty_i { size_and_align_of::<int>() } + ast::ty_i8 { size_and_align_of::<i8>() } + ast::ty_i16 { size_and_align_of::<i16>() } + ast::ty_i32 { size_and_align_of::<i32>() } }} ast::ty_uint(m) { alt m { - ast::ty_u. { size_and_align_of::<uint>() } - ast::ty_u8. { size_and_align_of::<i8>() } - ast::ty_u16. { size_and_align_of::<u16>() } - ast::ty_u32. { size_and_align_of::<u32>() } + ast::ty_u { size_and_align_of::<uint>() } + ast::ty_u8 { size_and_align_of::<i8>() } + ast::ty_u16 { size_and_align_of::<u16>() } + ast::ty_u32 { size_and_align_of::<u32>() } }} ast::ty_float(m) { alt m { - ast::ty_f. { size_and_align_of::<float>() } - ast::ty_f32. { size_and_align_of::<f32>() } - ast::ty_f64. { size_and_align_of::<f64>() } + ast::ty_f { size_and_align_of::<float>() } + ast::ty_f32 { size_and_align_of::<f32>() } + ast::ty_f64 { size_and_align_of::<f64>() } }} ast::ty_box(_) | ast::ty_uniq(_) { size_and_align_of::<ctypes::uintptr_t>() @@ -534,14 +534,14 @@ fn create_ty(cx: @crate_ctxt, t: ty::t, ty: @ast::ty) alt cached_metadata::<@metadata<tydesc_md>>( cache, tg, {|md| t == md.data.hash}) { option::some(md) { ret md; } - option::none. {} + option::none {} }*/ fn t_to_ty(cx: @crate_ctxt, t: ty::t, span: codemap::span) -> @ast::ty { let ty = alt ty::struct(ccx_tcx(cx), t) { - ty::ty_nil. { ast::ty_nil } - ty::ty_bot. { ast::ty_bot } - ty::ty_bool. { ast::ty_bool } + ty::ty_nil { ast::ty_nil } + ty::ty_bot { ast::ty_bot } + ty::ty_bool { ast::ty_bool } ty::ty_int(t) { ast::ty_int(t) } ty::ty_float(t) { ast::ty_float(t) } ty::ty_uint(t) { ast::ty_uint(t) } @@ -627,7 +627,7 @@ fn create_local_var(bcx: @block_ctxt, local: @ast::local) alt cached_metadata::<@metadata<local_var_md>>( cache, tg, {|md| md.data.id == local.node.id}) { option::some(md) { ret md; } - option::none. {} + option::none {} } let name = path_to_ident(alt pat_util::normalize_pat(bcx_tcx(bcx), @@ -640,7 +640,7 @@ fn create_local_var(bcx: @block_ctxt, local: @ast::local) let tymd = create_ty(cx, ty, local.node.ty); let filemd = create_file(cx, loc.filename); let context = alt bcx.parent { - trans_common::parent_none. { create_function(bcx.fcx).node } + trans_common::parent_none { create_function(bcx.fcx).node } trans_common::parent_some(_) { create_block(bcx).node } }; let mdnode = create_var(tg, context, name, filemd.node, @@ -650,7 +650,7 @@ fn create_local_var(bcx: @block_ctxt, local: @ast::local) let llptr = alt bcx.fcx.lllocals.find(local.node.id) { option::some(local_mem(v)) { v } - option::none. { + option::none { alt bcx.fcx.lllocals.get(local.node.pat.id) { local_imm(v) { v } } @@ -671,7 +671,7 @@ fn create_arg(bcx: @block_ctxt, arg: ast::arg) alt cached_metadata::<@metadata<argument_md>>( cache, ArgVariableTag, {|md| md.data.id == arg.id}) { option::some(md) { ret md; } - option::none. {} + option::none {} } /*let arg_n = alt cx.ast_map.get(arg.id) { @@ -759,7 +759,7 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> { cache, SubprogramTag, {|md| md.data.path == path && /*md.data.path == ??*/ true}) { option::some(md) { ret md; } - option::none. {} + option::none {} } let loc = codemap::lookup_char_pos(cx.sess.codemap, @@ -769,7 +769,7 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> { let mangled = cx.item_symbols.get(key); let ty_node = if cx.sess.opts.extra_debuginfo { alt ret_ty.node { - ast::ty_nil. { llnull() } + ast::ty_nil { llnull() } _ { create_ty(cx, ty::node_id_to_type(ccx_tcx(cx), id), ret_ty).node } } diff --git a/src/comp/middle/fn_usage.rs b/src/comp/middle/fn_usage.rs index 6901ae9d9f9..79ded67a2a9 100644 --- a/src/comp/middle/fn_usage.rs +++ b/src/comp/middle/fn_usage.rs @@ -19,8 +19,8 @@ fn fn_usage_expr(expr: @ast::expr, ast::expr_path(path) { if !ctx.unsafe_fn_legal { alt ctx.tcx.def_map.find(expr.id) { - some(ast::def_fn(_, ast::unsafe_fn.)) | - some(ast::def_native_fn(_, ast::unsafe_fn.)) { + some(ast::def_fn(_, ast::unsafe_fn)) | + some(ast::def_native_fn(_, ast::unsafe_fn)) { log(error, ("expr=", expr_to_str(expr))); ctx.tcx.sess.span_fatal( expr.span, @@ -33,7 +33,7 @@ fn fn_usage_expr(expr: @ast::expr, if !ctx.generic_bare_fn_legal && ty::expr_has_ty_params(ctx.tcx, expr) { alt ty::struct(ctx.tcx, ty::expr_ty(ctx.tcx, expr)) { - ty::ty_fn({proto: ast::proto_bare., _}) { + ty::ty_fn({proto: ast::proto_bare, _}) { ctx.tcx.sess.span_fatal( expr.span, "generic bare functions can only be called or bound"); diff --git a/src/comp/middle/freevars.rs b/src/comp/middle/freevars.rs index 8578556b28e..cce5b3973b8 100644 --- a/src/comp/middle/freevars.rs +++ b/src/comp/middle/freevars.rs @@ -49,7 +49,7 @@ fn collect_freevars(def_map: resolve::def_map, blk: ast::blk) ast::expr_path(path) { let i = 0; alt def_map.find(expr.id) { - none. { fail ("Not found: " + path_to_str(path)) } + none { fail ("Not found: " + path_to_str(path)) } some(df) { let def = df; while i < depth { @@ -104,7 +104,7 @@ fn annotate_freevars(def_map: resolve::def_map, crate: @ast::crate) -> fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info { alt tcx.freevars.find(fid) { - none. { fail "get_freevars: " + int::str(fid) + " has no freevars"; } + none { fail "get_freevars: " + int::str(fid) + " has no freevars"; } some(d) { ret d; } } } diff --git a/src/comp/middle/gc.rs b/src/comp/middle/gc.rs index ebd1d4ff9f4..f67ac128b5e 100644 --- a/src/comp/middle/gc.rs +++ b/src/comp/middle/gc.rs @@ -51,7 +51,7 @@ fn add_gc_root(cx: @block_ctxt, llval: ValueRef, ty: ty::t) -> @block_ctxt { let llvalptr = bld::PointerCast(bcx, llval, T_ptr(T_ptr(T_i8()))); alt td_r.kind { - tk_derived. { + tk_derived { // It's a derived type descriptor. First, spill it. let lltydescptr = trans::alloca(bcx, val_ty(lltydesc)); @@ -81,11 +81,11 @@ fn add_gc_root(cx: @block_ctxt, llval: ValueRef, ty: ty::t) -> @block_ctxt { bld::Call(llderivedtydescs, gcroot, [lltydescptr, lldestindex]); bld::Call(bcx, gcroot, [llvalptr, llsrcindex]); } - tk_param. { + tk_param { bcx_tcx(cx).sess.bug("we should never be trying to root values " + "of a type parameter"); } - tk_static. { + tk_static { // Static type descriptor. let llstaticgcmeta = @@ -103,9 +103,9 @@ fn add_gc_root(cx: @block_ctxt, llval: ValueRef, ty: ty::t) -> @block_ctxt { fn type_is_gc_relevant(cx: ty::ctxt, ty: ty::t) -> bool { alt ty::struct(cx, ty) { - ty::ty_nil. | ty::ty_bot. | ty::ty_bool. | ty::ty_int(_) | - ty::ty_float(_) | ty::ty_uint(_) | ty::ty_str. | - ty::ty_type. | ty::ty_native(_) | ty::ty_ptr(_) | ty::ty_type. | + ty::ty_nil | ty::ty_bot | ty::ty_bool | ty::ty_int(_) | + ty::ty_float(_) | ty::ty_uint(_) | ty::ty_str | + ty::ty_type | ty::ty_native(_) | ty::ty_ptr(_) | ty::ty_type. | ty::ty_native(_) { ret false; } diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index 575b1cc0189..600389b3058 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -22,9 +22,9 @@ import driver::session::session; fn kind_to_str(k: kind) -> str { alt k { - kind_sendable. { "sendable" } - kind_copyable. { "copyable" } - kind_noncopyable. { "noncopyable" } + kind_sendable { "sendable" } + kind_copyable { "copyable" } + kind_noncopyable { "noncopyable" } } } @@ -61,10 +61,10 @@ fn with_appropriate_checker(cx: ctx, id: node_id, b: block(fn@(ctx, ty::t, sp: span))) { let fty = ty::node_id_to_monotype(cx.tcx, id); alt ty::ty_fn_proto(cx.tcx, fty) { - proto_uniq. { b(check_send); } - proto_box. { b(check_copy); } - proto_bare. { b(check_none); } - proto_any. | proto_block. { /* no check needed */ } + proto_uniq { b(check_send); } + proto_box { b(check_copy); } + proto_bare { b(check_none); } + proto_any | proto_block { /* no check needed */ } } } @@ -135,7 +135,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) { expr_ret(some(ex)) { maybe_copy(cx, ex); } expr_copy(expr) { check_copy_ex(cx, expr, false); } // Vector add copies. - expr_binary(add., ls, rs) { maybe_copy(cx, ls); maybe_copy(cx, rs); } + expr_binary(add, ls, rs) { maybe_copy(cx, ls); maybe_copy(cx, rs); } expr_rec(fields, def) { for field in fields { maybe_copy(cx, field.node.expr); } alt def { @@ -163,7 +163,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) { expr_call(f, args, _) { let i = 0u; for arg_t in ty::ty_fn_args(cx.tcx, ty::expr_ty(cx.tcx, f)) { - alt arg_t.mode { by_copy. { maybe_copy(cx, args[i]); } _ {} } + alt arg_t.mode { by_copy { maybe_copy(cx, args[i]); } _ {} } i += 1u; } } @@ -186,7 +186,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) { i += 1u; } } - none. {} + none {} } } expr_ternary(_, a, b) { maybe_copy(cx, a); maybe_copy(cx, b); } @@ -203,7 +203,7 @@ fn check_stmt(stmt: @stmt, cx: ctx, v: visit::vt<ctx>) { stmt_decl(@{node: decl_local(locals), _}, _) { for (_, local) in locals { alt local.node.init { - some({op: init_assign., expr}) { maybe_copy(cx, expr); } + some({op: init_assign, expr}) { maybe_copy(cx, expr); } _ {} } } diff --git a/src/comp/middle/last_use.rs b/src/comp/middle/last_use.rs index 7126199349d..c5c7c544831 100644 --- a/src/comp/middle/last_use.rs +++ b/src/comp/middle/last_use.rs @@ -80,7 +80,7 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) { visit::visit_expr_opt(oexpr, cx, v); leave_fn(cx); } - expr_break. { add_block_exit(cx, loop); } + expr_break { add_block_exit(cx, loop); } expr_while(_, _) | expr_do_while(_, _) { visit_block(loop, cx) {|| visit::visit_expr(ex, cx, v);} } @@ -160,7 +160,7 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) { } _ { alt arg_ts[i].mode { - by_mut_ref. { clear_if_path(cx, arg, v, false); } + by_mut_ref { clear_if_path(cx, arg, v, false); } _ { v.visit_expr(arg, cx, v); } } } @@ -179,12 +179,12 @@ fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, let fty = ty::node_id_to_type(cx.tcx, id); let proto = ty::ty_fn_proto(cx.tcx, fty); alt proto { - proto_any. | proto_block. { + proto_any | proto_block { visit_block(func, cx, {|| visit::visit_fn(fk, decl, body, sp, id, cx, v); }); } - proto_box. | proto_uniq. | proto_bare. { + proto_box | proto_uniq | proto_bare { alt cx.tcx.freevars.find(id) { some(vars) { for v in *vars { @@ -283,8 +283,8 @@ fn clear_in_current(cx: ctx, my_def: node_id, to: bool) { fn clear_def_if_path(cx: ctx, d: def, to: bool) -> option<node_id> { alt d { - def_local(def_id, let_copy.) | def_arg(def_id, by_copy.) | - def_arg(def_id, by_move.) { + def_local(def_id, let_copy) | def_arg(def_id, by_copy) | + def_arg(def_id, by_move) { clear_in_current(cx, def_id.node, to); some(def_id.node) } diff --git a/src/comp/middle/mut.rs b/src/comp/middle/mut.rs index 8071ea0972f..d67a03d4a53 100644 --- a/src/comp/middle/mut.rs +++ b/src/comp/middle/mut.rs @@ -75,7 +75,7 @@ fn expr_root(tcx: ty::ctxt, ex: @expr, autoderef: bool) -> kind: index, outer_t: auto_unbox.t}]; } - ty::ty_str. { + ty::ty_str { ds += [@{mut: false, kind: index, outer_t: auto_unbox.t}]; } } @@ -125,9 +125,9 @@ tag msg { msg_assign; msg_move_out; msg_mut_ref; } fn mk_err(cx: @ctx, span: syntax::codemap::span, msg: msg, name: str) { cx.tcx.sess.span_err(span, alt msg { - msg_assign. { "assigning to " + name } - msg_move_out. { "moving out of " + name } - msg_mut_ref. { "passing " + name + " by mutable reference" } + msg_assign { "assigning to " + name } + msg_move_out { "moving out of " + name } + msg_mut_ref { "passing " + name + " by mutable reference" } }); } @@ -140,7 +140,7 @@ fn visit_decl(cx: @ctx, d: @decl, &&e: (), v: visit::vt<()>) { some(init) { if init.op == init_move { check_move_rhs(cx, init.expr); } } - none. { } + none { } } } } @@ -224,8 +224,8 @@ fn check_call(cx: @ctx, f: @expr, args: [@expr]) { let i = 0u; for arg_t: ty::arg in arg_ts { alt arg_t.mode { - by_mut_ref. { check_lval(cx, args[i], msg_mut_ref); } - by_move. { check_lval(cx, args[i], msg_move_out); } + by_mut_ref { check_lval(cx, args[i], msg_mut_ref); } + by_move { check_lval(cx, args[i], msg_move_out); } _ {} } i += 1u; @@ -239,15 +239,15 @@ fn check_bind(cx: @ctx, f: @expr, args: [option::t<@expr>]) { alt arg { some(expr) { alt (alt arg_ts[i].mode { - by_mut_ref. { some("by mutable reference") } - by_move. { some("by move") } + by_mut_ref { some("by mutable reference") } + by_move { some("by move") } _ { none } }) { some(name) { cx.tcx.sess.span_err( expr.span, "can not bind an argument passed " + name); } - none. {} + none {} } } _ {} @@ -262,19 +262,19 @@ fn is_immutable_def(cx: @ctx, def: def) -> option::t<str> { def_use(_) { some("static item") } - def_arg(_, by_ref.) | def_arg(_, by_val.) | - def_arg(_, mode_infer.) { some("argument") } + def_arg(_, by_ref) | def_arg(_, by_val) | + def_arg(_, mode_infer) { some("argument") } def_self(_) { some("self argument") } def_upvar(_, inner, node_id) { let ty = ty::node_id_to_monotype(cx.tcx, node_id); let proto = ty::ty_fn_proto(cx.tcx, ty); ret alt proto { - proto_any. | proto_block. { is_immutable_def(cx, *inner) } + proto_any | proto_block { is_immutable_def(cx, *inner) } _ { some("upvar") } }; } def_binding(_) { some("binding") } - def_local(_, let_ref.) { some("by-reference binding") } + def_local(_, let_ref) { some("by-reference binding") } _ { none } } } diff --git a/src/comp/middle/pat_util.rs b/src/comp/middle/pat_util.rs index f2d1b6ea6ca..b949dce004d 100644 --- a/src/comp/middle/pat_util.rs +++ b/src/comp/middle/pat_util.rs @@ -16,8 +16,8 @@ fn normalize_pat_def_map(dm: resolve::def_map, p: @pat) -> @pat { // have to do it the hard way b/c ast fold doesn't pass around // node IDs. bother. alt p.node { - pat_wild. { p } - pat_ident(_, none.) { normalize_one(dm, p) } + pat_wild { p } + pat_ident(_, none) { normalize_one(dm, p) } pat_ident(q, some(r)) { @{node: pat_ident(q, some(normalize_pat_def_map(dm, r))) with *p} @@ -58,7 +58,7 @@ fn normalize_one(dm: resolve::def_map, p: @pat) -> @pat { _ { p } } } - none. { p } + none { p } } } @@ -93,14 +93,14 @@ fn pat_id_map(tcx: ty::ctxt, pat: @pat) -> pat_id_map { // Could return a constrained type in order to express that (future work) fn pat_bindings(pat: @pat, it: block(@pat)) { alt pat.node { - pat_ident(_, option::none.) { it(pat); } + pat_ident(_, option::none) { it(pat); } pat_ident(_, option::some(sub)) { it(pat); pat_bindings(sub, it); } pat_tag(_, sub) { for p in sub { pat_bindings(p, it); } } pat_rec(fields, _) { for f in fields { pat_bindings(f.pat, it); } } pat_tup(elts) { for elt in elts { pat_bindings(elt, it); } } pat_box(sub) { pat_bindings(sub, it); } pat_uniq(sub) { pat_bindings(sub, it); } - pat_wild. | pat_lit(_) | pat_range(_, _) { } + pat_wild | pat_lit(_) | pat_range(_, _) { } } } @@ -112,7 +112,7 @@ fn pat_binding_ids(pat: @pat) -> [node_id] { fn path_to_ident(p: @path) -> ident { alt vec::last(p.node.idents) { - none. { // sigh + none { // sigh fail "Malformed path"; } some(i) { ret i; } } diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index 6ccc8cc12be..487ea536688 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -71,8 +71,8 @@ fn new_ext_hash() -> ext_hash { ret str::hash(v.ident) + util::common::hash_def(v.did) + alt v.ns { ns_val(_) { 1u } - ns_type. { 2u } - ns_module. { 3u } + ns_type { 2u } + ns_module { 3u } }; } fn eq(v1: key, v2: key) -> bool { @@ -88,8 +88,8 @@ fn new_exp_hash() -> exp_map { ret str::hash(v.path) + alt v.ns { ns_val(_) { 1u } - ns_type. { 2u } - ns_module. { 3u } + ns_type { 2u } + ns_module { 3u } }; } fn eq(v1: key, v2: key) -> bool { @@ -286,11 +286,11 @@ fn map_crate(e: @env, c: @ast::crate) { } scope_block(b, _, _) { let globs = alt e.block_map.find(b.node.id) { - some(globs) { globs + [glob] } none. { [glob] } + some(globs) { globs + [glob] } none { [glob] } }; e.block_map.insert(b.node.id, globs); } - scope_crate. { + scope_crate { e.mod_map.get(ast::crate_node_id).glob_imports += [glob]; } } @@ -422,7 +422,7 @@ fn resolve_names(e: @env, c: @ast::crate) { } /* Here we determine whether a given pat_ident binds a new variable a refers to a nullary tag. */ - ast::pat_ident(p, none.) { + ast::pat_ident(p, none) { let fnd = lookup_in_scope(*e, sc, p.span, path_to_ident(p), ns_val(ns_a_tag)); alt fnd { @@ -504,8 +504,8 @@ fn visit_fn_with_scope(e: @env, fk: visit::fn_kind, decl: ast::fn_decl, let scope = alt fk { visit::fk_item_fn(_, tps) | visit::fk_res(_, tps) | visit::fk_method(_, tps) { scope_bare_fn(decl, id, tps) } - visit::fk_anon(ast::proto_bare.) { scope_bare_fn(decl, id, []) } - visit::fk_anon(_) | visit::fk_fn_block. { scope_fn_expr(decl, id, []) } + visit::fk_anon(ast::proto_bare) { scope_bare_fn(decl, id, []) } + visit::fk_anon(_) | visit::fk_fn_block { scope_fn_expr(decl, id, []) } }; visit::visit_fn(fk, decl, body, sp, id, cons(scope, @sc), v); @@ -557,7 +557,7 @@ fn visit_expr_with_scope(x: @ast::expr, sc: scopes, v: vt<scopes>) { } // This is only for irrefutable patterns (e.g. ones that appear in a let) -// So if x occurs, and x is already known to be a tag, that's always an error. +// So if x occurs, and x is already known to be a tag, that's always an error fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt<scopes>) { // Check whether the given local has the same name as a tag that's // in scope @@ -616,7 +616,7 @@ fn resolve_constr(e: @env, c: @ast::constr, sc: scopes, _v: vt<scopes>) { ns_val(ns_any_value)); if option::is_some(new_def) { alt option::get(new_def) { - ast::def_fn(pred_id, ast::pure_fn.) { + ast::def_fn(pred_id, ast::pure_fn) { e.def_map.insert(c.node.id, ast::def_fn(pred_id, ast::pure_fn)); } _ { @@ -675,7 +675,7 @@ fn resolve_import(e: env, defid: ast::def_id, name: ast::ident, cons(scope_block(b, _, _), _) { lst(id, b.node.view_items) } - cons(scope_crate., _) { + cons(scope_crate, _) { lst(id, option::get(e.mod_map.get(ast::crate_node_id).m).view_items) } @@ -693,7 +693,7 @@ fn resolve_import(e: env, defid: ast::def_id, name: ast::ident, {|ns| lookup_in_scope(e, sc, sp, end_id, ns) }, []); } else { alt lookup_in_scope(e, sc, sp, ids[0], ns_module) { - none. { + none { unresolved_err(e, in_scope(sc), sp, ids[0], ns_name(ns_module)); } some(dcur_) { @@ -710,7 +710,7 @@ fn resolve_import(e: env, defid: ast::def_id, name: ast::ident, dcur = alt lookup_in_mod(e, dcur, sp, ids[i], ns_module, outside) { some(dcur) { dcur } - none. { + none { unresolved_err(e, in_mod(dcur), sp, ids[i], ns_name(ns_module)); break; @@ -738,14 +738,14 @@ fn resolve_import(e: env, defid: ast::def_id, name: ast::ident, // Utilities fn ns_name(ns: namespace) -> str { alt ns { - ns_type. { "typename" } + ns_type { "typename" } ns_val(v) { alt (v) { - ns_any_value. { "name" } - ns_a_tag. { "tag" } + ns_any_value { "name" } + ns_a_tag { "tag" } } } - ns_module. { ret "modulename" } + ns_module { ret "modulename" } } } @@ -758,7 +758,7 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) { alt sc { cons(cur, rest) { alt cur { - scope_crate. | scope_bare_fn(_, _, _) | + scope_crate | scope_bare_fn(_, _, _) | scope_fn_expr(_, _, _) | scope_item(@{node: ast::item_mod(_), _}) { ret some(cur); @@ -835,7 +835,7 @@ fn lookup_path_strict(e: env, sc: scopes, sp: span, pth: ast::path_, fn lookup_in_scope_strict(e: env, sc: scopes, sp: span, name: ident, ns: namespace) -> option::t<def> { alt lookup_in_scope(e, sc, sp, name, ns) { - none. { + none { unresolved_err(e, in_scope(sc), sp, name, ns_name(ns)); ret none; } @@ -884,7 +884,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace) fn in_scope(e: env, sp: span, name: ident, s: scope, ns: namespace) -> option::t<def> { alt s { - scope_crate. { + scope_crate { ret lookup_in_local_mod(e, ast::crate_node_id, sp, name, ns, inside); } @@ -953,7 +953,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace) let sc = sc; while true { alt copy sc { - nil. { ret none::<def>; } + nil { ret none::<def>; } cons(hd, tl) { let fnd = in_scope(e, sp, name, hd, ns); if !is_none(fnd) { @@ -962,7 +962,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace) if left_fn && local || left_fn_level2 && self_scope || scope_is_fn(hd) && left_fn && def_is_ty_arg(df) { let msg = alt ns { - ns_type. { + ns_type { "attempt to use a type argument out of scope" } ns_val(v) { @@ -970,7 +970,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace) /* If we were looking for a tag, at this point we know it's bound to a non-tag value, and we can return none instead of failing */ - ns_a_tag. { ret none; } + ns_a_tag { ret none; } _ { "attempted dynamic environment-capture" } } } @@ -1009,7 +1009,7 @@ fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param]) let n = 0u; for tp: ast::ty_param in ty_params { if str::eq(tp.ident, name) && alt e.current_tp { - some(cur) { n < cur } none. { true } + some(cur) { n < cur } none { true } } { ret some(ast::def_ty_param(local_def(tp.id), n)); } n += 1u; } @@ -1031,7 +1031,7 @@ fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl, ty_params: [ast::ty_param], ns: namespace) -> option::t<def> { alt ns { - ns_val(ns_any_value.) { + ns_val(ns_any_value) { for a: ast::arg in decl.inputs { if str::eq(a.ident, name) { ret some(ast::def_arg(local_def(a.id), a.mode)); @@ -1039,7 +1039,7 @@ fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl, } ret none::<def>; } - ns_type. { ret lookup_in_ty_params(e, name, ty_params); } + ns_type { ret lookup_in_ty_params(e, name, ty_params); } _ { ret none::<def>; } } } @@ -1155,10 +1155,10 @@ fn found_def_item(i: @ast::item, ns: namespace) -> option::t<def> { } ast::item_res(_, _, _, _, ctor_id) { alt ns { - ns_val(ns_any_value.) { + ns_val(ns_any_value) { ret some(ast::def_fn(local_def(ctor_id), ast::impure_fn)); } - ns_type. { ret some(ast::def_ty(local_def(i.id))); } + ns_type { ret some(ast::def_ty(local_def(i.id))); } _ { } } } @@ -1170,7 +1170,7 @@ fn found_def_item(i: @ast::item, ns: namespace) -> option::t<def> { fn lookup_in_mod_strict(e: env, m: def, sp: span, name: ident, ns: namespace, dr: dir) -> option::t<def> { alt lookup_in_mod(e, m, sp, name, ns, dr) { - none. { + none { unresolved_err(e, in_mod(m), sp, name, ns_name(ns)); ret none; } @@ -1231,8 +1231,8 @@ fn lookup_import(e: env, defid: def_id, ns: namespace) -> option::t<def> { if e.used_imports.track { e.used_imports.data += [defid.node]; } - ret alt ns { ns_val(_) { val } ns_type. { typ } - ns_module. { md } }; + ret alt ns { ns_val(_) { val } ns_type { typ } + ns_module { md } }; } } } @@ -1254,12 +1254,12 @@ fn lookup_in_local_mod(e: env, node_id: node_id, sp: span, id: ident, ret none::<def>; // name is not visible } alt info.index.find(id) { - none. { } + none { } some(lst_) { let lst = lst_; while true { alt lst { - nil. { break; } + nil { break; } cons(hd, tl) { let found = lookup_in_mie(e, hd, ns); if !is_none(found) { ret found; } @@ -1284,7 +1284,7 @@ fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident, } alt lookup_in_mod(e, def.def, sp, name, ns, dr) { some(d) { option::some({def: d, item: def.item}) } - none. { none } + none { none } } } let matches = vec::filter_map(copy globs, @@ -1326,8 +1326,8 @@ fn lookup_glob_in_mod(e: env, info: @indexed_mod, sp: span, id: ident, glob_resolved(val, typ, md) { ret alt wanted_ns { ns_val(_) { val } - ns_type. { typ } - ns_module. { md } + ns_type { typ } + ns_module { md } }; } } @@ -1357,7 +1357,7 @@ fn lookup_in_mie(e: env, mie: mod_index_entry, ns: namespace) -> } mie_native_item(native_item) { alt native_item.node { - ast::native_item_ty. { + ast::native_item_ty { if ns == ns_type { ret some(ast::def_native_ty(local_def(native_item.id))); } @@ -1380,7 +1380,7 @@ fn lookup_in_mie(e: env, mie: mod_index_entry, ns: namespace) -> fn add_to_index(index: hashmap<ident, list<mod_index_entry>>, id: ident, ent: mod_index_entry) { alt index.find(id) { - none. { index.insert(id, cons(ent, @nil::<mod_index_entry>)); } + none { index.insert(id, cons(ent, @nil::<mod_index_entry>)); } some(prev) { index.insert(id, cons(ent, @prev)); } } } @@ -1471,7 +1471,7 @@ fn ns_for_def(d: def) -> namespace { // a tag fn ns_ok(wanted:namespace, actual:namespace) -> bool { alt actual { - ns_val(ns_a_tag.) { + ns_val(ns_a_tag) { alt wanted { ns_val(_) { true } _ { false } @@ -1556,7 +1556,7 @@ fn check_mod_name(e: env, name: ident, entries: list<mod_index_entry>) { } entries = *rest; } - nil. { break; } + nil { break; } } } } @@ -1798,7 +1798,7 @@ fn check_exports(e: @env) { } } } - none. { } + none { } } }; } @@ -1892,7 +1892,7 @@ fn find_impls_in_mod(e: env, m: def, &impls: [@_impl], let cached; alt e.impl_cache.find(defid) { some(v) { cached = v; } - none. { + none { cached = if defid.crate == ast::local_crate { let tmp = []; for i in option::get(e.mod_map.get(defid.node).m).items { diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs index a4fbb78e114..39835854fea 100644 --- a/src/comp/middle/shape.rs +++ b/src/comp/middle/shape.rs @@ -313,24 +313,24 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] { let s = []; alt ty::struct(ccx.tcx, t) { - ty::ty_nil. | ty::ty_bool. | ty::ty_uint(ast::ty_u8.) | - ty::ty_bot. { s += [shape_u8]; } - ty::ty_int(ast::ty_i.) { s += [s_int(ccx.tcx)]; } - ty::ty_float(ast::ty_f.) { s += [s_float(ccx.tcx)]; } - ty::ty_uint(ast::ty_u.) | ty::ty_ptr(_) | + ty::ty_nil | ty::ty_bool | ty::ty_uint(ast::ty_u8) | + ty::ty_bot { s += [shape_u8]; } + ty::ty_int(ast::ty_i) { s += [s_int(ccx.tcx)]; } + ty::ty_float(ast::ty_f) { s += [s_float(ccx.tcx)]; } + ty::ty_uint(ast::ty_u) | ty::ty_ptr(_) | ty::ty_native(_) { s += [s_uint(ccx.tcx)]; } - ty::ty_type. { s += [s_tydesc(ccx.tcx)]; } - ty::ty_send_type. { s += [s_send_tydesc(ccx.tcx)]; } - ty::ty_int(ast::ty_i8.) { s += [shape_i8]; } - ty::ty_uint(ast::ty_u16.) { s += [shape_u16]; } - ty::ty_int(ast::ty_i16.) { s += [shape_i16]; } - ty::ty_uint(ast::ty_u32.) { s += [shape_u32]; } - ty::ty_int(ast::ty_i32.) | ty::ty_int(ast::ty_char.) {s += [shape_i32];} - ty::ty_uint(ast::ty_u64.) { s += [shape_u64]; } - ty::ty_int(ast::ty_i64.) { s += [shape_i64]; } - ty::ty_float(ast::ty_f32.) { s += [shape_f32]; } - ty::ty_float(ast::ty_f64.) { s += [shape_f64]; } - ty::ty_str. { + ty::ty_type { s += [s_tydesc(ccx.tcx)]; } + ty::ty_send_type { s += [s_send_tydesc(ccx.tcx)]; } + ty::ty_int(ast::ty_i8) { s += [shape_i8]; } + ty::ty_uint(ast::ty_u16) { s += [shape_u16]; } + ty::ty_int(ast::ty_i16) { s += [shape_i16]; } + ty::ty_uint(ast::ty_u32) { s += [shape_u32]; } + ty::ty_int(ast::ty_i32) | ty::ty_int(ast::ty_char) {s += [shape_i32];} + ty::ty_uint(ast::ty_u64) { s += [shape_u64]; } + ty::ty_int(ast::ty_i64) { s += [shape_i64]; } + ty::ty_float(ast::ty_f32) { s += [shape_f32]; } + ty::ty_float(ast::ty_f64) { s += [shape_f64]; } + ty::ty_str { s += [shape_vec]; add_bool(s, true); // type is POD let unit_ty = ty::mk_mach_uint(ccx.tcx, ast::ty_u8); @@ -338,19 +338,19 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] { } ty::ty_tag(did, tps) { alt tag_kind(ccx, did) { - tk_unit. { + tk_unit { // FIXME: For now we do this. s += [s_variant_tag_t(ccx.tcx)]; } - tk_enum. { s += [s_variant_tag_t(ccx.tcx)]; } - tk_complex. { + tk_enum { s += [s_variant_tag_t(ccx.tcx)]; } + tk_complex { s += [shape_tag]; let sub = []; let id; alt ccx.shape_cx.tag_id_to_index.find(did) { - none. { + none { id = ccx.shape_cx.next_tag_id; ccx.shape_cx.tag_id_to_index.insert(did, id); ccx.shape_cx.tag_order += [did]; @@ -423,19 +423,19 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] { // Find the type parameter in the parameter list. alt vec::position(n, ty_param_map) { some(i) { s += [shape_var, i as u8]; } - none. { fail "ty param not found in ty_param_map"; } + none { fail "ty param not found in ty_param_map"; } } } - ty::ty_fn({proto: ast::proto_box., _}) { + ty::ty_fn({proto: ast::proto_box, _}) { s += [shape_box_fn]; } - ty::ty_fn({proto: ast::proto_uniq., _}) { + ty::ty_fn({proto: ast::proto_uniq, _}) { s += [shape_uniq_fn]; } - ty::ty_fn({proto: ast::proto_block., _}) { + ty::ty_fn({proto: ast::proto_block, _}) { s += [shape_stack_fn]; } - ty::ty_fn({proto: ast::proto_bare., _}) { + ty::ty_fn({proto: ast::proto_bare, _}) { s += [shape_bare_fn]; } ty::ty_opaque_closure_ptr(_) { diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 13d17eecb83..825a76f32b1 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -126,15 +126,15 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t) if cx.lltypes.contains_key(t) { ret cx.lltypes.get(t); } let llty = alt ty::struct(cx.tcx, t) { ty::ty_native(_) { T_ptr(T_i8()) } - ty::ty_nil. { T_nil() } - ty::ty_bot. { + ty::ty_nil { T_nil() } + ty::ty_bot { T_nil() /* ...I guess? */ } - ty::ty_bool. { T_bool() } + ty::ty_bool { T_bool() } ty::ty_int(t) { T_int_ty(cx, t) } ty::ty_uint(t) { T_uint_ty(cx, t) } ty::ty_float(t) { T_float_ty(cx, t) } - ty::ty_str. { T_ptr(T_vec(cx, T_i8())) } + ty::ty_str { T_ptr(T_vec(cx, T_i8())) } ty::ty_tag(did, _) { type_of_tag(cx, sp, did, t) } ty::ty_box(mt) { let mt_ty = mt.ty; @@ -188,7 +188,7 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t) std::util::unreachable() } ty::ty_param(_, _) { T_typaram(cx.tn) } - ty::ty_send_type. | ty::ty_type. { T_ptr(cx.tydesc_type) } + ty::ty_send_type | ty::ty_type { T_ptr(cx.tydesc_type) } ty::ty_tup(elts) { let tys = []; for elt in elts { @@ -442,7 +442,7 @@ fn dynastack_alloca(cx: @block_ctxt, t: TypeRef, n: ValueRef, ty: ty::t) -> let bcx = cx; let dy_cx = new_raw_block_ctxt(cx.fcx, cx.fcx.lldynamicallocas); alt bcx_fcx(cx).llobstacktoken { - none. { + none { bcx_fcx(cx).llobstacktoken = some(mk_obstack_token(bcx_ccx(cx), cx.fcx)); } @@ -935,7 +935,7 @@ fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool, ret rslt(cx, info.lltydesc); } } - none. {/* fall through */ } + none {/* fall through */ } } bcx_ccx(cx).stats.n_derived_tydescs += 1u; @@ -1015,7 +1015,7 @@ fn get_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool, uint::str(id)); } } - none. {/* fall through */ } + none {/* fall through */ } } // Does it contain a type param? If so, generate a derived tydesc. @@ -1033,7 +1033,7 @@ fn get_static_tydesc(cx: @block_ctxt, t: ty::t, ty_params: [uint]) -> @tydesc_info { alt bcx_ccx(cx).tydescs.find(t) { some(info) { ret info; } - none. { + none { bcx_ccx(cx).stats.n_static_tydescs += 1u; let info = declare_tydesc(cx.fcx.lcx, cx.sp, t, ty_params); bcx_ccx(cx).tydescs.insert(t, info); @@ -1199,22 +1199,22 @@ fn emit_tydescs(ccx: @crate_ctxt) { let ti = val; let take_glue = alt ti.take_glue { - none. { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) } + none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) } some(v) { ccx.stats.n_real_glues += 1u; v } }; let drop_glue = alt ti.drop_glue { - none. { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) } + none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) } some(v) { ccx.stats.n_real_glues += 1u; v } }; let free_glue = alt ti.free_glue { - none. { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) } + none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) } some(v) { ccx.stats.n_real_glues += 1u; v } }; let cmp_glue = alt ti.cmp_glue { - none. { ccx.stats.n_null_glues += 1u; C_null(cmp_fn_ty) } + none { ccx.stats.n_null_glues += 1u; C_null(cmp_fn_ty) } some(v) { ccx.stats.n_real_glues += 1u; v } }; @@ -1264,12 +1264,12 @@ fn make_take_glue(cx: @block_ctxt, v: ValueRef, t: ty::t) { Store(r.bcx, r.val, v); r.bcx } - ty::ty_vec(_) | ty::ty_str. { + ty::ty_vec(_) | ty::ty_str { let r = tvec::duplicate(bcx, Load(bcx, v), t); Store(r.bcx, r.val, v); r.bcx } - ty::ty_send_type. { + ty::ty_send_type { // sendable type descriptors are basically unique pointers, // they must be cloned when copied: let r = Load(bcx, v); @@ -1328,7 +1328,7 @@ fn make_free_glue(bcx: @block_ctxt, v: ValueRef, t: ty::t) { let v = PointerCast(bcx, v, type_of_1(bcx, t)); trans_uniq::make_free_glue(bcx, v, t) } - ty::ty_vec(_) | ty::ty_str. { + ty::ty_vec(_) | ty::ty_str { tvec::make_free_glue(bcx, PointerCast(bcx, v, type_of_1(bcx, t)), t) } ty::ty_iface(_, _) { @@ -1345,7 +1345,7 @@ fn make_free_glue(bcx: @block_ctxt, v: ValueRef, t: ty::t) { abi::tydesc_field_drop_glue, ti); trans_free_if_not_gc(bcx, b) } - ty::ty_send_type. { + ty::ty_send_type { // sendable type descriptors are basically unique pointers, // they must be freed. let ccx = bcx_ccx(bcx); @@ -1372,7 +1372,7 @@ fn make_drop_glue(bcx: @block_ctxt, v0: ValueRef, t: ty::t) { ty::ty_box(_) | ty::ty_iface(_, _) { decr_refcnt_maybe_free(bcx, Load(bcx, v0), t) } - ty::ty_uniq(_) | ty::ty_vec(_) | ty::ty_str. | ty::ty_send_type. { + ty::ty_uniq(_) | ty::ty_vec(_) | ty::ty_str | ty::ty_send_type { free_ty(bcx, Load(bcx, v0), t) } ty::ty_res(did, inner, tps) { @@ -1478,12 +1478,12 @@ fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, let f = bind compare_scalar_values(cx, lhs, rhs, _, op); alt ty::struct(bcx_tcx(cx), t) { - ty::ty_nil. { ret rslt(cx, f(nil_type)); } - ty::ty_bool. | ty::ty_ptr(_) { ret rslt(cx, f(unsigned_int)); } + ty::ty_nil { ret rslt(cx, f(nil_type)); } + ty::ty_bool | ty::ty_ptr(_) { ret rslt(cx, f(unsigned_int)); } ty::ty_int(_) { ret rslt(cx, f(signed_int)); } ty::ty_uint(_) { ret rslt(cx, f(unsigned_int)); } ty::ty_float(_) { ret rslt(cx, f(floating_point)); } - ty::ty_type. { + ty::ty_type { ret rslt(trans_fail(cx, none, "attempt to compare values of type type"), C_nil()); @@ -1506,44 +1506,44 @@ fn compare_scalar_types(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, fn compare_scalar_values(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, nt: scalar_type, op: ast::binop) -> ValueRef { alt nt { - nil_type. { + nil_type { // We don't need to do actual comparisons for nil. // () == () holds but () < () does not. alt op { - ast::eq. | ast::le. | ast::ge. { ret C_bool(true); } - ast::ne. | ast::lt. | ast::gt. { ret C_bool(false); } + ast::eq | ast::le | ast::ge { ret C_bool(true); } + ast::ne | ast::lt | ast::gt { ret C_bool(false); } } } - floating_point. { + floating_point { let cmp = alt op { - ast::eq. { lib::llvm::LLVMRealOEQ } - ast::ne. { lib::llvm::LLVMRealUNE } - ast::lt. { lib::llvm::LLVMRealOLT } - ast::le. { lib::llvm::LLVMRealOLE } - ast::gt. { lib::llvm::LLVMRealOGT } - ast::ge. { lib::llvm::LLVMRealOGE } + ast::eq { lib::llvm::LLVMRealOEQ } + ast::ne { lib::llvm::LLVMRealUNE } + ast::lt { lib::llvm::LLVMRealOLT } + ast::le { lib::llvm::LLVMRealOLE } + ast::gt { lib::llvm::LLVMRealOGT } + ast::ge { lib::llvm::LLVMRealOGE } }; ret FCmp(cx, cmp, lhs, rhs); } - signed_int. { + signed_int { let cmp = alt op { - ast::eq. { lib::llvm::LLVMIntEQ } - ast::ne. { lib::llvm::LLVMIntNE } - ast::lt. { lib::llvm::LLVMIntSLT } - ast::le. { lib::llvm::LLVMIntSLE } - ast::gt. { lib::llvm::LLVMIntSGT } - ast::ge. { lib::llvm::LLVMIntSGE } + ast::eq { lib::llvm::LLVMIntEQ } + ast::ne { lib::llvm::LLVMIntNE } + ast::lt { lib::llvm::LLVMIntSLT } + ast::le { lib::llvm::LLVMIntSLE } + ast::gt { lib::llvm::LLVMIntSGT } + ast::ge { lib::llvm::LLVMIntSGE } }; ret ICmp(cx, cmp, lhs, rhs); } - unsigned_int. { + unsigned_int { let cmp = alt op { - ast::eq. { lib::llvm::LLVMIntEQ } - ast::ne. { lib::llvm::LLVMIntNE } - ast::lt. { lib::llvm::LLVMIntULT } - ast::le. { lib::llvm::LLVMIntULE } - ast::gt. { lib::llvm::LLVMIntUGT } - ast::ge. { lib::llvm::LLVMIntUGE } + ast::eq { lib::llvm::LLVMIntEQ } + ast::ne { lib::llvm::LLVMIntNE } + ast::lt { lib::llvm::LLVMIntULT } + ast::le { lib::llvm::LLVMIntULE } + ast::gt { lib::llvm::LLVMIntUGT } + ast::ge { lib::llvm::LLVMIntUGE } }; ret ICmp(cx, cmp, lhs, rhs); } @@ -1697,12 +1697,12 @@ fn lazily_emit_all_generic_info_tydesc_glues(cx: @block_ctxt, fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int, static_ti: option::t<@tydesc_info>) { alt static_ti { - none. { } + none { } some(ti) { if field == abi::tydesc_field_take_glue { alt ti.take_glue { some(_) { } - none. { + none { #debug("+++ lazily_emit_tydesc_glue TAKE %s", ty_to_str(bcx_tcx(cx), ti.ty)); let lcx = cx.fcx.lcx; @@ -1720,7 +1720,7 @@ fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int, } else if field == abi::tydesc_field_drop_glue { alt ti.drop_glue { some(_) { } - none. { + none { #debug("+++ lazily_emit_tydesc_glue DROP %s", ty_to_str(bcx_tcx(cx), ti.ty)); let lcx = cx.fcx.lcx; @@ -1738,7 +1738,7 @@ fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int, } else if field == abi::tydesc_field_free_glue { alt ti.free_glue { some(_) { } - none. { + none { #debug("+++ lazily_emit_tydesc_glue FREE %s", ty_to_str(bcx_tcx(cx), ti.ty)); let lcx = cx.fcx.lcx; @@ -1756,7 +1756,7 @@ fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int, } else if field == abi::tydesc_field_cmp_glue { alt ti.cmp_glue { some(_) { } - none. { + none { #debug("+++ lazily_emit_tydesc_glue CMP %s", ty_to_str(bcx_tcx(cx), ti.ty)); ti.cmp_glue = some(bcx_ccx(cx).upcalls.cmp_type); @@ -1775,7 +1775,7 @@ fn call_tydesc_glue_full(cx: @block_ctxt, v: ValueRef, tydesc: ValueRef, let static_glue_fn = none; alt static_ti { - none. {/* no-op */ } + none {/* no-op */ } some(sti) { if field == abi::tydesc_field_take_glue { static_glue_fn = sti.take_glue; @@ -1794,7 +1794,7 @@ fn call_tydesc_glue_full(cx: @block_ctxt, v: ValueRef, tydesc: ValueRef, let llfn; alt static_glue_fn { - none. { + none { let llfnptr = GEPi(cx, tydesc, [0, field]); llfn = Load(cx, llfnptr); } @@ -1840,7 +1840,7 @@ fn call_cmp_glue(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t, let llfn; alt ti { - none. { + none { let llfnptr = GEPi(bcx, lltydesc, [0, abi::tydesc_field_cmp_glue]); llfn = Load(bcx, llfnptr); @@ -1870,7 +1870,7 @@ fn drop_ty(cx: @block_ctxt, v: ValueRef, t: ty::t) -> @block_ctxt { fn drop_ty_immediate(bcx: @block_ctxt, v: ValueRef, t: ty::t) -> @block_ctxt { alt ty::struct(bcx_tcx(bcx), t) { - ty::ty_uniq(_) | ty::ty_vec(_) | ty::ty_str. { free_ty(bcx, v, t) } + ty::ty_uniq(_) | ty::ty_vec(_) | ty::ty_str { free_ty(bcx, v, t) } ty::ty_box(_) | ty::ty_iface(_, _) { decr_refcnt_maybe_free(bcx, v, t) } } } @@ -1884,7 +1884,7 @@ fn take_ty_immediate(bcx: @block_ctxt, v: ValueRef, t: ty::t) -> result { check trans_uniq::type_is_unique_box(bcx, t); trans_uniq::duplicate(bcx, v, t) } - ty::ty_str. | ty::ty_vec(_) { tvec::duplicate(bcx, v, t) } + ty::ty_str | ty::ty_vec(_) { tvec::duplicate(bcx, v, t) } _ { rslt(bcx, v) } } } @@ -2046,7 +2046,7 @@ fn trans_crate_lit(cx: @crate_ctxt, lit: ast::lit) -> ValueRef { ast::lit_uint(u, t) { C_integral(T_uint_ty(cx, t), u, False) } ast::lit_float(fs, t) { C_floating(fs, T_float_ty(cx, t)) } ast::lit_bool(b) { C_bool(b) } - ast::lit_nil. { C_nil() } + ast::lit_nil { C_nil() } ast::lit_str(s) { cx.sess.span_unimpl(lit.span, "unique string in this context"); } @@ -2083,11 +2083,11 @@ fn trans_unary(bcx: @block_ctxt, op: ast::unop, e: @ast::expr, if dest == ignore { ret trans_expr(bcx, e, ignore); } let e_ty = ty::expr_ty(bcx_tcx(bcx), e); alt op { - ast::not. { + ast::not { let {bcx, val} = trans_temp_expr(bcx, e); ret store_in_dest(bcx, Not(bcx, val), dest); } - ast::neg. { + ast::neg { let {bcx, val} = trans_temp_expr(bcx, e); let neg = if ty::type_is_fp(bcx_tcx(bcx), e_ty) { FNeg(bcx, val) @@ -2099,7 +2099,7 @@ fn trans_unary(bcx: @block_ctxt, op: ast::unop, e: @ast::expr, add_clean_free(bcx, box, false); // Cast the body type to the type of the value. This is needed to // make tags work, since tags have a different LLVM type depending - // on whether they're boxed or not. + // on whether they're boxed or not let ccx = bcx_ccx(bcx); if check type_has_static_size(ccx, e_ty) { let e_sp = e.span; @@ -2113,7 +2113,7 @@ fn trans_unary(bcx: @block_ctxt, op: ast::unop, e: @ast::expr, ast::uniq(_) { ret trans_uniq::trans_uniq(bcx, e, id, dest); } - ast::deref. { + ast::deref { bcx_ccx(bcx).sess.bug("deref expressions should have been \ translated using trans_lval(), not \ trans_unary()"); @@ -2131,17 +2131,17 @@ fn trans_compare(cx: @block_ctxt, op: ast::binop, lhs: ValueRef, // Determine the operation we need. let llop; alt op { - ast::eq. | ast::ne. { llop = C_u8(abi::cmp_glue_op_eq); } - ast::lt. | ast::ge. { llop = C_u8(abi::cmp_glue_op_lt); } - ast::le. | ast::gt. { llop = C_u8(abi::cmp_glue_op_le); } + ast::eq | ast::ne { llop = C_u8(abi::cmp_glue_op_eq); } + ast::lt | ast::ge { llop = C_u8(abi::cmp_glue_op_lt); } + ast::le | ast::gt { llop = C_u8(abi::cmp_glue_op_le); } } let rs = call_cmp_glue(cx, lhs, rhs, rhs_t, llop); // Invert the result if necessary. alt op { - ast::eq. | ast::lt. | ast::le. { ret rslt(rs.bcx, rs.val); } - ast::ne. | ast::ge. | ast::gt. { + ast::eq | ast::lt | ast::le { ret rslt(rs.bcx, rs.val); } + ast::ne | ast::ge | ast::gt { ret rslt(rs.bcx, Not(rs.bcx, rs.val)); } } @@ -2161,36 +2161,36 @@ fn trans_eager_binop(cx: @block_ctxt, op: ast::binop, lhs: ValueRef, ret tvec::trans_add(cx, intype, lhs, rhs, dest); } let cx = cx, val = alt op { - ast::add. { + ast::add { if is_float { FAdd(cx, lhs, rhs) } else { Add(cx, lhs, rhs) } } - ast::subtract. { + ast::subtract { if is_float { FSub(cx, lhs, rhs) } else { Sub(cx, lhs, rhs) } } - ast::mul. { + ast::mul { if is_float { FMul(cx, lhs, rhs) } else { Mul(cx, lhs, rhs) } } - ast::div. { + ast::div { if is_float { FDiv(cx, lhs, rhs) } else if ty::type_is_signed(bcx_tcx(cx), intype) { SDiv(cx, lhs, rhs) } else { UDiv(cx, lhs, rhs) } } - ast::rem. { + ast::rem { if is_float { FRem(cx, lhs, rhs) } else if ty::type_is_signed(bcx_tcx(cx), intype) { SRem(cx, lhs, rhs) } else { URem(cx, lhs, rhs) } } - ast::bitor. { Or(cx, lhs, rhs) } - ast::bitand. { And(cx, lhs, rhs) } - ast::bitxor. { Xor(cx, lhs, rhs) } - ast::lsl. { Shl(cx, lhs, rhs) } - ast::lsr. { LShr(cx, lhs, rhs) } - ast::asr. { AShr(cx, lhs, rhs) } + ast::bitor { Or(cx, lhs, rhs) } + ast::bitand { And(cx, lhs, rhs) } + ast::bitxor { Xor(cx, lhs, rhs) } + ast::lsl { Shl(cx, lhs, rhs) } + ast::lsr { LShr(cx, lhs, rhs) } + ast::asr { AShr(cx, lhs, rhs) } _ { let cmpr = trans_compare(cx, op, lhs, lhs_t, rhs, rhs_t); cx = cmpr.bcx; @@ -2222,7 +2222,7 @@ fn trans_assign_op(bcx: @block_ctxt, op: ast::binop, dst: @ast::expr, let {bcx, val: rhs_val} = trans_temp_expr(lhs_res.bcx, src); if ty::type_is_sequence(tcx, t) { alt op { - ast::add. { + ast::add { ret tvec::trans_append(bcx, t, lhs_res.val, rhs_val); } _ { } @@ -2283,7 +2283,7 @@ fn autoderef(cx: @block_ctxt, v: ValueRef, t: ty::t) -> result_t { fn trans_lazy_binop(bcx: @block_ctxt, op: ast::binop, a: @ast::expr, b: @ast::expr, dest: dest) -> @block_ctxt { - let is_and = alt op { ast::and. { true } ast::or. { false } }; + let is_and = alt op { ast::and { true } ast::or { false } }; let lhs_res = trans_temp_expr(bcx, a); if lhs_res.bcx.unreachable { ret lhs_res.bcx; } let rhs_cx = new_scope_block_ctxt(lhs_res.bcx, "rhs"); @@ -2316,7 +2316,7 @@ fn trans_binary(cx: @block_ctxt, op: ast::binop, a: @ast::expr, b: @ast::expr, dest: dest) -> @block_ctxt { // First couple cases are lazy: alt op { - ast::and. | ast::or. { + ast::and | ast::or { ret trans_lazy_binop(cx, op, a, b, dest); } _ { @@ -2381,7 +2381,7 @@ fn join_returns(parent_cx: @block_ctxt, in_cxs: [@block_ctxt], // Used to put an immediate value in a dest. fn store_in_dest(bcx: @block_ctxt, val: ValueRef, dest: dest) -> @block_ctxt { alt dest { - ignore. {} + ignore {} by_val(cell) { *cell = val; } save_in(addr) { Store(bcx, val, addr); } } @@ -2578,7 +2578,7 @@ fn lval_static_fn(bcx: @block_ctxt, fn_id: ast::def_id, id: ast::node_id) fn lookup_discriminant(lcx: @local_ctxt, vid: ast::def_id) -> ValueRef { let ccx = lcx.ccx; alt ccx.discrims.find(vid) { - none. { + none { // It's an external discriminant that we haven't seen yet. assert (vid.crate != ast::local_crate); let sym = csearch::get_symbol(lcx.ccx.sess.cstore, vid); @@ -2788,7 +2788,7 @@ fn trans_lval(cx: @block_ctxt, e: @ast::expr) -> lval_result { ast::expr_index(base, idx) { ret trans_index(cx, e.span, base, idx, e.id); } - ast::expr_unary(ast::deref., base) { + ast::expr_unary(ast::deref, base) { let ccx = bcx_ccx(cx); let sub = trans_temp_expr(cx, base); let t = ty::expr_ty(ccx.tcx, base); @@ -2826,11 +2826,11 @@ fn trans_lval(cx: @block_ctxt, e: @ast::expr) -> lval_result { fn maybe_add_env(bcx: @block_ctxt, c: lval_maybe_callee) -> (lval_kind, ValueRef) { alt c.env { - is_closure. { (c.kind, c.val) } + is_closure { (c.kind, c.val) } self_env(_) | dict_env(_, _) { fail "Taking the value of a method does not work yet (issue #435)"; } - null_env. { + null_env { let llfnty = llvm::LLVMGetElementType(val_ty(c.val)); (temporary, create_real_fn_pair(bcx, llfnty, c.val, null_env_ptr(bcx))) @@ -2849,7 +2849,7 @@ fn lval_maybe_callee_to_lval(c: lval_maybe_callee, ty: ty::t) -> lval_result { add_clean_temp(bcx, space.val, ty); ret {bcx: bcx, val: space.val, kind: temporary}; } - none. { + none { let (kind, val) = maybe_add_env(c.bcx, c); ret {bcx: c.bcx, val: val, kind: kind}; } @@ -2915,41 +2915,41 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id, let newval = alt {in: k_in, out: k_out} { - {in: integral., out: integral.} { + {in: integral, out: integral.} { int_cast(e_res.bcx, ll_t_out, ll_t_in, e_res.val, s_in) } - {in: float., out: float.} { + {in: float, out: float.} { float_cast(e_res.bcx, ll_t_out, ll_t_in, e_res.val) } - {in: integral., out: float.} { + {in: integral, out: float} { if s_in { SIToFP(e_res.bcx, e_res.val, ll_t_out) } else { UIToFP(e_res.bcx, e_res.val, ll_t_out) } } - {in: float., out: integral.} { + {in: float, out: integral} { if ty::type_is_signed(ccx.tcx, t_out) { FPToSI(e_res.bcx, e_res.val, ll_t_out) } else { FPToUI(e_res.bcx, e_res.val, ll_t_out) } } - {in: integral., out: pointer.} { + {in: integral, out: pointer} { IntToPtr(e_res.bcx, e_res.val, ll_t_out) } - {in: pointer., out: integral.} { + {in: pointer, out: integral} { PtrToInt(e_res.bcx, e_res.val, ll_t_out) } - {in: pointer., out: pointer.} { + {in: pointer, out: pointer.} { PointerCast(e_res.bcx, e_res.val, ll_t_out) } - {in: tag_., out: integral.} | {in: tag_., out: float.} { + {in: tag_, out: integral} | {in: tag_., out: float} { let cx = e_res.bcx; let lltagty = T_opaque_tag_ptr(ccx); let av_tag = PointerCast(cx, e_res.val, lltagty); let lldiscrim_a_ptr = GEPi(cx, av_tag, [0, 0]); let lldiscrim_a = Load(cx, lldiscrim_a_ptr); alt k_out { - integral. {int_cast(e_res.bcx, ll_t_out, + integral {int_cast(e_res.bcx, ll_t_out, val_ty(lldiscrim_a), lldiscrim_a, true)} - float. {SIToFP(e_res.bcx, lldiscrim_a, ll_t_out)} + float {SIToFP(e_res.bcx, lldiscrim_a, ll_t_out)} } } _ { ccx.sess.bug("Translating unsupported cast.") } @@ -3081,7 +3081,7 @@ fn trans_args(cx: @block_ctxt, llenv: ValueRef, } // Arg 0: Output pointer. let llretslot = alt dest { - ignore. { + ignore { if ty::type_is_nil(tcx, retty) { llvm::LLVMGetUndef(T_ptr(T_nil())) } else { @@ -3153,12 +3153,12 @@ fn trans_call(in_cx: @block_ctxt, f: @ast::expr, let faddr = f_res.val; let llenv, dict_param = none; alt f_res.env { - null_env. { + null_env { llenv = llvm::LLVMGetUndef(T_opaque_cbox_ptr(bcx_ccx(cx))); } self_env(e) { llenv = e; } dict_env(dict, e) { llenv = e; dict_param = some(dict); } - is_closure. { + is_closure { // It's a closure. Have to fetch the elements if f_res.kind == owned { faddr = load_if_immediate(bcx, faddr, fn_expr_ty); @@ -3186,7 +3186,7 @@ fn trans_call(in_cx: @block_ctxt, f: @ast::expr, bcx = invoke_full(bcx, faddr, llargs, args_res.to_zero, args_res.to_revoke); alt dest { - ignore. { + ignore { if llvm::LLVMIsUndef(llretslot) != lib::llvm::True { bcx = drop_ty(bcx, llretslot, ret_ty); } @@ -3271,7 +3271,7 @@ fn get_landing_pad(bcx: @block_ctxt, } else { scope_bcx = alt scope_bcx.parent { parent_some(b) { b } - parent_none. { + parent_none { ret scope_bcx; } }; @@ -3316,7 +3316,7 @@ fn trans_landing_pad(bcx: @block_ctxt, bcx = trans_block_cleanups(bcx, scope_cx); scope_cx = alt scope_cx.parent { parent_some(b) { b } - parent_none. { break; } + parent_none { break; } }; } @@ -3330,7 +3330,7 @@ fn trans_tup(bcx: @block_ctxt, elts: [@ast::expr], id: ast::node_id, let t = node_id_type(bcx.fcx.lcx.ccx, id); let bcx = bcx; let addr = alt dest { - ignore. { + ignore { for ex in elts { bcx = trans_expr(bcx, ex, ignore); } ret bcx; } @@ -3355,7 +3355,7 @@ fn trans_rec(bcx: @block_ctxt, fields: [ast::field], let t = node_id_type(bcx_ccx(bcx), id); let bcx = bcx; let addr = alt dest { - ignore. { + ignore { for fld in fields { bcx = trans_expr(bcx, fld.node.expr, ignore); } @@ -3390,7 +3390,7 @@ fn trans_rec(bcx: @block_ctxt, fields: [ast::field], i += 1; } } - none. {} + none {} }; // Now revoke the cleanups as we pass responsibility for the data @@ -3527,11 +3527,11 @@ fn trans_expr(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt { } // These return nothing - ast::expr_break. { + ast::expr_break { assert dest == ignore; ret trans_break(e.span, bcx); } - ast::expr_cont. { + ast::expr_cont { assert dest == ignore; ret trans_cont(e.span, bcx); } @@ -3657,7 +3657,7 @@ fn lval_to_dps(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt { save_in(loc) { bcx = store_temp_expr(bcx, INIT, loc, lv, ty, last_use); } - ignore. {} + ignore {} } ret bcx; } @@ -3805,7 +3805,7 @@ fn trans_fail_value(bcx: @block_ctxt, sp_opt: option::t<span>, V_filename = C_cstr(bcx_ccx(bcx), loc.filename); V_line = loc.line as int; } - none. { V_filename = C_cstr(bcx_ccx(bcx), "<runtime>"); V_line = 0; } + none { V_filename = C_cstr(bcx_ccx(bcx), "<runtime>"); V_line = 0; } } let V_str = PointerCast(bcx, V_fail_str, T_ptr(T_i8())); V_filename = PointerCast(bcx, V_filename, T_ptr(T_i8())); @@ -3837,7 +3837,7 @@ fn trans_break_cont(sp: span, bcx: @block_ctxt, to_end: bool) _ { alt cleanup_cx.parent { parent_some(cx) { cleanup_cx = cx; } - parent_none. { + parent_none { bcx_ccx(bcx).sess.span_fatal (sp, if to_end { "Break" } else { "Cont" } + " outside a loop"); @@ -3871,7 +3871,7 @@ fn trans_ret(bcx: @block_ctxt, e: option::t<@ast::expr>) -> @block_ctxt { bcx = trans_block_cleanups(bcx, cleanup_cx); alt cleanup_cx.parent { parent_some(b) { cleanup_cx = b; } - parent_none. { more_cleanups = false; } + parent_none { more_cleanups = false; } } } build_return(bcx); @@ -3894,7 +3894,7 @@ fn init_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt { let llptr = alt bcx.fcx.lllocals.find(local.node.id) { some(local_mem(v)) { v } // This is a local that is kept immediate - none. { + none { let initexpr = alt local.node.init { some({expr, _}) { expr } }; let {bcx, val, kind} = trans_temp_lval(bcx, initexpr); if kind != temporary { @@ -3929,8 +3929,8 @@ fn init_ref_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt { let init_expr = option::get(local.node.init).expr; let {bcx, val, kind} = trans_lval(bcx, init_expr); alt kind { - owned_imm. { val = do_spill_noroot(bcx, val); } - owned. {} + owned_imm { val = do_spill_noroot(bcx, val); } + owned {} } ret trans_alt::bind_irrefutable_pat(bcx, local.node.pat, val, false); } @@ -4096,7 +4096,7 @@ fn trans_fn_cleanups(fcx: @fn_ctxt, cx: @block_ctxt) { let lltoken = lltoken_; // satisfy alias checker Call(cx, fcx_ccx(fcx).upcalls.dynastack_free, [lltoken]); } - none. {/* nothing to do */ } + none {/* nothing to do */ } } } @@ -4181,7 +4181,7 @@ fn alloc_local(cx: @block_ctxt, local: @ast::local) -> @block_ctxt { let t = node_id_type(bcx_ccx(cx), local.node.id); let p = normalize_pat(bcx_tcx(cx), local.node.pat); let is_simple = alt p.node { - ast::pat_ident(_, none.) { true } _ { false } + ast::pat_ident(_, none) { true } _ { false } }; // Do not allocate space for locals that can be kept immediate. let ccx = bcx_ccx(cx); @@ -4189,13 +4189,13 @@ fn alloc_local(cx: @block_ctxt, local: @ast::local) -> @block_ctxt { !ccx.last_uses.contains_key(local.node.pat.id) && ty::type_is_immediate(ccx.tcx, t) { alt local.node.init { - some({op: ast::init_assign., _}) { ret cx; } + some({op: ast::init_assign, _}) { ret cx; } _ {} } } let r = alloc_ty(cx, t); alt p.node { - ast::pat_ident(pth, none.) { + ast::pat_ident(pth, none) { if bcx_ccx(cx).sess.opts.debuginfo { let _: () = str::as_buf(path_to_ident(pth), {|buf| llvm::LLVMSetValueName(r.val, buf) @@ -4326,7 +4326,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg, impl_self(tt) { cx.llself = some({v: cx.llenv, t: tt}); } - no_self. {} + no_self {} } for tp in ty_params { let lltydesc = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint); @@ -4338,7 +4338,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg, let dict = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint); arg_n += 1u; dicts = some(alt dicts { - none. { [dict] } + none { [dict] } some(ds) { ds + [dict] } }); } @@ -4368,9 +4368,9 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, bcx: @block_ctxt, args: [ast::arg], let id = args[arg_n].id; let argval = alt fcx.llargs.get(id) { local_mem(v) { v } }; alt arg.mode { - ast::by_mut_ref. { } - ast::by_move. | ast::by_copy. { add_clean(bcx, argval, arg.ty); } - ast::by_val. { + ast::by_mut_ref { } + ast::by_move | ast::by_copy { add_clean(bcx, argval, arg.ty); } + ast::by_val { if !ty::type_is_immediate(bcx_tcx(bcx), arg.ty) { let {bcx: cx, val: alloc} = alloc_ty(bcx, arg.ty); bcx = cx; @@ -4380,7 +4380,7 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, bcx: @block_ctxt, args: [ast::arg], fcx.llargs.insert(id, local_imm(argval)); } } - ast::by_ref. {} + ast::by_ref {} } if fcx_ccx(fcx).sess.opts.extra_debuginfo { debuginfo::create_arg(bcx, args[arg_n]); @@ -4607,42 +4607,42 @@ fn trans_const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef { let is_float = ty::type_is_fp(ccx_tcx(cx), ty); let signed = ty::type_is_signed(ccx_tcx(cx), ty); ret alt b { - ast::add. { + ast::add { if is_float { llvm::LLVMConstFAdd(te1, te2) } else { llvm::LLVMConstAdd(te1, te2) } } - ast::subtract. { + ast::subtract { if is_float { llvm::LLVMConstFSub(te1, te2) } else { llvm::LLVMConstSub(te1, te2) } } - ast::mul. { + ast::mul { if is_float { llvm::LLVMConstFMul(te1, te2) } else { llvm::LLVMConstMul(te1, te2) } } - ast::div. { + ast::div { if is_float { llvm::LLVMConstFDiv(te1, te2) } else if signed { llvm::LLVMConstSDiv(te1, te2) } else { llvm::LLVMConstUDiv(te1, te2) } } - ast::rem. { + ast::rem { if is_float { llvm::LLVMConstFRem(te1, te2) } else if signed { llvm::LLVMConstSRem(te1, te2) } else { llvm::LLVMConstURem(te1, te2) } } - ast::and. | - ast::or. { cx.sess.span_unimpl(e.span, "binop logic"); } - ast::bitxor. { llvm::LLVMConstXor(te1, te2) } - ast::bitand. { llvm::LLVMConstAnd(te1, te2) } - ast::bitor. { llvm::LLVMConstOr(te1, te2) } - ast::lsl. { llvm::LLVMConstShl(te1, te2) } - ast::lsr. { llvm::LLVMConstLShr(te1, te2) } - ast::asr. { llvm::LLVMConstAShr(te1, te2) } - ast::eq. | - ast::lt. | - ast::le. | - ast::ne. | - ast::ge. | - ast::gt. { cx.sess.span_unimpl(e.span, "binop comparator"); } + ast::and | + ast::or { cx.sess.span_unimpl(e.span, "binop logic"); } + ast::bitxor { llvm::LLVMConstXor(te1, te2) } + ast::bitand { llvm::LLVMConstAnd(te1, te2) } + ast::bitor { llvm::LLVMConstOr(te1, te2) } + ast::lsl { llvm::LLVMConstShl(te1, te2) } + ast::lsr { llvm::LLVMConstLShr(te1, te2) } + ast::asr { llvm::LLVMConstAShr(te1, te2) } + ast::eq | + ast::lt | + ast::le | + ast::ne | + ast::ge | + ast::gt { cx.sess.span_unimpl(e.span, "binop comparator"); } } } ast::expr_unary(u, e) { @@ -4652,10 +4652,10 @@ fn trans_const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef { ret alt u { ast::box(_) | ast::uniq(_) | - ast::deref. { cx.sess.span_bug(e.span, + ast::deref { cx.sess.span_bug(e.span, "bad unop type in trans_const_expr"); } - ast::not. { llvm::LLVMConstNot(te) } - ast::neg. { + ast::not { llvm::LLVMConstNot(te) } + ast::neg { if is_float { llvm::LLVMConstFNeg(te) } else { llvm::LLVMConstNeg(te) } } @@ -4848,7 +4848,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod, for native_item in native_mod.items { alt native_item.node { - ast::native_item_ty. {} + ast::native_item_ty {} ast::native_item_fn(fn_decl, tps) { let span = native_item.span; let id = native_item.id; @@ -4860,7 +4860,7 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod, vec::len(tps), llshimfn, llwrapfn); } - none. { + none { ccx.sess.span_fatal( native_item.span, "unbound function item in trans_native_mod"); @@ -4933,7 +4933,7 @@ fn trans_item(cx: @local_ctxt, item: ast::item) { } } -// Translate a module. Doing this amounts to translating the items in the +// Translate a module. Doing this amounts to translating the items in the // module; there ends up being no artifact (aside from linkage names) of // separate modules in the compiled program. That's because modules exist // only as a convenience for humans working with the code, to organize names @@ -5084,7 +5084,7 @@ fn native_fn_ty_param_count(cx: @crate_ctxt, id: ast::node_id) -> uint { let native_item = alt cx.ast_map.find(id) { some(ast_map::node_native_item(i)) { i } }; alt native_item.node { - ast::native_item_ty. { + ast::native_item_ty { cx.sess.bug("register_native_fn(): native fn isn't \ actually a fn"); } @@ -5113,7 +5113,7 @@ fn raw_native_fn_type(ccx: @crate_ctxt, sp: span, args: [ty::arg], fn link_name(i: @ast::native_item) -> str { alt attr::get_meta_item_value_str_by_name(i.attrs, "link_name") { - none. { ret i.ident; } + none { ret i.ident; } option::some(ln) { ret ln; } } } @@ -5130,7 +5130,7 @@ fn collect_native_item(ccx: @crate_ctxt, let node_type = node_id_type(ccx, id); let fn_abi = alt attr::get_meta_item_value_str_by_name(i.attrs, "abi") { - option::none. { + option::none { // if abi isn't specified for this function, inherit from // its enclosing native module option::get(*abi) diff --git a/src/comp/middle/trans_alt.rs b/src/comp/middle/trans_alt.rs index 5addbebddc1..cef43dc25e5 100644 --- a/src/comp/middle/trans_alt.rs +++ b/src/comp/middle/trans_alt.rs @@ -129,7 +129,7 @@ fn enter_match(m: match, col: uint, val: ValueRef, e: enter_pat) -> match { vec::slice(br.pats, col + 1u, vec::len(br.pats)); let new_br = @{pats: pats, bound: alt br.pats[col].node { - ast::pat_ident(name, none.) { + ast::pat_ident(name, none) { br.bound + [{ident: path_to_ident(name), val: val}] } @@ -137,7 +137,7 @@ fn enter_match(m: match, col: uint, val: ValueRef, e: enter_pat) -> match { } with *br}; result += [new_br]; } - none. { } + none { } } } ret result; @@ -146,8 +146,8 @@ fn enter_match(m: match, col: uint, val: ValueRef, e: enter_pat) -> match { fn enter_default(m: match, col: uint, val: ValueRef) -> match { fn matches_always(p: @ast::pat) -> bool { alt p.node { - ast::pat_wild. | ast::pat_rec(_, _) | - ast::pat_ident(_, none.) | ast::pat_tup(_) { true } + ast::pat_wild | ast::pat_rec(_, _) | + ast::pat_ident(_, none) | ast::pat_tup(_) { true } _ { false } } } @@ -508,7 +508,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail, } let else_cx = alt kind { - no_branch. | single. { bcx } + no_branch | single { bcx } _ { new_sub_block_ctxt(bcx, "match_else") } }; let sw; @@ -525,8 +525,8 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail, for opt: opt in opts { let opt_cx = new_sub_block_ctxt(bcx, "match_case"); alt kind { - single. { Br(bcx, opt_cx.llbb); } - switch. { + single { Br(bcx, opt_cx.llbb); } + switch { let res = trans_opt(bcx, opt); alt res { single_result(r) { @@ -535,7 +535,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail, } } } - compare. { + compare { let compare_cx = new_scope_block_ctxt(bcx, "compare_scope"); Br(bcx, compare_cx.llbb); bcx = compare_cx; @@ -603,7 +603,7 @@ fn make_phi_bindings(bcx: @block_ctxt, map: [exit_node], if ex.to as uint == our_block { alt assoc(name, ex.bound) { some(val) { llbbs += [ex.from]; vals += [val]; } - none. { } + none { } } } } @@ -767,7 +767,7 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: @ast::pat, val: ValueRef, let val = Load(bcx, val); bcx = bind_irrefutable_pat(bcx, inner, val, true); } - ast::pat_wild. | ast::pat_lit(_) | ast::pat_range(_, _) { } + ast::pat_wild | ast::pat_lit(_) | ast::pat_range(_, _) { } } ret bcx; } diff --git a/src/comp/middle/trans_closure.rs b/src/comp/middle/trans_closure.rs index fe7752994cf..66002c89979 100644 --- a/src/comp/middle/trans_closure.rs +++ b/src/comp/middle/trans_closure.rs @@ -137,8 +137,8 @@ fn ev_to_str(ccx: @crate_ctxt, ev: environment_value) -> str { fn mk_tydesc_ty(tcx: ty::ctxt, ck: ty::closure_kind) -> ty::t { ret alt ck { - ty::ck_block. | ty::ck_box. { ty::mk_type(tcx) } - ty::ck_uniq. { ty::mk_send_type(tcx) } + ty::ck_block | ty::ck_box { ty::mk_type(tcx) } + ty::ck_uniq { ty::mk_send_type(tcx) } }; } @@ -237,15 +237,15 @@ fn allocate_cbox(bcx: @block_ctxt, // Allocate the box: let temp_cleanups = []; let (bcx, box, rc) = alt ck { - ty::ck_box. { + ty::ck_box { let (bcx, box) = alloc_in_heap(bcx, false, temp_cleanups); (bcx, box, 1) } - ty::ck_uniq. { + ty::ck_uniq { let (bcx, box) = alloc_in_heap(bcx, true, temp_cleanups); (bcx, box, 0x12345678) // use arbitrary value for debugging } - ty::ck_block. { + ty::ck_block { let {bcx, val: box} = trans::alloc_ty(bcx, cbox_ty); (bcx, box, 0x12345678) // use arbitrary value for debugging } @@ -289,10 +289,10 @@ fn store_environment( ck: ty::closure_kind, td: ValueRef) -> ValueRef { ret alt ck { - ty::ck_block. | ty::ck_box. { + ty::ck_block | ty::ck_box { td } - ty::ck_uniq. { + ty::ck_uniq { Call(bcx, bcx_ccx(bcx).upcalls.create_shared_type_desc, [td]) } }; @@ -311,7 +311,7 @@ fn store_environment( // store data tydesc. alt ck { - ty::ck_box. | ty::ck_uniq. { + ty::ck_box | ty::ck_uniq { let bound_tydesc = GEPi(bcx, llbox, [0, abi::cbox_elt_tydesc]); let ti = none; @@ -324,7 +324,7 @@ fn store_environment( let td = maybe_clone_tydesc(bcx, ck, closure_td.val); Store(bcx, td, bound_tydesc); } - ty::ck_block. { /* skip this for blocks, not really relevant */ } + ty::ck_block { /* skip this for blocks, not really relevant */ } } // cbox_ty has the form of a tuple: (a, b, c) we want a ptr to a @@ -371,28 +371,28 @@ fn store_environment( add_clean_temp_mem(bcx, bound_data, bound_tys[i]); temp_cleanups += [bound_data]; } - env_copy(val, ty, owned.) { + env_copy(val, ty, owned) { let val1 = load_if_immediate(bcx, val, ty); bcx = trans::copy_val(bcx, INIT, bound_data, val1, ty); } - env_copy(val, ty, owned_imm.) { + env_copy(val, ty, owned_imm) { bcx = trans::copy_val(bcx, INIT, bound_data, val, ty); } - env_copy(_, _, temporary.) { + env_copy(_, _, temporary) { fail "Cannot capture temporary upvar"; } env_move(val, ty, kind) { let src = {bcx:bcx, val:val, kind:kind}; bcx = move_val(bcx, INIT, bound_data, src, ty); } - env_ref(val, ty, owned.) { + env_ref(val, ty, owned) { Store(bcx, val, bound_data); } - env_ref(val, ty, owned_imm.) { + env_ref(val, ty, owned_imm) { let addr = do_spill_noroot(bcx, val); Store(bcx, addr, bound_data); } - env_ref(_, _, temporary.) { + env_ref(_, _, temporary) { fail "Cannot capture temporary upvar"; } } @@ -489,8 +489,8 @@ fn load_environment(enclosing_cx: @block_ctxt, bcx = upvarptr.bcx; let llupvarptr = upvarptr.val; alt ck { - ty::ck_block. { llupvarptr = Load(bcx, llupvarptr); } - ty::ck_uniq. | ty::ck_box. { } + ty::ck_block { llupvarptr = Load(bcx, llupvarptr); } + ty::ck_uniq | ty::ck_box { } } let def_id = ast_util::def_id_of_def(cap_var.def); fcx.llupvars.insert(def_id.node, llupvarptr); @@ -528,11 +528,11 @@ fn trans_expr_fn(bcx: @block_ctxt, }; let closure = alt proto { - ast::proto_any. { fail "proto_any cannot appear in an expr"; } - ast::proto_block. { trans_closure_env(ty::ck_block) } - ast::proto_box. { trans_closure_env(ty::ck_box) } - ast::proto_uniq. { trans_closure_env(ty::ck_uniq) } - ast::proto_bare. { + ast::proto_any { fail "proto_any cannot appear in an expr"; } + ast::proto_block { trans_closure_env(ty::ck_block) } + ast::proto_box { trans_closure_env(ty::ck_box) } + ast::proto_uniq { trans_closure_env(ty::ck_uniq) } + ast::proto_bare { let closure = C_null(T_opaque_cbox_ptr(ccx)); trans_closure(sub_cx, sp, decl, body, llfn, no_self, [], id, {|_fcx|}); @@ -556,7 +556,7 @@ fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, dest: dest) -> @block_ctxt { let bound: [@ast::expr] = []; for argopt: option::t<@ast::expr> in args { - alt argopt { none. { } some(e) { bound += [e]; } } + alt argopt { none { } some(e) { bound += [e]; } } } let bcx = f_res.bcx; if dest == ignore { @@ -566,7 +566,7 @@ fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, // Figure out which tydescs we need to pass, if any. let (outgoing_fty_real, lltydescs, param_bounds) = alt f_res.generic { - none. { (outgoing_fty, [], @[]) } + none { (outgoing_fty, [], @[]) } some(ginfo) { let tds = [], orig = 0u; vec::iter2(ginfo.tydescs, *ginfo.param_bounds) {|td, bounds| @@ -596,7 +596,7 @@ fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, ret memmove_ty(bcx, get_dest_addr(dest), lv.val, pair_ty); } let closure = alt f_res.env { - null_env. { none } + null_env { none } _ { let (_, cl) = maybe_add_env(cx, f_res); some(cl) } }; @@ -616,7 +616,7 @@ fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, let src_loc = PointerCast(bcx, cl, llclosurety); ([env_copy(src_loc, pair_ty, owned)], none) } - none. { ([], some(f_res.val)) } + none { ([], some(f_res.val)) } }; // Actually construct the closure @@ -668,11 +668,11 @@ fn make_fn_glue( }; ret alt ty::struct(tcx, t) { - ty::ty_native_fn(_, _) | ty::ty_fn({proto: ast::proto_bare., _}) { bcx } - ty::ty_fn({proto: ast::proto_block., _}) { bcx } - ty::ty_fn({proto: ast::proto_any., _}) { bcx } - ty::ty_fn({proto: ast::proto_uniq., _}) { fn_env(ty::ck_uniq) } - ty::ty_fn({proto: ast::proto_box., _}) { fn_env(ty::ck_box) } + ty::ty_native_fn(_, _) | ty::ty_fn({proto: ast::proto_bare, _}) { bcx } + ty::ty_fn({proto: ast::proto_block, _}) { bcx } + ty::ty_fn({proto: ast::proto_any, _}) { bcx } + ty::ty_fn({proto: ast::proto_uniq, _}) { fn_env(ty::ck_uniq) } + ty::ty_fn({proto: ast::proto_box, _}) { fn_env(ty::ck_box) } _ { fail "make_fn_glue invoked on non-function type" } }; } @@ -684,9 +684,9 @@ fn make_opaque_cbox_take_glue( -> @block_ctxt { // Easy cases: alt ck { - ty::ck_block. { ret bcx; } - ty::ck_box. { ret incr_refcnt_of_boxed(bcx, Load(bcx, cboxptr)); } - ty::ck_uniq. { /* hard case: */ } + ty::ck_block { ret bcx; } + ty::ck_box { ret incr_refcnt_of_boxed(bcx, Load(bcx, cboxptr)); } + ty::ck_uniq { /* hard case: */ } } // Hard case, a deep copy: @@ -722,12 +722,12 @@ fn make_opaque_cbox_drop_glue( cboxptr: ValueRef) // ptr to the opaque closure -> @block_ctxt { alt ck { - ty::ck_block. { bcx } - ty::ck_box. { + ty::ck_block { bcx } + ty::ck_box { decr_refcnt_maybe_free(bcx, Load(bcx, cboxptr), ty::mk_opaque_closure_ptr(bcx_tcx(bcx), ck)) } - ty::ck_uniq. { + ty::ck_uniq { free_ty(bcx, Load(bcx, cboxptr), ty::mk_opaque_closure_ptr(bcx_tcx(bcx), ck)) } @@ -740,8 +740,8 @@ fn make_opaque_cbox_free_glue( cbox: ValueRef) // ptr to the opaque closure -> @block_ctxt { alt ck { - ty::ck_block. { ret bcx; } - ty::ck_box. | ty::ck_uniq. { /* hard cases: */ } + ty::ck_block { ret bcx; } + ty::ck_box | ty::ck_uniq { /* hard cases: */ } } let ccx = bcx_ccx(bcx); @@ -768,11 +768,11 @@ fn make_opaque_cbox_free_glue( // Free the ty descr (if necc) and the box itself alt ck { - ty::ck_block. { fail "Impossible."; } - ty::ck_box. { + ty::ck_block { fail "Impossible"; } + ty::ck_box { trans_free_if_not_gc(bcx, cbox) } - ty::ck_uniq. { + ty::ck_uniq { let bcx = free_ty(bcx, tydesc, mk_tydesc_ty(tcx, ck)); trans_shared_free(bcx, cbox) } @@ -858,7 +858,7 @@ fn trans_bind_thunk(cx: @local_ctxt, some(fptr) { (fptr, llvm::LLVMGetUndef(T_opaque_cbox_ptr(ccx)), 0) } - none. { + none { // Silly check check type_is_tup_like(bcx, cbox_ty); let {bcx: cx, val: pair} = @@ -915,7 +915,7 @@ fn trans_bind_thunk(cx: @local_ctxt, llargs += [dict]; off += 1; dicts = some(alt dicts { - none. { [dict] } + none { [dict] } some(ds) { ds + [dict] } }); } @@ -961,7 +961,7 @@ fn trans_bind_thunk(cx: @local_ctxt, } // Arg will be provided when the thunk is invoked. - none. { + none { let arg: ValueRef = llvm::LLVMGetParam(llthunk, a as c_uint); if ty::type_contains_params(cx.ccx.tcx, out_arg.ty) { arg = PointerCast(bcx, arg, llout_arg_ty); diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index 835f8cc5c5e..db1e615804f 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -33,7 +33,7 @@ fn new_namegen() -> namegen { type derived_tydesc_info = {lltydesc: ValueRef, escapes: bool}; tag tydesc_kind { - tk_static; // Static (monomorphic) type descriptor. + tk_static; // Static (monomorphic) type descriptor tk_param; // Type parameter. tk_derived; // Derived from a typaram or another derived tydesc. } @@ -335,7 +335,7 @@ tag block_kind { // A scope block is a basic block created by translating a block { ... } - // the the source language. Since these blocks create variable scope, any + // in the source language. Since these blocks create variable scope, any // variables created in them that are still live at the end of the block // must be dropped and cleaned up when the block ends. SCOPE_BLOCK; @@ -422,7 +422,7 @@ fn find_scope_cx(cx: @block_ctxt) -> @block_ctxt { if cx.kind != NON_SCOPE_BLOCK { ret cx; } alt cx.parent { parent_some(b) { ret find_scope_cx(b); } - parent_none. { + parent_none { cx.fcx.lcx.ccx.sess.bug("trans::find_scope_cx() " + "called on parentless block_ctxt"); } @@ -491,30 +491,30 @@ fn T_int(targ_cfg: @session::config) -> TypeRef { fn T_int_ty(cx: @crate_ctxt, t: ast::int_ty) -> TypeRef { alt t { - ast::ty_i. { cx.int_type } - ast::ty_char. { T_char() } - ast::ty_i8. { T_i8() } - ast::ty_i16. { T_i16() } - ast::ty_i32. { T_i32() } - ast::ty_i64. { T_i64() } + ast::ty_i { cx.int_type } + ast::ty_char { T_char() } + ast::ty_i8 { T_i8() } + ast::ty_i16 { T_i16() } + ast::ty_i32 { T_i32() } + ast::ty_i64 { T_i64() } } } fn T_uint_ty(cx: @crate_ctxt, t: ast::uint_ty) -> TypeRef { alt t { - ast::ty_u. { cx.int_type } - ast::ty_u8. { T_i8() } - ast::ty_u16. { T_i16() } - ast::ty_u32. { T_i32() } - ast::ty_u64. { T_i64() } + ast::ty_u { cx.int_type } + ast::ty_u8 { T_i8() } + ast::ty_u16 { T_i16() } + ast::ty_u32 { T_i32() } + ast::ty_u64 { T_i64() } } } fn T_float_ty(cx: @crate_ctxt, t: ast::float_ty) -> TypeRef { alt t { - ast::ty_f. { cx.float_type } - ast::ty_f32. { T_f32() } - ast::ty_f64. { T_f64() } + ast::ty_f { cx.float_type } + ast::ty_f32 { T_f32() } + ast::ty_f64 { T_f64() } } } diff --git a/src/comp/middle/trans_impl.rs b/src/comp/middle/trans_impl.rs index e5a0e9a4ac7..9a0430481a4 100644 --- a/src/comp/middle/trans_impl.rs +++ b/src/comp/middle/trans_impl.rs @@ -341,7 +341,7 @@ fn get_static_dict(bcx: @block_ctxt, origin: typeck::dict_origin) let id = dict_id(ccx.tcx, origin); alt ccx.dicts.find(id) { some(d) { ret d; } - none. {} + none {} } let ptrs = C_struct(get_dict_ptrs(bcx, origin).ptrs); let name = ccx.names("dict"); diff --git a/src/comp/middle/trans_vec.rs b/src/comp/middle/trans_vec.rs index c33d5178790..feccfc413bf 100644 --- a/src/comp/middle/trans_vec.rs +++ b/src/comp/middle/trans_vec.rs @@ -153,7 +153,7 @@ fn trans_append(cx: @block_ctxt, vec_ty: ty::t, lhsptr: ValueRef, (PointerCast(cx, lhsptr, T_ptr(T_ptr(ccx.opaque_vec_type))), PointerCast(cx, rhs, T_ptr(ccx.opaque_vec_type))); let strings = alt ty::struct(bcx_tcx(cx), vec_ty) { - ty::ty_str. { true } + ty::ty_str { true } ty::ty_vec(_) { false } }; @@ -221,7 +221,7 @@ fn trans_add(bcx: @block_ctxt, vec_ty: ty::t, lhs: ValueRef, rhs: ValueRef, dest: dest) -> @block_ctxt { let ccx = bcx_ccx(bcx); let strings = alt ty::struct(bcx_tcx(bcx), vec_ty) { - ty::ty_str. { true } + ty::ty_str { true } ty::ty_vec(_) { false } }; let unit_ty = ty::sequence_element_type(bcx_tcx(bcx), vec_ty); diff --git a/src/comp/middle/tstate/ann.rs b/src/comp/middle/tstate/ann.rs index 18fe58ae8ee..f3862e3d20f 100644 --- a/src/comp/middle/tstate/ann.rs +++ b/src/comp/middle/tstate/ann.rs @@ -240,7 +240,7 @@ fn implies(a: t, b: t) -> bool { } fn trit_str(t: trit) -> str { - alt t { dont_care. { "?" } ttrue. { "1" } tfalse. { "0" } } + alt t { dont_care { "?" } ttrue { "1" } tfalse { "0" } } } // // Local Variables: diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index cb592be250c..04469cda4eb 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -41,7 +41,7 @@ fn comma_str(args: [@constr_arg_use]) -> str { for a: @constr_arg_use in args { if comma { rslt += ", "; } else { comma = true; } alt a.node { - carg_base. { rslt += "*"; } + carg_base { rslt += "*"; } carg_ident(i) { rslt += i.ident; } carg_lit(l) { rslt += lit_to_str(l); } } @@ -69,7 +69,7 @@ fn tritv_to_str(fcx: fn_ctxt, v: tritv::t) -> str { let comma = false; for p: norm_constraint in constraints(fcx) { alt tritv_get(v, p.bit_num) { - dont_care. { } + dont_care { } tt { s += if comma { ", " } else { comma = true; "" } + @@ -310,7 +310,7 @@ fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option::t<ts_ann> { /********* utils ********/ fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann { alt get_ts_ann(ccx, id) { - none. { + none { #error("node_id_to_ts_ann: no ts_ann for node_id %d", id); fail; } @@ -507,7 +507,7 @@ fn constraints_expr(cx: ty::ctxt, e: @expr) -> [@ty::constr] { fn node_id_to_def_strict(cx: ty::ctxt, id: node_id) -> def { alt cx.def_map.find(id) { - none. { + none { #error("node_id_to_def: node_id %d has no def", id); fail; } @@ -565,7 +565,7 @@ fn match_args(fcx: fn_ctxt, occs: @mutable [pred_args], fn def_id_for_constr(tcx: ty::ctxt, t: node_id) -> def_id { alt tcx.def_map.find(t) { - none. { + none { tcx.sess.bug("node_id_for_constr: bad node_id " + int::str(t)); } some(def_fn(i, _)) { ret i; } @@ -658,7 +658,7 @@ fn substitute_arg(cx: ty::ctxt, actuals: [@expr], a: @constr_arg) -> cx.sess.span_fatal(a.span, "Constraint argument out of bounds"); } } - carg_base. { ret @respan(a.span, carg_base); } + carg_base { ret @respan(a.span, carg_base); } carg_lit(l) { ret @respan(a.span, carg_lit(l)); } } } @@ -675,7 +675,7 @@ fn pred_args_matches(pattern: [constr_arg_general_<inst>], desc: pred_args) -> _ { ret false; } } } - carg_base. { if n != carg_base { ret false; } } + carg_base { if n != carg_base { ret false; } } carg_lit(l) { alt n { carg_lit(m) { if !lit_eq(l, m) { ret false; } } @@ -741,7 +741,7 @@ fn insts_to_str(stuff: [constr_arg_general_<inst>]) -> str { " " + alt i { carg_ident(p) { p.ident } - carg_base. { "*" } + carg_base { "*" } carg_lit(_) { "[lit]" } } + " "; } @@ -794,7 +794,7 @@ fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) -> "local_node_id_to_def_id: id \ isn't a local"); } - none. { + none { // should really be bug. span_bug()? fcx.ccx.tcx.sess.span_fatal(sp, "local_node_id_to_def_id: id \ @@ -848,8 +848,8 @@ fn copy_in_poststate_two(fcx: fn_ctxt, src_post: poststate, ty: oper_type) { let subst; alt ty { - oper_swap. { subst = [{from: dest, to: src}, {from: src, to: dest}]; } - oper_assign_op. { + oper_swap { subst = [{from: dest, to: src}, {from: src, to: dest}]; } + oper_assign_op { ret; // Don't do any propagation } _ { subst = [{from: src, to: dest}]; } @@ -1003,7 +1003,7 @@ fn vec_contains(v: @mutable [node_id], i: node_id) -> bool { } fn op_to_oper_ty(io: init_op) -> oper_type { - alt io { init_move. { oper_move } _ { oper_assign } } + alt io { init_move { oper_move } _ { oper_assign } } } // default function visitor @@ -1021,7 +1021,7 @@ fn args_to_constr_args(tcx: ty::ctxt, args: [arg], actuals += [@respan(a.span, alt a.node { - carg_base. { carg_base } + carg_base { carg_base } carg_ident(i) { if i < num_args { carg_ident({ident: args[i].ident, @@ -1090,7 +1090,7 @@ fn callee_modes(fcx: fn_ctxt, callee: node_id) -> [ty::mode] { fn callee_arg_init_ops(fcx: fn_ctxt, callee: node_id) -> [init_op] { fn mode_to_op(m: ty::mode) -> init_op { - alt m { by_move. { init_move } _ { init_assign } } + alt m { by_move { init_move } _ { init_assign } } } vec::map(callee_modes(fcx, callee), mode_to_op) } diff --git a/src/comp/middle/tstate/bitvectors.rs b/src/comp/middle/tstate/bitvectors.rs index c4e09873085..f9209d60c16 100644 --- a/src/comp/middle/tstate/bitvectors.rs +++ b/src/comp/middle/tstate/bitvectors.rs @@ -48,7 +48,7 @@ fn promises_(n: uint, p: poststate) -> bool { ret tritv_get(p, n) == ttrue; } // v "happens after" u fn seq_trit(u: trit, v: trit) -> trit { - alt v { ttrue. { ttrue } tfalse. { tfalse } dont_care. { u } } + alt v { ttrue { ttrue } tfalse { tfalse } dont_care { u } } } // idea: q "happens after" p -- so if something is diff --git a/src/comp/middle/tstate/collect_locals.rs b/src/comp/middle/tstate/collect_locals.rs index 102451a6985..200aef3b6db 100644 --- a/src/comp/middle/tstate/collect_locals.rs +++ b/src/comp/middle/tstate/collect_locals.rs @@ -84,7 +84,7 @@ fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) -> } } } - none. { + none { let rslt: @mutable [pred_args] = @mutable [respan(c.span, {args: args, bit_num: next})]; tbl.insert(d_id, cpred(p, rslt)); diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index 57bb0379779..5b7322fbb16 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -132,9 +132,9 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, find_pre_post_expr(fcx, antec); find_pre_post_block(fcx, conseq); alt maybe_alt { - none. { + none { alt chck { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); gen(fcx, antec.id, c.node); } @@ -166,7 +166,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, /* Be sure to set the bit for the check condition here, so that it's *not* set in the alternative. */ alt chck { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); gen(fcx, antec.id, c.node); } @@ -219,14 +219,14 @@ fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr, let tmp = tritv_clone(post); alt ty { - oper_move. { + oper_move { if is_path(rhs) { forget_in_postcond(fcx, parent.id, rhs.id); } } - oper_swap. { + oper_swap { forget_in_postcond_still_init(fcx, parent.id, lhs.id); forget_in_postcond_still_init(fcx, parent.id, rhs.id); } - oper_assign. { + oper_assign { forget_in_postcond_still_init(fcx, parent.id, lhs.id); } _ { @@ -336,7 +336,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { /* if this is a failing call, its postcondition sets everything */ alt controlflow_expr(fcx.ccx, operator) { - noreturn. { set_postcond_false(fcx.ccx, e.id); } + noreturn { set_postcond_false(fcx.ccx, e.id); } _ { } } } @@ -374,7 +374,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { } expr_rec(fields, maybe_base) { let es = field_exprs(fields); - alt maybe_base { none. {/* no-op */ } some(b) { es += [b]; } } + alt maybe_base { none {/* no-op */ } some(b) { es += [b]; } } find_pre_post_exprs(fcx, es, e.id); } expr_tup(elts) { find_pre_post_exprs(fcx, elts, e.id); } @@ -395,7 +395,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { expr_lit(_) { clear_pp(expr_pp(fcx.ccx, e)); } expr_ret(maybe_val) { alt maybe_val { - none. { + none { clear_precond(fcx.ccx, e.id); set_postcond_false(fcx.ccx, e.id); } @@ -503,7 +503,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { expr_fail(maybe_val) { let prestate; alt maybe_val { - none. { prestate = empty_prestate(num_local_vars); } + none { prestate = empty_prestate(num_local_vars); } some(fail_val) { find_pre_post_expr(fcx, fail_val); prestate = expr_precond(fcx.ccx, fail_val); @@ -542,7 +542,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { let i = 0; for expr_opt: option::t<@expr> in maybe_args { alt expr_opt { - none. {/* no-op */ } + none {/* no-op */ } some(expr) { modes += [cmodes[i]]; args += [expr]; } } i += 1; @@ -551,8 +551,8 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { forget_args_moved_in(fcx, e, modes, args); find_pre_post_exprs(fcx, args, e.id); } - expr_break. { clear_pp(expr_pp(fcx.ccx, e)); } - expr_cont. { clear_pp(expr_pp(fcx.ccx, e)); } + expr_break { clear_pp(expr_pp(fcx.ccx, e)); } + expr_cont { clear_pp(expr_pp(fcx.ccx, e)); } expr_mac(_) { fcx.ccx.tcx.sess.bug("unexpanded macro"); } } } @@ -601,7 +601,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) { node: an_init.expr.id}, op_to_oper_ty(an_init.op)); } - none. { } + none { } } gen(fcx, id, ninit(pat.id, ident)); }; @@ -631,7 +631,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) { copy_pre_post_(fcx.ccx, id, prev_pp.precondition, prev_pp.postcondition); } - none. { + none { pat_bindings(alocal.node.pat) {|p| clear_pp(node_id_to_ts_ann(fcx.ccx, p.id).conditions); }; @@ -689,7 +689,7 @@ fn find_pre_post_block(fcx: fn_ctxt, b: blk) { let pps: [pre_and_post] = []; for s: @stmt in b.node.stmts { pps += [stmt_pp(fcx.ccx, *s)]; } alt b.node.expr { - none. {/* no-op */ } + none {/* no-op */ } some(e) { pps += [expr_pp(fcx.ccx, e)]; } } @@ -721,7 +721,7 @@ fn find_pre_post_fn(fcx: fn_ctxt, body: blk) { // Treat the tail expression as a return statement alt body.node.expr { some(tailexpr) { set_postcond_false(fcx.ccx, tailexpr.id); } - none. {/* fallthrough */ } + none {/* fallthrough */ } } } diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index 50208b9dacf..6256ea11b3f 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -15,7 +15,7 @@ import driver::session::session; fn forbid_upvar(fcx: fn_ctxt, rhs_id: node_id, sp: span, t: oper_type) { alt t { - oper_move. { + oper_move { alt local_node_id_to_def(fcx, rhs_id) { some(def_upvar(_, _, _)) { fcx.ccx.tcx.sess.span_err(sp, @@ -94,7 +94,7 @@ fn find_pre_post_state_sub(fcx: fn_ctxt, pres: prestate, e: @expr, let post = tritv_clone(expr_poststate(fcx.ccx, e)); alt c { - none. { } + none { } some(c1) { set_in_poststate_(bit_num(fcx, c1), post); } } @@ -123,11 +123,11 @@ fn find_pre_post_state_two(fcx: fn_ctxt, pres: prestate, lhs: @expr, let tmp = tritv_clone(post); alt ty { - oper_move. { + oper_move { if is_path(rhs) { forget_in_poststate(fcx, post, rhs.id); } forget_in_poststate_still_init(fcx, post, lhs.id); } - oper_swap. { + oper_swap { forget_in_poststate_still_init(fcx, post, lhs.id); forget_in_poststate_still_init(fcx, post, rhs.id); } @@ -187,7 +187,7 @@ fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id, let changed = rs.changed | set_prestate_ann(fcx.ccx, id, pres); /* if this is a failing call, it sets everything as initialized */ alt cf { - noreturn. { + noreturn { let post = false_postcond(num_constraints(fcx.enclosing)); changed |= set_poststate_ann(fcx.ccx, id, post); } @@ -265,9 +265,9 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, */ alt maybe_alt { - none. { + none { alt chk { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); let conseq_prestate = tritv_clone(expr_poststate(fcx.ccx, antec)); tritv_set(bit_num(fcx, c.node), conseq_prestate, ttrue); @@ -292,7 +292,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, let conseq_prestate = expr_poststate(fcx.ccx, antec); alt chk { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); conseq_prestate = tritv_clone(conseq_prestate); tritv_set(bit_num(fcx, c.node), conseq_prestate, ttrue); @@ -360,7 +360,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { let i = 0; for a_opt: option::t<@expr> in maybe_args { alt a_opt { - none. {/* no-op */ } + none {/* no-op */ } some(a) { ops += [callee_ops[i]]; args += [a]; } } i += 1; @@ -390,7 +390,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { vec::len(fields)), field_exprs(fields), return_val); alt maybe_base { - none. {/* do nothing */ } + none {/* do nothing */ } some(base) { changed |= find_pre_post_state_expr(fcx, pres, base) | @@ -431,7 +431,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { set_poststate_ann(fcx.ccx, e.id, post); alt maybe_ret_val { - none. {/* do nothing */ } + none {/* do nothing */ } some(ret_val) { changed |= find_pre_post_state_expr(fcx, pres, ret_val); } @@ -586,13 +586,13 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { woo! */ let post = false_postcond(num_constrs); alt fcx.enclosing.cf { - noreturn. { kill_poststate_(fcx, ninit(fcx.id, fcx.name), post); } + noreturn { kill_poststate_(fcx, ninit(fcx.id, fcx.name), post); } _ { } } ret set_prestate_ann(fcx.ccx, e.id, pres) | set_poststate_ann(fcx.ccx, e.id, post) | alt maybe_fail_val { - none. { false } + none { false } some(fail_val) { find_pre_post_state_expr(fcx, pres, fail_val) } @@ -609,8 +609,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { expr_if_check(p, conseq, maybe_alt) { ret join_then_else(fcx, p, conseq, maybe_alt, e.id, if_check, pres); } - expr_break. { ret pure_exp(fcx.ccx, e.id, pres); } - expr_cont. { ret pure_exp(fcx.ccx, e.id, pres); } + expr_break { ret pure_exp(fcx.ccx, e.id, pres); } + expr_cont { ret pure_exp(fcx.ccx, e.id, pres); } } } @@ -704,7 +704,7 @@ fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool { } let post = pres; alt b.node.expr { - none. { } + none { } some(e) { changed |= find_pre_post_state_expr(fcx, pres, e); post = expr_poststate(fcx.ccx, e); @@ -767,7 +767,7 @@ fn find_pre_post_state_fn(fcx: fn_ctxt, set_poststate_ann(fcx.ccx, f_body.node.id, post); } } - none. {/* fallthrough */ } + none {/* fallthrough */ } } /* diff --git a/src/comp/middle/tstate/tritv.rs b/src/comp/middle/tstate/tritv.rs index c979b1aa74e..6a7504de5c3 100644 --- a/src/comp/middle/tstate/tritv.rs +++ b/src/comp/middle/tstate/tritv.rs @@ -49,25 +49,25 @@ fn trit_minus(a: trit, b: trit) -> trit { 0 - anything else - 0 */ alt a { - dont_care. { dont_care } - ttrue. { + dont_care { dont_care } + ttrue { alt b { - ttrue. { dont_care } - tfalse. { ttrue } + ttrue { dont_care } + tfalse { ttrue } /* internally contradictory, but I guess it'll get flagged? */ - dont_care. { + dont_care { ttrue } } } - tfalse. { + tfalse { alt b { - ttrue. { tfalse } + ttrue { tfalse } @@ -83,11 +83,11 @@ fn trit_minus(a: trit, b: trit) -> trit { fn trit_or(a: trit, b: trit) -> trit { alt a { - dont_care. { b } - ttrue. { ttrue } - tfalse. { + dont_care { b } + ttrue { ttrue } + tfalse { alt b { - ttrue. { dont_care } + ttrue { dont_care } @@ -108,21 +108,21 @@ fn trit_or(a: trit, b: trit) -> trit { // (we consider a constraint false until proven true), too. fn trit_and(a: trit, b: trit) -> trit { alt a { - dont_care. { b } + dont_care { b } // also seems wrong for case b = ttrue - ttrue. { + ttrue { alt b { - dont_care. { ttrue } + dont_care { ttrue } // ??? Seems wrong - ttrue. { + ttrue { ttrue } @@ -135,7 +135,7 @@ fn trit_and(a: trit, b: trit) -> trit { // (Rationale: it's always safe to assume that // a var is uninitialized or that a constraint // needs to be re-established) - tfalse. { + tfalse { tfalse } } @@ -147,7 +147,7 @@ fn trit_and(a: trit, b: trit) -> trit { // Rationale: if it's uninit on one path, // we can consider it as uninit on all paths - tfalse. { + tfalse { tfalse } } @@ -214,12 +214,12 @@ fn tritv_get(v: t, i: uint) -> trit { fn tritv_set(i: uint, v: t, t: trit) -> bool { let old = tritv_get(v, i); alt t { - dont_care. { + dont_care { bitv::set(v.uncertain, i, true); bitv::set(v.val, i, false); } - ttrue. { bitv::set(v.uncertain, i, false); bitv::set(v.val, i, true); } - tfalse. { + ttrue { bitv::set(v.uncertain, i, false); bitv::set(v.val, i, true); } + tfalse { bitv::set(v.uncertain, i, false); bitv::set(v.val, i, false); } @@ -273,9 +273,9 @@ fn to_vec(v: t) -> [uint] { while i < v.nbits { rslt += [alt tritv_get(v, i) { - dont_care. { 2u } - ttrue. { 1u } - tfalse. { 0u } + dont_care { 2u } + ttrue { 1u } + tfalse { 0u } }]; i += 1u; } @@ -288,9 +288,9 @@ fn to_str(v: t) -> str { while i < v.nbits { rs += alt tritv_get(v, i) { - dont_care. { "?" } - ttrue. { "1" } - tfalse. { "0" } + dont_care { "?" } + ttrue { "1" } + tfalse { "0" } }; i += 1u; } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 88a25126168..b376af652aa 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -313,10 +313,10 @@ fn param_bounds_to_kind(bounds: param_bounds) -> kind { let kind = kind_noncopyable; for bound in *bounds { alt bound { - bound_copy. { + bound_copy { if kind != kind_sendable { kind = kind_copyable; } } - bound_send. { kind = kind_sendable; } + bound_send { kind = kind_sendable; } _ {} } } @@ -468,8 +468,8 @@ fn mk_raw_ty(cx: ctxt, st: sty) -> @raw_t { derive_flags_t(cx, has_params, has_vars, tt); } alt st { - ty_nil. | ty_bot. | ty_bool. | ty_int(_) | ty_float(_) | ty_uint(_) | - ty_str. | ty_send_type. | ty_type. | ty_native(_) | + ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) | + ty_str | ty_send_type | ty_type | ty_native(_) | ty_opaque_closure_ptr(_) { /* no-op */ } @@ -535,30 +535,30 @@ fn mk_uint(_cx: ctxt) -> t { ret idx_uint; } fn mk_mach_int(_cx: ctxt, tm: ast::int_ty) -> t { alt tm { - ast::ty_i. { ret idx_int; } - ast::ty_char. { ret idx_char; } - ast::ty_i8. { ret idx_i8; } - ast::ty_i16. { ret idx_i16; } - ast::ty_i32. { ret idx_i32; } - ast::ty_i64. { ret idx_i64; } + ast::ty_i { ret idx_int; } + ast::ty_char { ret idx_char; } + ast::ty_i8 { ret idx_i8; } + ast::ty_i16 { ret idx_i16; } + ast::ty_i32 { ret idx_i32; } + ast::ty_i64 { ret idx_i64; } } } fn mk_mach_uint(_cx: ctxt, tm: ast::uint_ty) -> t { alt tm { - ast::ty_u. { ret idx_uint; } - ast::ty_u8. { ret idx_u8; } - ast::ty_u16. { ret idx_u16; } - ast::ty_u32. { ret idx_u32; } - ast::ty_u64. { ret idx_u64; } + ast::ty_u { ret idx_uint; } + ast::ty_u8 { ret idx_u8; } + ast::ty_u16 { ret idx_u16; } + ast::ty_u32 { ret idx_u32; } + ast::ty_u64 { ret idx_u64; } } } fn mk_mach_float(_cx: ctxt, tm: ast::float_ty) -> t { alt tm { - ast::ty_f. { ret idx_float; } - ast::ty_f32. { ret idx_f32; } - ast::ty_f64. { ret idx_f64; } + ast::ty_f { ret idx_float; } + ast::ty_f32 { ret idx_f32; } + ast::ty_f64 { ret idx_f64; } } } @@ -659,9 +659,9 @@ pure fn mach_struct(cx: ctxt, cfg: @session::config, typ: t) -> sty { // Converts s to its machine type equivalent pure fn mach_sty(cfg: @session::config, s: sty) -> sty { alt s { - ty_int(ast::ty_i.) { ty_int(cfg.int_type) } - ty_uint(ast::ty_u.) { ty_uint(cfg.uint_type) } - ty_float(ast::ty_f.) { ty_float(cfg.float_type) } + ty_int(ast::ty_i) { ty_int(cfg.int_type) } + ty_uint(ast::ty_u) { ty_uint(cfg.uint_type) } + ty_float(ast::ty_f) { ty_float(cfg.float_type) } s { s } } } @@ -679,8 +679,8 @@ type ty_walk = fn@(t); fn walk_ty(cx: ctxt, walker: ty_walk, ty: t) { alt struct(cx, ty) { - ty_nil. | ty_bot. | ty_bool. | ty_int(_) | ty_uint(_) | ty_float(_) | - ty_str. | ty_send_type. | ty_type. | ty_native(_) | + ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | + ty_str | ty_send_type | ty_type | ty_native(_) | ty_opaque_closure_ptr(_) { /* no-op */ } @@ -728,8 +728,8 @@ fn fold_ty(cx: ctxt, fld: fold_mode, ty_0: t) -> t { fm_general(_) {/* no fast path */ } } alt interner::get(*cx.ts, ty).struct { - ty_nil. | ty_bot. | ty_bool. | ty_int(_) | ty_uint(_) | ty_float(_) | - ty_str. | ty_send_type. | ty_type. | ty_native(_) | + ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | + ty_str | ty_send_type | ty_type | ty_native(_) | ty_opaque_closure_ptr(_) { /* no-op */ } @@ -813,15 +813,15 @@ fn fold_ty(cx: ctxt, fld: fold_mode, ty_0: t) -> t { // Type utilities fn type_is_nil(cx: ctxt, ty: t) -> bool { - alt struct(cx, ty) { ty_nil. { ret true; } _ { ret false; } } + alt struct(cx, ty) { ty_nil { ret true; } _ { ret false; } } } fn type_is_bot(cx: ctxt, ty: t) -> bool { - alt struct(cx, ty) { ty_bot. { ret true; } _ { ret false; } } + alt struct(cx, ty) { ty_bot { ret true; } _ { ret false; } } } fn type_is_bool(cx: ctxt, ty: t) -> bool { - alt struct(cx, ty) { ty_bool. { ret true; } _ { ret false; } } + alt struct(cx, ty) { ty_bool { ret true; } _ { ret false; } } } fn type_is_structural(cx: ctxt, ty: t) -> bool { @@ -838,19 +838,19 @@ fn type_is_copyable(cx: ctxt, ty: t) -> bool { fn type_is_sequence(cx: ctxt, ty: t) -> bool { alt struct(cx, ty) { - ty_str. { ret true; } + ty_str { ret true; } ty_vec(_) { ret true; } _ { ret false; } } } fn type_is_str(cx: ctxt, ty: t) -> bool { - alt struct(cx, ty) { ty_str. { ret true; } _ { ret false; } } + alt struct(cx, ty) { ty_str { ret true; } _ { ret false; } } } fn sequence_element_type(cx: ctxt, ty: t) -> t { alt struct(cx, ty) { - ty_str. { ret mk_mach_uint(cx, ast::ty_u8); } + ty_str { ret mk_mach_uint(cx, ast::ty_u8); } ty_vec(mt) { ret mt.ty; } _ { cx.sess.bug("sequence_element_type called on non-sequence value"); } } @@ -907,7 +907,7 @@ pure fn type_is_unsafe_ptr(cx: ctxt, ty: t) -> bool { pure fn type_is_vec(cx: ctxt, ty: t) -> bool { ret alt struct(cx, ty) { ty_vec(_) { true } - ty_str. { true } + ty_str { true } _ { false } }; } @@ -916,15 +916,15 @@ pure fn type_is_unique(cx: ctxt, ty: t) -> bool { alt struct(cx, ty) { ty_uniq(_) { ret true; } ty_vec(_) { true } - ty_str. { true } + ty_str { true } _ { ret false; } } } pure fn type_is_scalar(cx: ctxt, ty: t) -> bool { alt struct(cx, ty) { - ty_nil. | ty_bool. | ty_int(_) | ty_float(_) | ty_uint(_) | - ty_send_type. | ty_type. | ty_native(_) | ty_ptr(_) { true } + ty_nil | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) | + ty_send_type | ty_type | ty_native(_) | ty_ptr(_) { true } _ { false } } } @@ -938,14 +938,14 @@ fn type_is_immediate(cx: ctxt, ty: t) -> bool { fn type_needs_drop(cx: ctxt, ty: t) -> bool { alt cx.needs_drop_cache.find(ty) { some(result) { ret result; } - none. {/* fall through */ } + none {/* fall through */ } } let accum = false; let result = alt struct(cx, ty) { // scalar types - ty_nil. | ty_bot. | ty_bool. | ty_int(_) | ty_float(_) | ty_uint(_) | - ty_type. | ty_native(_) | ty_ptr(_) { false } + ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) | + ty_type | ty_native(_) | ty_ptr(_) { false } ty_rec(flds) { for f in flds { if type_needs_drop(cx, f.mt.ty) { accum = true; } } accum @@ -980,35 +980,35 @@ tag kind { kind_sendable; kind_copyable; kind_noncopyable; } // future. pure fn kind_can_be_copied(k: kind) -> bool { ret alt k { - kind_sendable. { true } - kind_copyable. { true } - kind_noncopyable. { false } + kind_sendable { true } + kind_copyable { true } + kind_noncopyable { false } }; } pure fn kind_can_be_sent(k: kind) -> bool { ret alt k { - kind_sendable. { true } - kind_copyable. { false } - kind_noncopyable. { false } + kind_sendable { true } + kind_copyable { false } + kind_noncopyable { false } }; } fn proto_kind(p: proto) -> kind { alt p { - ast::proto_any. { kind_noncopyable } - ast::proto_block. { kind_noncopyable } - ast::proto_box. { kind_copyable } - ast::proto_uniq. { kind_sendable } - ast::proto_bare. { kind_sendable } + ast::proto_any { kind_noncopyable } + ast::proto_block { kind_noncopyable } + ast::proto_box { kind_copyable } + ast::proto_uniq { kind_sendable } + ast::proto_bare { kind_sendable } } } fn kind_lteq(a: kind, b: kind) -> bool { alt a { - kind_noncopyable. { true } - kind_copyable. { b != kind_noncopyable } - kind_sendable. { b == kind_sendable } + kind_noncopyable { true } + kind_copyable { b != kind_noncopyable } + kind_sendable { b == kind_sendable } } } @@ -1019,7 +1019,7 @@ fn lower_kind(a: kind, b: kind) -> kind { fn type_kind(cx: ctxt, ty: t) -> kind { alt cx.kind_cache.find(ty) { some(result) { ret result; } - none. {/* fall through */ } + none {/* fall through */ } } // Insert a default in case we loop back on self recursively. @@ -1027,14 +1027,14 @@ fn type_kind(cx: ctxt, ty: t) -> kind { let result = alt struct(cx, ty) { // Scalar and unique types are sendable - ty_nil. | ty_bot. | ty_bool. | ty_int(_) | ty_uint(_) | ty_float(_) | + ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) | ty_native(_) | ty_ptr(_) | - ty_send_type. | ty_str. | ty_native_fn(_, _) { kind_sendable } - ty_type. { kind_copyable } + ty_send_type | ty_str | ty_native_fn(_, _) { kind_sendable } + ty_type { kind_copyable } ty_fn(f) { proto_kind(f.proto) } - ty_opaque_closure_ptr(ck_block.) { kind_noncopyable } - ty_opaque_closure_ptr(ck_box.) { kind_copyable } - ty_opaque_closure_ptr(ck_uniq.) { kind_sendable } + ty_opaque_closure_ptr(ck_block) { kind_noncopyable } + ty_opaque_closure_ptr(ck_box) { kind_copyable } + ty_opaque_closure_ptr(ck_uniq) { kind_sendable } // Those with refcounts-to-inner raise pinned to shared, // lower unique to shared. Therefore just set result to shared. ty_box(_) | ty_iface(_, _) { kind_copyable } @@ -1164,7 +1164,7 @@ fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool { ret alt sty { ty_uniq(_) { ret true; } ty_vec(_) { true } - ty_str. { true } + ty_str { true } _ { ret false; } }; }); @@ -1172,7 +1172,7 @@ fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool { fn type_is_integral(cx: ctxt, ty: t) -> bool { alt struct(cx, ty) { - ty_int(_) | ty_uint(_) | ty_bool. { true } + ty_int(_) | ty_uint(_) | ty_bool { true } _ { false } } } @@ -1201,10 +1201,10 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool { let result = true; alt struct(cx, ty) { // Scalar types - ty_nil. | ty_bot. | ty_bool. | ty_int(_) | ty_float(_) | ty_uint(_) | - ty_send_type. | ty_type. | ty_native(_) | ty_ptr(_) { result = true; } + ty_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) | + ty_send_type | ty_type | ty_native(_) | ty_ptr(_) { result = true; } // Boxed types - ty_str. | ty_box(_) | ty_uniq(_) | ty_vec(_) | ty_fn(_) | + ty_str | ty_box(_) | ty_uniq(_) | ty_vec(_) | ty_fn(_) | ty_native_fn(_, _) | ty_iface(_, _) { result = false; } // Structural types ty_tag(did, tps) { @@ -1334,7 +1334,7 @@ fn hash_type_structure(st: sty) -> uint { let h = id; for a: @ty_constr_arg in args { alt a.node { - carg_base. { h += h << 5u; } + carg_base { h += h << 5u; } carg_lit(_) { // FIXME fail "lit args not implemented yet"; @@ -1355,23 +1355,23 @@ fn hash_type_structure(st: sty) -> uint { ret h; } alt st { - ty_nil. { 0u } ty_bool. { 1u } + ty_nil { 0u } ty_bool { 1u } ty_int(t) { alt t { - ast::ty_i. { 2u } ast::ty_char. { 3u } ast::ty_i8. { 4u } - ast::ty_i16. { 5u } ast::ty_i32. { 6u } ast::ty_i64. { 7u } + ast::ty_i { 2u } ast::ty_char { 3u } ast::ty_i8 { 4u } + ast::ty_i16 { 5u } ast::ty_i32 { 6u } ast::ty_i64 { 7u } } } ty_uint(t) { alt t { - ast::ty_u. { 8u } ast::ty_u8. { 9u } ast::ty_u16. { 10u } - ast::ty_u32. { 11u } ast::ty_u64. { 12u } + ast::ty_u { 8u } ast::ty_u8 { 9u } ast::ty_u16 { 10u } + ast::ty_u32 { 11u } ast::ty_u64 { 12u } } } ty_float(t) { - alt t { ast::ty_f. { 13u } ast::ty_f32. { 14u } ast::ty_f64. { 15u } } + alt t { ast::ty_f { 13u } ast::ty_f32 { 14u } ast::ty_f64 { 15u } } } - ty_str. { ret 17u; } + ty_str { ret 17u; } ty_tag(did, tys) { let h = hash_def(18u, did); for typ: t in tys { h += (h << 5u) + typ; } @@ -1391,9 +1391,9 @@ fn hash_type_structure(st: sty) -> uint { ty_native_fn(args, rty) { ret hash_fn(28u, args, rty); } ty_var(v) { ret hash_uint(30u, v as uint); } ty_param(pid, _) { ret hash_uint(31u, pid); } - ty_type. { ret 32u; } + ty_type { ret 32u; } ty_native(did) { ret hash_def(33u, did); } - ty_bot. { ret 34u; } + ty_bot { ret 34u; } ty_ptr(mt) { ret hash_subty(35u, mt.ty); } ty_res(did, sub, tps) { let h = hash_subty(hash_def(18u, did), sub); @@ -1405,16 +1405,16 @@ fn hash_type_structure(st: sty) -> uint { ret h; } ty_uniq(mt) { ret hash_subty(37u, mt.ty); } - ty_send_type. { ret 38u; } + ty_send_type { ret 38u; } ty_named(t, name) { (str::hash(*name) << 5u) + hash_subty(39u, t) } ty_iface(did, tys) { let h = hash_def(40u, did); for typ: t in tys { h = hash_subty(h, typ); } ret h; } - ty_opaque_closure_ptr(ck_block.) { ret 41u; } - ty_opaque_closure_ptr(ck_box.) { ret 42u; } - ty_opaque_closure_ptr(ck_uniq.) { ret 43u; } + ty_opaque_closure_ptr(ck_block) { ret 41u; } + ty_opaque_closure_ptr(ck_box) { ret 42u; } + ty_opaque_closure_ptr(ck_uniq) { ret 43u; } } } @@ -1425,8 +1425,8 @@ fn arg_eq<T>(eq: block(T, T) -> bool, b: @sp_constr_arg<T>) -> bool { alt a.node { - ast::carg_base. { - alt b.node { ast::carg_base. { ret true; } _ { ret false; } } + ast::carg_base { + alt b.node { ast::carg_base { ret true; } _ { ret false; } } } ast::carg_ident(s) { alt b.node { ast::carg_ident(t) { ret eq(s, t); } _ { ret false; } } @@ -1469,7 +1469,7 @@ fn node_id_to_ty_param_substs_opt_and_ty(cx: ctxt, id: ast::node_id) -> ty_param_substs_opt_and_ty { // Pull out the node type table. alt smallintmap::find(*cx.node_types, id as uint) { - none. { + none { cx.sess.bug("node_id_to_ty_param_substs_opt_and_ty() called on " + "an untyped node (" + int::to_str(id, 10u) + ")"); @@ -1484,7 +1484,7 @@ fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t { fn node_id_to_type_params(cx: ctxt, id: ast::node_id) -> [t] { alt node_id_to_ty_param_substs_opt_and_ty(cx, id).substs { - none. { ret []; } + none { ret []; } some(tps) { ret tps; } } } @@ -1494,19 +1494,19 @@ fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool { } -// Returns a type with type parameter substitutions performed if applicable. +// Returns a type with type parameter substitutions performed if applicable fn ty_param_substs_opt_and_ty_to_monotype(cx: ctxt, tpot: ty_param_substs_opt_and_ty) -> t { alt tpot.substs { - none. { ret tpot.ty; } + none { ret tpot.ty; } some(tps) { ret substitute_type_params(cx, tps, tpot.ty); } } } // Returns the type of an annotation, with type parameter substitutions -// performed if applicable. +// performed if applicable fn node_id_to_monotype(cx: ctxt, id: ast::node_id) -> t { let tpot = node_id_to_ty_param_substs_opt_and_ty(cx, id); ret ty_param_substs_opt_and_ty_to_monotype(cx, tpot); @@ -1643,7 +1643,7 @@ fn expr_has_ty_params(cx: ctxt, expr: @ast::expr) -> bool { fn expr_is_lval(method_map: typeck::method_map, e: @ast::expr) -> bool { alt e.node { ast::expr_path(_) | ast::expr_index(_, _) | - ast::expr_unary(ast::deref., _) { true } + ast::expr_unary(ast::deref, _) { true } ast::expr_field(base, ident, _) { !method_map.contains_key(e.id) } _ { false } } @@ -1771,15 +1771,15 @@ mod unify { alt smallintmap::find(vb.types, root_a) { - none. { + none { alt smallintmap::find(vb.types, root_b) { - none. { ufind::union(vb.sets, set_a, set_b); ret unres_ok; } + none { ufind::union(vb.sets, set_a, set_b); ret unres_ok; } some(t_b) { replace_type(vb, t_b); ret unres_ok; } } } some(t_a) { alt smallintmap::find(vb.types, root_b) { - none. { replace_type(vb, t_a); ret unres_ok; } + none { replace_type(vb, t_a); ret unres_ok; } some(t_b) { alt unify_step(cx, t_a, t_b, variance) { ures_ok(t_c) { replace_type(vb, t_c); ret unres_ok; } @@ -1818,7 +1818,7 @@ mod unify { rs { ret rs; } } } - none. {/* fall through */ } + none {/* fall through */ } } smallintmap::insert::<t>(vb.types, root, result_type); ret ures_ok(typ); @@ -1866,8 +1866,8 @@ mod unify { for a: @ty_constr_arg in expected.node.args { actual = actual_constr.node.args[i]; alt a.node { - carg_base. { - alt actual.node { carg_base. { } _ { ret err_res; } } + carg_base { + alt actual.node { carg_base { } _ { ret err_res; } } } carg_lit(l) { alt actual.node { @@ -1895,7 +1895,7 @@ mod unify { // If you're unifying on something mutable then we have to // be invariant on the inner type let newvariance = alt expected { - ast::mut. { + ast::mut { variance_transform(variance, invariant) } _ { @@ -1929,9 +1929,9 @@ mod unify { // subtype). fn sub_proto(p_sub: ast::proto, p_sup: ast::proto) -> bool { ret alt (p_sub, p_sup) { - (_, ast::proto_any.) { true } - (_, ast::proto_block.) { true } /* NDM temporary */ - (ast::proto_bare., _) { true } + (_, ast::proto_any) { true } + (_, ast::proto_block) { true } /* NDM temporary */ + (ast::proto_bare, _) { true } // Equal prototypes are always subprotos: (_, _) { p_sub == p_sup } @@ -1939,9 +1939,9 @@ mod unify { } ret alt variance { - invariant. if e_proto == a_proto { none } - covariant. if sub_proto(a_proto, e_proto) { none } - contravariant. if sub_proto(e_proto, a_proto) { none } + invariant if e_proto == a_proto { none } + covariant if sub_proto(a_proto, e_proto) { none } + contravariant if sub_proto(e_proto, a_proto) { none } _ { some(ures_err(terr_mismatch)) } }; } @@ -1981,7 +1981,7 @@ mod unify { -> result { alt unify_fn_proto(e_f.proto, a_f.proto, variance) { some(err) { ret err; } - none. { /* fall through */ } + none { /* fall through */ } } if a_f.ret_style != ast::noreturn && a_f.ret_style != e_f.ret_style { @@ -2032,7 +2032,7 @@ mod unify { if vid as uint >= ufind::set_count(vb.sets) { ret fix_err(vid); } let root_id = ufind::find(vb.sets, vid as uint); alt smallintmap::find::<t>(vb.types, root_id) { - none. { ret fix_err(vid); } + none { ret fix_err(vid); } some(rt) { ret fix_ok(rt); } } } @@ -2058,25 +2058,25 @@ mod unify { // read the paper (yet). fn variance_transform(a: variance, b: variance) -> variance { alt a { - covariant. { + covariant { alt b { - covariant. { covariant } - contravariant. { contravariant } - invariant. { invariant } + covariant { covariant } + contravariant { contravariant } + invariant { invariant } } } - contravariant. { + contravariant { alt b { - covariant. { contravariant } - contravariant. { covariant } - invariant. { invariant } + covariant { contravariant } + contravariant { covariant } + invariant { invariant } } } - invariant. { + invariant { alt b { - covariant. { invariant } - contravariant. { invariant } - invariant. { invariant } + covariant { invariant } + contravariant { invariant } + invariant { invariant } } } } @@ -2108,7 +2108,7 @@ mod unify { if expected == actual { ret ures_ok(expected); } // Stage 1: Handle the cases in which one side or another is a type - // variable. + // variable alt struct(cx.tcx, actual) { // If the RHS is a variable type, then just do the @@ -2119,7 +2119,7 @@ mod unify { ty::ty_var(expected_id) { let expected_n = expected_id as uint; alt union(cx, expected_n, actual_n, variance) { - unres_ok. {/* fall through */ } + unres_ok {/* fall through */ } unres_err(t_e) { ret ures_err(t_e); } } } @@ -2152,17 +2152,17 @@ mod unify { // Stage 2: Handle all other cases. alt struct(cx.tcx, actual) { - ty::ty_bot. { ret ures_ok(expected); } + ty::ty_bot { ret ures_ok(expected); } _ {/* fall through */ } } alt struct(cx.tcx, expected) { - ty::ty_nil. { ret struct_cmp(cx, expected, actual); } + ty::ty_nil { ret struct_cmp(cx, expected, actual); } // _|_ unifies with anything - ty::ty_bot. { + ty::ty_bot { ret ures_ok(actual); } - ty::ty_bool. | ty::ty_int(_) | ty_uint(_) | ty_float(_) | - ty::ty_str. | ty::ty_type. | ty::ty_send_type. { + ty::ty_bool | ty::ty_int(_) | ty_uint(_) | ty_float(_) | + ty::ty_str | ty::ty_type | ty::ty_send_type { ret struct_cmp(cx, expected, actual); } ty::ty_native(ex_id) { @@ -2216,7 +2216,7 @@ mod unify { ty::ty_box(actual_mt) { let (mutt, var) = alt unify_mut( expected_mt.mut, actual_mt.mut, variance) { - none. { ret ures_err(terr_box_mutability); } + none { ret ures_err(terr_box_mutability); } some(mv) { mv } }; let result = unify_step( @@ -2237,7 +2237,7 @@ mod unify { ty::ty_uniq(actual_mt) { let (mutt, var) = alt unify_mut( expected_mt.mut, actual_mt.mut, variance) { - none. { ret ures_err(terr_box_mutability); } + none { ret ures_err(terr_box_mutability); } some(mv) { mv } }; let result = unify_step( @@ -2258,7 +2258,7 @@ mod unify { ty::ty_vec(actual_mt) { let (mutt, var) = alt unify_mut( expected_mt.mut, actual_mt.mut, variance) { - none. { ret ures_err(terr_vec_mutability); } + none { ret ures_err(terr_vec_mutability); } some(mv) { mv } }; let result = unify_step( @@ -2279,7 +2279,7 @@ mod unify { ty::ty_ptr(actual_mt) { let (mutt, var) = alt unify_mut( expected_mt.mut, actual_mt.mut, variance) { - none. { ret ures_err(terr_vec_mutability); } + none { ret ures_err(terr_vec_mutability); } some(mv) { mv } }; let result = unify_step( @@ -2344,7 +2344,7 @@ mod unify { let (mutt, var) = alt unify_mut( expected_field.mt.mut, actual_field.mt.mut, variance) { - none. { ret ures_err(terr_record_mutability); } + none { ret ures_err(terr_record_mutability); } some(mv) { mv } }; if !str::eq(expected_field.ident, actual_field.ident) { @@ -2462,7 +2462,7 @@ mod unify { } let typespec; alt smallintmap::find::<t>(vb.types, i) { - none. { typespec = ""; } + none { typespec = ""; } some(typ) { typespec = " =" + ty_to_str(tcx, typ); } } #error("set %u:%s%s", i, typespec, sets); @@ -2486,7 +2486,7 @@ mod unify { } let root_id = ufind::find(vb.sets, vid as uint); alt smallintmap::find::<t>(vb.types, root_id) { - none. { *unresolved = some(vid); ret ty::mk_var(tcx, vid); } + none { *unresolved = some(vid); ret ty::mk_var(tcx, vid); } some(rt) { if occurs_check_fails(tcx, sp, vid, rt) { // Return the type unchanged, so we can error out @@ -2505,7 +2505,7 @@ mod unify { typ); let ur = *unresolved; alt ur { - none. { ret fix_ok(rty); } + none { ret fix_ok(rty); } some(var_id) { ret fix_err(var_id); } } } @@ -2514,7 +2514,7 @@ mod unify { if vid as uint >= ufind::set_count(vb.sets) { ret fix_err(vid); } let root_id = ufind::find(vb.sets, vid as uint); alt smallintmap::find::<t>(vb.types, root_id) { - none. { ret fix_err(vid); } + none { ret fix_err(vid); } some(rt) { ret fixup_vars(tcx, sp, vb, rt); } } } @@ -2529,19 +2529,19 @@ fn same_type(cx: ctxt, a: t, b: t) -> bool { fn type_err_to_str(err: ty::type_err) -> str { alt err { - terr_mismatch. { ret "types differ"; } + terr_mismatch { ret "types differ"; } terr_ret_style_mismatch(expect, actual) { fn to_str(s: ast::ret_style) -> str { alt s { - ast::noreturn. { "non-returning" } + ast::noreturn { "non-returning" } ast::return_val. { "return-by-value" } } } ret to_str(actual) + " function found where " + to_str(expect) + " function was expected"; } - terr_box_mutability. { ret "boxed values differ in mutability"; } - terr_vec_mutability. { ret "vectors differ in mutability"; } + terr_box_mutability { ret "boxed values differ in mutability"; } + terr_vec_mutability { ret "vectors differ in mutability"; } terr_tuple_size(e_sz, a_sz) { ret "expected a tuple with " + uint::to_str(e_sz, 10u) + " elements but found one with " + uint::to_str(a_sz, 10u) + @@ -2552,12 +2552,12 @@ fn type_err_to_str(err: ty::type_err) -> str { " fields but found one with " + uint::to_str(a_sz, 10u) + " fields"; } - terr_record_mutability. { ret "record elements differ in mutability"; } + terr_record_mutability { ret "record elements differ in mutability"; } terr_record_fields(e_fld, a_fld) { ret "expected a record with field '" + e_fld + "' but found one with field '" + a_fld + "'"; } - terr_arg_count. { ret "incorrect number of function parameters"; } + terr_arg_count { ret "incorrect number of function parameters"; } terr_mode_mismatch(e_mode, a_mode) { ret "expected argument mode " + mode_str(e_mode) + " but found " + mode_str(a_mode); @@ -2701,7 +2701,7 @@ fn lookup_item_type(cx: ctxt, did: ast::def_id) -> ty_param_bounds_and_ty { } alt cx.tcache.find(did) { some(tpt) { ret tpt; } - none. { + none { let tyt = csearch::get_type(cx, did); cx.tcache.insert(did, tyt); ret tyt; @@ -2735,40 +2735,40 @@ fn is_binopable(cx: ctxt, ty: t, op: ast::binop) -> bool { fn opcat(op: ast::binop) -> int { alt op { - ast::add. { opcat_add } - ast::subtract. { opcat_sub } - ast::mul. { opcat_mult } - ast::div. { opcat_mult } - ast::rem. { opcat_mult } - ast::and. { opcat_logic } - ast::or. { opcat_logic } - ast::bitxor. { opcat_bit } - ast::bitand. { opcat_bit } - ast::bitor. { opcat_bit } - ast::lsl. { opcat_shift } - ast::lsr. { opcat_shift } - ast::asr. { opcat_shift } - ast::eq. { opcat_eq } - ast::ne. { opcat_eq } - ast::lt. { opcat_rel } - ast::le. { opcat_rel } - ast::ge. { opcat_rel } - ast::gt. { opcat_rel } + ast::add { opcat_add } + ast::subtract { opcat_sub } + ast::mul { opcat_mult } + ast::div { opcat_mult } + ast::rem { opcat_mult } + ast::and { opcat_logic } + ast::or { opcat_logic } + ast::bitxor { opcat_bit } + ast::bitand { opcat_bit } + ast::bitor { opcat_bit } + ast::lsl { opcat_shift } + ast::lsr { opcat_shift } + ast::asr { opcat_shift } + ast::eq { opcat_eq } + ast::ne { opcat_eq } + ast::lt { opcat_rel } + ast::le { opcat_rel } + ast::ge { opcat_rel } + ast::gt { opcat_rel } } } fn tycat(cx: ctxt, ty: t) -> int { alt struct(cx, ty) { - ty_bool. { tycat_bool } + ty_bool { tycat_bool } ty_int(_) { tycat_int } ty_uint(_) { tycat_int } ty_float(_) { tycat_float } - ty_str. { tycat_str } + ty_str { tycat_str } ty_vec(_) { tycat_vec } ty_rec(_) { tycat_struct } ty_tup(_) { tycat_struct } ty_tag(_, _) { tycat_struct } - ty_bot. { tycat_bot } + ty_bot { tycat_bot } _ { tycat_other } } } @@ -2798,7 +2798,7 @@ fn is_binopable(cx: ctxt, ty: t, op: ast::binop) -> bool { fn ast_constr_to_constr<T>(tcx: ty::ctxt, c: @ast::constr_general<T>) -> @ty::constr_general<T> { alt tcx.def_map.find(c.node.id) { - some(ast::def_fn(pred_id, ast::pure_fn.)) { + some(ast::def_fn(pred_id, ast::pure_fn)) { ret @ast_util::respan(c.span, {path: c.node.path, args: c.node.args, diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 7c8e21464c4..ea64d5f3f11 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -218,7 +218,7 @@ fn type_is_c_like_enum(fcx: @fn_ctxt, sp: span, typ: ty::t) -> bool { fn default_arg_mode_for_ty(tcx: ty::ctxt, m: ast::mode, ty: ty::t) -> ast::mode { alt m { - ast::mode_infer. { + ast::mode_infer { alt ty::struct(tcx, ty) { ty::ty_var(_) { ast::mode_infer } _ { @@ -237,8 +237,8 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t { fn getter(tcx: ty::ctxt, mode: mode, id: ast::def_id) -> ty::ty_param_bounds_and_ty { alt mode { - m_check. | m_check_tyvar(_) { ty::lookup_item_type(tcx, id) } - m_collect. { + m_check | m_check_tyvar(_) { ty::lookup_item_type(tcx, id) } + m_collect { if id.crate != ast::local_crate { csearch::get_type(tcx, id) } else { alt tcx.items.find(id.node) { @@ -260,13 +260,13 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t { } alt tcx.ast_ty_to_ty_cache.find(ast_ty) { some(some(ty)) { ret ty; } - some(none.) { + some(none) { tcx.sess.span_fatal(ast_ty.span, "illegal recursive type \ insert a tag in the cycle, \ if this is desired)"); } - none. { } + none { } } /* go on */ tcx.ast_ty_to_ty_cache.insert(ast_ty, none::<ty::t>); @@ -299,13 +299,13 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t { } let typ; alt ast_ty.node { - ast::ty_nil. { typ = ty::mk_nil(tcx); } - ast::ty_bot. { typ = ty::mk_bot(tcx); } - ast::ty_bool. { typ = ty::mk_bool(tcx); } + ast::ty_nil { typ = ty::mk_nil(tcx); } + ast::ty_bot { typ = ty::mk_bot(tcx); } + ast::ty_bool { typ = ty::mk_bool(tcx); } ast::ty_int(it) { typ = ty::mk_mach_int(tcx, it); } ast::ty_uint(uit) { typ = ty::mk_mach_uint(tcx, uit); } ast::ty_float(ft) { typ = ty::mk_mach_float(tcx, ft); } - ast::ty_str. { typ = ty::mk_str(tcx); } + ast::ty_str { typ = ty::mk_str(tcx); } ast::ty_box(mt) { typ = ty::mk_box(tcx, ast_mt_to_mt(tcx, mode, mt)); } @@ -385,7 +385,7 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item) ast::item_ty(t, tps) { alt tcx.tcache.find(local_def(it.id)) { some(tpt) { ret tpt; } - none. { } + none { } } // Tell ast_ty_to_ty() that we want to perform a recursive // call to resolve any named types. @@ -434,10 +434,10 @@ fn ty_of_native_item(tcx: ty::ctxt, mode: mode, it: @ast::native_item) ret ty_of_native_fn_decl(tcx, mode, fn_decl, params, ast_util::local_def(it.id)); } - ast::native_item_ty. { + ast::native_item_ty { alt tcx.tcache.find(local_def(it.id)) { some(tpt) { ret tpt; } - none. { } + none { } } let t = ty::mk_native(tcx, ast_util::local_def(it.id)); let t = ty::mk_named(tcx, t, @it.ident); @@ -491,12 +491,12 @@ fn ty_param_bounds(tcx: ty::ctxt, mode: mode, params: [ast::ty_param]) for param in params { result += [alt tcx.ty_param_bounds.find(param.id) { some(bs) { bs } - none. { + none { let bounds = []; for b in *param.bounds { bounds += [alt b { - ast::bound_send. { ty::bound_send } - ast::bound_copy. { ty::bound_copy } + ast::bound_send { ty::bound_send } + ast::bound_copy { ty::bound_copy } ast::bound_iface(t) { let ity = ast_ty_to_ty(tcx, mode, t); alt ty::struct(tcx, ity) { @@ -545,7 +545,7 @@ fn ast_ty_to_ty_crate_infer(ccx: @crate_ctxt, &&ast_ty: @ast::ty) -> } -// Functions that write types into the node type table. +// Functions that write types into the node type table mod write { fn inner(ntt: node_type_table, node_id: ast::node_id, tpot: ty_param_substs_opt_and_ty) { @@ -713,7 +713,7 @@ mod collect { compare_impl_method(cx.tcx, t.span, m, vec::len(tps), if_m, tys); } - none. { + none { cx.tcx.sess.span_err(t.span, "missing method `" + if_m.ident + "`"); } @@ -773,7 +773,7 @@ mod collect { // table. let tpt = ty_of_native_item(cx.tcx, m_collect, i); alt i.node { - ast::native_item_ty. { + ast::native_item_ty { // FIXME: Native types have no annotation. Should they? --pcw } ast::native_item_fn(_, _) { @@ -975,17 +975,17 @@ mod writeback { let new_ty = alt resolve_type_vars_in_type(fcx, sp, tpot.ty) { some(t) { t } - none. { wbcx.success = false; ret } + none { wbcx.success = false; ret } }; let new_substs_opt; alt tpot.substs { - none. { new_substs_opt = none; } + none { new_substs_opt = none; } some(substs) { let new_substs: [ty::t] = []; for subst: ty::t in substs { alt resolve_type_vars_in_type(fcx, sp, subst) { some(t) { new_substs += [t]; } - none. { wbcx.success = false; ret; } + none { wbcx.success = false; ret; } } } new_substs_opt = some(new_substs); @@ -1095,7 +1095,7 @@ fn gather_locals(ccx: @crate_ctxt, old_fcx: option::t<@fn_ctxt>) -> gather_result { let {vb: vb, locals: locals, nvi: nvi} = alt old_fcx { - none. { + none { {vb: ty::unify::mk_var_bindings(), locals: new_int_hash::<int>(), nvi: @mutable 0} @@ -1113,7 +1113,7 @@ fn gather_locals(ccx: @crate_ctxt, let var_id = next_var_id(); locals.insert(nid, var_id); alt ty_opt { - none. {/* nothing to do */ } + none {/* nothing to do */ } some(typ) { ty::unify::unify(ty::mk_var(tcx, var_id), typ, ty::unify::in_bindings(vb), tcx); @@ -1171,7 +1171,7 @@ fn check_lit(ccx: @crate_ctxt, lit: @ast::lit) -> ty::t { ast::lit_int(_, t) { ty::mk_mach_int(ccx.tcx, t) } ast::lit_uint(_, t) { ty::mk_mach_uint(ccx.tcx, t) } ast::lit_float(_, t) { ty::mk_mach_float(ccx.tcx, t) } - ast::lit_nil. { ty::mk_nil(ccx.tcx) } + ast::lit_nil { ty::mk_nil(ccx.tcx) } ast::lit_bool(_) { ty::mk_bool(ccx.tcx) } } } @@ -1185,7 +1185,7 @@ fn valid_range_bounds(from: @ast::expr, to: @ast::expr) -> bool { fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat, expected: ty::t) { alt normalize_pat(fcx.ccx.tcx, pat).node { - ast::pat_wild. { + ast::pat_wild { alt structure_of(fcx, pat.span, expected) { ty::ty_tag(_, expected_tps) { let path_tpt = {substs: some(expected_tps), @@ -1337,7 +1337,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat, for f: ast::field_pat in fields { alt vec::find(ex_fields, bind matches(f.ident, _)) { some(field) { check_pat(fcx, map, f.pat, field.mt.ty); } - none. { + none { fcx.ccx.tcx.sess.span_fatal(pat.span, #fmt["mismatched types: did not \ expect a record with a field `%s`", @@ -1402,7 +1402,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat, fn require_unsafe(sess: session, f_purity: ast::purity, sp: span) { alt f_purity { - ast::unsafe_fn. { ret; } + ast::unsafe_fn { ret; } _ { sess.span_err( sp, @@ -1413,9 +1413,9 @@ fn require_unsafe(sess: session, f_purity: ast::purity, sp: span) { fn require_impure(sess: session, f_purity: ast::purity, sp: span) { alt f_purity { - ast::unsafe_fn. { ret; } - ast::impure_fn. { ret; } - ast::pure_fn. { + ast::unsafe_fn { ret; } + ast::impure_fn { ret; } + ast::pure_fn { sess.span_err(sp, "Found impure expression in pure function decl"); } } @@ -1424,11 +1424,11 @@ fn require_impure(sess: session, f_purity: ast::purity, sp: span) { fn require_pure_call(ccx: @crate_ctxt, caller_purity: ast::purity, callee: @ast::expr, sp: span) { alt caller_purity { - ast::unsafe_fn. { ret; } - ast::impure_fn. { + ast::unsafe_fn { ret; } + ast::impure_fn { alt ccx.tcx.def_map.find(callee.id) { - some(ast::def_fn(_, ast::unsafe_fn.)) | - some(ast::def_native_fn(_, ast::unsafe_fn.)) { + some(ast::def_fn(_, ast::unsafe_fn)) | + some(ast::def_native_fn(_, ast::unsafe_fn)) { ccx.tcx.sess.span_err( sp, "safe function calls function marked unsafe"); @@ -1438,10 +1438,10 @@ fn require_pure_call(ccx: @crate_ctxt, caller_purity: ast::purity, } ret; } - ast::pure_fn. { + ast::pure_fn { alt ccx.tcx.def_map.find(callee.id) { - some(ast::def_fn(_, ast::pure_fn.)) | - some(ast::def_native_fn(_, ast::pure_fn.)) | + some(ast::def_fn(_, ast::pure_fn)) | + some(ast::def_native_fn(_, ast::pure_fn)) | some(ast::def_variant(_, _)) { ret; } _ { ccx.tcx.sess.span_err @@ -1677,7 +1677,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, arg_tys[i].ty); } } - none. { } + none { } } i += 1u; } @@ -1772,7 +1772,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, }; (if_t, thn_bot & els_bot) } - none. { + none { check_block_no_value(fcx, thn); (ty::mk_nil(fcx.ccx.tcx), false) } @@ -1814,12 +1814,12 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, let t = alt binop { - ast::eq. { ty::mk_bool(tcx) } - ast::lt. { ty::mk_bool(tcx) } - ast::le. { ty::mk_bool(tcx) } - ast::ne. { ty::mk_bool(tcx) } - ast::ge. { ty::mk_bool(tcx) } - ast::gt. { ty::mk_bool(tcx) } + ast::eq { ty::mk_bool(tcx) } + ast::lt { ty::mk_bool(tcx) } + ast::le { ty::mk_bool(tcx) } + ast::ne { ty::mk_bool(tcx) } + ast::ge { ty::mk_bool(tcx) } + ast::gt { ty::mk_bool(tcx) } _ { lhs_t } }; write::ty_only_fixup(fcx, id, t); @@ -1832,7 +1832,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, ast::uniq(mut) { oper_t = ty::mk_uniq(tcx, {ty: oper_t, mut: mut}); } - ast::deref. { + ast::deref { alt structure_of(fcx, expr.span, oper_t) { ty::ty_box(inner) { oper_t = inner.ty; } ty::ty_uniq(inner) { oper_t = inner.ty; } @@ -1861,7 +1861,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, } } } - ast::not. { + ast::not { if !type_is_integral(fcx, oper.span, oper_t) && structure_of(fcx, oper.span, oper_t) != ty::ty_bool { tcx.sess.span_err(expr.span, @@ -1870,7 +1870,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, ty_to_str(tcx, oper_t)]); } } - ast::neg. { + ast::neg { oper_t = structurally_resolved_type(fcx, oper.span, oper_t); if !(ty::type_is_integral(tcx, oper_t) || ty::type_is_fp(tcx, oper_t)) { @@ -1892,7 +1892,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, write::ty_fixup(fcx, id, path_tpot); } else { // The definition doesn't take type parameters. If the programmer - // supplied some, that's an error. + // supplied some, that's an error if vec::len::<@ast::ty>(pth.node.types) > 0u { tcx.sess.span_fatal(expr.span, "this kind of value does not \ @@ -1905,17 +1905,17 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, ast::expr_fail(expr_opt) { bot = true; alt expr_opt { - none. {/* do nothing */ } + none {/* do nothing */ } some(e) { check_expr_with(fcx, e, ty::mk_str(tcx)); } } write::bot_ty(tcx, id); } - ast::expr_break. { write::bot_ty(tcx, id); bot = true; } - ast::expr_cont. { write::bot_ty(tcx, id); bot = true; } + ast::expr_break { write::bot_ty(tcx, id); bot = true; } + ast::expr_cont { write::bot_ty(tcx, id); bot = true; } ast::expr_ret(expr_opt) { bot = true; alt expr_opt { - none. { + none { let nil = ty::mk_nil(tcx); if !are_compatible(fcx, fcx.ret_ty, nil) { tcx.sess.span_err(expr.span, @@ -1989,7 +1989,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, let ety = expr_ty(tcx, seq); alt structure_of(fcx, expr.span, ety) { ty::ty_vec(vec_elt_ty) { elt_ty = vec_elt_ty.ty; } - ty::ty_str. { elt_ty = ty::mk_mach_uint(tcx, ast::ty_u8); } + ty::ty_str { elt_ty = ty::mk_mach_uint(tcx, ast::ty_u8); } _ { tcx.sess.span_fatal(expr.span, "mismatched types: expected vector or string " @@ -2026,7 +2026,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, for arm: ast::arm in arms { alt arm.guard { some(e) { check_expr_with(fcx, e, ty::mk_bool(tcx)); } - none. { } + none { } } if !check_block(fcx, arm.body) { arm_non_bot = true; } let bty = block_ty(tcx, arm.body); @@ -2065,7 +2065,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, let typ = alt b.node.expr { some(expr) { expr_ty(tcx, expr) } - none. { ty::mk_nil(tcx) } + none { ty::mk_nil(tcx) } }; write::ty_only_fixup(fcx, id, typ); } @@ -2103,7 +2103,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, while i < vec::len(args) { alt args[i] { some(_) {/* no-op */ } - none. { out_args += [arg_tys[i]]; } + none { out_args += [arg_tys[i]]; } } i += 1u; } @@ -2112,7 +2112,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, fn lower_bound_proto(proto: ast::proto) -> ast::proto { // FIXME: This is right for bare fns, possibly not others alt proto { - ast::proto_bare. { ast::proto_box } + ast::proto_bare { ast::proto_box } _ { proto } } } @@ -2176,7 +2176,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, write::ty_only_fixup(fcx, id, typ); } ast::expr_rec(fields, base) { - alt base { none. {/* no-op */ } some(b_0) { check_expr(fcx, b_0); } } + alt base { none {/* no-op */ } some(b_0) { check_expr(fcx, b_0); } } let fields_t: [spanned<field>] = []; for f: ast::field in fields { bot |= check_expr(fcx, f.node.expr); @@ -2189,7 +2189,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, {ident: f.node.ident, mt: expr_mt})]; } alt base { - none. { + none { fn get_node(f: spanned<field>) -> field { f.node } let typ = ty::mk_rec(tcx, vec::map(fields_t, get_node)); write::ty_only_fixup(fcx, id, typ); @@ -2279,7 +2279,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, } fcx.ccx.method_map.insert(id, origin); } - none. { + none { let t_err = resolve_type_vars_if_possible(fcx, expr_t); let msg = #fmt["attempted access of field %s on type %s, but \ no method implementation was found", @@ -2303,7 +2303,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, } alt structure_of(fcx, expr.span, base_t) { ty::ty_vec(mt) { write::ty_only_fixup(fcx, id, mt.ty); } - ty::ty_str. { + ty::ty_str { let typ = ty::mk_mach_uint(tcx, ast::ty_u8); write::ty_only_fixup(fcx, id, typ); } @@ -2427,7 +2427,7 @@ fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool { bot |= check_stmt(fcx, s); } alt blk.node.expr { - none. { write::nil_ty(fcx.ccx.tcx, blk.node.id); } + none { write::nil_ty(fcx.ccx.tcx, blk.node.id); } some(e) { if bot && !warned { fcx.ccx.tcx.sess.span_warn(e.span, "unreachable expression"); @@ -2490,7 +2490,7 @@ fn check_tag_variants(ccx: @crate_ctxt, _sp: span, vs: [ast::variant], // FIXME: issue #1417 // Also, check_expr (from check_const pass) doesn't guarantee that // the expression in an form that eval_const_expr can handle, so - // we may still get an internal compiler error. + // we may still get an internal compiler error alt syntax::ast_util::eval_const_expr(e) { syntax::ast_util::const_int(val) { disr_val = val as int; @@ -2530,7 +2530,7 @@ fn check_pred_expr(fcx: @fn_ctxt, e: @ast::expr) -> bool { alt operator.node { ast::expr_path(oper_name) { alt fcx.ccx.tcx.def_map.find(operator.id) { - some(ast::def_fn(_, ast::pure_fn.)) { + some(ast::def_fn(_, ast::pure_fn)) { // do nothing } _ { @@ -2577,7 +2577,7 @@ fn check_constraints(fcx: @fn_ctxt, cs: [@ast::constr], args: [ast::arg]) { that's my justification. */ @alt a.node { - ast::carg_base. { + ast::carg_base { fcx.ccx.tcx.sess.span_bug(a.span, "check_constraints:\ unexpected carg_base"); @@ -2630,7 +2630,7 @@ fn check_fn(ccx: @crate_ctxt, // If old_fcx is some(...), this is a block fn { |x| ... }. // In that case, the purity is inherited from the context. let purity = alt old_fcx { - none. { decl.purity } + none { decl.purity } some(f) { assert decl.purity == ast::impure_fn; f.purity } }; @@ -2656,7 +2656,7 @@ fn check_fn(ccx: @crate_ctxt, let tail_expr_ty = expr_ty(ccx.tcx, tail_expr); demand::simple(fcx, tail_expr.span, fcx.ret_ty, tail_expr_ty); } - none. { } + none { } } let args = ty::ty_fn_args(ccx.tcx, ty::node_id_to_type(ccx.tcx, id)); @@ -2684,12 +2684,12 @@ fn check_native_fn(ccx: @crate_ctxt, decl: ast::fn_decl) { let tys = vec::map(decl.inputs) {|a| a.ty }; for ty in (tys + [decl.output]) { alt ty.node { - ast::ty_int(ast::ty_i.) { + ast::ty_int(ast::ty_i) { ccx.tcx.sess.span_warn( ty.span, "found rust type `int` in native module, while " + "ctypes::c_int or ctypes::long should be used"); } - ast::ty_uint(ast::ty_u.) { + ast::ty_uint(ast::ty_u) { ccx.tcx.sess.span_warn( ty.span, "found rust type `uint` in native module, while " + "ctypes::c_uint or ctypes::ulong should be used"); @@ -2733,7 +2733,7 @@ fn arg_is_argv_ty(tcx: ty::ctxt, a: ty::arg) -> bool { ty::ty_vec(mt) { if mt.mut != ast::imm { ret false; } alt ty::struct(tcx, mt.ty) { - ty::ty_str. { ret true; } + ty::ty_str { ret true; } _ { ret false; } } } @@ -2744,7 +2744,7 @@ fn arg_is_argv_ty(tcx: ty::ctxt, a: ty::arg) -> bool { fn check_main_fn_ty(tcx: ty::ctxt, main_id: ast::node_id) { let main_t = ty::node_id_to_monotype(tcx, main_id); alt ty::struct(tcx, main_t) { - ty::ty_fn({proto: ast::proto_bare., inputs, output, + ty::ty_fn({proto: ast::proto_bare, inputs, output, ret_style: ast::return_val., constraints}) { let ok = vec::len(constraints) == 0u; ok &= ty::type_is_nil(tcx, output); @@ -2771,7 +2771,7 @@ fn check_for_main_fn(tcx: ty::ctxt, crate: @ast::crate) { if !tcx.sess.building_library { alt tcx.sess.main_fn { some(id) { check_main_fn_ty(tcx, id); } - none. { tcx.sess.span_err(crate.span, "main function not found"); } + none { tcx.sess.span_err(crate.span, "main function not found"); } } } } |
