From e5d095d67e3926fa104ac495076fe9d4cd4f5562 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 31 Jan 2012 17:05:20 -0800 Subject: [PATCH] Change option::t to option Now that core exports "option" as a synonym for option::t, search-and- replace option::t with option. The only place that still refers to option::t are the modules in libcore that use option, because fixing this requires a new snapshot (forthcoming). --- src/cargo/cargo.rs | 24 +++--- src/comp/back/link.rs | 10 +-- src/comp/driver/driver.rs | 10 +-- src/comp/driver/session.rs | 4 +- src/comp/front/attr.rs | 12 +-- src/comp/front/config.rs | 6 +- src/comp/front/test.rs | 2 +- src/comp/lib/llvm.rs | 6 +- src/comp/metadata/creader.rs | 6 +- src/comp/metadata/csearch.rs | 4 +- src/comp/metadata/decoder.rs | 10 +-- src/comp/middle/alias.rs | 22 +++--- src/comp/middle/debuginfo.rs | 6 +- src/comp/middle/last_use.rs | 2 +- src/comp/middle/mut.rs | 4 +- src/comp/middle/resolve.rs | 78 +++++++++---------- src/comp/middle/trans/alt.rs | 20 ++--- src/comp/middle/trans/base.rs | 52 ++++++------- src/comp/middle/trans/closure.rs | 12 +-- src/comp/middle/trans/common.rs | 28 +++---- src/comp/middle/tstate/auxiliary.rs | 16 ++-- src/comp/middle/tstate/pre_post_conditions.rs | 4 +- src/comp/middle/tstate/states.rs | 6 +- src/comp/middle/ty.rs | 28 +++---- src/comp/middle/typeck.rs | 26 +++---- src/comp/syntax/ast.rs | 28 +++---- src/comp/syntax/ast_util.rs | 4 +- src/comp/syntax/codemap.rs | 2 +- src/comp/syntax/ext/base.rs | 4 +- src/comp/syntax/ext/concat_idents.rs | 2 +- src/comp/syntax/ext/env.rs | 4 +- src/comp/syntax/ext/fmt.rs | 2 +- src/comp/syntax/ext/ident_to_str.rs | 2 +- src/comp/syntax/ext/log_syntax.rs | 2 +- src/comp/syntax/ext/simplext.rs | 26 +++---- src/comp/syntax/parse/eval.rs | 6 +- src/comp/syntax/parse/lexer.rs | 2 +- src/comp/syntax/parse/parser.rs | 22 +++--- src/comp/syntax/print/pprust.rs | 22 +++--- src/comp/syntax/visit.rs | 4 +- src/comp/util/filesearch.rs | 10 +-- src/comp/util/ppaux.rs | 2 +- src/compiletest/common.rs | 6 +- src/compiletest/compiletest.rs | 4 +- src/compiletest/header.rs | 12 +-- src/compiletest/procsrv.rs | 6 +- src/compiletest/runtest.rs | 8 +- src/libcore/core.rs | 2 +- src/libcore/task.rs | 2 +- src/libstd/c_vec.rs | 2 +- src/libstd/deque.rs | 2 +- src/libstd/ebml.rs | 2 +- src/libstd/freebsd_os.rs | 2 +- src/libstd/fun_treemap.rs | 2 +- src/libstd/generic_os.rs | 6 +- src/libstd/getopts.rs | 6 +- src/libstd/io.rs | 8 +- src/libstd/json.rs | 16 ++-- src/libstd/linux_os.rs | 2 +- src/libstd/list.rs | 8 +- src/libstd/macos_os.rs | 2 +- src/libstd/map.rs | 12 +-- src/libstd/rope.rs | 16 ++-- src/libstd/smallintmap.rs | 18 ++--- src/libstd/tempfile.rs | 2 +- src/libstd/test.rs | 6 +- src/libstd/treemap.rs | 2 +- src/libstd/ufind.rs | 2 +- src/libstd/win32_os.rs | 2 +- .../bench/task-perf-word-count-generic.rs | 2 +- src/test/bench/task-perf-word-count.rs | 2 +- src/test/compile-fail/pattern-tyvar-2.rs | 2 +- src/test/compile-fail/pattern-tyvar.rs | 2 +- .../tag-that-dare-not-speak-its-name.rs | 2 +- src/test/run-pass/alias-uninit-value.rs | 4 +- src/test/run-pass/alt-join.rs | 5 +- src/test/run-pass/hashmap-memory.rs | 2 +- src/test/run-pass/issue-511.rs | 2 +- src/test/run-pass/nested-pattern.rs | 2 +- .../run-pass/shape_intrinsic_tag_then_rec.rs | 2 +- 80 files changed, 362 insertions(+), 365 deletions(-) diff --git a/src/cargo/cargo.rs b/src/cargo/cargo.rs index da9646e4caaf..fd39797b29fc 100644 --- a/src/cargo/cargo.rs +++ b/src/cargo/cargo.rs @@ -32,16 +32,16 @@ type package = { url: str, method: str, description: str, - ref: option::t, + ref: option, tags: [str] }; type source = { name: str, url: str, - sig: option::t, - key: option::t, - keyfp: option::t, + sig: option, + key: option, + keyfp: option, mutable packages: [package] }; @@ -60,9 +60,9 @@ type pkg = { name: str, vers: str, uuid: str, - desc: option::t, - sigs: option::t, - crate_type: option::t + desc: option, + sigs: option, + crate_type: option }; fn info(msg: str) { @@ -77,9 +77,9 @@ fn error(msg: str) { io::stdout().write_line("error: " + msg); } -fn load_link(mis: [@ast::meta_item]) -> (option::t, - option::t, - option::t) { +fn load_link(mis: [@ast::meta_item]) -> (option, + option, + option) { let name = none; let vers = none; let uuid = none; @@ -99,7 +99,7 @@ fn load_link(mis: [@ast::meta_item]) -> (option::t, (name, vers, uuid) } -fn load_pkg(filename: str) -> option::t { +fn load_pkg(filename: str) -> option { let cm = codemap::new_codemap(); let handler = diagnostic::mk_handler(none); let sess = @{ @@ -439,7 +439,7 @@ fn install_source(c: cargo, path: str) { } } -fn install_git(c: cargo, wd: str, url: str, ref: option::t) { +fn install_git(c: cargo, wd: str, url: str, ref: option) { run::run_program("git", ["clone", url, wd]); if option::is_some::(ref) { let r = option::get::(ref); diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index 068c8fddb334..b7a16d7e863b 100644 --- a/src/comp/back/link.rs +++ b/src/comp/back/link.rs @@ -38,7 +38,7 @@ fn llvm_err(sess: session, msg: str) unsafe { } else { sess.fatal(msg + ": " + str::from_cstr(buf)); } } -fn load_intrinsics_bc(sess: session) -> option::t { +fn load_intrinsics_bc(sess: session) -> option { let path = alt filesearch::search( sess.filesearch, bind filesearch::pick_file("intrinsics.bc", _)) { @@ -368,14 +368,14 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, sha: sha1) -> link_meta { type provided_metas = - {name: option::t, - vers: option::t, + {name: option, + vers: option, cmh_items: [@ast::meta_item]}; fn provided_link_metas(sess: session, c: ast::crate) -> provided_metas { - let name: option::t = none; - let vers: option::t = none; + let name: option = none; + let vers: option = none; let cmh_items: [@ast::meta_item] = []; let linkage_metas = attr::find_linkage_metas(c.node.attrs); attr::require_unique_names(sess, linkage_metas); diff --git a/src/comp/driver/driver.rs b/src/comp/driver/driver.rs index 8781c07b4aa4..3a96762f41e9 100644 --- a/src/comp/driver/driver.rs +++ b/src/comp/driver/driver.rs @@ -105,8 +105,8 @@ enum compile_upto { fn compile_upto(sess: session, cfg: ast::crate_cfg, input: str, upto: compile_upto, - outputs: option::t) - -> {crate: @ast::crate, tcx: option::t} { + outputs: option) + -> {crate: @ast::crate, tcx: option} { let time_passes = sess.opts.time_passes; let crate = time(time_passes, "parsing", bind parse_input(sess, cfg, input)); @@ -197,7 +197,7 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg, } fn compile_input(sess: session, cfg: ast::crate_cfg, input: str, - outdir: option::t, output: option::t) { + outdir: option, output: option) { let upto = if sess.opts.parse_only { cu_parse } else if sess.opts.no_trans { cu_no_trans } @@ -504,8 +504,8 @@ fn opts() -> [getopts::opt] { type output_filenames = @{out_filename: str, obj_filename:str}; fn build_output_filenames(ifile: str, - odir: option::t, - ofile: option::t, + odir: option, + ofile: option, sess: session) -> output_filenames { let obj_path = ""; diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs index 81f1c76a2c92..897e367251c3 100644 --- a/src/comp/driver/session.rs +++ b/src/comp/driver/session.rs @@ -40,7 +40,7 @@ type options = time_llvm_passes: bool, output_type: back::link::output_type, addl_lib_search_paths: [str], - maybe_sysroot: option::t, + maybe_sysroot: option, target_triple: str, cfg: ast::crate_cfg, test: bool, @@ -58,7 +58,7 @@ type session = @{targ_cfg: @config, parse_sess: parse_sess, codemap: codemap::codemap, // For a library crate, this is always none - mutable main_fn: option::t<(node_id, codemap::span)>, + mutable main_fn: option<(node_id, codemap::span)>, span_diagnostic: diagnostic::span_handler, filesearch: filesearch::filesearch, mutable building_library: bool, diff --git a/src/comp/front/attr.rs b/src/comp/front/attr.rs index 54960d653603..e90fd0ecdfb1 100644 --- a/src/comp/front/attr.rs +++ b/src/comp/front/attr.rs @@ -48,7 +48,7 @@ fn find_linkage_metas(attrs: [ast::attribute]) -> [@ast::meta_item] { fn find_attrs_by_name(attrs: [ast::attribute], name: ast::ident) -> [ast::attribute] { let filter = ( - fn@(a: ast::attribute) -> option::t { + fn@(a: ast::attribute) -> option { if get_attr_name(a) == name { option::some(a) } else { option::none } @@ -67,7 +67,7 @@ fn get_attr_name(attr: ast::attribute) -> ast::ident { fn find_meta_items_by_name(metas: [@ast::meta_item], name: ast::ident) -> [@ast::meta_item] { - let filter = fn@(&&m: @ast::meta_item) -> option::t<@ast::meta_item> { + let filter = fn@(&&m: @ast::meta_item) -> option<@ast::meta_item> { if get_meta_item_name(m) == name { option::some(m) } else { option::none } @@ -85,7 +85,7 @@ fn get_meta_item_name(meta: @ast::meta_item) -> ast::ident { // Gets the string value if the meta_item is a meta_name_value variant // containing a string, otherwise none -fn get_meta_item_value_str(meta: @ast::meta_item) -> option::t { +fn get_meta_item_value_str(meta: @ast::meta_item) -> option { alt meta.node { ast::meta_name_value(_, v) { alt v.node { ast::lit_str(s) { option::some(s) } _ { option::none } } @@ -95,7 +95,7 @@ fn get_meta_item_value_str(meta: @ast::meta_item) -> option::t { } fn get_meta_item_value_str_by_name(attrs: [ast::attribute], name: ast::ident) - -> option::t { + -> option { let mattrs = find_attrs_by_name(attrs, name); if vec::len(mattrs) > 0u { ret get_meta_item_value_str(attr_meta(mattrs[0])); @@ -103,7 +103,7 @@ fn get_meta_item_value_str_by_name(attrs: [ast::attribute], name: ast::ident) ret option::none; } -fn get_meta_item_list(meta: @ast::meta_item) -> option::t<[@ast::meta_item]> { +fn get_meta_item_list(meta: @ast::meta_item) -> option<[@ast::meta_item]> { alt meta.node { ast::meta_list(_, l) { option::some(l) } _ { option::none } @@ -184,7 +184,7 @@ fn sort_meta_items(items: [@ast::meta_item]) -> [@ast::meta_item] { fn remove_meta_items_by_name(items: [@ast::meta_item], name: str) -> [@ast::meta_item] { - let filter = fn@(&&item: @ast::meta_item) -> option::t<@ast::meta_item> { + let filter = fn@(&&item: @ast::meta_item) -> option<@ast::meta_item> { if get_meta_item_name(item) != name { option::some(item) } else { option::none } diff --git a/src/comp/front/config.rs b/src/comp/front/config.rs index 684564052afc..5e5723680d9c 100644 --- a/src/comp/front/config.rs +++ b/src/comp/front/config.rs @@ -37,7 +37,7 @@ fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred) } fn filter_item(cx: ctxt, &&item: @ast::item) -> - option::t<@ast::item> { + option<@ast::item> { if item_in_cfg(cx, item) { option::some(item) } else { option::none } } @@ -50,7 +50,7 @@ fn fold_mod(cx: ctxt, m: ast::_mod, fld: fold::ast_fold) -> } fn filter_native_item(cx: ctxt, &&item: @ast::native_item) -> - option::t<@ast::native_item> { + option<@ast::native_item> { if native_item_in_cfg(cx, item) { option::some(item) } else { option::none } @@ -65,7 +65,7 @@ fn fold_native_mod(cx: ctxt, nm: ast::native_mod, } fn filter_stmt(cx: ctxt, &&stmt: @ast::stmt) -> - option::t<@ast::stmt> { + option<@ast::stmt> { alt stmt.node { ast::stmt_decl(decl, _) { alt decl.node { diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index 79ed35093261..0e84930658a8 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -67,7 +67,7 @@ fn fold_mod(_cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod { // the one we're going to add. FIXME: This is sloppy. Instead we should // have some mechanism to indicate to the translation pass which function // we want to be main. - fn nomain(&&item: @ast::item) -> option::t<@ast::item> { + fn nomain(&&item: @ast::item) -> option<@ast::item> { alt item.node { ast::item_fn(_, _, _) { if item.ident == "main" { diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index daa86e5be90b..9dcee021b56d 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -917,11 +917,11 @@ fn associate_type(tn: type_names, s: str, t: TypeRef) { assert tn.named_types.insert(s, t); } -fn type_has_name(tn: type_names, t: TypeRef) -> option::t { +fn type_has_name(tn: type_names, t: TypeRef) -> option { ret tn.type_names.find(t); } -fn name_has_type(tn: type_names, s: str) -> option::t { +fn name_has_type(tn: type_names, s: str) -> option { ret tn.named_types.find(s); } @@ -1072,7 +1072,7 @@ resource object_file_res(ObjectFile: ObjectFileRef) { type object_file = {llof: ObjectFileRef, dtor: @object_file_res}; -fn mk_object_file(llmb: MemoryBufferRef) -> option::t { +fn mk_object_file(llmb: MemoryBufferRef) -> option { let llof = llvm::LLVMCreateObjectFile(llmb); if llof as int == 0 { ret option::none::; } ret option::some({llof: llof, dtor: @object_file_res(llof)}); diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs index e4e39730350d..4929b02b7af4 100644 --- a/src/comp/metadata/creader.rs +++ b/src/comp/metadata/creader.rs @@ -137,7 +137,7 @@ fn default_native_lib_naming(sess: session::session, static: bool) -> fn find_library_crate(sess: session::session, ident: ast::ident, metas: [@ast::meta_item]) - -> option::t<{ident: str, data: @[u8]}> { + -> option<{ident: str, data: @[u8]}> { attr::require_unique_names(sess, metas); let metas = metas; @@ -173,7 +173,7 @@ fn find_library_crate_aux(sess: session::session, crate_name: str, metas: [@ast::meta_item], filesearch: filesearch::filesearch) -> - option::t<{ident: str, data: @[u8]}> { + option<{ident: str, data: @[u8]}> { let prefix: str = nn.prefix + crate_name + "-"; let suffix: str = nn.suffix; @@ -206,7 +206,7 @@ fn find_library_crate_aux(sess: session::session, } fn get_metadata_section(sess: session::session, - filename: str) -> option::t<@[u8]> unsafe { + filename: str) -> option<@[u8]> unsafe { let mb = str::as_buf(filename, {|buf| llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf) }); diff --git a/src/comp/metadata/csearch.rs b/src/comp/metadata/csearch.rs index 1f1593ae742d..941fedb0c205 100644 --- a/src/comp/metadata/csearch.rs +++ b/src/comp/metadata/csearch.rs @@ -63,7 +63,7 @@ fn get_enum_variants(tcx: ty::ctxt, def: ast::def_id) -> [ty::variant_info] { } fn get_impls_for_mod(cstore: cstore::cstore, def: ast::def_id, - name: option::t) + name: option) -> @[@middle::resolve::_impl] { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_impls_for_mod(cdata, def.node, name) @@ -82,7 +82,7 @@ fn get_type(tcx: ty::ctxt, def: ast::def_id) -> ty::ty_param_bounds_and_ty { } fn get_impl_iface(tcx: ty::ctxt, def: ast::def_id) - -> option::t { + -> option { let cstore = tcx.sess.cstore; let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_impl_iface(cdata, def.node, tcx) diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs index 8fb12aae533f..2ce10e8673ca 100644 --- a/src/comp/metadata/decoder.rs +++ b/src/comp/metadata/decoder.rs @@ -55,7 +55,7 @@ fn lookup_hash(d: ebml::doc, eq_fn: fn@([u8]) -> bool, hash: uint) -> ret result; } -fn maybe_find_item(item_id: int, items: ebml::doc) -> option::t { +fn maybe_find_item(item_id: int, items: ebml::doc) -> option { fn eq_item(bytes: [u8], item_id: int) -> bool { ret ebml::be_uint_from_bytes(@bytes, 0u, 4u) as int == item_id; } @@ -92,7 +92,7 @@ fn variant_enum_id(d: ebml::doc) -> ast::def_id { ret parse_def_id(ebml::doc_data(tagdoc)); } -fn variant_disr_val(d: ebml::doc) -> option::t { +fn variant_disr_val(d: ebml::doc) -> option { alt ebml::maybe_get_doc(d, tag_disr_val) { some(val_doc) { let val_buf = ebml::doc_data(val_doc); @@ -118,7 +118,7 @@ fn item_type(item: ebml::doc, tcx: ty::ctxt, cdata: cmd) -> ty::t { } fn item_impl_iface(item: ebml::doc, tcx: ty::ctxt, cdata: cmd) - -> option::t { + -> option { let result = none; ebml::tagged_docs(item, tag_impl_iface) {|ity| let t = parse_ty_data(ity.data, cdata.cnum, ity.start, tcx, {|did| @@ -227,7 +227,7 @@ fn get_type_param_count(data: @[u8], id: ast::node_id) -> uint { } fn get_impl_iface(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) - -> option::t { + -> option { item_impl_iface(lookup_item(id, cdata.data), tcx, cdata) } @@ -279,7 +279,7 @@ fn item_impl_methods(cdata: cmd, item: ebml::doc, base_tps: uint) } fn get_impls_for_mod(cdata: cmd, m_id: ast::node_id, - name: option::t) + name: option) -> @[@middle::resolve::_impl] { let data = cdata.data; let mod_item = lookup_item(m_id, data), result = []; diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index 98cade0ca26a..cecdffc35c18 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -27,7 +27,7 @@ enum unsafe_ty { contains(ty::t), mut_contains(ty::t), } type binding = @{node_id: node_id, span: span, - root_var: option::t, + root_var: option, local_id: uint, unsafe_tys: [unsafe_ty], mutable copied: copied}; @@ -36,7 +36,7 @@ type binding = @{node_id: node_id, type scope = {bs: [binding], invalid: @mutable list<@invalid>}; -fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option::t, +fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option, unsafe_tys: [unsafe_ty]) -> binding { alt root_var { some(r_id) { cx.ref_map.insert(id, r_id); } @@ -427,7 +427,7 @@ fn check_assign(cx: @ctx, dest: @ast::expr, src: @ast::expr, sc: scope, check_lval(cx, dest, sc, v); } -fn check_if(c: @ast::expr, then: ast::blk, els: option::t<@ast::expr>, +fn check_if(c: @ast::expr, then: ast::blk, els: option<@ast::expr>, sc: scope, v: vt) { v.visit_expr(c, sc, v); let orig_invalid = *sc.invalid; @@ -476,14 +476,14 @@ fn test_scope(cx: ctx, sc: scope, b: binding, p: @ast::path) { } } -fn path_def(cx: ctx, ex: @ast::expr) -> option::t { +fn path_def(cx: ctx, ex: @ast::expr) -> option { ret alt ex.node { ast::expr_path(_) { some(cx.tcx.def_map.get(ex.id)) } _ { none } } } -fn path_def_id(cx: ctx, ex: @ast::expr) -> option::t { +fn path_def_id(cx: ctx, ex: @ast::expr) -> option { alt ex.node { ast::expr_path(_) { ret some(ast_util::def_id_of_def(cx.tcx.def_map.get(ex.id)).node); @@ -589,12 +589,12 @@ fn copy_is_expensive(tcx: ty::ctxt, ty: ty::t) -> bool { type pattern_root = {id: node_id, name: ident, - mut: option::t, + mut: option, span: span}; -fn pattern_roots(tcx: ty::ctxt, mut: option::t, pat: @ast::pat) +fn pattern_roots(tcx: ty::ctxt, mut: option, pat: @ast::pat) -> [pattern_root] { - fn walk(tcx: ty::ctxt, mut: option::t, pat: @ast::pat, + fn walk(tcx: ty::ctxt, mut: option, pat: @ast::pat, &set: [pattern_root]) { alt normalize_pat(tcx, pat).node { ast::pat_wild | ast::pat_lit(_) | ast::pat_range(_, _) {} @@ -642,7 +642,7 @@ fn pattern_roots(tcx: ty::ctxt, mut: option::t, pat: @ast::pat) // Wraps the expr_root in mut.rs to also handle roots that exist through // return-by-reference fn expr_root(cx: ctx, ex: @ast::expr, autoderef: bool) - -> {ex: @ast::expr, mut: option::t} { + -> {ex: @ast::expr, mut: option} { let base_root = mut::expr_root(cx.tcx, ex, autoderef); let unsafe_ty = none; for d in *base_root.ds { @@ -651,12 +651,12 @@ fn expr_root(cx: ctx, ex: @ast::expr, autoderef: bool) ret {ex: base_root.ex, mut: unsafe_ty}; } -fn unsafe_set(from: option::t) -> [unsafe_ty] { +fn unsafe_set(from: option) -> [unsafe_ty] { alt from { some(t) { [t] } _ { [] } } } fn find_invalid(id: node_id, lst: list<@invalid>) - -> option::t<@invalid> { + -> option<@invalid> { let cur = lst; while true { alt cur { diff --git a/src/comp/middle/debuginfo.rs b/src/comp/middle/debuginfo.rs index fe843c6795b1..177bbef06eac 100644 --- a/src/comp/middle/debuginfo.rs +++ b/src/comp/middle/debuginfo.rs @@ -143,7 +143,7 @@ fn md_from_metadata(val: debug_metadata) -> T unsafe { } fn cached_metadata(cache: metadata_cache, mdtag: int, - eq: fn(md: T) -> bool) -> option::t unsafe { + eq: fn(md: T) -> bool) -> option unsafe { if cache.contains_key(mdtag) { let items = cache.get(mdtag); for item in items { @@ -456,8 +456,8 @@ fn create_boxed_type(cx: @crate_ctxt, outer: ty::t, _inner: ty::t, fn create_composite_type(type_tag: int, name: str, file: ValueRef, line: int, size: int, align: int, offset: int, - derived: option::t, - members: option::t<[ValueRef]>) + derived: option, + members: option<[ValueRef]>) -> ValueRef { let lldata = [lltag(type_tag), file, diff --git a/src/comp/middle/last_use.rs b/src/comp/middle/last_use.rs index 24b378b8d386..27968048a57d 100644 --- a/src/comp/middle/last_use.rs +++ b/src/comp/middle/last_use.rs @@ -298,7 +298,7 @@ fn clear_def_if_path(cx: ctx, d: def, to: bool) } fn clear_if_path(cx: ctx, ex: @expr, v: visit::vt, to: bool) - -> option::t { + -> option { alt ex.node { expr_path(_) { ret clear_def_if_path(cx, cx.def_map.get(ex.id), to); diff --git a/src/comp/middle/mut.rs b/src/comp/middle/mut.rs index 736a31851d22..bf9f3b1c88bf 100644 --- a/src/comp/middle/mut.rs +++ b/src/comp/middle/mut.rs @@ -240,7 +240,7 @@ fn check_call(cx: @ctx, f: @expr, args: [@expr]) { } } -fn check_bind(cx: @ctx, f: @expr, args: [option::t<@expr>]) { +fn check_bind(cx: @ctx, f: @expr, args: [option<@expr>]) { let arg_ts = ty::ty_fn_args(cx.tcx, ty::expr_ty(cx.tcx, f)); let i = 0u; for arg in args { @@ -264,7 +264,7 @@ fn check_bind(cx: @ctx, f: @expr, args: [option::t<@expr>]) { } } -fn is_immutable_def(cx: @ctx, def: def) -> option::t { +fn is_immutable_def(cx: @ctx, def: def) -> option { alt def { def_fn(_, _) | def_mod(_) | def_native_mod(_) | def_const(_) | def_use(_) { diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index 1c04541e7640..12895459b75a 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -48,9 +48,9 @@ enum import_state { todo(ast::node_id, ast::ident, @[ast::ident], span, scopes), is_glob(@[ast::ident], scopes, span), resolving(span), - resolved(option::t, /* value */ - option::t, /* type */ - option::t, /* module */ + resolved(option, /* value */ + option, /* type */ + option, /* module */ @[@_impl], /* impls */ /* used for reporting unused import warning */ ast::ident, span), @@ -58,9 +58,9 @@ enum import_state { enum glob_import_state { glob_resolving(span), - glob_resolved(option::t, /* value */ - option::t, /* type */ - option::t), /* module */ + glob_resolved(option, /* value */ + option, /* type */ + option), /* module */ } type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>; @@ -98,7 +98,7 @@ type mod_index = hashmap>; type glob_imp_def = {def: def, item: @ast::view_item}; type indexed_mod = { - m: option::t, + m: option, index: mod_index, mutable glob_imports: [glob_imp_def], glob_imported_names: hashmap, @@ -113,7 +113,7 @@ type def_map = hashmap; type ext_map = hashmap; type exp_map = hashmap; type impl_map = hashmap; -type impl_cache = hashmap>; +type impl_cache = hashmap>; type env = {cstore: cstore::cstore, @@ -131,7 +131,7 @@ type env = mutable data: [ast::node_id]}, mutable reported: [{ident: str, sc: scope}], mutable ignored_imports: [node_id], - mutable current_tp: option::t, + mutable current_tp: option, mutable resolve_unexported: bool, sess: session}; @@ -324,7 +324,7 @@ fn resolve_capture_item(e: @env, sc: scopes, &&cap_item: @ast::capture_item) { maybe_insert(e, cap_item.id, dcur); } -fn maybe_insert(e: @env, id: node_id, def: option::t) { +fn maybe_insert(e: @env, id: node_id, def: option) { if option::is_some(def) { e.def_map.insert(id, option::get(def)); } } @@ -578,7 +578,7 @@ fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt) { fn follow_import(e: env, sc: scopes, path: [ident], sp: span) -> - option::t { + option { let path_len = vec::len(path); let dcur = lookup_in_scope_strict(e, sc, sp, path[0], ns_module); let i = 1u; @@ -623,7 +623,7 @@ fn resolve_constr(e: @env, c: @ast::constr, sc: scopes, _v: vt) { fn resolve_import(e: env, defid: ast::def_id, name: ast::ident, ids: [ast::ident], sp: codemap::span, sc: scopes) { fn register(e: env, id: node_id, cx: ctxt, sp: codemap::span, - name: ast::ident, lookup: fn(namespace) -> option::t, + name: ast::ident, lookup: fn(namespace) -> option, impls: [@_impl]) { let val = lookup(ns_val(ns_any_value)), typ = lookup(ns_type), md = lookup(ns_module); @@ -746,7 +746,7 @@ fn ns_name(ns: namespace) -> str { enum ctxt { in_mod(def), in_scope(scopes), } fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) { - fn find_fn_or_mod_scope(sc: scopes) -> option::t { + fn find_fn_or_mod_scope(sc: scopes) -> option { let sc = sc; while true { alt sc { @@ -803,7 +803,7 @@ fn mk_unresolved_msg(id: ident, kind: str) -> str { // Lookup helpers fn lookup_path_strict(e: env, sc: scopes, sp: span, pth: ast::path_, - ns: namespace) -> option::t { + ns: namespace) -> option { let n_idents = vec::len(pth.idents); let headns = if n_idents == 1u { ns } else { ns_module }; @@ -827,7 +827,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 { + ns: namespace) -> option { alt lookup_in_scope(e, sc, sp, name, ns) { none { unresolved_err(e, in_scope(sc), sp, name, ns_name(ns)); @@ -847,7 +847,7 @@ fn scope_is_fn(sc: scope) -> bool { // Returns: // none - does not close // some(node_id) - closes via the expr w/ node_id -fn scope_closes(sc: scope) -> option::t { +fn scope_closes(sc: scope) -> option { alt sc { scope_fn_expr(_, node_id, _) { some(node_id) } _ { none } @@ -874,9 +874,9 @@ fn def_is_ty_arg(d: def) -> bool { } fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace) - -> option::t { + -> option { fn in_scope(e: env, sp: span, name: ident, s: scope, ns: namespace) -> - option::t { + option { alt s { scope_crate { ret lookup_in_local_mod(e, ast::crate_node_id, sp, @@ -1003,7 +1003,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace) } fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param]) - -> option::t { + -> option { let n = 0u; for tp: ast::ty_param in ty_params { if str::eq(tp.ident, name) && alt e.current_tp { @@ -1014,7 +1014,7 @@ fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param]) ret none::; } -fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option::t { +fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option { let found = none; pat_util::pat_bindings(normalize_pat_def_map(e.def_map, pat)) @@ -1027,7 +1027,7 @@ fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option::t { fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl, ty_params: [ast::ty_param], - ns: namespace) -> option::t { + ns: namespace) -> option { alt ns { ns_val(ns_any_value) { for a: ast::arg in decl.inputs { @@ -1044,7 +1044,7 @@ fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl, fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint, - loc_pos: uint, ns: namespace) -> option::t { + loc_pos: uint, ns: namespace) -> option { let i = vec::len(b.stmts); while i > 0u { i -= 1u; @@ -1132,7 +1132,7 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint, ret none; } -fn found_def_item(i: @ast::item, ns: namespace) -> option::t { +fn found_def_item(i: @ast::item, ns: namespace) -> option { alt i.node { ast::item_const(_, _) { if ns == ns_val(ns_any_value) { @@ -1167,7 +1167,7 @@ fn found_def_item(i: @ast::item, ns: namespace) -> option::t { } fn lookup_in_mod_strict(e: env, m: def, sp: span, name: ident, - ns: namespace, dr: dir) -> option::t { + ns: namespace, dr: dir) -> option { alt lookup_in_mod(e, m, sp, name, ns, dr) { none { unresolved_err(e, in_mod(m), sp, name, ns_name(ns)); @@ -1178,7 +1178,7 @@ fn lookup_in_mod_strict(e: env, m: def, sp: span, name: ident, } fn lookup_in_mod(e: env, m: def, sp: span, name: ident, ns: namespace, - dr: dir) -> option::t { + dr: dir) -> option { let defid = def_id_of_def(m); if defid.crate != ast::local_crate { // examining a module in an external crate @@ -1214,7 +1214,7 @@ fn found_view_item(e: env, id: node_id) -> def { ret ast::def_mod({crate: cnum, node: ast::crate_node_id}); } -fn lookup_import(e: env, defid: def_id, ns: namespace) -> option::t { +fn lookup_import(e: env, defid: def_id, ns: namespace) -> option { // Imports are simply ignored when resolving themselves. if vec::member(defid.node, e.ignored_imports) { ret none; } alt e.imports.get(defid.node) { @@ -1240,7 +1240,7 @@ fn lookup_import(e: env, defid: def_id, ns: namespace) -> option::t { } fn lookup_in_local_native_mod(e: env, node_id: node_id, sp: span, id: ident, - ns: namespace) -> option::t { + ns: namespace) -> option { ret lookup_in_local_mod(e, node_id, sp, id, ns, inside); } @@ -1249,7 +1249,7 @@ fn is_exported(e: env, i: ident, m: _mod) -> bool { } fn lookup_in_local_mod(e: env, node_id: node_id, sp: span, id: ident, - ns: namespace, dr: dir) -> option::t { + ns: namespace, dr: dir) -> option { let info = e.mod_map.get(node_id); if dr == outside && !is_exported(e, id, option::get(info.m)) { // if we're in a native mod, then dr==inside, so info.m is some _mod @@ -1276,9 +1276,9 @@ fn lookup_in_local_mod(e: env, node_id: node_id, sp: span, id: ident, } fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident, - ns: namespace, dr: dir) -> option::t { + ns: namespace, dr: dir) -> option { fn lookup_in_mod_(e: env, def: glob_imp_def, sp: span, name: ident, - ns: namespace, dr: dir) -> option::t { + ns: namespace, dr: dir) -> option { alt def.item.node { ast::view_item_import_glob(_, id) { if vec::member(id, e.ignored_imports) { ret none; } @@ -1310,7 +1310,7 @@ fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident, } fn lookup_glob_in_mod(e: env, info: @indexed_mod, sp: span, id: ident, - wanted_ns: namespace, dr: dir) -> option::t { + wanted_ns: namespace, dr: dir) -> option { // since we don't know what names we have in advance, // absence takes the place of todo() if !info.glob_imported_names.contains_key(id) { @@ -1339,7 +1339,7 @@ fn lookup_glob_in_mod(e: env, info: @indexed_mod, sp: span, id: ident, } fn lookup_in_mie(e: env, mie: mod_index_entry, ns: namespace) -> - option::t { + option { alt mie { mie_view_item(_, id, _) { if ns == ns_module { ret some(found_view_item(e, id)); } @@ -1487,7 +1487,7 @@ fn ns_ok(wanted:namespace, actual:namespace) -> bool { } fn lookup_external(e: env, cnum: int, ids: [ident], ns: namespace) -> - option::t { + option { for d: def in csearch::lookup_defs(e.sess.cstore, cnum, ids) { e.ext_map.insert(def_id_of_def(d), ids); if ns_ok(ns, ns_for_def(d)) { ret some(d); } @@ -1734,7 +1734,7 @@ fn check_exports(e: @env) { is_some(m) || is_some(v) || is_some(t) } - fn maybe_add_reexport(e: @env, path: str, def: option::t) { + fn maybe_add_reexport(e: @env, path: str, def: option) { alt def { some(def) { alt e.exp_map.find(path) { @@ -1868,7 +1868,7 @@ fn resolve_impls(e: @env, c: @ast::crate) { } fn find_impls_in_view_item(e: env, vi: @ast::view_item, - &impls: [@_impl], sc: option::t) { + &impls: [@_impl], sc: option) { fn lookup_imported_impls(e: env, id: ast::node_id, act: fn(@[@_impl])) { alt e.imports.get(id) { @@ -1930,8 +1930,8 @@ fn find_impls_in_view_item(e: env, vi: @ast::view_item, } fn find_impls_in_item(e: env, i: @ast::item, &impls: [@_impl], - name: option::t, - ck_exports: option::t) { + name: option, + ck_exports: option) { alt i.node { ast::item_impl(_, ifce, _, mthds) { if alt name { some(n) { n == i.ident } _ { true } } && @@ -1953,7 +1953,7 @@ fn find_impls_in_item(e: env, i: @ast::item, &impls: [@_impl], } fn find_impls_in_mod_by_id(e: env, defid: def_id, &impls: [@_impl], - name: option::t) { + name: option) { let cached; alt e.impl_cache.find(defid) { some(some(v)) { cached = v; } @@ -1987,7 +1987,7 @@ fn find_impls_in_mod_by_id(e: env, defid: def_id, &impls: [@_impl], } fn find_impls_in_mod(e: env, m: def, &impls: [@_impl], - name: option::t) { + name: option) { alt m { ast::def_mod(defid) { find_impls_in_mod_by_id(e, defid, impls, name); diff --git a/src/comp/middle/trans/alt.rs b/src/comp/middle/trans/alt.rs index a18a6bb1aa11..0203edb90d13 100644 --- a/src/comp/middle/trans/alt.rs +++ b/src/comp/middle/trans/alt.rs @@ -77,7 +77,7 @@ fn variant_opt(ccx: @crate_ctxt, pat_id: ast::node_id) -> opt { } type bind_map = [{ident: ast::ident, val: ValueRef}]; -fn assoc(key: str, list: bind_map) -> option::t { +fn assoc(key: str, list: bind_map) -> option { for elt: {ident: ast::ident, val: ValueRef} in list { if str::eq(elt.ident, key) { ret some(elt.val); } } @@ -88,7 +88,7 @@ type match_branch = @{pats: [@ast::pat], bound: bind_map, data: @{body: BasicBlockRef, - guard: option::t<@ast::expr>, + guard: option<@ast::expr>, id_map: pat_id_map}}; type match = [match_branch]; @@ -120,7 +120,7 @@ fn expand_nested_bindings(m: match, col: uint, val: ValueRef) -> match { result } -type enter_pat = fn@(@ast::pat) -> option::t<[@ast::pat]>; +type enter_pat = fn@(@ast::pat) -> option<[@ast::pat]>; fn enter_match(m: match, col: uint, val: ValueRef, e: enter_pat) -> match { let result = []; @@ -153,7 +153,7 @@ fn enter_default(m: match, col: uint, val: ValueRef) -> match { _ { false } } } - fn e(p: @ast::pat) -> option::t<[@ast::pat]> { + fn e(p: @ast::pat) -> option<[@ast::pat]> { ret if matches_always(p) { some([]) } else { none }; } ret enter_match(m, col, val, e); @@ -163,7 +163,7 @@ fn enter_opt(ccx: @crate_ctxt, m: match, opt: opt, col: uint, enum_size: uint, val: ValueRef) -> match { let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; fn e(ccx: @crate_ctxt, dummy: @ast::pat, opt: opt, size: uint, - p: @ast::pat) -> option::t<[@ast::pat]> { + p: @ast::pat) -> option<[@ast::pat]> { alt p.node { ast::pat_enum(ctor, subpats) { ret if opt_eq(variant_opt(ccx, p.id), opt) { @@ -186,7 +186,7 @@ fn enter_rec(m: match, col: uint, fields: [ast::ident], val: ValueRef) -> match { let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; fn e(dummy: @ast::pat, fields: [ast::ident], p: @ast::pat) -> - option::t<[@ast::pat]> { + option<[@ast::pat]> { alt p.node { ast::pat_rec(fpats, _) { let pats = []; @@ -208,7 +208,7 @@ fn enter_rec(m: match, col: uint, fields: [ast::ident], val: ValueRef) -> fn enter_tup(m: match, col: uint, val: ValueRef, n_elts: uint) -> match { let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; fn e(dummy: @ast::pat, n_elts: uint, p: @ast::pat) -> - option::t<[@ast::pat]> { + option<[@ast::pat]> { alt p.node { ast::pat_tup(elts) { ret some(elts); } _ { ret some(vec::init_elt(n_elts, dummy)); } @@ -219,7 +219,7 @@ fn enter_tup(m: match, col: uint, val: ValueRef, n_elts: uint) -> match { fn enter_box(m: match, col: uint, val: ValueRef) -> match { let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; - fn e(dummy: @ast::pat, p: @ast::pat) -> option::t<[@ast::pat]> { + fn e(dummy: @ast::pat, p: @ast::pat) -> option<[@ast::pat]> { alt p.node { ast::pat_box(sub) { ret some([sub]); } _ { ret some([dummy]); } @@ -230,7 +230,7 @@ fn enter_box(m: match, col: uint, val: ValueRef) -> match { fn enter_uniq(m: match, col: uint, val: ValueRef) -> match { let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; - fn e(dummy: @ast::pat, p: @ast::pat) -> option::t<[@ast::pat]> { + fn e(dummy: @ast::pat, p: @ast::pat) -> option<[@ast::pat]> { alt p.node { ast::pat_uniq(sub) { ret some([sub]); } _ { ret some([dummy]); } @@ -682,7 +682,7 @@ fn trans_alt(cx: @block_ctxt, expr: @ast::expr, arms_: [ast::arm], // Cached fail-on-fallthrough block let fail_cx = @mutable none; fn mk_fail(cx: @block_ctxt, sp: span, - done: @mutable option::t) -> BasicBlockRef { + done: @mutable option) -> BasicBlockRef { alt *done { some(bb) { ret bb; } _ { } } let fail_cx = new_sub_block_ctxt(cx, "case_fallthrough"); base::trans_fail(fail_cx, some(sp), "non-exhaustive match failure");; diff --git a/src/comp/middle/trans/base.rs b/src/comp/middle/trans/base.rs index 7bff9b250608..16cf9952bf7c 100644 --- a/src/comp/middle/trans/base.rs +++ b/src/comp/middle/trans/base.rs @@ -878,7 +878,7 @@ fn trans_stack_local_derived_tydesc(cx: @block_ctxt, llsz: ValueRef, } fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool, - &static_ti: option::t<@tydesc_info>) -> result { + &static_ti: option<@tydesc_info>) -> result { alt cx.fcx.derived_tydescs.find(t) { some(info) { // If the tydesc escapes in this context, the cached derived @@ -949,7 +949,7 @@ fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool, type get_tydesc_result = {kind: tydesc_kind, result: result}; fn get_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool, - &static_ti: option::t<@tydesc_info>) + &static_ti: option<@tydesc_info>) -> get_tydesc_result { // Is the supplied type a type param? If so, return the passed-in tydesc. @@ -1366,7 +1366,7 @@ fn trans_res_drop(cx: @block_ctxt, rs: ValueRef, did: ast::def_id, let dtor_addr = common::get_res_dtor(ccx, did, inner_t); let args = [cx.fcx.llretptr, null_env_ptr(cx)]; for tp: ty::t in tps { - let ti: option::t<@tydesc_info> = none; + let ti: option<@tydesc_info> = none; let td = get_tydesc(cx, tp, false, ti).result; args += [td.val]; cx = td.bcx; @@ -1641,7 +1641,7 @@ fn iter_structural_ty(cx: @block_ctxt, av: ValueRef, t: ty::t, } fn lazily_emit_all_tydesc_glue(cx: @block_ctxt, - static_ti: option::t<@tydesc_info>) { + static_ti: option<@tydesc_info>) { lazily_emit_tydesc_glue(cx, abi::tydesc_field_take_glue, static_ti); lazily_emit_tydesc_glue(cx, abi::tydesc_field_drop_glue, static_ti); lazily_emit_tydesc_glue(cx, abi::tydesc_field_free_glue, static_ti); @@ -1650,13 +1650,13 @@ fn lazily_emit_all_tydesc_glue(cx: @block_ctxt, fn lazily_emit_all_generic_info_tydesc_glues(cx: @block_ctxt, gi: generic_info) { - for ti: option::t<@tydesc_info> in gi.static_tis { + for ti: option<@tydesc_info> in gi.static_tis { lazily_emit_all_tydesc_glue(cx, ti); } } fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int, - static_ti: option::t<@tydesc_info>) { + static_ti: option<@tydesc_info>) { alt static_ti { none { } some(ti) { @@ -1731,7 +1731,7 @@ fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int, } fn call_tydesc_glue_full(cx: @block_ctxt, v: ValueRef, tydesc: ValueRef, - field: int, static_ti: option::t<@tydesc_info>) { + field: int, static_ti: option<@tydesc_info>) { lazily_emit_tydesc_glue(cx, field, static_ti); let static_glue_fn = none; @@ -1768,7 +1768,7 @@ fn call_tydesc_glue_full(cx: @block_ctxt, v: ValueRef, tydesc: ValueRef, fn call_tydesc_glue(cx: @block_ctxt, v: ValueRef, t: ty::t, field: int) -> @block_ctxt { - let ti: option::t<@tydesc_info> = none::<@tydesc_info>; + let ti: option<@tydesc_info> = none::<@tydesc_info>; let {bcx: bcx, val: td} = get_tydesc(cx, t, false, ti).result; call_tydesc_glue_full(bcx, v, td, field, ti); ret bcx; @@ -2402,7 +2402,7 @@ fn get_dest_addr(dest: dest) -> ValueRef { } fn trans_if(cx: @block_ctxt, cond: @ast::expr, thn: ast::blk, - els: option::t<@ast::expr>, dest: dest) + els: option<@ast::expr>, dest: dest) -> @block_ctxt { let {bcx, val: cond_val} = trans_temp_expr(cx, cond); @@ -2505,10 +2505,10 @@ fn trans_do_while(cx: @block_ctxt, body: ast::blk, cond: @ast::expr) -> type generic_info = { item_type: ty::t, - static_tis: [option::t<@tydesc_info>], + static_tis: [option<@tydesc_info>], tydescs: [ValueRef], param_bounds: @[ty::param_bounds], - origins: option::t + origins: option }; enum lval_kind { @@ -2528,7 +2528,7 @@ type lval_maybe_callee = {bcx: @block_ctxt, val: ValueRef, kind: lval_kind, env: callee_env, - generic: option::t}; + generic: option}; fn null_env_ptr(bcx: @block_ctxt) -> ValueRef { C_null(T_opaque_cbox_ptr(bcx_ccx(bcx))) @@ -3055,7 +3055,7 @@ fn trans_arg_expr(cx: @block_ctxt, arg: ty::arg, lldestty: TypeRef, // - new_fn_ctxt // - trans_args fn trans_args(cx: @block_ctxt, llenv: ValueRef, - gen: option::t, es: [@ast::expr], fn_ty: ty::t, + gen: option, es: [@ast::expr], fn_ty: ty::t, dest: dest) -> {bcx: @block_ctxt, args: [ValueRef], @@ -3378,7 +3378,7 @@ fn trans_tup(bcx: @block_ctxt, elts: [@ast::expr], id: ast::node_id, } fn trans_rec(bcx: @block_ctxt, fields: [ast::field], - base: option::t<@ast::expr>, id: ast::node_id, + base: option<@ast::expr>, id: ast::node_id, dest: dest) -> @block_ctxt { let t = node_id_type(bcx_ccx(bcx), id); let bcx = bcx; @@ -3809,8 +3809,8 @@ fn trans_check_expr(cx: @block_ctxt, e: @ast::expr, s: str) -> @block_ctxt { ret next_cx; } -fn trans_fail_expr(bcx: @block_ctxt, sp_opt: option::t, - fail_expr: option::t<@ast::expr>) -> @block_ctxt { +fn trans_fail_expr(bcx: @block_ctxt, sp_opt: option, + fail_expr: option<@ast::expr>) -> @block_ctxt { let bcx = bcx; alt fail_expr { some(expr) { @@ -3836,13 +3836,13 @@ fn trans_fail_expr(bcx: @block_ctxt, sp_opt: option::t, } } -fn trans_fail(bcx: @block_ctxt, sp_opt: option::t, fail_str: str) -> +fn trans_fail(bcx: @block_ctxt, sp_opt: option, fail_str: str) -> @block_ctxt { let V_fail_str = C_cstr(bcx_ccx(bcx), fail_str); ret trans_fail_value(bcx, sp_opt, V_fail_str); } -fn trans_fail_value(bcx: @block_ctxt, sp_opt: option::t, +fn trans_fail_value(bcx: @block_ctxt, sp_opt: option, V_fail_str: ValueRef) -> @block_ctxt { let ccx = bcx_ccx(bcx); let V_filename; @@ -3907,7 +3907,7 @@ fn trans_cont(cx: @block_ctxt) -> @block_ctxt { ret trans_break_cont(cx, false); } -fn trans_ret(bcx: @block_ctxt, e: option::t<@ast::expr>) -> @block_ctxt { +fn trans_ret(bcx: @block_ctxt, e: option<@ast::expr>) -> @block_ctxt { let cleanup_cx = bcx, bcx = bcx; alt e { some(x) { bcx = trans_expr_save_in(bcx, x, bcx.fcx.llretptr); } @@ -4057,7 +4057,7 @@ fn trans_stmt(cx: @block_ctxt, s: ast::stmt) -> @block_ctxt { // You probably don't want to use this one. See the // next three functions instead. fn new_block_ctxt(cx: @fn_ctxt, parent: block_parent, kind: block_kind, - name: str, block_span: option::t) -> @block_ctxt { + name: str, block_span: option) -> @block_ctxt { let s = ""; if cx.lcx.ccx.sess.opts.save_temps || cx.lcx.ccx.sess.opts.debuginfo { @@ -4086,7 +4086,7 @@ fn new_block_ctxt(cx: @fn_ctxt, parent: block_parent, kind: block_kind, // Use this when you're at the top block of a function or the like. -fn new_top_block_ctxt(fcx: @fn_ctxt, sp: option::t) -> @block_ctxt { +fn new_top_block_ctxt(fcx: @fn_ctxt, sp: option) -> @block_ctxt { ret new_block_ctxt(fcx, parent_none, SCOPE_BLOCK, "function top level", sp); } @@ -4101,7 +4101,7 @@ fn new_real_block_ctxt(bcx: @block_ctxt, n: str, sp: span) -> @block_ctxt { ret new_block_ctxt(bcx.fcx, parent_some(bcx), SCOPE_BLOCK, n, some(sp)); } -fn new_loop_scope_block_ctxt(bcx: @block_ctxt, _cont: option::t<@block_ctxt>, +fn new_loop_scope_block_ctxt(bcx: @block_ctxt, _cont: option<@block_ctxt>, _break: @block_ctxt, n: str, sp: span) -> @block_ctxt { ret new_block_ctxt(bcx.fcx, parent_some(bcx), @@ -4336,7 +4336,7 @@ fn mk_standard_basic_blocks(llfn: ValueRef) -> // - trans_args fn new_fn_ctxt_w_id(cx: @local_ctxt, llfndecl: ValueRef, id: ast::node_id, rstyle: ast::ret_style, - sp: option::t) -> @fn_ctxt { + sp: option) -> @fn_ctxt { let llbbs = mk_standard_basic_blocks(llfndecl); ret @{llfn: llfndecl, llenv: llvm::LLVMGetParam(llfndecl, 1u as c_uint), @@ -4360,7 +4360,7 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, llfndecl: ValueRef, lcx: cx}; } -fn new_fn_ctxt(cx: @local_ctxt, llfndecl: ValueRef, sp: option::t) +fn new_fn_ctxt(cx: @local_ctxt, llfndecl: ValueRef, sp: option) -> @fn_ctxt { ret new_fn_ctxt_w_id(cx, llfndecl, -1, ast::return_val, sp); } @@ -5198,7 +5198,7 @@ fn link_name(i: @ast::native_item) -> str { } fn collect_native_item(ccx: @crate_ctxt, - abi: @mutable option::t, + abi: @mutable option, i: @ast::native_item, &&pt: [str], _v: vt<[str]>) { @@ -5248,7 +5248,7 @@ fn collect_native_item(ccx: @crate_ctxt, } } -fn collect_item(ccx: @crate_ctxt, abi: @mutable option::t, +fn collect_item(ccx: @crate_ctxt, abi: @mutable option, i: @ast::item, &&pt: [str], v: vt<[str]>) { let new_pt = pt + [i.ident]; alt i.node { diff --git a/src/comp/middle/trans/closure.rs b/src/comp/middle/trans/closure.rs index 4ff6d6fca2b8..6873646a48f3 100644 --- a/src/comp/middle/trans/closure.rs +++ b/src/comp/middle/trans/closure.rs @@ -541,7 +541,7 @@ fn trans_expr_fn(bcx: @block_ctxt, ret bcx; } -fn trans_bind(cx: @block_ctxt, f: @ast::expr, args: [option::t<@ast::expr>], +fn trans_bind(cx: @block_ctxt, f: @ast::expr, args: [option<@ast::expr>], id: ast::node_id, dest: dest) -> @block_ctxt { let f_res = trans_callee(cx, f); ret trans_bind_1(cx, ty::expr_ty(bcx_tcx(cx), f), f_res, args, @@ -550,10 +550,10 @@ fn trans_bind(cx: @block_ctxt, f: @ast::expr, args: [option::t<@ast::expr>], fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t, f_res: lval_maybe_callee, - args: [option::t<@ast::expr>], pair_ty: ty::t, + args: [option<@ast::expr>], pair_ty: ty::t, dest: dest) -> @block_ctxt { let bound: [@ast::expr] = []; - for argopt: option::t<@ast::expr> in args { + for argopt: option<@ast::expr> in args { alt argopt { none { } some(e) { bound += [e]; } } } let bcx = f_res.bcx; @@ -781,10 +781,10 @@ fn make_opaque_cbox_free_glue( fn trans_bind_thunk(cx: @local_ctxt, incoming_fty: ty::t, outgoing_fty: ty::t, - args: [option::t<@ast::expr>], + args: [option<@ast::expr>], cbox_ty: ty::t, param_bounds: [ty::param_bounds], - target_fn: option::t) + target_fn: option) -> {val: ValueRef, ty: TypeRef} { // If we supported constraints on record fields, we could make the // constraints for this function: @@ -926,7 +926,7 @@ fn trans_bind_thunk(cx: @local_ctxt, let outgoing_arg_index: uint = 0u; let llout_arg_tys: [TypeRef] = type_of_explicit_args(cx.ccx, outgoing_args); - for arg: option::t<@ast::expr> in args { + for arg: option<@ast::expr> in args { let out_arg = outgoing_args[outgoing_arg_index]; let llout_arg_ty = llout_arg_tys[outgoing_arg_index]; alt arg { diff --git a/src/comp/middle/trans/common.rs b/src/comp/middle/trans/common.rs index 96cc79a6db25..46a49fd7fbdb 100644 --- a/src/comp/middle/trans/common.rs +++ b/src/comp/middle/trans/common.rs @@ -43,10 +43,10 @@ type tydesc_info = tydesc: ValueRef, size: ValueRef, align: ValueRef, - mutable take_glue: option::t, - mutable drop_glue: option::t, - mutable free_glue: option::t, - mutable cmp_glue: option::t, + mutable take_glue: option, + mutable drop_glue: option, + mutable free_glue: option, + mutable cmp_glue: option, ty_params: [uint]}; /* @@ -90,7 +90,7 @@ type crate_ctxt = ast_map: ast_map::map, exp_map: resolve::exp_map, item_symbols: hashmap, - mutable main_fn: option::t, + mutable main_fn: option, link_meta: link::link_meta, enum_sizes: hashmap, discrims: hashmap, @@ -122,7 +122,7 @@ type crate_ctxt = shape_cx: shape::ctxt, gc_cx: gc::ctxt, crate_map: ValueRef, - dbg_cx: option::t<@debuginfo::debug_ctxt>}; + dbg_cx: option<@debuginfo::debug_ctxt>}; type local_ctxt = {path: [str], @@ -134,7 +134,7 @@ type val_self_pair = {v: ValueRef, t: ty::t}; enum local_val { local_mem(ValueRef), local_imm(ValueRef), } -type fn_ty_param = {desc: ValueRef, dicts: option::t<[ValueRef]>}; +type fn_ty_param = {desc: ValueRef, dicts: option<[ValueRef]>}; // Function context. Every LLVM function we create will have one of // these. @@ -231,8 +231,8 @@ type fn_ctxt = mutable llderivedtydescs: BasicBlockRef, mutable lldynamicallocas: BasicBlockRef, mutable llreturn: BasicBlockRef, - mutable llobstacktoken: option::t, - mutable llself: option::t, + mutable llobstacktoken: option, + mutable llself: option, llargs: hashmap, lllocals: hashmap, llupvars: hashmap, @@ -240,7 +240,7 @@ type fn_ctxt = derived_tydescs: hashmap, id: ast::node_id, ret_style: ast::ret_style, - span: option::t, + span: option, lcx: @local_ctxt}; enum cleanup { @@ -339,7 +339,7 @@ enum block_kind { SCOPE_BLOCK, // A basic block created from the body of a loop. Contains pointers to // which block to jump to in the case of "continue" or "break". - LOOP_SCOPE_BLOCK(option::t<@block_ctxt>, @block_ctxt), + LOOP_SCOPE_BLOCK(option<@block_ctxt>, @block_ctxt), // A non-scope block is a basic block created as a translation artifact // from translating code that expresses conditional logic rather than by // explicit { ... } block structure in the source language. It's called a @@ -374,11 +374,11 @@ type block_ctxt = kind: block_kind, mutable cleanups: [cleanup], mutable lpad_dirty: bool, - mutable lpad: option::t, - block_span: option::t, + mutable lpad: option, + block_span: option, fcx: @fn_ctxt}; -// FIXME: we should be able to use option::t<@block_parent> here but +// FIXME: we should be able to use option<@block_parent> here but // the infinite-enum check in rustboot gets upset. enum block_parent { parent_none, parent_some(@block_ctxt), } diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index 2934d4a5b1e0..3ca8a0b89fb0 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -300,7 +300,7 @@ fn add_node(ccx: crate_ctxt, i: node_id, a: ts_ann) { ccx.node_anns[i] = a; } -fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option::t { +fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option { if i as uint < vec::len(*ccx.node_anns) { ret some::(ccx.node_anns[i]); } else { ret none::; } @@ -515,7 +515,7 @@ fn node_id_to_def_strict(cx: ty::ctxt, id: node_id) -> def { } } -fn node_id_to_def(ccx: crate_ctxt, id: node_id) -> option::t { +fn node_id_to_def(ccx: crate_ctxt, id: node_id) -> option { ret ccx.tcx.def_map.find(id); } @@ -691,7 +691,7 @@ fn pred_args_matches(pattern: [constr_arg_general_], desc: pred_args) -> } fn find_instance_(pattern: [constr_arg_general_], descs: [pred_args]) -> - option::t { + option { for d: pred_args in descs { if pred_args_matches(pattern, d) { ret some(d.node.bit_num); } } @@ -725,7 +725,7 @@ fn find_instances(_fcx: fn_ctxt, subst: subst, c: constraint) -> rslt } -fn find_in_subst(id: node_id, s: subst) -> option::t { +fn find_in_subst(id: node_id, s: subst) -> option { for p: {from: inst, to: inst} in s { if id == p.from.node { ret some(p.to); } } @@ -805,11 +805,11 @@ fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) -> } } -fn local_node_id_to_def(fcx: fn_ctxt, i: node_id) -> option::t { +fn local_node_id_to_def(fcx: fn_ctxt, i: node_id) -> option { fcx.ccx.tcx.def_map.find(i) } -fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option::t { +fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option { alt local_node_id_to_def(fcx, i) { some(def_local(id, _)) | some(def_arg(id, _)) | some(def_binding(id)) | some(def_upvar(id, _, _)) { @@ -820,7 +820,7 @@ fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option::t { } fn local_node_id_to_local_def_id(fcx: fn_ctxt, i: node_id) -> - option::t { + option { alt local_node_id_to_def_id(fcx, i) { some(did) { some(did.node) } _ { none } @@ -1053,7 +1053,7 @@ fn ast_constr_to_sp_constr(tcx: ty::ctxt, args: [arg], c: @constr) -> ret respan(c.span, tconstr); } -type binding = {lhs: [inst], rhs: option::t}; +type binding = {lhs: [inst], rhs: option}; fn local_to_bindings(tcx: ty::ctxt, loc: @local) -> binding { let lhs = []; diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index dcb117cb6a3d..e0fa0728eace 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -110,7 +110,7 @@ fn find_pre_post_loop(fcx: fn_ctxt, l: @local, index: @expr, body: blk, // annotation for an if-expression with consequent conseq // and alternative maybe_alt fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, - maybe_alt: option::t<@expr>, id: node_id, chck: if_ty) { + maybe_alt: option<@expr>, id: node_id, chck: if_ty) { find_pre_post_expr(fcx, antec); find_pre_post_block(fcx, conseq); alt maybe_alt { @@ -521,7 +521,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { let cmodes = callee_modes(fcx, operator.id); let modes = []; let i = 0; - for expr_opt: option::t<@expr> in maybe_args { + for expr_opt: option<@expr> in maybe_args { alt expr_opt { none {/* no-op */ } some(expr) { modes += [cmodes[i]]; args += [expr]; } diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index 9a4bfc26ddf9..f68c7ba7a105 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -103,7 +103,7 @@ fn seq_states(fcx: fn_ctxt, pres: prestate, bindings: [binding]) -> } fn find_pre_post_state_sub(fcx: fn_ctxt, pres: prestate, e: @expr, - parent: node_id, c: option::t) -> bool { + parent: node_id, c: option) -> bool { let changed = find_pre_post_state_expr(fcx, pres, e); changed = set_prestate_ann(fcx.ccx, parent, pres) || changed; @@ -261,7 +261,7 @@ fn gen_if_local(fcx: fn_ctxt, p: poststate, e: @expr) -> bool { } fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, - maybe_alt: option::t<@expr>, id: node_id, chk: if_ty, + maybe_alt: option<@expr>, id: node_id, chk: if_ty, pres: prestate) -> bool { let changed = set_prestate_ann(fcx.ccx, id, pres) | @@ -376,7 +376,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { let callee_ops = callee_arg_init_ops(fcx, operator.id); let ops = []; let i = 0; - for a_opt: option::t<@expr> in maybe_args { + for a_opt: option<@expr> in maybe_args { alt a_opt { none {/* no-op */ } some(a) { ops += [callee_ops[i]]; args += [a]; } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 597fd548f04c..e2390ab99114 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -217,7 +217,7 @@ type ctxt = short_names_cache: hashmap, needs_drop_cache: hashmap, kind_cache: hashmap, - ast_ty_to_ty_cache: hashmap<@ast::ty, option::t>, + ast_ty_to_ty_cache: hashmap<@ast::ty, option>, enum_var_cache: hashmap, iface_method_cache: hashmap, ty_param_bounds: hashmap}; @@ -648,7 +648,7 @@ pure fn mach_sty(cfg: @session::config, s: sty) -> sty { } } -pure fn ty_name(cx: ctxt, typ: t) -> option::t<@str> { +pure fn ty_name(cx: ctxt, typ: t) -> option<@str> { alt interner::get(*cx.ts, typ).struct { ty_named(_, n) { some(n) } _ { none } @@ -1229,7 +1229,7 @@ fn type_is_c_like_enum(cx: ctxt, ty: t) -> bool { } } -fn type_param(cx: ctxt, ty: t) -> option::t { +fn type_param(cx: ctxt, ty: t) -> option { alt struct(cx, ty) { ty_param(id, _) { ret some(id); } _ {/* fall through */ } @@ -1579,7 +1579,7 @@ fn stmt_node_id(s: @ast::stmt) -> ast::node_id { } } -fn field_idx(id: ast::ident, fields: [field]) -> option::t { +fn field_idx(id: ast::ident, fields: [field]) -> option { let i = 0u; for f in fields { if f.ident == id { ret some(i); } i += 1u; } ret none; @@ -1600,7 +1600,7 @@ fn get_fields(tcx:ctxt, rec_ty:t) -> [field] { } } -fn method_idx(id: ast::ident, meths: [method]) -> option::t { +fn method_idx(id: ast::ident, meths: [method]) -> option { let i = 0u; for m in meths { if m.ident == id { ret some(i); } i += 1u; } ret none; @@ -1613,7 +1613,7 @@ fn sort_methods(meths: [method]) -> [method] { ret std::sort::merge_sort(bind method_lteq(_, _), meths); } -fn occurs_check_fails(tcx: ctxt, sp: option::t, vid: int, rt: t) -> +fn occurs_check_fails(tcx: ctxt, sp: option, vid: int, rt: t) -> bool { if !type_contains_vars(tcx, rt) { // Fast path @@ -1821,7 +1821,7 @@ mod unify { // Unifies two mutability flags. fn unify_mut(expected: ast::mutability, actual: ast::mutability, variance: variance) -> - option::t<(ast::mutability, variance)> { + option<(ast::mutability, variance)> { // If you're unifying on something mutable then we have to // be invariant on the inner type @@ -1847,7 +1847,7 @@ mod unify { ret none; } fn unify_fn_proto(e_proto: ast::proto, a_proto: ast::proto, - variance: variance) -> option::t { + variance: variance) -> option { // Prototypes form a diamond-shaped partial order: // // block @@ -2365,7 +2365,7 @@ mod unify { while i < vec::len::(vb.sets.nodes) { let sets = ""; let j = 0u; - while j < vec::len::>(vb.sets.nodes) { + while j < vec::len::>(vb.sets.nodes) { if ufind::find(vb.sets, j) == i { sets += #fmt[" %u", j]; } j += 1u; } @@ -2383,10 +2383,10 @@ mod unify { // Takes an optional span - complain about occurs check violations // iff the span is present (so that if we already know we're going // to error anyway, we don't complain) - fn fixup_vars(tcx: ty_ctxt, sp: option::t, vb: @var_bindings, + fn fixup_vars(tcx: ty_ctxt, sp: option, vb: @var_bindings, typ: t) -> fixup_result { - fn subst_vars(tcx: ty_ctxt, sp: option::t, vb: @var_bindings, - unresolved: @mutable option::t, + fn subst_vars(tcx: ty_ctxt, sp: option, vb: @var_bindings, + unresolved: @mutable option, vars_seen: std::list::list, vid: int) -> t { // Should really return a fixup_result instead of a t, but fold_ty // doesn't allow returning anything but a t. @@ -2426,7 +2426,7 @@ mod unify { some(var_id) { ret fix_err(var_id); } } } - fn resolve_type_var(tcx: ty_ctxt, sp: option::t, vb: @var_bindings, + fn resolve_type_var(tcx: ty_ctxt, sp: option, vb: @var_bindings, vid: int) -> fixup_result { if vid as uint >= ufind::set_count(vb.sets) { ret fix_err(vid); } let root_id = ufind::find(vb.sets, vid as uint); @@ -2537,7 +2537,7 @@ fn iface_methods(cx: ctxt, id: ast::def_id) -> @[method] { result } -fn impl_iface(cx: ctxt, id: ast::def_id) -> option::t { +fn impl_iface(cx: ctxt, id: ast::def_id) -> option { if id.crate == ast::local_crate { option::map(cx.tcache.find(id), {|it| it.ty}) } else { diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index da951150c7f5..c2f79c6c13ee 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -191,7 +191,7 @@ fn structure_of(fcx: @fn_ctxt, sp: span, typ: ty::t) -> ty::sty { // Returns the one-level-deep structure of the given type or none if it // is not known yet. fn structure_of_maybe(fcx: @fn_ctxt, _sp: span, typ: ty::t) -> - option::t { + option { let r = ty::unify::resolve_type_structure(fcx.ccx.tcx, fcx.var_bindings, typ); ret alt r { @@ -545,7 +545,7 @@ fn ast_ty_to_ty_crate(ccx: @crate_ctxt, &&ast_ty: @ast::ty) -> ty::t { // A wrapper around ast_ty_to_ty_crate that handles ty_infer. fn ast_ty_to_ty_crate_infer(ccx: @crate_ctxt, &&ast_ty: @ast::ty) -> - option::t { + option { alt ast_ty.node { ast::ty_infer { none } _ { some(ast_ty_to_ty_crate(ccx, ast_ty)) } @@ -946,7 +946,7 @@ mod writeback { export resolve_type_vars_in_expr; fn resolve_type_vars_in_type(fcx: @fn_ctxt, sp: span, typ: ty::t) -> - option::t { + option { if !ty::type_contains_vars(fcx.ccx.tcx, typ) { ret some(typ); } alt ty::unify::fixup_vars(fcx.ccx.tcx, some(sp), fcx.var_bindings, typ) { @@ -1077,7 +1077,7 @@ fn gather_locals(ccx: @crate_ctxt, decl: ast::fn_decl, body: ast::blk, id: ast::node_id, - old_fcx: option::t<@fn_ctxt>) -> gather_result { + old_fcx: option<@fn_ctxt>) -> gather_result { let {vb: vb, locals: locals, nvi: nvi} = alt old_fcx { none { @@ -1094,7 +1094,7 @@ fn gather_locals(ccx: @crate_ctxt, let tcx = ccx.tcx; let next_var_id = fn@() -> int { let rv = *nvi; *nvi += 1; ret rv; }; - let assign = fn@(nid: ast::node_id, ty_opt: option::t) { + let assign = fn@(nid: ast::node_id, ty_opt: option) { let var_id = next_var_id(); locals.insert(nid, var_id); alt ty_opt { @@ -1445,7 +1445,7 @@ fn impl_self_ty(tcx: ty::ctxt, did: ast::def_id) -> {n_tps: uint, ty: ty::t} { fn lookup_method(fcx: @fn_ctxt, isc: resolve::iscopes, name: ast::ident, ty: ty::t, sp: span) - -> option::t<{method_ty: ty::t, n_tps: uint, substs: [ty::t], + -> option<{method_ty: ty::t, n_tps: uint, substs: [ty::t], origin: method_origin}> { let tcx = fcx.ccx.tcx; @@ -1579,7 +1579,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, // A generic function to factor out common logic from call and bind // expressions. fn check_call_or_bind(fcx: @fn_ctxt, sp: span, fty: ty::t, - args: [option::t<@ast::expr>]) -> bool { + args: [option<@ast::expr>]) -> bool { let sty = structure_of(fcx, sp, fty); // Grab the argument types let arg_tys = alt sty { @@ -1658,7 +1658,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, // A generic function for checking call expressions fn check_call(fcx: @fn_ctxt, sp: span, f: @ast::expr, args: [@ast::expr]) -> bool { - let args_opt_0: [option::t<@ast::expr>] = []; + let args_opt_0: [option<@ast::expr>] = []; for arg: @ast::expr in args { args_opt_0 += [some::<@ast::expr>(arg)]; } @@ -1712,7 +1712,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, // A generic function for checking the then and else in an if // or if-check fn check_then_else(fcx: @fn_ctxt, thn: ast::blk, - elsopt: option::t<@ast::expr>, id: ast::node_id, + elsopt: option<@ast::expr>, id: ast::node_id, _sp: span) -> bool { let (if_t, if_bot) = alt elsopt { @@ -1737,7 +1737,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, ret if_bot; } - fn binop_method(op: ast::binop) -> option::t { + fn binop_method(op: ast::binop) -> option { alt op { ast::add | ast::subtract | ast::mul | ast::div | ast::rem | ast::bitxor | ast::bitand | ast::bitor | ast::lsl | ast::lsr | @@ -1747,7 +1747,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier, } fn lookup_op_method(fcx: @fn_ctxt, op_ex: @ast::expr, self_t: ty::t, opname: str, - args: [option::t<@ast::expr>]) -> option::t { + args: [option<@ast::expr>]) -> option { let isc = fcx.ccx.impl_map.get(op_ex.id); alt lookup_method(fcx, isc, opname, self_t, op_ex.span) { some({method_ty, n_tps: 0u, substs, origin}) { @@ -2329,7 +2329,7 @@ fn bind_params(fcx: @fn_ctxt, tp: ty::t, count: uint) {vars: vars, ty: ty::substitute_type_params(fcx.ccx.tcx, vars, tp)} } -fn get_self_info(ccx: @crate_ctxt) -> option::t { +fn get_self_info(ccx: @crate_ctxt) -> option { ret vec::last(ccx.self_infos); } @@ -2633,7 +2633,7 @@ fn check_fn(ccx: @crate_ctxt, decl: ast::fn_decl, body: ast::blk, id: ast::node_id, - old_fcx: option::t<@fn_ctxt>) { + old_fcx: option<@fn_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 { diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index f52afc0875c4..38986ea9d641 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -8,7 +8,7 @@ type spanned = {node: T, span: span}; type ident = str; // Functions may or may not have names. -type fn_ident = option::t; +type fn_ident = option; // FIXME: with typestate constraint, could say // idents and types are the same length, and are @@ -87,7 +87,7 @@ enum meta_item_ { type blk = spanned; -type blk_ = {view_items: [@view_item], stmts: [@stmt], expr: option::t<@expr>, +type blk_ = {view_items: [@view_item], stmts: [@stmt], expr: option<@expr>, id: node_id, rules: blk_check_mode}; type pat = {id: node_id, node: pat_, span: span}; @@ -106,7 +106,7 @@ enum pat_ { // After the resolution phase, code should never pattern- // match on a pat directly! Always call pat_util::normalize_pat -- // it turns any pat_idents that refer to nullary enums into pat_enums. - pat_ident(@path, option::t<@pat>), + pat_ident(@path, option<@pat>), pat_enum(@path, [@pat]), pat_rec([field_pat], bool), pat_tup([@pat]), @@ -180,7 +180,7 @@ enum init_op { init_assign, init_move, } type initializer = {op: init_op, expr: @expr}; type local_ = // FIXME: should really be a refinement on pat - {ty: @ty, pat: @pat, init: option::t, id: node_id}; + {ty: @ty, pat: @pat, init: option, id: node_id}; type local = spanned; @@ -190,7 +190,7 @@ enum let_style { let_copy, let_ref, } enum decl_ { decl_local([(let_style, @local)]), decl_item(@item), } -type arm = {pats: [@pat], guard: option::t<@expr>, body: blk}; +type arm = {pats: [@pat], guard: option<@expr>, body: blk}; type field_ = {mut: mutability, ident: ident, expr: @expr}; @@ -204,15 +204,15 @@ type expr = {id: node_id, node: expr_, span: span}; enum expr_ { expr_vec([@expr], mutability), - expr_rec([field], option::t<@expr>), + expr_rec([field], option<@expr>), expr_call(@expr, [@expr], bool), expr_tup([@expr]), - expr_bind(@expr, [option::t<@expr>]), + expr_bind(@expr, [option<@expr>]), expr_binary(binop, @expr, @expr), expr_unary(unop, @expr), expr_lit(@lit), expr_cast(@expr, @ty), - expr_if(@expr, blk, option::t<@expr>), + expr_if(@expr, blk, option<@expr>), expr_while(@expr, blk), expr_for(@local, @expr, blk), expr_do_while(blk, @expr), @@ -233,10 +233,10 @@ enum expr_ { expr_field(@expr, ident, [@ty]), expr_index(@expr, @expr), expr_path(@path), - expr_fail(option::t<@expr>), + expr_fail(option<@expr>), expr_break, expr_cont, - expr_ret(option::t<@expr>), + expr_ret(option<@expr>), expr_be(@expr), expr_log(int, @expr, @expr), @@ -248,7 +248,7 @@ enum expr_ { /* FIXME Would be nice if expr_check desugared to expr_if_check. */ - expr_if_check(@expr, blk, option::t<@expr>), + expr_if_check(@expr, blk, option<@expr>), expr_mac(mac), } @@ -274,7 +274,7 @@ enum blk_sort { type mac = spanned; enum mac_ { - mac_invoc(@path, @expr, option::t), + mac_invoc(@path, @expr, option), mac_embed_type(@ty), mac_embed_block(blk), mac_ellipsis, @@ -415,7 +415,7 @@ type native_mod = type variant_arg = {ty: @ty, id: node_id}; type variant_ = {name: ident, attrs: [attribute], args: [variant_arg], - id: node_id, disr_expr: option::t<@expr>}; + id: node_id, disr_expr: option<@expr>}; type variant = spanned; @@ -465,7 +465,7 @@ enum item_ { item_res(fn_decl /* dtor */, [ty_param], blk, node_id /* dtor id */, node_id /* ctor id */), item_iface([ty_param], [ty_method]), - item_impl([ty_param], option::t<@ty> /* iface */, + item_impl([ty_param], option<@ty> /* iface */, @ty /* self */, [@method]), } diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index baaa3022eb32..2e6be5d27d98 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -203,7 +203,7 @@ fn block_from_expr(e: @expr) -> blk { ret {node: blk_, span: e.span}; } -fn default_block(stmts1: [@stmt], expr1: option::t<@expr>, id1: node_id) -> +fn default_block(stmts1: [@stmt], expr1: option<@expr>, id1: node_id) -> blk_ { {view_items: [], stmts: stmts1, expr: expr1, id: id1, rules: default_blk} } @@ -364,7 +364,7 @@ pure fn is_unguarded(&&a: arm) -> bool { } } -pure fn unguarded_pat(a: arm) -> option::t<[@pat]> { +pure fn unguarded_pat(a: arm) -> option<[@pat]> { if is_unguarded(a) { some(a.pats) } else { none } } diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index 3c7d036d1f2d..0b893376bdbf 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -67,7 +67,7 @@ fn lookup_byte_pos(map: codemap, pos: uint) -> loc { enum opt_span { - //hack (as opposed to option::t), to make `span` compile + //hack (as opposed to option), to make `span` compile os_none, os_some(@span), } diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 50ff9932e7eb..bfe3e36c0bc4 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -6,10 +6,10 @@ import std::map::new_str_hash; import codemap; type syntax_expander = - fn@(ext_ctxt, span, @ast::expr, option::t) -> @ast::expr; + fn@(ext_ctxt, span, @ast::expr, option) -> @ast::expr; type macro_def = {ident: str, ext: syntax_extension}; type macro_definer = - fn@(ext_ctxt, span, @ast::expr, option::t) -> macro_def; + fn@(ext_ctxt, span, @ast::expr, option) -> macro_def; enum syntax_extension { normal(syntax_expander), diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs index c487a3ecc361..0a9d5b4cf3e4 100644 --- a/src/comp/syntax/ext/concat_idents.rs +++ b/src/comp/syntax/ext/concat_idents.rs @@ -3,7 +3,7 @@ import base::*; import syntax::ast; fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, - _body: option::t) -> @ast::expr { + _body: option) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _) { elts } diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index e5d80c3f314f..fe464473e031 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -10,7 +10,7 @@ import base::*; export expand_syntax_ext; fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, - _body: option::t) -> @ast::expr { + _body: option) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _) { elts } @@ -22,7 +22,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, cx.span_fatal(sp, "malformed #env call"); } // FIXME: if this was more thorough it would manufacture an - // option::t rather than just an maybe-empty string. + // option rather than just an maybe-empty string. let var = expr_to_str(cx, args[0], "#env requires a string"); alt generic_os::getenv(var) { diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 5b57923e3088..0dfe2cb17d0d 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -13,7 +13,7 @@ import codemap::span; export expand_syntax_ext; fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: @ast::expr, - _body: option::t) -> @ast::expr { + _body: option) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _) { elts } diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs index d6093b61dbfd..5fbc05062ee5 100644 --- a/src/comp/syntax/ext/ident_to_str.rs +++ b/src/comp/syntax/ext/ident_to_str.rs @@ -3,7 +3,7 @@ import base::*; import syntax::ast; fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, - _body: option::t) -> @ast::expr { + _body: option) -> @ast::expr { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _) { elts } diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs index 47a639b7ed0b..b7be75e349f8 100644 --- a/src/comp/syntax/ext/log_syntax.rs +++ b/src/comp/syntax/ext/log_syntax.rs @@ -3,7 +3,7 @@ import syntax::ast; import std::io::writer_util; fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, - _body: option::t) -> @ast::expr { + _body: option) -> @ast::expr { cx.print_backtrace(); std::io::stdout().write_line(print::pprust::expr_to_str(arg)); diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index b7fdfc469084..cc133e704e72 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -15,7 +15,7 @@ import ast::{ident, path, ty, blk_, expr, path_, expr_path, export add_new_extension; -fn path_to_ident(pth: @path) -> option::t { +fn path_to_ident(pth: @path) -> option { if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u { ret some(pth.node.idents[0u]); } @@ -71,11 +71,11 @@ fn match_error(cx: ext_ctxt, m: matchable, expected: str) -> ! { // If we want better match failure error messages (like in Fortifying Syntax), // we'll want to return something indicating amount of progress and location // of failure instead of `none`. -type match_result = option::t>; +type match_result = option>; type selector = fn@(matchable) -> match_result; fn elts_to_ell(cx: ext_ctxt, elts: [@expr]) -> - {pre: [@expr], rep: option::t<@expr>, post: [@expr]} { + {pre: [@expr], rep: option<@expr>, post: [@expr]} { let idx: uint = 0u; let res = none; for elt: @expr in elts { @@ -104,8 +104,8 @@ fn elts_to_ell(cx: ext_ctxt, elts: [@expr]) -> } } -fn option_flatten_map(f: fn@(T) -> option::t, v: [T]) -> - option::t<[U]> { +fn option_flatten_map(f: fn@(T) -> option, v: [T]) -> + option<[U]> { let res = []; for elem: T in v { alt f(elem) { none { ret none; } some(fv) { res += [fv]; } } @@ -165,7 +165,7 @@ fn pattern_to_selectors(cx: ext_ctxt, e: @expr) -> binders { bindings. Most of the work is done in p_t_s, which generates the selectors. */ -fn use_selectors_to_bind(b: binders, e: @expr) -> option::t { +fn use_selectors_to_bind(b: binders, e: @expr) -> option { let res = new_str_hash::>(); //need to do this first, to check vec lengths. for sel: selector in b.literal_ast_matchers { @@ -223,8 +223,8 @@ fn follow(m: arb_depth, idx_path: @mutable [uint]) -> ret res; } -fn follow_for_trans(cx: ext_ctxt, mmaybe: option::t>, - idx_path: @mutable [uint]) -> option::t { +fn follow_for_trans(cx: ext_ctxt, mmaybe: option>, + idx_path: @mutable [uint]) -> option { alt mmaybe { none { ret none } some(m) { @@ -269,7 +269,7 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint], alt repeat_me_maybe { none { } some(repeat_me) { - let repeat: option::t<{rep_count: uint, name: ident}> = none; + let repeat: option<{rep_count: uint, name: ident}> = none; /* we need to walk over all the free vars in lockstep, except for the leaves, which are just duplicated */ free_vars(b, repeat_me) {|fv| @@ -523,7 +523,7 @@ fn p_t_s_r_path(cx: ext_ctxt, p: @path, s: selector, b: binders) { } } -fn block_to_ident(blk: blk_) -> option::t { +fn block_to_ident(blk: blk_) -> option { if vec::len(blk.stmts) != 0u { ret none; } ret alt blk.expr { some(expr) { @@ -667,7 +667,7 @@ fn p_t_s_r_actual_vector(cx: ext_ctxt, elts: [@expr], _repeat_after: bool, } fn add_new_extension(cx: ext_ctxt, sp: span, arg: @expr, - _body: option::t) -> base::macro_def { + _body: option) -> base::macro_def { let args: [@ast::expr] = alt arg.node { ast::expr_vec(elts, _) { elts } @@ -677,7 +677,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: @expr, } }; - let macro_name: option::t = none; + let macro_name: option = none; let clauses: [@clause] = []; for arg: @expr in args { alt arg.node { @@ -751,7 +751,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: @expr, ext: normal(ext)}; fn generic_extension(cx: ext_ctxt, sp: span, arg: @expr, - _body: option::t, clauses: [@clause]) -> @expr { + _body: option, clauses: [@clause]) -> @expr { for c: @clause in clauses { alt use_selectors_to_bind(c.params, arg) { some(bindings) { ret transcribe(cx, bindings, c.body); } diff --git a/src/comp/syntax/parse/eval.rs b/src/comp/syntax/parse/eval.rs index 2530c794c94f..74d2259c51e5 100644 --- a/src/comp/syntax/parse/eval.rs +++ b/src/comp/syntax/parse/eval.rs @@ -25,7 +25,7 @@ fn eval_crate_directives(cx: ctx, cdirs: [@ast::crate_directive], prefix: str, } fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive], - prefix: str, suffix: option::t) + prefix: str, suffix: option) -> (ast::_mod, [ast::attribute]) { #debug("eval crate prefix: %s", prefix); #debug("eval crate suffix: %s", @@ -50,10 +50,10 @@ companion mod is a .rs file with the same name as the directory. We build the path to the companion mod by combining the prefix and the optional suffix then adding the .rs extension. */ -fn parse_companion_mod(cx: ctx, prefix: str, suffix: option::t) +fn parse_companion_mod(cx: ctx, prefix: str, suffix: option) -> ([@ast::view_item], [@ast::item], [ast::attribute]) { - fn companion_file(prefix: str, suffix: option::t) -> str { + fn companion_file(prefix: str, suffix: option) -> str { ret alt suffix { option::some(s) { fs::connect(prefix, s) } option::none { prefix } diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index ae31f1b3434e..03fc40171061 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -148,7 +148,7 @@ fn consume_block_comment(rdr: reader) { be consume_whitespace_and_comments(rdr); } -fn scan_exponent(rdr: reader) -> option::t { +fn scan_exponent(rdr: reader) -> option { let c = rdr.curr; let rslt = ""; if c == 'e' || c == 'E' { diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 95c37b9b8e9a..06f4e78372d0 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -542,7 +542,7 @@ fn parse_fn_block_arg(p: parser) -> ast::arg { ret {mode: m, ty: t, ident: i, id: p.get_id()}; } -fn parse_seq_to_before_gt(sep: option::t, +fn parse_seq_to_before_gt(sep: option, f: fn(parser) -> T, p: parser) -> [T] { let first = true; @@ -559,7 +559,7 @@ fn parse_seq_to_before_gt(sep: option::t, ret v; } -fn parse_seq_to_gt(sep: option::t, +fn parse_seq_to_gt(sep: option, f: fn(parser) -> T, p: parser) -> [T] { let v = parse_seq_to_before_gt(sep, f, p); expect_gt(p); @@ -567,7 +567,7 @@ fn parse_seq_to_gt(sep: option::t, ret v; } -fn parse_seq_lt_gt(sep: option::t, +fn parse_seq_lt_gt(sep: option, f: fn(parser) -> T, p: parser) -> spanned<[T]> { let lo = p.span.lo; @@ -586,7 +586,7 @@ fn parse_seq_to_end(ket: token::token, sep: seq_sep, } type seq_sep = { - sep: option::t, + sep: option, trailing_opt: bool // is trailing separator optional? }; @@ -845,7 +845,7 @@ fn parse_bottom_expr(p: parser) -> pexpr { ret pexpr(mk_mac_expr(p, lo, p.span.hi, ast::mac_ellipsis)); } else if eat_word(p, "bind") { let e = parse_expr_res(p, RESTRICT_NO_CALL_EXPRS); - fn parse_expr_opt(p: parser) -> option::t<@ast::expr> { + fn parse_expr_opt(p: parser) -> option<@ast::expr> { alt p.token { token::UNDERSCORE { p.bump(); ret none; } _ { ret some(parse_expr(p)); } @@ -1202,13 +1202,13 @@ fn parse_assign_expr(p: parser) -> @ast::expr { fn parse_if_expr_1(p: parser) -> {cond: @ast::expr, then: ast::blk, - els: option::t<@ast::expr>, + els: option<@ast::expr>, lo: uint, hi: uint} { let lo = p.last_span.lo; let cond = parse_expr(p); let thn = parse_block(p); - let els: option::t<@ast::expr> = none; + let els: option<@ast::expr> = none; let hi = thn.span.hi; if eat_word(p, "else") { let elexpr = parse_else_expr(p); @@ -1364,7 +1364,7 @@ fn parse_expr_res(p: parser, r: restriction) -> @ast::expr { ret e; } -fn parse_initializer(p: parser) -> option::t { +fn parse_initializer(p: parser) -> option { alt p.token { token::EQ { p.bump(); @@ -2143,7 +2143,7 @@ fn fn_expr_lookahead(tok: token::token) -> bool { } } -fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> { +fn parse_item(p: parser, attrs: [ast::attribute]) -> option<@ast::item> { if eat_word(p, "const") { ret some(parse_item_const(p, attrs)); } else if eat_word(p, "inline") { @@ -2178,7 +2178,7 @@ fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> { // A type to distingush between the parsing of item attributes or syntax // extensions, which both begin with token.POUND -type attr_or_ext = option::t>; +type attr_or_ext = option>; fn parse_outer_attrs_or_ext( p: parser, @@ -2292,7 +2292,7 @@ fn parse_use(p: parser) -> ast::view_item_ { } fn parse_rest_import_name(p: parser, first: ast::ident, - def_ident: option::t) -> + def_ident: option) -> ast::view_item_ { let identifiers: [ast::ident] = [first]; let glob: bool = false; diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index fbfa5f4f4336..938e86fc74e1 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -28,9 +28,9 @@ fn no_ann() -> pp_ann { type ps = @{s: pp::printer, - cm: option::t, - comments: option::t<[lexer::cmnt]>, - literals: option::t<[lexer::lit]>, + cm: option, + comments: option<[lexer::cmnt]>, + literals: option<[lexer::lit]>, mutable cur_cmnt: uint, mutable cur_lit: uint, mutable boxes: [pp::breaks], @@ -688,13 +688,13 @@ fn print_maybe_parens_discrim(s: ps, e: @ast::expr) { } fn print_if(s: ps, test: @ast::expr, blk: ast::blk, - elseopt: option::t<@ast::expr>, chk: bool) { + elseopt: option<@ast::expr>, chk: bool) { head(s, "if"); if chk { word_nbsp(s, "check"); } print_maybe_parens_discrim(s, test); space(s.s); print_block(s, blk); - fn do_else(s: ps, els: option::t<@ast::expr>) { + fn do_else(s: ps, els: option<@ast::expr>) { alt els { some(_else) { alt _else.node { @@ -809,7 +809,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) { } } ast::expr_bind(func, args) { - fn print_opt(s: ps, expr: option::t<@ast::expr>) { + fn print_opt(s: ps, expr: option<@ast::expr>) { alt expr { some(expr) { print_expr(s, expr); } _ { word(s.s, "_"); } @@ -1411,8 +1411,8 @@ fn print_mt(s: ps, mt: ast::mt) { } fn print_ty_fn(s: ps, opt_proto: option, - decl: ast::fn_decl, id: option::t, - tps: option::t<[ast::ty_param]>) { + decl: ast::fn_decl, id: option, + tps: option<[ast::ty_param]>) { ibox(s, indent_unit); word(s.s, opt_proto_to_str(opt_proto)); alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } } @@ -1442,7 +1442,7 @@ fn print_ty_fn(s: ps, opt_proto: option, } fn maybe_print_trailing_comment(s: ps, span: codemap::span, - next_pos: option::t) { + next_pos: option) { let cm; alt s.cm { some(ccm) { cm = ccm; } _ { ret; } } alt next_comment(s) { @@ -1512,7 +1512,7 @@ fn print_literal(s: ps, &&lit: @ast::lit) { fn lit_to_str(l: @ast::lit) -> str { be to_str(l, print_literal); } -fn next_lit(s: ps, pos: uint) -> option::t { +fn next_lit(s: ps, pos: uint) -> option { alt s.literals { some(lits) { while s.cur_lit < vec::len(lits) { @@ -1621,7 +1621,7 @@ fn to_str(t: T, f: fn@(ps, T)) -> str { io::mem_buffer_str(buffer) } -fn next_comment(s: ps) -> option::t { +fn next_comment(s: ps) -> option { alt s.comments { some(cmnts) { if s.cur_cmnt < vec::len(cmnts) { diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index 2ba0567c213f..de8b53af2c44 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -264,7 +264,7 @@ fn visit_decl(d: @decl, e: E, v: vt) { } } -fn visit_expr_opt(eo: option::t<@expr>, e: E, v: vt) { +fn visit_expr_opt(eo: option<@expr>, e: E, v: vt) { alt eo { none { } some(ex) { v.visit_expr(ex, e, v); } } } @@ -295,7 +295,7 @@ fn visit_expr(ex: @expr, e: E, v: vt) { } expr_bind(callee, args) { v.visit_expr(callee, e, v); - for eo: option::t<@expr> in args { visit_expr_opt(eo, e, v); } + for eo: option<@expr> in args { visit_expr_opt(eo, e, v); } } expr_binary(_, a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); } expr_unary(_, a) { v.visit_expr(a, e, v); } diff --git a/src/comp/util/filesearch.rs b/src/comp/util/filesearch.rs index 60df64a2a351..0e4c3671bf11 100644 --- a/src/comp/util/filesearch.rs +++ b/src/comp/util/filesearch.rs @@ -18,9 +18,9 @@ export relative_target_lib_path; export get_cargo_root; export libdir; -type pick = fn(path: fs::path) -> option::t; +type pick = fn(path: fs::path) -> option; -fn pick_file(file: fs::path, path: fs::path) -> option::t { +fn pick_file(file: fs::path, path: fs::path) -> option { if fs::basename(path) == file { option::some(path) } else { option::none } } @@ -32,7 +32,7 @@ iface filesearch { fn get_target_lib_file_path(file: fs::path) -> fs::path; } -fn mk_filesearch(maybe_sysroot: option::t, +fn mk_filesearch(maybe_sysroot: option, target_triple: str, addl_lib_search_paths: [fs::path]) -> filesearch { type filesearch_impl = {sysroot: fs::path, @@ -64,7 +64,7 @@ fn mk_filesearch(maybe_sysroot: option::t, } // FIXME #1001: This can't be an obj method -fn search(filesearch: filesearch, pick: pick) -> option::t { +fn search(filesearch: filesearch, pick: pick) -> option { for lib_search_path in filesearch.lib_search_paths() { #debug("searching %s", lib_search_path); for path in fs::list_dir(lib_search_path) { @@ -102,7 +102,7 @@ fn get_default_sysroot() -> fs::path { } } -fn get_sysroot(maybe_sysroot: option::t) -> fs::path { +fn get_sysroot(maybe_sysroot: option) -> fs::path { alt maybe_sysroot { option::some(sr) { sr } option::none { get_default_sysroot() } diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index 9b0be29ca26c..6d8af8e3846e 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -33,7 +33,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str { }; modestr + ty_to_str(cx, input.ty) } - fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option::t, + fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option, inputs: [arg], output: t, cf: ast::ret_style, constrs: [@constr]) -> str { let s = proto_to_str(proto); diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index bf56dea642b2..bb5e629ef624 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -24,9 +24,9 @@ type config = stage_id: str, mode: mode, run_ignored: bool, - filter: option::t, - runtool: option::t, - rustcflags: option::t, + filter: option, + runtool: option, + rustcflags: option, verbose: bool}; type cx = {config: config, procsrv: procsrv::handle}; diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index a86a94547f73..32f8762577f0 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -84,11 +84,11 @@ fn log_config(config: config) { logv(c, #fmt["\n"]); } -fn opt_str(maybestr: option::t) -> str { +fn opt_str(maybestr: option) -> str { alt maybestr { option::some(s) { s } option::none { "(none)" } } } -fn str_opt(maybestr: str) -> option::t { +fn str_opt(maybestr: str) -> option { if maybestr != "(none)" { option::some(maybestr) } else { option::none } } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 71968abdd6db..ec881caebbcf 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -14,10 +14,10 @@ type test_props = { // Lines that should be expected, in order, on standard out error_patterns: [str], // Extra flags to pass to the compiler - compile_flags: option::t, + compile_flags: option, // If present, the name of a file that this test should match when // pretty-printed - pp_exact: option::t + pp_exact: option }; // Load any test directives embedded in the file @@ -78,15 +78,15 @@ fn iter_header(testfile: str, it: fn(str)) { } } -fn parse_error_pattern(line: str) -> option::t { +fn parse_error_pattern(line: str) -> option { parse_name_value_directive(line, "error-pattern") } -fn parse_compile_flags(line: str) -> option::t { +fn parse_compile_flags(line: str) -> option { parse_name_value_directive(line, "compile-flags") } -fn parse_pp_exact(line: str, testfile: str) -> option::t { +fn parse_pp_exact(line: str, testfile: str) -> option { alt parse_name_value_directive(line, "pp-exact") { option::some(s) { option::some(s) } option::none { @@ -104,7 +104,7 @@ fn parse_name_directive(line: str, directive: str) -> bool { } fn parse_name_value_directive(line: str, - directive: str) -> option::t { + directive: str) -> option { let keycolon = directive + ":"; if str::find(line, keycolon) >= 0 { let colon = str::find(line, keycolon) as uint; diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 6f3fd87466a6..4d01d299548f 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -26,7 +26,7 @@ export reqchan; type reqchan = chan; type handle = - {task: option::t<(task::task, port)>, + {task: option<(task::task, port)>, chan: reqchan}; enum request { exec([u8], [u8], [[u8]], chan), stop, } @@ -54,7 +54,7 @@ fn close(handle: handle) { } fn run(handle: handle, lib_path: str, prog: str, args: [str], - input: option::t) -> {status: int, out: str, err: str} { + input: option) -> {status: int, out: str, err: str} { let p = port(); let ch = chan(p); send(handle.chan, @@ -69,7 +69,7 @@ fn run(handle: handle, lib_path: str, prog: str, args: [str], ret {status: status, out: output, err: errput}; } -fn writeclose(fd: fd_t, s: option::t) { +fn writeclose(fd: fd_t, s: option) { if option::is_some(s) { let writer = io::fd_writer(fd, false); writer.write_str(option::get(s)); diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index d3d02f08977c..a3920ccb1849 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -298,7 +298,7 @@ fn exec_compiled_test(cx: cx, props: test_props, testfile: str) -> procres { fn compose_and_run(cx: cx, testfile: str, make_args: fn@(config, str) -> procargs, lib_path: str, - input: option::t) -> procres { + input: option) -> procres { let procargs = make_args(cx.config, testfile); ret program_output(cx, testfile, lib_path, procargs.prog, procargs.args, input); @@ -334,9 +334,9 @@ fn make_run_args(config: config, _props: test_props, testfile: str) -> ret {prog: args[0], args: vec::slice(args, 1u, vec::len(args))}; } -fn split_maybe_args(argstr: option::t) -> [str] { +fn split_maybe_args(argstr: option) -> [str] { fn rm_whitespace(v: [str]) -> [str] { - fn flt(&&s: str) -> option::t { + fn flt(&&s: str) -> option { if !is_whitespace(s) { option::some(s) } else { option::none } } @@ -355,7 +355,7 @@ fn split_maybe_args(argstr: option::t) -> [str] { } fn program_output(cx: cx, testfile: str, lib_path: str, prog: str, - args: [str], input: option::t) -> procres { + args: [str], input: option) -> procres { let cmdline = { let cmdline = make_cmdline(lib_path, prog, args); diff --git a/src/libcore/core.rs b/src/libcore/core.rs index dc9a24785c3f..23ac02b75849 100644 --- a/src/libcore/core.rs +++ b/src/libcore/core.rs @@ -1,6 +1,6 @@ // Top-level, visible-everywhere definitions. -// Export type option as a synonym for option::t and export the some and none +// Export type option as a synonym for option and export the some and none // enum constructors. import option::{some, none}; diff --git a/src/libcore/task.rs b/src/libcore/task.rs index b56425159533..9bdc9fb006d4 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -122,7 +122,7 @@ fn spawn(+f: fn~()) -> task { } fn spawn_inner(-f: fn~(), - notify: option>) -> task unsafe { + notify: option::t>) -> task unsafe { let closure: *rust_closure = unsafe::reinterpret_cast(ptr::addr_of(f)); #debug("spawn: closure={%x,%x}", (*closure).fnptr, (*closure).envptr); let id = rustrt::new_task(); diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index b2154bc61b4b..53dccda3f15d 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -46,7 +46,7 @@ enum t { t({ base: *mutable T, len: uint, rsrc: @dtor_res}) } -resource dtor_res(dtor: option::t) { +resource dtor_res(dtor: option) { alt dtor { option::none { } option::some(f) { f(); } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 290b981306f6..e6c30f67302e 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -38,7 +38,7 @@ Function: create // FIXME eventually, a proper datatype plus an exported impl would be // preferrable fn create() -> t { - type cell = option::t; + type cell = option; let initial_capacity: uint = 32u; // 2^5 /** diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index b76ba4ad9b82..19cf97624ab5 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -50,7 +50,7 @@ fn doc_at(data: @[u8], start: uint) -> doc { ret {data: data, start: elt_size.next, end: end}; } -fn maybe_get_doc(d: doc, tg: uint) -> option::t { +fn maybe_get_doc(d: doc, tg: uint) -> option { let pos = d.start; while pos < d.end { let elt_tag = vint_at(*d.data, pos); diff --git a/src/libstd/freebsd_os.rs b/src/libstd/freebsd_os.rs index 89aad5d77778..77db136dc25c 100644 --- a/src/libstd/freebsd_os.rs +++ b/src/libstd/freebsd_os.rs @@ -127,7 +127,7 @@ fn dylib_filename(base: str) -> str { ret "lib" + base + ".so"; } /// Returns the directory containing the running program /// followed by a path separator -fn get_exe_path() -> option::t unsafe { +fn get_exe_path() -> option unsafe { let bufsize = 1023u; // FIXME: path "strings" will likely need fixing... let path = str::from_bytes(vec::init_elt(bufsize, 0u8)); diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 4a98bf5c6617..d497b2a4963b 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -13,7 +13,7 @@ of features. */ import option::{some, none}; -import option = option::t; +import option = option; export treemap; export init; diff --git a/src/libstd/generic_os.rs b/src/libstd/generic_os.rs index 934352e77884..f41e83fa5fbe 100644 --- a/src/libstd/generic_os.rs +++ b/src/libstd/generic_os.rs @@ -16,7 +16,7 @@ Function: getenv Get the value of an environment variable */ -fn getenv(n: str) -> option::t { } +fn getenv(n: str) -> option { } #[cfg(bogus)] /* @@ -29,7 +29,7 @@ fn setenv(n: str, v: str) { } #[cfg(target_os = "linux")] #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] -fn getenv(n: str) -> option::t unsafe { +fn getenv(n: str) -> option unsafe { let s = str::as_buf(n, {|buf| os::libc::getenv(buf) }); ret if unsafe::reinterpret_cast(s) == 0 { option::none:: @@ -55,7 +55,7 @@ fn setenv(n: str, v: str) { } #[cfg(target_os = "win32")] -fn getenv(n: str) -> option::t { +fn getenv(n: str) -> option { let nsize = 256u; while true { let v: [u8] = []; diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index b870dde34c6e..585ea48725f9 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -148,7 +148,7 @@ fn name_str(nm: name) -> str { ret alt nm { short(ch) { str::from_char(ch) } long(s) { s } }; } -fn find_opt(opts: [opt], nm: name) -> option::t { +fn find_opt(opts: [opt], nm: name) -> option { vec::position_pred(opts, { |opt| opt.name == nm }) } @@ -354,7 +354,7 @@ Function: opt_str Returns the string argument supplied to a matching option or none */ -fn opt_maybe_str(m: match, nm: str) -> option::t { +fn opt_maybe_str(m: match, nm: str) -> option { let vals = opt_vals(m, nm); if vec::len::(vals) == 0u { ret none::; } ret alt vals[0] { val(s) { some::(s) } _ { none:: } }; @@ -370,7 +370,7 @@ Returns none if the option was not present, `def` if the option was present but no argument was provided, and the argument if the option was present and an argument was provided. */ -fn opt_default(m: match, nm: str, def: str) -> option::t { +fn opt_default(m: match, nm: str, def: str) -> option { let vals = opt_vals(m, nm); if vec::len::(vals) == 0u { ret none::; } ret alt vals[0] { val(s) { some::(s) } _ { some::(def) } } diff --git a/src/libstd/io.rs b/src/libstd/io.rs index 5cc08813d6ab..ba8f1e62fc6f 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -525,13 +525,13 @@ mod fsync { type arg = { val: t, - opt_level: option::t, + opt_level: option, fsync_fn: fn@(t, level) -> int }; // fsync file after executing blk // FIXME find better way to create resources within lifetime of outer res - fn FILE_res_sync(&&file: FILE_res, opt_level: option::t, + fn FILE_res_sync(&&file: FILE_res, opt_level: option, blk: fn(&&res)) { blk(res({ val: *file, opt_level: opt_level, @@ -542,7 +542,7 @@ mod fsync { } // fsync fd after executing blk - fn fd_res_sync(&&fd: fd_res, opt_level: option::t, + fn fd_res_sync(&&fd: fd_res, opt_level: option, blk: fn(&&res)) { blk(res({ val: *fd, opt_level: opt_level, @@ -556,7 +556,7 @@ mod fsync { iface t { fn fsync(l: level) -> int; } // Call o.fsync after executing blk - fn obj_sync(&&o: t, opt_level: option::t, blk: fn(&&res)) { + fn obj_sync(&&o: t, opt_level: option, blk: fn(&&res)) { blk(res({ val: o, opt_level: opt_level, fsync_fn: fn@(&&o: t, l: level) -> int { ret o.fsync(l); } diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 0229b4d1b228..306bcf6e16a2 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -74,7 +74,7 @@ fn rest(s: str) -> str { str::char_slice(s, 1u, str::char_len(s)) } -fn from_str_str(s: str) -> (option::t, str) { +fn from_str_str(s: str) -> (option, str) { let pos = 0u; let len = str::byte_len(s); let escape = false; @@ -107,7 +107,7 @@ fn from_str_str(s: str) -> (option::t, str) { ret (none, s); } -fn from_str_list(s: str) -> (option::t, str) { +fn from_str_list(s: str) -> (option, str) { if str::char_at(s, 0u) != '[' { ret (none, s); } let s0 = str::trim_left(rest(s)); let vals = []; @@ -133,7 +133,7 @@ fn from_str_list(s: str) -> (option::t, str) { ret (none, s0); } -fn from_str_dict(s: str) -> (option::t, str) { +fn from_str_dict(s: str) -> (option, str) { if str::char_at(s, 0u) != '{' { ret (none, s); } let s0 = str::trim_left(rest(s)); let vals = map::new_str_hash::(); @@ -170,7 +170,7 @@ fn from_str_dict(s: str) -> (option::t, str) { (none, s) } -fn from_str_float(s: str) -> (option::t, str) { +fn from_str_float(s: str) -> (option, str) { let pos = 0u; let len = str::byte_len(s); let res = 0f; @@ -226,7 +226,7 @@ fn from_str_float(s: str) -> (option::t, str) { ret (some(num(neg * res)), str::char_slice(s, pos, str::char_len(s))); } -fn from_str_bool(s: str) -> (option::t, str) { +fn from_str_bool(s: str) -> (option, str) { if (str::starts_with(s, "true")) { (some(boolean(true)), str::slice(s, 4u, str::byte_len(s))) } else if (str::starts_with(s, "false")) { @@ -236,7 +236,7 @@ fn from_str_bool(s: str) -> (option::t, str) { } } -fn from_str_null(s: str) -> (option::t, str) { +fn from_str_null(s: str) -> (option, str) { if (str::starts_with(s, "null")) { (some(null), str::slice(s, 4u, str::byte_len(s))) } else { @@ -244,7 +244,7 @@ fn from_str_null(s: str) -> (option::t, str) { } } -fn from_str_helper(s: str) -> (option::t, str) { +fn from_str_helper(s: str) -> (option, str) { let s = str::trim_left(s); if str::is_empty(s) { ret (none, s); } let start = str::char_at(s, 0u); @@ -264,7 +264,7 @@ Function: from_str Deserializes a json value from a string. */ -fn from_str(s: str) -> option::t { +fn from_str(s: str) -> option { let (j, _) = from_str_helper(s); j } diff --git a/src/libstd/linux_os.rs b/src/libstd/linux_os.rs index 82b1197a51fb..378186c78509 100644 --- a/src/libstd/linux_os.rs +++ b/src/libstd/linux_os.rs @@ -123,7 +123,7 @@ fn dylib_filename(base: str) -> str { ret "lib" + base + ".so"; } /// Returns the directory containing the running program /// followed by a path separator -fn get_exe_path() -> option::t { +fn get_exe_path() -> option { let bufsize = 1023u; // FIXME: path "strings" will likely need fixing... let path = str::from_bytes(vec::init_elt(bufsize, 0u8)); diff --git a/src/libstd/list.rs b/src/libstd/list.rs index e393b42b9f25..be6ce7338a3f 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -61,8 +61,8 @@ Apply function `f` to each element of `v`, starting from the first. When function `f` returns true then an option containing the element is returned. If `f` matches no elements then none is returned. */ -fn find(ls: list, f: fn(T) -> option::t) - -> option::t { +fn find(ls: list, f: fn(T) -> option) + -> option { let ls = ls; while true { alt ls { @@ -259,7 +259,7 @@ mod tests { #[test] fn test_find_success() { - fn match(&&i: int) -> option::t { + fn match(&&i: int) -> option { ret if i == 2 { option::some(i) } else { option::none:: }; } let l = from_vec([0, 1, 2]); @@ -268,7 +268,7 @@ mod tests { #[test] fn test_find_fail() { - fn match(&&_i: int) -> option::t { ret option::none::; } + fn match(&&_i: int) -> option { ret option::none::; } let l = from_vec([0, 1, 2]); let empty = list::nil::; assert (list::find(l, match) == option::none::); diff --git a/src/libstd/macos_os.rs b/src/libstd/macos_os.rs index cd984870781c..eb2efddc35bc 100644 --- a/src/libstd/macos_os.rs +++ b/src/libstd/macos_os.rs @@ -131,7 +131,7 @@ fn target_os() -> str { ret "macos"; } fn dylib_filename(base: str) -> str { ret "lib" + base + ".dylib"; } -fn get_exe_path() -> option::t { +fn get_exe_path() -> option { // FIXME: This doesn't handle the case where the buffer is too small // FIXME: path "strings" will likely need fixing... let bufsize = 1023u32; diff --git a/src/libstd/map.rs b/src/libstd/map.rs index ed37318246b1..3f53270ed101 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -75,14 +75,14 @@ iface map { Get the value for the specified key. If the key does not exist in the map then returns none. */ - fn find(K) -> option::t; + fn find(K) -> option; /* Method: remove Remove and return a value from the map. If the key does not exist in the map then returns none. */ - fn remove(K) -> option::t; + fn remove(K) -> option; /* Method: items @@ -205,7 +205,7 @@ mod chained { } } - fn get(tbl: t, k: K) -> core::option::t { + fn get(tbl: t, k: K) -> core::option { alt search_tbl(tbl, k, tbl.hasher(k)) { not_found { ret core::option::none; @@ -221,7 +221,7 @@ mod chained { } } - fn remove(tbl: t, k: K) -> core::option::t { + fn remove(tbl: t, k: K) -> core::option { alt search_tbl(tbl, k, tbl.hasher(k)) { not_found { ret core::option::none; @@ -306,9 +306,9 @@ mod chained { fn get(k: K) -> V { option::get(get(self, k)) } - fn find(k: K) -> option::t { get(self, k) } + fn find(k: K) -> option { get(self, k) } - fn remove(k: K) -> option::t { remove(self, k) } + fn remove(k: K) -> option { remove(self, k) } fn items(blk: fn(K, V)) { items(self, blk); } diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index b181ba7475ca..28cdbfa3d405 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -481,7 +481,7 @@ mod iterator { node::content(x) { ret node::leaf_iterator::start(x) } } } - fn next(it: node::leaf_iterator::t) -> option::t { + fn next(it: node::leaf_iterator::t) -> option { ret node::leaf_iterator::next(it); } } @@ -492,7 +492,7 @@ mod iterator { node::content(x) { ret node::char_iterator::start(x) } } } - fn next(it: node::char_iterator::t) -> option::t { + fn next(it: node::char_iterator::t) -> option { ret node::char_iterator::next(it) } } @@ -952,7 +952,7 @@ mod node { - `option::some(x)` otherwise, in which case `x` has the same contents as `node` bot lower height and/or fragmentation. */ - fn bal(node: @node) -> option::t<@node> { + fn bal(node: @node) -> option<@node> { if height(node) < hint_max_node_height { ret option::none; } //1. Gather all leaves as a forest let forest = [mutable]; @@ -1230,7 +1230,7 @@ mod node { } } - fn next(it: t) -> option::t { + fn next(it: t) -> option { if it.stackpos < 0 { ret option::none; } while true { let current = it.stack[it.stackpos]; @@ -1254,7 +1254,7 @@ mod node { mod char_iterator { type t = { leaf_iterator: leaf_iterator::t, - mutable leaf: option::t, + mutable leaf: option, mutable leaf_byte_pos: uint }; @@ -1274,7 +1274,7 @@ mod node { } } - fn next(it: t) -> option::t { + fn next(it: t) -> option { while true { alt(get_current_or_next_leaf(it)) { option::none { ret option::none; } @@ -1294,7 +1294,7 @@ mod node { fail;//unreachable } - fn get_current_or_next_leaf(it: t) -> option::t { + fn get_current_or_next_leaf(it: t) -> option { alt(it.leaf) { option::some(_) { ret it.leaf } option::none { @@ -1311,7 +1311,7 @@ mod node { } } - fn get_next_char_in_leaf(it: t) -> option::t { + fn get_next_char_in_leaf(it: t) -> option { alt(it.leaf) { option::none { ret option::none } option::some(aleaf) { diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index dada53f355bc..d76e37e50714 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -12,7 +12,7 @@ import core::option::{some, none}; /* Type: smallintmap */ -type smallintmap = @{mutable v: [mutable option::t]}; +type smallintmap = @{mutable v: [mutable option]}; /* Function: mk @@ -20,7 +20,7 @@ Function: mk Create a smallintmap */ fn mk() -> smallintmap { - let v: [mutable option::t] = [mutable]; + let v: [mutable option] = [mutable]; ret @{mutable v: v}; } @@ -31,7 +31,7 @@ Add a value to the map. If the map already contains a value for the specified key then the original value is replaced. */ fn insert(m: smallintmap, key: uint, val: T) { - vec::grow_set::>(m.v, key, none::, some::(val)); + vec::grow_set::>(m.v, key, none::, some::(val)); } /* @@ -40,8 +40,8 @@ Function: find Get the value for the specified key. If the key does not exist in the map then returns none */ -fn find(m: smallintmap, key: uint) -> option::t { - if key < vec::len::>(m.v) { ret m.v[key]; } +fn find(m: smallintmap, key: uint) -> option { + if key < vec::len::>(m.v) { ret m.v[key]; } ret none::; } @@ -73,11 +73,11 @@ fn contains_key(m: smallintmap, key: uint) -> bool { // FIXME: Are these really useful? fn truncate(m: smallintmap, len: uint) { - m.v = vec::slice_mut::>(m.v, 0u, len); + m.v = vec::slice_mut::>(m.v, 0u, len); } fn max_key(m: smallintmap) -> uint { - ret vec::len::>(m.v); + ret vec::len::>(m.v); } /* @@ -98,7 +98,7 @@ impl of map::map for smallintmap { insert(self, key, value); ret !exists; } - fn remove(&&key: uint) -> option::t { + fn remove(&&key: uint) -> option { if key >= vec::len(self.v) { ret none; } let old = self.v[key]; self.v[key] = none; @@ -108,7 +108,7 @@ impl of map::map for smallintmap { contains_key(self, key) } fn get(&&key: uint) -> V { get(self, key) } - fn find(&&key: uint) -> option::t { find(self, key) } + fn find(&&key: uint) -> option { find(self, key) } fn rehash() { fail } fn items(it: fn(&&uint, V)) { let idx = 0u; diff --git a/src/libstd/tempfile.rs b/src/libstd/tempfile.rs index 197c1a71cb02..eaf1409da1d7 100644 --- a/src/libstd/tempfile.rs +++ b/src/libstd/tempfile.rs @@ -12,7 +12,7 @@ import rand; /* Function: mkdtemp */ -fn mkdtemp(prefix: str, suffix: str) -> option::t { +fn mkdtemp(prefix: str, suffix: str) -> option { let r = rand::mk_rng(); let i = 0u; while (i < 1000u) { diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 10b3545fc40d..072850a6a65f 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -56,7 +56,7 @@ fn test_main(args: [str], tests: [test_desc]) { if !run_tests_console(opts, tests) { fail "Some tests failed"; } } -type test_opts = {filter: option::t, run_ignored: bool}; +type test_opts = {filter: option, run_ignored: bool}; type opt_res = either::t; @@ -248,7 +248,7 @@ fn filter_tests(opts: test_opts, }; fn filter_fn(test: test_desc, filter_str: str) -> - option::t { + option { if str::find(test.name, filter_str) >= 0 { ret option::some(test); } else { ret option::none; } @@ -263,7 +263,7 @@ fn filter_tests(opts: test_opts, filtered = if !opts.run_ignored { filtered } else { - fn filter(test: test_desc) -> option::t { + fn filter(test: test_desc) -> option { if test.ignore { ret option::some({name: test.name, fn: test.fn, diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs index 1c711952e0b6..bcea14df3772 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -10,7 +10,7 @@ red-black tree or something else. */ import core::option::{some, none}; -import option = core::option::t; +import option = core::option; export treemap; export init; diff --git a/src/libstd/ufind.rs b/src/libstd/ufind.rs index 322e3bf40c27..eee4c836277a 100644 --- a/src/libstd/ufind.rs +++ b/src/libstd/ufind.rs @@ -6,7 +6,7 @@ import option::{some, none}; // A very naive implementation of union-find with unsigned integer nodes. // Maintains the invariant that the root of a node is always equal to or less // than the node itself. -type node = option::t; +type node = option; type ufind = {mutable nodes: [mutable node]}; diff --git a/src/libstd/win32_os.rs b/src/libstd/win32_os.rs index 83306c757a4d..0d874da458a9 100644 --- a/src/libstd/win32_os.rs +++ b/src/libstd/win32_os.rs @@ -111,7 +111,7 @@ fn waitpid(pid: pid_t) -> i32 { ret rustrt::rust_process_wait(pid); } fn getcwd() -> str { ret rustrt::rust_getcwd(); } -fn get_exe_path() -> option::t { +fn get_exe_path() -> option { // FIXME: This doesn't handle the case where the buffer is too small // FIXME: path "strings" will likely need fixing... let bufsize = 1023u; diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index 8be28fabd794..338a494ad160 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -12,7 +12,7 @@ use std; -import option = option::t; +import option = option; import option::some; import option::none; import str; diff --git a/src/test/bench/task-perf-word-count.rs b/src/test/bench/task-perf-word-count.rs index 357b062471e6..67b1505afd9c 100644 --- a/src/test/bench/task-perf-word-count.rs +++ b/src/test/bench/task-perf-word-count.rs @@ -10,7 +10,7 @@ use std; -import option = option::t; +import option = option; import option::{some, none}; import std::{map, io, time}; import io::reader_util; diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/compile-fail/pattern-tyvar-2.rs index 4e7087268644..6ebc4a276267 100644 --- a/src/test/compile-fail/pattern-tyvar-2.rs +++ b/src/test/compile-fail/pattern-tyvar-2.rs @@ -6,7 +6,7 @@ import option::some; // error-pattern: mismatched types -enum bar { t1((), option::t<[int]>), t2, } +enum bar { t1((), option<[int]>), t2, } fn foo(t: bar) -> int { alt t { t1(_, some(x)) { ret x * 3; } _ { fail; } } } diff --git a/src/test/compile-fail/pattern-tyvar.rs b/src/test/compile-fail/pattern-tyvar.rs index 05028b7a3edf..607e32685f32 100644 --- a/src/test/compile-fail/pattern-tyvar.rs +++ b/src/test/compile-fail/pattern-tyvar.rs @@ -5,7 +5,7 @@ import option::some; // error-pattern: mismatched types -enum bar { t1((), option::t<[int]>), t2, } +enum bar { t1((), option<[int]>), t2, } fn foo(t: bar) { alt t { diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index 0c0ea02164cf..e429db659ab1 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -1,6 +1,6 @@ // -*- rust -*- // xfail-test -// error-pattern:option::t +// error-pattern:option use std; import vec::*; diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index 01b850dabeb9..0679022d37a9 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -7,9 +7,9 @@ import option::none; enum sty { ty_nil, } -type raw_t = {struct: sty, cname: option::t, hash: uint}; +type raw_t = {struct: sty, cname: option, hash: uint}; -fn mk_raw_ty(st: sty, cname: option::t) -> raw_t { +fn mk_raw_ty(st: sty, cname: option) -> raw_t { ret {struct: st, cname: cname, hash: 0u}; } diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs index 687cf30f97fe..77b52da4acfc 100644 --- a/src/test/run-pass/alt-join.rs +++ b/src/test/run-pass/alt-join.rs @@ -1,11 +1,8 @@ use std; import option; -import option::t; -import option::none; -import option::some; -fn foo(y: option::t) { +fn foo(y: option) { let x: int; let rs: [int] = []; /* tests that x doesn't get put in the precondition for the diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 9301d93874eb..eeed3d32800a 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -6,7 +6,7 @@ use std; -import option = option::t; +import option = option; import option::some; import option::none; import str; diff --git a/src/test/run-pass/issue-511.rs b/src/test/run-pass/issue-511.rs index 36b2e65897ee..34e8a8e47b92 100644 --- a/src/test/run-pass/issue-511.rs +++ b/src/test/run-pass/issue-511.rs @@ -1,7 +1,7 @@ use std; import option; -fn f(&o: option::t) { +fn f(&o: option) { assert o == option::none; } diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index 2bd5e9ff3303..6eda8f11489c 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -6,7 +6,7 @@ import option; import option::some; import option::none; -enum t { foo(int, uint), bar(int, option::t), } +enum t { foo(int, uint), bar(int, option), } fn nested(o: t) { alt o { diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index 9777de4b1460..65b793564ad8 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -9,7 +9,7 @@ import option; enum opt_span { - //hack (as opposed to option::t), to make `span` compile + //hack (as opposed to option), to make `span` compile os_none, os_some(@span), }