diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-06 12:34:08 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-06 15:36:30 -0700 |
| commit | ecaf9e39c9435fa2de4fe393c4b263be36eb2d99 (patch) | |
| tree | 775f69be65adff65551d96173dd797e32e2c3157 /src/rustc/back | |
| parent | d3a9bb1bd4a1d510bbaca2ab1121e4c85a239247 (diff) | |
| download | rust-ecaf9e39c9435fa2de4fe393c4b263be36eb2d99.tar.gz rust-ecaf9e39c9435fa2de4fe393c4b263be36eb2d99.zip | |
Convert alt to match. Stop parsing alt
Diffstat (limited to 'src/rustc/back')
| -rw-r--r-- | src/rustc/back/link.rs | 24 | ||||
| -rw-r--r-- | src/rustc/back/rpath.rs | 4 | ||||
| -rw-r--r-- | src/rustc/back/x86.rs | 4 | ||||
| -rw-r--r-- | src/rustc/back/x86_64.rs | 4 |
4 files changed, 18 insertions, 18 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index c4dc6efe7b2..e7fe5fa3e3d 100644 --- a/src/rustc/back/link.rs +++ b/src/rustc/back/link.rs @@ -61,7 +61,7 @@ mod write { // and the extension to use. fn mk_intermediate_name(output_path: ~str, extension: ~str) -> ~str unsafe { - let stem = alt str::find_char(output_path, '.') { + let stem = match str::find_char(output_path, '.') { some(dot_pos) => str::slice(output_path, 0u, dot_pos), none => output_path }; @@ -82,7 +82,7 @@ mod write { // specified. if opts.save_temps { - alt opts.output_type { + match opts.output_type { output_type_bitcode => { if opts.optimize != 0u { let filename = mk_intermediate_name(output, ~"no-opt.bc"); @@ -146,7 +146,7 @@ mod write { let LLVMOptDefault = 2 as c_int; // -O2, -Os let LLVMOptAggressive = 3 as c_int; // -O3 - let mut CodeGenOptLevel = alt check opts.optimize { + let mut CodeGenOptLevel = match check opts.optimize { 0u => LLVMOptNone, 1u => LLVMOptLess, 2u => LLVMOptDefault, @@ -323,12 +323,12 @@ fn build_link_meta(sess: session, c: ast::crate, output: ~str, attr::require_unique_names(sess.diagnostic(), linkage_metas); for linkage_metas.each |meta| { if *attr::get_meta_item_name(meta) == ~"name" { - alt attr::get_meta_item_value_str(meta) { + match attr::get_meta_item_value_str(meta) { some(v) => { name = some(v); } none => vec::push(cmh_items, meta) } } else if *attr::get_meta_item_name(meta) == ~"vers" { - alt attr::get_meta_item_value_str(meta) { + match attr::get_meta_item_value_str(meta) { some(v) => { vers = some(v); } none => vec::push(cmh_items, meta) } @@ -355,7 +355,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: ~str, symbol_hasher.reset(); for cmh_items.each |m_| { let m = m_; - alt m.node { + match m.node { ast::meta_name_value(key, value) => { symbol_hasher.write_str(len_and_str(*key)); symbol_hasher.write_str(len_and_str_lit(value)); @@ -385,7 +385,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: ~str, fn crate_meta_name(sess: session, _crate: ast::crate, output: ~str, metas: provided_metas) -> @~str { - return alt metas.name { + return match metas.name { some(v) => v, none => { let name = @@ -407,7 +407,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: ~str, fn crate_meta_vers(sess: session, _crate: ast::crate, metas: provided_metas) -> @~str { - return alt metas.vers { + return match metas.vers { some(v) => v, none => { let vers = ~"0.0"; @@ -451,7 +451,7 @@ fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t, } fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> ~str { - alt ccx.type_hashcodes.find(t) { + match ccx.type_hashcodes.find(t) { some(h) => return h, none => { let hash = symbol_hash(ccx.tcx, ccx.symbol_hasher, t, ccx.link_meta); @@ -467,7 +467,7 @@ fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> ~str { fn sanitize(s: ~str) -> ~str { let mut result = ~""; do str::chars_iter(s) |c| { - alt c { + match c { '@' => result += ~"_sbox_", '~' => result += ~"_ubox_", '*' => result += ~"_ptr_", @@ -503,7 +503,7 @@ fn mangle(ss: path) -> ~str { let mut n = ~"_ZN"; // Begin name-sequence. for ss.each |s| { - alt s { path_name(s) | path_mod(s) => { + match s { path_name(s) | path_mod(s) => { let sani = sanitize(*s); n += fmt!{"%u%s", str::len(sani), sani}; } } @@ -566,7 +566,7 @@ fn link_binary(sess: session, vec::pop(parts); return str::connect(parts, ~"."); } - return alt config.os { + return match config.os { session::os_macos => rmext(rmlib(filename)), session::os_linux => rmext(rmlib(filename)), session::os_freebsd => rmext(rmlib(filename)), diff --git a/src/rustc/back/rpath.rs b/src/rustc/back/rpath.rs index f74ffe8f067..e06b0a2fe72 100644 --- a/src/rustc/back/rpath.rs +++ b/src/rustc/back/rpath.rs @@ -7,7 +7,7 @@ import metadata::filesearch; export get_rpath_flags; pure fn not_win32(os: session::os) -> bool { - alt os { + match os { session::os_win32 => false, _ => true } @@ -108,7 +108,7 @@ fn get_rpath_relative_to_output(os: session::os, assert not_win32(os); // Mac doesn't appear to support $ORIGIN - let prefix = alt os { + let prefix = match os { session::os_linux => ~"$ORIGIN" + path::path_sep(), session::os_freebsd => ~"$ORIGIN" + path::path_sep(), session::os_macos => ~"@executable_path" + path::path_sep(), diff --git a/src/rustc/back/x86.rs b/src/rustc/back/x86.rs index 045a90de495..78270f31e37 100644 --- a/src/rustc/back/x86.rs +++ b/src/rustc/back/x86.rs @@ -8,7 +8,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t { meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), - data_layout: alt target_os { + data_layout: match target_os { session::os_macos => { ~"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" + ~"-i32:32:32-i64:32:64" + @@ -29,7 +29,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t { } }, - target_triple: alt target_os { + target_triple: match target_os { session::os_macos => ~"i686-apple-darwin", session::os_win32 => ~"i686-pc-mingw32", session::os_linux => ~"i686-unknown-linux-gnu", diff --git a/src/rustc/back/x86_64.rs b/src/rustc/back/x86_64.rs index 70a35eb3289..18c2232c0fc 100644 --- a/src/rustc/back/x86_64.rs +++ b/src/rustc/back/x86_64.rs @@ -8,7 +8,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t { meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), - data_layout: alt target_os { + data_layout: match target_os { session::os_macos => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ @@ -35,7 +35,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t { } }, - target_triple: alt target_os { + target_triple: match target_os { session::os_macos => ~"x86_64-apple-darwin", session::os_win32 => ~"x86_64-pc-mingw32", session::os_linux => ~"x86_64-unknown-linux-gnu", |
