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) }
};
}
&&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(
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.
"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,
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 =
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"
}
};
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 {
{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"}; }
}
}
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);
}
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;
}
} 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);
}
// 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 }
};
}
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));
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: 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);
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
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);
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 {
}
};
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(
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.
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);
}
}
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(
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() }
};
}
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() }
};
}
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) +
}
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,
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)) }
}
}
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;
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);
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)})
}
} 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
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
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);
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 */ }
}
}
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;
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);
}
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);
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); }
}
}
popen(s);
commasep(s, inconsistent, args, print_pat);
pclose(s);
- } else { word(s.s, "."); } // FIXME
+ } else { }
}
ast::pat_rec(fields, etc) {
word(s.s, "{");
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
hardbreak(s.s);
}
}
- lexer::trailing. {
+ lexer::trailing {
word(s.s, " ");
if vec::len(cmnt.lines) == 1u {
word(s.s, cmnt.lines[0]);
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);
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 }
let result = [];
for elem: T in v {
alt f(copy elem) {
- none. {/* no-op */ }
+ none {/* no-op */ }
some(result_elem) { result += [result_elem]; }
}
}
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); }
}
}
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)
none { doc }
}
}
- // FIXME: Warning when documenting a non-existant arg
+ // FIXME: Warning when documenting a non-existent arg
}
fn merge_ret_attrs(
#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.");
alt b {
none { ret none; }
single { ret none; }
- dual. { ret single; }
+ dual { ret single; }
multiple(3) { ret dual; }
multiple(n) { ret multiple(n - 1); }
}
// #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;
tag a { A; }
tag b { B; }
-fn main() { let x: a = A; alt x { B. { } } }
+fn main() { let x: a = A; alt x { B { } } }
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);
}
// 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 { } } }
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;
}
tag foo { foo1; foo2; }
}
-fn bar(x: m1::foo) { alt x { m1::foo1. { } } }
+fn bar(x: m1::foo) { alt x { m1::foo1 { } } }
fn main() { }
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() { }
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; }
}
}
alt tag1("test") {
- tag2. { fail; }
+ tag2 { fail; }
tag1("not-test") { fail; }
tag1("test") { }
_ { fail; }
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));
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"); }
}
}
tag blah { a; b; }
fn or_alt(q: blah) -> int {
- alt q { a. | b. { 42 } }
+ alt q { a | b { 42 } }
}
fn main() {
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() {
fn main() {
let x = none::<int>;
- alt x { none::<int>. { #debug("hello world"); } }
+ alt x { none::<int> { #debug("hello world"); } }
}
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"); }
}
}
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"}
}
}
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;
}
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;
}