Remove support for the '.' after a nullary tag in a pattern
(Commit also includes lots of changes to remove '.'s that a git merge messed up, or else it was monkeys.)
This commit is contained in:
parent
9df0306889
commit
5b028f527f
@ -583,9 +583,9 @@ fn link_binary(sess: session,
|
||||
ret str::connect(parts, ".");
|
||||
}
|
||||
ret alt config.os {
|
||||
session::os_macos. { rmext(rmlib(filename)) }
|
||||
session::os_linux. { rmext(rmlib(filename)) }
|
||||
session::os_freebsd. { rmext(rmlib(filename)) }
|
||||
session::os_macos { rmext(rmlib(filename)) }
|
||||
session::os_linux { rmext(rmlib(filename)) }
|
||||
session::os_freebsd { rmext(rmlib(filename)) }
|
||||
_ { rmext(filename) }
|
||||
};
|
||||
}
|
||||
|
@ -102,9 +102,9 @@ fn get_rpath_relative_to_output(os: session::os,
|
||||
&&lib: fs::path) -> str {
|
||||
// Mac doesn't appear to support $ORIGIN
|
||||
let prefix = alt os {
|
||||
session::os_linux. { "$ORIGIN" + fs::path_sep() }
|
||||
session::os_freebsd. { "$ORIGIN" + fs::path_sep() }
|
||||
session::os_macos. { "@executable_path" + fs::path_sep() }
|
||||
session::os_linux { "$ORIGIN" + fs::path_sep() }
|
||||
session::os_freebsd { "$ORIGIN" + fs::path_sep() }
|
||||
session::os_macos { "@executable_path" + fs::path_sep() }
|
||||
};
|
||||
|
||||
prefix + get_relative_to(
|
||||
|
@ -24,19 +24,19 @@ fn default_configuration(sess: session, argv0: str, input: str) ->
|
||||
ast::crate_cfg {
|
||||
let libc =
|
||||
alt sess.targ_cfg.os {
|
||||
session::os_win32. { "msvcrt.dll" }
|
||||
session::os_macos. { "libc.dylib" }
|
||||
session::os_linux. { "libc.so.6" }
|
||||
session::os_freebsd. { "libc.so.7" }
|
||||
session::os_win32 { "msvcrt.dll" }
|
||||
session::os_macos { "libc.dylib" }
|
||||
session::os_linux { "libc.so.6" }
|
||||
session::os_freebsd { "libc.so.7" }
|
||||
_ { "libc.so" }
|
||||
};
|
||||
|
||||
let mk = attr::mk_name_value_item_str;
|
||||
|
||||
let arch = alt sess.targ_cfg.arch {
|
||||
session::arch_x86. { "x86" }
|
||||
session::arch_x86_64. { "x86_64" }
|
||||
session::arch_arm. { "arm" }
|
||||
session::arch_x86 { "x86" }
|
||||
session::arch_x86_64 { "x86_64" }
|
||||
session::arch_arm { "arm" }
|
||||
};
|
||||
|
||||
ret [ // Target bindings.
|
||||
@ -340,14 +340,14 @@ fn build_target_config(sopts: @session::options,
|
||||
"Unknown architecture! " + sopts.target_triple) }
|
||||
};
|
||||
let (int_type, uint_type, float_type) = alt arch {
|
||||
session::arch_x86. {(ast::ty_i32, ast::ty_u32, ast::ty_f64)}
|
||||
session::arch_x86_64. {(ast::ty_i64, ast::ty_u64, ast::ty_f64)}
|
||||
session::arch_arm. {(ast::ty_i32, ast::ty_u32, ast::ty_f64)}
|
||||
session::arch_x86 {(ast::ty_i32, ast::ty_u32, ast::ty_f64)}
|
||||
session::arch_x86_64 {(ast::ty_i64, ast::ty_u64, ast::ty_f64)}
|
||||
session::arch_arm {(ast::ty_i32, ast::ty_u32, ast::ty_f64)}
|
||||
};
|
||||
let target_strs = alt arch {
|
||||
session::arch_x86. {x86::get_target_strs(os)}
|
||||
session::arch_x86_64. {x86_64::get_target_strs(os)}
|
||||
session::arch_arm. {x86::get_target_strs(os)}
|
||||
session::arch_x86 {x86::get_target_strs(os)}
|
||||
session::arch_x86_64 {x86_64::get_target_strs(os)}
|
||||
session::arch_arm {x86::get_target_strs(os)}
|
||||
};
|
||||
let target_cfg: @session::config =
|
||||
@{os: os, arch: arch, target_strs: target_strs, int_type: int_type,
|
||||
@ -406,7 +406,7 @@ fn build_session_options(match: getopts::match,
|
||||
let no_asm_comments = getopts::opt_present(match, "no-asm-comments");
|
||||
alt output_type {
|
||||
// unless we're emitting huamn-readable assembly, omit comments.
|
||||
link::output_type_llvm_assembly. | link::output_type_assembly. {}
|
||||
link::output_type_llvm_assembly | link::output_type_assembly {}
|
||||
_ { no_asm_comments = true; }
|
||||
}
|
||||
let opt_level: uint =
|
||||
@ -540,10 +540,10 @@ fn build_output_filenames(ifile: str,
|
||||
alt sopts.output_type {
|
||||
link::output_type_none { "none" }
|
||||
link::output_type_bitcode { "bc" }
|
||||
link::output_type_assembly. { "s" }
|
||||
link::output_type_llvm_assembly. { "ll" }
|
||||
link::output_type_assembly { "s" }
|
||||
link::output_type_llvm_assembly { "ll" }
|
||||
// Object and exe output both use the '.o' extension here
|
||||
link::output_type_object. | link::output_type_exe. {
|
||||
link::output_type_object | link::output_type_exe {
|
||||
"o"
|
||||
}
|
||||
};
|
||||
|
@ -102,7 +102,7 @@ fn run_compiler(args: [str], demitter: diagnostic::emitter) {
|
||||
bind parse_pretty(sess, _));
|
||||
alt pretty {
|
||||
some::<pp_mode>(ppm) { pretty_print_input(sess, cfg, ifile, ppm); ret; }
|
||||
none::<pp_mode>. {/* continue */ }
|
||||
none::<pp_mode> {/* continue */ }
|
||||
}
|
||||
let ls = opt_present(match, "ls");
|
||||
if ls {
|
||||
|
@ -128,10 +128,10 @@ fn default_native_lib_naming(sess: session::session, static: bool) ->
|
||||
{prefix: str, suffix: str} {
|
||||
if static { ret {prefix: "lib", suffix: ".rlib"}; }
|
||||
alt sess.targ_cfg.os {
|
||||
session::os_win32. { ret {prefix: "", suffix: ".dll"}; }
|
||||
session::os_macos. { ret {prefix: "lib", suffix: ".dylib"}; }
|
||||
session::os_linux. { ret {prefix: "lib", suffix: ".so"}; }
|
||||
session::os_freebsd. { ret {prefix: "lib", suffix: ".so"}; }
|
||||
session::os_win32 { ret {prefix: "", suffix: ".dll"}; }
|
||||
session::os_macos { ret {prefix: "lib", suffix: ".dylib"}; }
|
||||
session::os_linux { ret {prefix: "lib", suffix: ".so"}; }
|
||||
session::os_freebsd { ret {prefix: "lib", suffix: ".so"}; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -583,7 +583,7 @@ fn create_ty(cx: @crate_ctxt, t: ty::t, ty: @ast::ty)
|
||||
ret create_pointer_type(cx, t, ty.span, md);
|
||||
}
|
||||
|
||||
ast::ty_infer. {
|
||||
ast::ty_infer {
|
||||
let inferred = t_to_ty(cx, t, ty.span);
|
||||
ret create_ty(cx, t, inferred);
|
||||
}
|
||||
|
@ -105,8 +105,7 @@ 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_native(_) {
|
||||
ty::ty_type | ty::ty_ptr(_) | ty::ty_native(_) {
|
||||
ret false;
|
||||
}
|
||||
|
||||
|
@ -187,9 +187,9 @@ fn check_lval(cx: @ctx, dest: @expr, msg: msg) {
|
||||
} else if !root.ds[0].mut {
|
||||
let name =
|
||||
alt root.ds[0].kind {
|
||||
mut::unbox. { "immutable box" }
|
||||
mut::field. { "immutable field" }
|
||||
mut::index. { "immutable vec content" }
|
||||
mut::unbox { "immutable box" }
|
||||
mut::field { "immutable field" }
|
||||
mut::index { "immutable vec content" }
|
||||
};
|
||||
mk_err(cx, dest.span, msg, name);
|
||||
}
|
||||
|
@ -246,25 +246,25 @@ fn tag_kind(ccx: @crate_ctxt, did: ast::def_id) -> tag_kind {
|
||||
// Returns the code corresponding to the pointer size on this architecture.
|
||||
fn s_int(tcx: ty_ctxt) -> u8 {
|
||||
ret alt tcx.sess.targ_cfg.arch {
|
||||
session::arch_x86. { shape_i32 }
|
||||
session::arch_x86_64. { shape_i64 }
|
||||
session::arch_arm. { shape_i32 }
|
||||
session::arch_x86 { shape_i32 }
|
||||
session::arch_x86_64 { shape_i64 }
|
||||
session::arch_arm { shape_i32 }
|
||||
};
|
||||
}
|
||||
|
||||
fn s_uint(tcx: ty_ctxt) -> u8 {
|
||||
ret alt tcx.sess.targ_cfg.arch {
|
||||
session::arch_x86. { shape_u32 }
|
||||
session::arch_x86_64. { shape_u64 }
|
||||
session::arch_arm. { shape_u32 }
|
||||
session::arch_x86 { shape_u32 }
|
||||
session::arch_x86_64 { shape_u64 }
|
||||
session::arch_arm { shape_u32 }
|
||||
};
|
||||
}
|
||||
|
||||
fn s_float(tcx: ty_ctxt) -> u8 {
|
||||
ret alt tcx.sess.targ_cfg.arch {
|
||||
session::arch_x86. { shape_f64 }
|
||||
session::arch_x86_64. { shape_f64 }
|
||||
session::arch_arm. { shape_f64 }
|
||||
session::arch_x86 { shape_f64 }
|
||||
session::arch_x86_64 { shape_f64 }
|
||||
session::arch_arm { shape_f64 }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1904,8 +1904,8 @@ fn call_memmove(cx: @block_ctxt, dst: ValueRef, src: ValueRef,
|
||||
|
||||
let ccx = bcx_ccx(cx);
|
||||
let key = alt ccx.sess.targ_cfg.arch {
|
||||
session::arch_x86. | session::arch_arm. { "llvm.memmove.p0i8.p0i8.i32" }
|
||||
session::arch_x86_64. { "llvm.memmove.p0i8.p0i8.i64" }
|
||||
session::arch_x86 | session::arch_arm { "llvm.memmove.p0i8.p0i8.i32" }
|
||||
session::arch_x86_64 { "llvm.memmove.p0i8.p0i8.i64" }
|
||||
};
|
||||
let i = ccx.intrinsics;
|
||||
assert (i.contains_key(key));
|
||||
@ -2915,10 +2915,10 @@ 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} {
|
||||
@ -2937,10 +2937,10 @@ fn trans_cast(cx: @block_ctxt, e: @ast::expr, id: ast::node_id,
|
||||
{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);
|
||||
@ -3559,11 +3559,11 @@ fn trans_expr(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt {
|
||||
assert dest == ignore;
|
||||
ret trans_check_expr(bcx, a, "Assertion");
|
||||
}
|
||||
ast::expr_check(ast::checked_expr., a) {
|
||||
ast::expr_check(ast::checked_expr, a) {
|
||||
assert dest == ignore;
|
||||
ret trans_check_expr(bcx, a, "Predicate");
|
||||
}
|
||||
ast::expr_check(ast::claimed_expr., a) {
|
||||
ast::expr_check(ast::claimed_expr, a) {
|
||||
assert dest == ignore;
|
||||
/* Claims are turned on and off by a global variable
|
||||
that the RTS sets. This case generates code to
|
||||
@ -3945,8 +3945,8 @@ fn zero_alloca(cx: @block_ctxt, llptr: ValueRef, t: ty::t)
|
||||
Store(bcx, C_null(llty), llptr);
|
||||
} else {
|
||||
let key = alt ccx.sess.targ_cfg.arch {
|
||||
session::arch_x86. | session::arch_arm. { "llvm.memset.p0i8.i32" }
|
||||
session::arch_x86_64. { "llvm.memset.p0i8.i64" }
|
||||
session::arch_x86 | session::arch_arm { "llvm.memset.p0i8.i32" }
|
||||
session::arch_x86_64 { "llvm.memset.p0i8.i64" }
|
||||
};
|
||||
let i = ccx.intrinsics;
|
||||
let memset = i.get(key);
|
||||
@ -4841,9 +4841,9 @@ fn trans_native_mod(lcx: @local_ctxt, native_mod: ast::native_mod,
|
||||
let ccx = lcx_ccx(lcx);
|
||||
let cc = lib::llvm::LLVMCCallConv;
|
||||
alt abi {
|
||||
ast::native_abi_rust_intrinsic. { ret; }
|
||||
ast::native_abi_cdecl. { cc = lib::llvm::LLVMCCallConv; }
|
||||
ast::native_abi_stdcall. { cc = lib::llvm::LLVMX86StdcallCallConv; }
|
||||
ast::native_abi_rust_intrinsic { ret; }
|
||||
ast::native_abi_cdecl { cc = lib::llvm::LLVMCCallConv; }
|
||||
ast::native_abi_stdcall { cc = lib::llvm::LLVMX86StdcallCallConv; }
|
||||
}
|
||||
|
||||
for native_item in native_mod.items {
|
||||
@ -5143,7 +5143,7 @@ fn collect_native_item(ccx: @crate_ctxt,
|
||||
}
|
||||
};
|
||||
alt fn_abi {
|
||||
ast::native_abi_rust_intrinsic. {
|
||||
ast::native_abi_rust_intrinsic {
|
||||
// For intrinsics: link the function directly to the intrinsic
|
||||
// function itself.
|
||||
let fn_type = type_of_fn_from_ty(
|
||||
@ -5157,7 +5157,7 @@ fn collect_native_item(ccx: @crate_ctxt,
|
||||
ccx.item_symbols.insert(id, ri_name);
|
||||
}
|
||||
|
||||
ast::native_abi_cdecl. | ast::native_abi_stdcall. {
|
||||
ast::native_abi_cdecl | ast::native_abi_stdcall {
|
||||
// For true external functions: create a rust wrapper
|
||||
// and link to that. The rust wrapper will handle
|
||||
// switching to the C stack.
|
||||
|
@ -419,18 +419,18 @@ fn build_closure(bcx0: @block_ctxt,
|
||||
let nid = ast_util::def_id_of_def(cap_var.def).node;
|
||||
let ty = ty::node_id_to_monotype(tcx, nid);
|
||||
alt cap_var.mode {
|
||||
capture::cap_ref. {
|
||||
capture::cap_ref {
|
||||
assert ck == ty::ck_block;
|
||||
ty = ty::mk_mut_ptr(tcx, ty);
|
||||
env_vals += [env_ref(lv.val, ty, lv.kind)];
|
||||
}
|
||||
capture::cap_copy. {
|
||||
capture::cap_copy {
|
||||
env_vals += [env_copy(lv.val, ty, lv.kind)];
|
||||
}
|
||||
capture::cap_move. {
|
||||
capture::cap_move {
|
||||
env_vals += [env_move(lv.val, ty, lv.kind)];
|
||||
}
|
||||
capture::cap_drop. {
|
||||
capture::cap_drop {
|
||||
bcx = drop_ty(bcx, lv.val, ty);
|
||||
}
|
||||
}
|
||||
@ -481,7 +481,7 @@ fn load_environment(enclosing_cx: @block_ctxt,
|
||||
let i = 0u;
|
||||
vec::iter(cap_vars) { |cap_var|
|
||||
alt cap_var.mode {
|
||||
capture::cap_drop. { /* ignore */ }
|
||||
capture::cap_drop { /* ignore */ }
|
||||
_ {
|
||||
check type_is_tup_like(bcx, cbox_ty);
|
||||
let upvarptr = GEP_tup_like(
|
||||
|
@ -483,9 +483,9 @@ fn T_bool() -> TypeRef { ret T_i1(); }
|
||||
|
||||
fn T_int(targ_cfg: @session::config) -> TypeRef {
|
||||
ret alt targ_cfg.arch {
|
||||
session::arch_x86. { T_i32() }
|
||||
session::arch_x86_64. { T_i64() }
|
||||
session::arch_arm. { T_i32() }
|
||||
session::arch_x86 { T_i32() }
|
||||
session::arch_x86_64 { T_i64() }
|
||||
session::arch_arm { T_i32() }
|
||||
};
|
||||
}
|
||||
|
||||
@ -520,9 +520,9 @@ fn T_float_ty(cx: @crate_ctxt, t: ast::float_ty) -> TypeRef {
|
||||
|
||||
fn T_float(targ_cfg: @session::config) -> TypeRef {
|
||||
ret alt targ_cfg.arch {
|
||||
session::arch_x86. { T_f64() }
|
||||
session::arch_x86_64. { T_f64() }
|
||||
session::arch_arm. { T_f64() }
|
||||
session::arch_x86 { T_f64() }
|
||||
session::arch_x86_64 { T_f64() }
|
||||
session::arch_arm { T_f64() }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2534,7 +2534,7 @@ fn type_err_to_str(err: ty::type_err) -> str {
|
||||
fn to_str(s: ast::ret_style) -> str {
|
||||
alt s {
|
||||
ast::noreturn { "non-returning" }
|
||||
ast::return_val. { "return-by-value" }
|
||||
ast::return_val { "return-by-value" }
|
||||
}
|
||||
}
|
||||
ret to_str(actual) + " function found where " + to_str(expect) +
|
||||
|
@ -358,7 +358,7 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
|
||||
}
|
||||
typ = ty::mk_constr(tcx, ast_ty_to_ty(tcx, mode, t), out_cs);
|
||||
}
|
||||
ast::ty_infer. {
|
||||
ast::ty_infer {
|
||||
alt mode {
|
||||
m_check_tyvar(fcx) { ret next_ty_var(fcx); }
|
||||
_ { tcx.sess.span_bug(ast_ty.span,
|
||||
@ -539,7 +539,7 @@ fn ast_ty_to_ty_crate(ccx: @crate_ctxt, &&ast_ty: @ast::ty) -> ty::t {
|
||||
fn ast_ty_to_ty_crate_infer(ccx: @crate_ctxt, &&ast_ty: @ast::ty) ->
|
||||
option::t<ty::t> {
|
||||
alt ast_ty.node {
|
||||
ast::ty_infer. { none }
|
||||
ast::ty_infer { none }
|
||||
_ { some(ast_ty_to_ty_crate(ccx, ast_ty)) }
|
||||
}
|
||||
}
|
||||
@ -2406,9 +2406,9 @@ fn check_block_no_value(fcx: @fn_ctxt, blk: ast::blk) -> bool {
|
||||
|
||||
fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool {
|
||||
let fcx = alt blk.node.rules {
|
||||
ast::unchecked_blk. { @{purity: ast::impure_fn with *fcx0} }
|
||||
ast::unsafe_blk. { @{purity: ast::unsafe_fn with *fcx0} }
|
||||
ast::default_blk. { fcx0 }
|
||||
ast::unchecked_blk { @{purity: ast::impure_fn with *fcx0} }
|
||||
ast::unsafe_blk { @{purity: ast::unsafe_fn with *fcx0} }
|
||||
ast::default_blk { fcx0 }
|
||||
};
|
||||
let bot = false;
|
||||
let warned = false;
|
||||
@ -2745,7 +2745,7 @@ 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,
|
||||
ret_style: ast::return_val., constraints}) {
|
||||
ret_style: ast::return_val, constraints}) {
|
||||
let ok = vec::len(constraints) == 0u;
|
||||
ok &= ty::type_is_nil(tcx, output);
|
||||
let num_args = vec::len(inputs);
|
||||
|
@ -453,7 +453,7 @@ fn noop_fold_local(l: local_, fld: ast_fold) -> local_ {
|
||||
pat: fld.fold_pat(l.pat),
|
||||
init:
|
||||
alt l.init {
|
||||
option::none::<initializer>. { l.init }
|
||||
option::none::<initializer> { l.init }
|
||||
option::some::<initializer>(init) {
|
||||
option::some::<initializer>({op: init.op,
|
||||
expr: fld.fold_expr(init.expr)})
|
||||
|
@ -1485,8 +1485,6 @@ fn parse_pat(p: parser) -> @ast::pat {
|
||||
}
|
||||
} else if is_plain_ident(p) &&
|
||||
alt p.look_ahead(1u) {
|
||||
// Take this out once the libraries change
|
||||
token::DOT |
|
||||
token::LPAREN | token::LBRACKET |
|
||||
token::LT {
|
||||
false
|
||||
@ -1508,8 +1506,6 @@ fn parse_pat(p: parser) -> @ast::pat {
|
||||
args = a.node;
|
||||
hi = a.span.hi;
|
||||
}
|
||||
// take this out once the libraries change
|
||||
token::DOT. { args = []; p.bump(); }
|
||||
_ { args = []; }
|
||||
}
|
||||
// at this point, we're not sure whether it's a tag or a bind
|
||||
|
@ -275,7 +275,7 @@ fn print_type(s: ps, &&ty: @ast::ty) {
|
||||
word(s.s, "]");
|
||||
}
|
||||
ast::ty_ptr(mt) { word(s.s, "*"); print_mt(s, mt); }
|
||||
ast::ty_task. { word(s.s, "task"); }
|
||||
ast::ty_task { word(s.s, "task"); }
|
||||
ast::ty_port(t) {
|
||||
word(s.s, "port<");
|
||||
print_type(s, t);
|
||||
@ -506,7 +506,7 @@ fn print_outer_attributes(s: ps, attrs: [ast::attribute]) {
|
||||
let count = 0;
|
||||
for attr: ast::attribute in attrs {
|
||||
alt attr.node.style {
|
||||
ast::attr_outer. { print_attribute(s, attr); count += 1; }
|
||||
ast::attr_outer { print_attribute(s, attr); count += 1; }
|
||||
_ {/* fallthrough */ }
|
||||
}
|
||||
}
|
||||
@ -517,7 +517,7 @@ fn print_inner_attributes(s: ps, attrs: [ast::attribute]) {
|
||||
let count = 0;
|
||||
for attr: ast::attribute in attrs {
|
||||
alt attr.node.style {
|
||||
ast::attr_inner. {
|
||||
ast::attr_inner {
|
||||
print_attribute(s, attr);
|
||||
word(s.s, ";");
|
||||
count += 1;
|
||||
@ -576,9 +576,9 @@ fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type,
|
||||
fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
|
||||
indented: uint, attrs: [ast::attribute]) {
|
||||
alt blk.node.rules {
|
||||
ast::unchecked_blk. { word(s.s, "unchecked"); }
|
||||
ast::unsafe_blk. { word(s.s, "unsafe"); }
|
||||
ast::default_blk. { }
|
||||
ast::unchecked_blk { word(s.s, "unchecked"); }
|
||||
ast::unsafe_blk { word(s.s, "unsafe"); }
|
||||
ast::default_blk { }
|
||||
}
|
||||
|
||||
maybe_print_comment(s, blk.span.lo);
|
||||
@ -950,8 +950,8 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||
}
|
||||
ast::expr_check(m, expr) {
|
||||
alt m {
|
||||
ast::claimed_expr. { word_nbsp(s, "claim"); }
|
||||
ast::checked_expr. { word_nbsp(s, "check"); }
|
||||
ast::claimed_expr { word_nbsp(s, "claim"); }
|
||||
ast::checked_expr { word_nbsp(s, "check"); }
|
||||
}
|
||||
popen(s);
|
||||
print_expr(s, expr);
|
||||
@ -989,7 +989,7 @@ fn print_expr_parens_if_not_bot(s: ps, ex: @ast::expr) {
|
||||
fn print_local_decl(s: ps, loc: @ast::local) {
|
||||
print_pat(s, loc.node.pat);
|
||||
alt loc.node.ty.node {
|
||||
ast::ty_infer. { }
|
||||
ast::ty_infer { }
|
||||
_ { word_space(s, ":"); print_type(s, loc.node.ty); }
|
||||
}
|
||||
}
|
||||
@ -1072,7 +1072,7 @@ fn print_pat(s: ps, &&pat: @ast::pat) {
|
||||
popen(s);
|
||||
commasep(s, inconsistent, args, print_pat);
|
||||
pclose(s);
|
||||
} else { word(s.s, "."); } // FIXME
|
||||
} else { }
|
||||
}
|
||||
ast::pat_rec(fields, etc) {
|
||||
word(s.s, "{");
|
||||
@ -1479,13 +1479,13 @@ fn maybe_print_comment(s: ps, pos: uint) {
|
||||
|
||||
fn print_comment(s: ps, cmnt: lexer::cmnt) {
|
||||
alt cmnt.style {
|
||||
lexer::mixed. {
|
||||
lexer::mixed {
|
||||
assert (vec::len(cmnt.lines) == 1u);
|
||||
zerobreak(s.s);
|
||||
word(s.s, cmnt.lines[0]);
|
||||
zerobreak(s.s);
|
||||
}
|
||||
lexer::isolated. {
|
||||
lexer::isolated {
|
||||
pprust::hardbreak_if_not_bol(s);
|
||||
for line: str in cmnt.lines {
|
||||
// Don't print empty lines because they will end up as trailing
|
||||
@ -1494,7 +1494,7 @@ fn print_comment(s: ps, cmnt: lexer::cmnt) {
|
||||
hardbreak(s.s);
|
||||
}
|
||||
}
|
||||
lexer::trailing. {
|
||||
lexer::trailing {
|
||||
word(s.s, " ");
|
||||
if vec::len(cmnt.lines) == 1u {
|
||||
word(s.s, cmnt.lines[0]);
|
||||
|
@ -47,7 +47,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
|
||||
s += " -> ";
|
||||
alt cf {
|
||||
ast::noreturn { s += "!"; }
|
||||
ast::return_val. { s += ty_to_str(cx, output); }
|
||||
ast::return_val { s += ty_to_str(cx, output); }
|
||||
}
|
||||
}
|
||||
s += constrs_str(constrs);
|
||||
|
@ -165,7 +165,7 @@ fn safe_to_replace_expr(e: ast::expr_, _tm: test_mode) -> bool {
|
||||
|
||||
fn safe_to_replace_ty(t: ast::ty_, _tm: test_mode) -> bool {
|
||||
alt t {
|
||||
ast::ty_infer. { false } // always implicit, always top level
|
||||
ast::ty_infer { false } // always implicit, always top level
|
||||
ast::ty_bot { false } // in source, can only appear as the out type of a function
|
||||
ast::ty_mac(_) { false }
|
||||
_ { true }
|
||||
|
@ -451,7 +451,7 @@ fn filter_map<T: copy, U: copy>(v: [const T], f: block(T) -> option::t<U>)
|
||||
let result = [];
|
||||
for elem: T in v {
|
||||
alt f(copy elem) {
|
||||
none. {/* no-op */ }
|
||||
none {/* no-op */ }
|
||||
some(result_elem) { result += [result_elem]; }
|
||||
}
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ fn fclose(file: libc::FILE) {
|
||||
|
||||
fn fsync_fd(fd: fd_t, level: io::fsync::level) -> c_int {
|
||||
alt level {
|
||||
io::fsync::fsync. | io::fsync::fullfsync. { ret libc::fsync(fd); }
|
||||
io::fsync::fdatasync. { ret libc::fdatasync(fd); }
|
||||
io::fsync::fsync | io::fsync::fullfsync { ret libc::fsync(fd); }
|
||||
io::fsync::fdatasync { ret libc::fdatasync(fd); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ fn waitpid(pid: pid_t) -> i32 {
|
||||
|
||||
fn fsync_fd(fd: fd_t, level: io::fsync::level) -> c_int {
|
||||
alt level {
|
||||
io::fsync::fsync. { ret libc::fsync(fd); }
|
||||
io::fsync::fsync { ret libc::fsync(fd); }
|
||||
_ {
|
||||
// According to man fnctl, the ok retval is only specified to be !=-1
|
||||
if (libc::fcntl(libc_constants::F_FULLFSYNC, fd) == -1 as c_int)
|
||||
|
@ -155,7 +155,7 @@ fn fold_fn(
|
||||
none { doc }
|
||||
}
|
||||
}
|
||||
// FIXME: Warning when documenting a non-existant arg
|
||||
// FIXME: Warning when documenting a non-existent arg
|
||||
}
|
||||
|
||||
fn merge_ret_attrs(
|
||||
|
@ -23,7 +23,7 @@ fn show(b: bottle) {
|
||||
#debug("Take one down and pass it around, \
|
||||
no more bottles of beer on the wall.");
|
||||
}
|
||||
dual. {
|
||||
dual {
|
||||
#debug("2 bottles of beer on the wall, 2 bottles of beer,");
|
||||
#debug("Take one down and pass it around, \
|
||||
1 bottle of beer on the wall.");
|
||||
@ -40,7 +40,7 @@ fn next(b: bottle) -> bottle {
|
||||
alt b {
|
||||
none { ret none; }
|
||||
single { ret none; }
|
||||
dual. { ret single; }
|
||||
dual { ret single; }
|
||||
multiple(3) { ret dual; }
|
||||
multiple(n) { ret multiple(n - 1); }
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ mod map_reduce {
|
||||
// #error("all done");
|
||||
state.is_done = true;
|
||||
}
|
||||
ref. { state.ref_count += 1; }
|
||||
release. { state.ref_count -= 1; }
|
||||
ref { state.ref_count += 1; }
|
||||
release { state.ref_count -= 1; }
|
||||
}
|
||||
}
|
||||
ret none;
|
||||
|
@ -3,5 +3,5 @@
|
||||
tag a { A; }
|
||||
tag b { B; }
|
||||
|
||||
fn main() { let x: a = A; alt x { B. { } } }
|
||||
fn main() { let x: a = A; alt x { B { } } }
|
||||
|
||||
|
@ -4,6 +4,6 @@ fn foo(s: str) { }
|
||||
|
||||
fn main() {
|
||||
let i =
|
||||
alt some::<int>(3) { none::<int>. { fail } some::<int>(_) { fail } };
|
||||
alt some::<int>(3) { none::<int> { fail } some::<int>(_) { fail } };
|
||||
foo(i);
|
||||
}
|
||||
|
@ -6,4 +6,4 @@
|
||||
// error-pattern:non-exhaustive match failure
|
||||
tag t { a; b; }
|
||||
|
||||
fn main() { let x = a; alt x { b. { } } }
|
||||
fn main() { let x = a; alt x { b { } } }
|
||||
|
@ -12,7 +12,7 @@ fn foo<T>(y: option::t<T>) {
|
||||
entire if expression */
|
||||
|
||||
if true {
|
||||
} else { alt y { none::<T>. { x = 17; } _ { x = 42; } } rs += [x]; }
|
||||
} else { alt y { none::<T> { x = 17; } _ { x = 42; } } rs += [x]; }
|
||||
ret;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,6 @@ mod m1 {
|
||||
tag foo { foo1; foo2; }
|
||||
}
|
||||
|
||||
fn bar(x: m1::foo) { alt x { m1::foo1. { } } }
|
||||
fn bar(x: m1::foo) { alt x { m1::foo1 { } } }
|
||||
|
||||
fn main() { }
|
||||
|
@ -1,7 +1,7 @@
|
||||
tag maybe<T> { nothing; just(T); }
|
||||
|
||||
fn foo(x: maybe<int>) {
|
||||
alt x { nothing. { #error("A"); } just(a) { #error("B"); } }
|
||||
alt x { nothing { #error("A"); } just(a) { #error("B"); } }
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -7,8 +7,8 @@ fn foo(it: block(int)) { it(10); }
|
||||
fn main() {
|
||||
let x = true;
|
||||
alt a {
|
||||
a. { x = true; foo {|_i|} }
|
||||
b. { x = false; }
|
||||
c. { x = false; }
|
||||
a { x = true; foo {|_i|} }
|
||||
b { x = false; }
|
||||
c { x = false; }
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ fn main() {
|
||||
|
||||
|
||||
alt tag1("test") {
|
||||
tag2. { fail; }
|
||||
tag2 { fail; }
|
||||
tag1("not-test") { fail; }
|
||||
tag1("test") { }
|
||||
_ { fail; }
|
||||
|
@ -49,7 +49,7 @@ fn main() {
|
||||
while true {
|
||||
let msg = recv(p);
|
||||
alt msg {
|
||||
closed. { #debug("Got close message"); break; }
|
||||
closed { #debug("Got close message"); break; }
|
||||
received(data) {
|
||||
#debug("Got data. Length is:");
|
||||
log(debug, vec::len::<u8>(data));
|
||||
|
@ -5,10 +5,10 @@ fn foo() {
|
||||
alt some::<int>(5) {
|
||||
some::<int>(x) {
|
||||
let bar;
|
||||
alt none::<int> { none::<int>. { bar = 5; } _ { baz(); } }
|
||||
alt none::<int> { none::<int> { bar = 5; } _ { baz(); } }
|
||||
log(debug, bar);
|
||||
}
|
||||
none::<int>. { #debug("hello"); }
|
||||
none::<int> { #debug("hello"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
tag blah { a; b; }
|
||||
|
||||
fn or_alt(q: blah) -> int {
|
||||
alt q { a. | b. { 42 } }
|
||||
alt q { a | b { 42 } }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
tag blah { a(int, int, uint); b(int, int); c; }
|
||||
|
||||
fn or_alt(q: blah) -> int {
|
||||
alt q { a(x, y, _) | b(x, y) { ret x + y; } c. { ret 0; } }
|
||||
alt q { a(x, y, _) | b(x, y) { ret x + y; } c { ret 0; } }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -4,5 +4,5 @@ tag opt<T> { none; }
|
||||
|
||||
fn main() {
|
||||
let x = none::<int>;
|
||||
alt x { none::<int>. { #debug("hello world"); } }
|
||||
alt x { none::<int> { #debug("hello world"); } }
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ tag clam<T> { a(T, int); b; }
|
||||
fn uhoh<T>(v: [clam<T>]) {
|
||||
alt v[1] {
|
||||
a::<T>(t, u) { #debug("incorrect"); log(debug, u); fail; }
|
||||
b::<T>. { #debug("correct"); }
|
||||
b::<T> { #debug("correct"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,12 @@ fn test_color(color: color, val: int, name: str) unsafe {
|
||||
|
||||
fn get_color_alt(color: color) -> str {
|
||||
alt color {
|
||||
red. {"red"}
|
||||
green. {"green"}
|
||||
blue. {"blue"}
|
||||
black. {"black"}
|
||||
white. {"white"}
|
||||
imaginary. {"imaginary"}
|
||||
red {"red"}
|
||||
green {"green"}
|
||||
blue {"blue"}
|
||||
black {"black"}
|
||||
white {"white"}
|
||||
imaginary {"imaginary"}
|
||||
_ {"unknown"}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
fn foo<T>(o: myoption<T>) -> int {
|
||||
let x: int = 5;
|
||||
alt o { none::<T>. { } some::<T>(t) { x += 1; } }
|
||||
alt o { none::<T> { } some::<T>(t) { x += 1; } }
|
||||
ret x;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
fn foo<T>(o: myoption<T>) -> int {
|
||||
let x: int;
|
||||
alt o { none::<T>. { fail; } some::<T>(t) { x = 5; } }
|
||||
alt o { none::<T> { fail; } some::<T>(t) { x = 5; } }
|
||||
ret x;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user