1
Fork 0

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).
This commit is contained in:
Tim Chevalier 2012-01-31 17:05:20 -08:00
parent 1f795ff3b0
commit e5d095d67e
80 changed files with 362 additions and 365 deletions

View file

@ -32,16 +32,16 @@ type package = {
url: str, url: str,
method: str, method: str,
description: str, description: str,
ref: option::t<str>, ref: option<str>,
tags: [str] tags: [str]
}; };
type source = { type source = {
name: str, name: str,
url: str, url: str,
sig: option::t<str>, sig: option<str>,
key: option::t<str>, key: option<str>,
keyfp: option::t<str>, keyfp: option<str>,
mutable packages: [package] mutable packages: [package]
}; };
@ -60,9 +60,9 @@ type pkg = {
name: str, name: str,
vers: str, vers: str,
uuid: str, uuid: str,
desc: option::t<str>, desc: option<str>,
sigs: option::t<str>, sigs: option<str>,
crate_type: option::t<str> crate_type: option<str>
}; };
fn info(msg: str) { fn info(msg: str) {
@ -77,9 +77,9 @@ fn error(msg: str) {
io::stdout().write_line("error: " + msg); io::stdout().write_line("error: " + msg);
} }
fn load_link(mis: [@ast::meta_item]) -> (option::t<str>, fn load_link(mis: [@ast::meta_item]) -> (option<str>,
option::t<str>, option<str>,
option::t<str>) { option<str>) {
let name = none; let name = none;
let vers = none; let vers = none;
let uuid = none; let uuid = none;
@ -99,7 +99,7 @@ fn load_link(mis: [@ast::meta_item]) -> (option::t<str>,
(name, vers, uuid) (name, vers, uuid)
} }
fn load_pkg(filename: str) -> option::t<pkg> { fn load_pkg(filename: str) -> option<pkg> {
let cm = codemap::new_codemap(); let cm = codemap::new_codemap();
let handler = diagnostic::mk_handler(none); let handler = diagnostic::mk_handler(none);
let sess = @{ 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<str>) { fn install_git(c: cargo, wd: str, url: str, ref: option<str>) {
run::run_program("git", ["clone", url, wd]); run::run_program("git", ["clone", url, wd]);
if option::is_some::<str>(ref) { if option::is_some::<str>(ref) {
let r = option::get::<str>(ref); let r = option::get::<str>(ref);

View file

@ -38,7 +38,7 @@ fn llvm_err(sess: session, msg: str) unsafe {
} else { sess.fatal(msg + ": " + str::from_cstr(buf)); } } else { sess.fatal(msg + ": " + str::from_cstr(buf)); }
} }
fn load_intrinsics_bc(sess: session) -> option::t<ModuleRef> { fn load_intrinsics_bc(sess: session) -> option<ModuleRef> {
let path = alt filesearch::search( let path = alt filesearch::search(
sess.filesearch, sess.filesearch,
bind filesearch::pick_file("intrinsics.bc", _)) { 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 { sha: sha1) -> link_meta {
type provided_metas = type provided_metas =
{name: option::t<str>, {name: option<str>,
vers: option::t<str>, vers: option<str>,
cmh_items: [@ast::meta_item]}; cmh_items: [@ast::meta_item]};
fn provided_link_metas(sess: session, c: ast::crate) -> fn provided_link_metas(sess: session, c: ast::crate) ->
provided_metas { provided_metas {
let name: option::t<str> = none; let name: option<str> = none;
let vers: option::t<str> = none; let vers: option<str> = none;
let cmh_items: [@ast::meta_item] = []; let cmh_items: [@ast::meta_item] = [];
let linkage_metas = attr::find_linkage_metas(c.node.attrs); let linkage_metas = attr::find_linkage_metas(c.node.attrs);
attr::require_unique_names(sess, linkage_metas); attr::require_unique_names(sess, linkage_metas);

View file

@ -105,8 +105,8 @@ enum compile_upto {
fn compile_upto(sess: session, cfg: ast::crate_cfg, fn compile_upto(sess: session, cfg: ast::crate_cfg,
input: str, upto: compile_upto, input: str, upto: compile_upto,
outputs: option::t<output_filenames>) outputs: option<output_filenames>)
-> {crate: @ast::crate, tcx: option::t<ty::ctxt>} { -> {crate: @ast::crate, tcx: option<ty::ctxt>} {
let time_passes = sess.opts.time_passes; let time_passes = sess.opts.time_passes;
let crate = time(time_passes, "parsing", let crate = time(time_passes, "parsing",
bind parse_input(sess, cfg, input)); 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, fn compile_input(sess: session, cfg: ast::crate_cfg, input: str,
outdir: option::t<str>, output: option::t<str>) { outdir: option<str>, output: option<str>) {
let upto = if sess.opts.parse_only { cu_parse } let upto = if sess.opts.parse_only { cu_parse }
else if sess.opts.no_trans { cu_no_trans } 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}; type output_filenames = @{out_filename: str, obj_filename:str};
fn build_output_filenames(ifile: str, fn build_output_filenames(ifile: str,
odir: option::t<str>, odir: option<str>,
ofile: option::t<str>, ofile: option<str>,
sess: session) sess: session)
-> output_filenames { -> output_filenames {
let obj_path = ""; let obj_path = "";

View file

@ -40,7 +40,7 @@ type options =
time_llvm_passes: bool, time_llvm_passes: bool,
output_type: back::link::output_type, output_type: back::link::output_type,
addl_lib_search_paths: [str], addl_lib_search_paths: [str],
maybe_sysroot: option::t<str>, maybe_sysroot: option<str>,
target_triple: str, target_triple: str,
cfg: ast::crate_cfg, cfg: ast::crate_cfg,
test: bool, test: bool,
@ -58,7 +58,7 @@ type session = @{targ_cfg: @config,
parse_sess: parse_sess, parse_sess: parse_sess,
codemap: codemap::codemap, codemap: codemap::codemap,
// For a library crate, this is always none // 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, span_diagnostic: diagnostic::span_handler,
filesearch: filesearch::filesearch, filesearch: filesearch::filesearch,
mutable building_library: bool, mutable building_library: bool,

View file

@ -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) -> fn find_attrs_by_name(attrs: [ast::attribute], name: ast::ident) ->
[ast::attribute] { [ast::attribute] {
let filter = ( let filter = (
fn@(a: ast::attribute) -> option::t<ast::attribute> { fn@(a: ast::attribute) -> option<ast::attribute> {
if get_attr_name(a) == name { if get_attr_name(a) == name {
option::some(a) option::some(a)
} else { option::none } } 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) -> fn find_meta_items_by_name(metas: [@ast::meta_item], name: ast::ident) ->
[@ast::meta_item] { [@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 { if get_meta_item_name(m) == name {
option::some(m) option::some(m)
} else { option::none } } 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 // Gets the string value if the meta_item is a meta_name_value variant
// containing a string, otherwise none // containing a string, otherwise none
fn get_meta_item_value_str(meta: @ast::meta_item) -> option::t<str> { fn get_meta_item_value_str(meta: @ast::meta_item) -> option<str> {
alt meta.node { alt meta.node {
ast::meta_name_value(_, v) { ast::meta_name_value(_, v) {
alt v.node { ast::lit_str(s) { option::some(s) } _ { option::none } } 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<str> {
} }
fn get_meta_item_value_str_by_name(attrs: [ast::attribute], name: ast::ident) fn get_meta_item_value_str_by_name(attrs: [ast::attribute], name: ast::ident)
-> option::t<str> { -> option<str> {
let mattrs = find_attrs_by_name(attrs, name); let mattrs = find_attrs_by_name(attrs, name);
if vec::len(mattrs) > 0u { if vec::len(mattrs) > 0u {
ret get_meta_item_value_str(attr_meta(mattrs[0])); 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; 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 { alt meta.node {
ast::meta_list(_, l) { option::some(l) } ast::meta_list(_, l) { option::some(l) }
_ { option::none } _ { 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) -> fn remove_meta_items_by_name(items: [@ast::meta_item], name: str) ->
[@ast::meta_item] { [@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 { if get_meta_item_name(item) != name {
option::some(item) option::some(item)
} else { option::none } } else { option::none }

View file

@ -37,7 +37,7 @@ fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
} }
fn filter_item(cx: ctxt, &&item: @ast::item) -> 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 } 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) -> 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) { if native_item_in_cfg(cx, item) {
option::some(item) option::some(item)
} else { option::none } } 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) -> fn filter_stmt(cx: ctxt, &&stmt: @ast::stmt) ->
option::t<@ast::stmt> { option<@ast::stmt> {
alt stmt.node { alt stmt.node {
ast::stmt_decl(decl, _) { ast::stmt_decl(decl, _) {
alt decl.node { alt decl.node {

View file

@ -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 // 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 // have some mechanism to indicate to the translation pass which function
// we want to be main. // 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 { alt item.node {
ast::item_fn(_, _, _) { ast::item_fn(_, _, _) {
if item.ident == "main" { if item.ident == "main" {

View file

@ -917,11 +917,11 @@ fn associate_type(tn: type_names, s: str, t: TypeRef) {
assert tn.named_types.insert(s, t); assert tn.named_types.insert(s, t);
} }
fn type_has_name(tn: type_names, t: TypeRef) -> option::t<str> { fn type_has_name(tn: type_names, t: TypeRef) -> option<str> {
ret tn.type_names.find(t); ret tn.type_names.find(t);
} }
fn name_has_type(tn: type_names, s: str) -> option::t<TypeRef> { fn name_has_type(tn: type_names, s: str) -> option<TypeRef> {
ret tn.named_types.find(s); 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}; type object_file = {llof: ObjectFileRef, dtor: @object_file_res};
fn mk_object_file(llmb: MemoryBufferRef) -> option::t<object_file> { fn mk_object_file(llmb: MemoryBufferRef) -> option<object_file> {
let llof = llvm::LLVMCreateObjectFile(llmb); let llof = llvm::LLVMCreateObjectFile(llmb);
if llof as int == 0 { ret option::none::<object_file>; } if llof as int == 0 { ret option::none::<object_file>; }
ret option::some({llof: llof, dtor: @object_file_res(llof)}); ret option::some({llof: llof, dtor: @object_file_res(llof)});

View file

@ -137,7 +137,7 @@ fn default_native_lib_naming(sess: session::session, static: bool) ->
fn find_library_crate(sess: session::session, ident: ast::ident, fn find_library_crate(sess: session::session, ident: ast::ident,
metas: [@ast::meta_item]) metas: [@ast::meta_item])
-> option::t<{ident: str, data: @[u8]}> { -> option<{ident: str, data: @[u8]}> {
attr::require_unique_names(sess, metas); attr::require_unique_names(sess, metas);
let metas = metas; let metas = metas;
@ -173,7 +173,7 @@ fn find_library_crate_aux(sess: session::session,
crate_name: str, crate_name: str,
metas: [@ast::meta_item], metas: [@ast::meta_item],
filesearch: filesearch::filesearch) -> filesearch: filesearch::filesearch) ->
option::t<{ident: str, data: @[u8]}> { option<{ident: str, data: @[u8]}> {
let prefix: str = nn.prefix + crate_name + "-"; let prefix: str = nn.prefix + crate_name + "-";
let suffix: str = nn.suffix; let suffix: str = nn.suffix;
@ -206,7 +206,7 @@ fn find_library_crate_aux(sess: session::session,
} }
fn get_metadata_section(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| let mb = str::as_buf(filename, {|buf|
llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf) llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf)
}); });

View file

@ -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, fn get_impls_for_mod(cstore: cstore::cstore, def: ast::def_id,
name: option::t<ast::ident>) name: option<ast::ident>)
-> @[@middle::resolve::_impl] { -> @[@middle::resolve::_impl] {
let cdata = cstore::get_crate_data(cstore, def.crate); let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_impls_for_mod(cdata, def.node, name) 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) fn get_impl_iface(tcx: ty::ctxt, def: ast::def_id)
-> option::t<ty::t> { -> option<ty::t> {
let cstore = tcx.sess.cstore; let cstore = tcx.sess.cstore;
let cdata = cstore::get_crate_data(cstore, def.crate); let cdata = cstore::get_crate_data(cstore, def.crate);
decoder::get_impl_iface(cdata, def.node, tcx) decoder::get_impl_iface(cdata, def.node, tcx)

View file

@ -55,7 +55,7 @@ fn lookup_hash(d: ebml::doc, eq_fn: fn@([u8]) -> bool, hash: uint) ->
ret result; ret result;
} }
fn maybe_find_item(item_id: int, items: ebml::doc) -> option::t<ebml::doc> { fn maybe_find_item(item_id: int, items: ebml::doc) -> option<ebml::doc> {
fn eq_item(bytes: [u8], item_id: int) -> bool { fn eq_item(bytes: [u8], item_id: int) -> bool {
ret ebml::be_uint_from_bytes(@bytes, 0u, 4u) as int == item_id; 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)); ret parse_def_id(ebml::doc_data(tagdoc));
} }
fn variant_disr_val(d: ebml::doc) -> option::t<int> { fn variant_disr_val(d: ebml::doc) -> option<int> {
alt ebml::maybe_get_doc(d, tag_disr_val) { alt ebml::maybe_get_doc(d, tag_disr_val) {
some(val_doc) { some(val_doc) {
let val_buf = ebml::doc_data(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) fn item_impl_iface(item: ebml::doc, tcx: ty::ctxt, cdata: cmd)
-> option::t<ty::t> { -> option<ty::t> {
let result = none; let result = none;
ebml::tagged_docs(item, tag_impl_iface) {|ity| ebml::tagged_docs(item, tag_impl_iface) {|ity|
let t = parse_ty_data(ity.data, cdata.cnum, ity.start, tcx, {|did| 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) fn get_impl_iface(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
-> option::t<ty::t> { -> option<ty::t> {
item_impl_iface(lookup_item(id, cdata.data), tcx, cdata) 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, fn get_impls_for_mod(cdata: cmd, m_id: ast::node_id,
name: option::t<ast::ident>) name: option<ast::ident>)
-> @[@middle::resolve::_impl] { -> @[@middle::resolve::_impl] {
let data = cdata.data; let data = cdata.data;
let mod_item = lookup_item(m_id, data), result = []; let mod_item = lookup_item(m_id, data), result = [];

View file

@ -27,7 +27,7 @@ enum unsafe_ty { contains(ty::t), mut_contains(ty::t), }
type binding = @{node_id: node_id, type binding = @{node_id: node_id,
span: span, span: span,
root_var: option::t<node_id>, root_var: option<node_id>,
local_id: uint, local_id: uint,
unsafe_tys: [unsafe_ty], unsafe_tys: [unsafe_ty],
mutable copied: copied}; mutable copied: copied};
@ -36,7 +36,7 @@ type binding = @{node_id: node_id,
type scope = {bs: [binding], type scope = {bs: [binding],
invalid: @mutable list<@invalid>}; invalid: @mutable list<@invalid>};
fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option::t<node_id>, fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option<node_id>,
unsafe_tys: [unsafe_ty]) -> binding { unsafe_tys: [unsafe_ty]) -> binding {
alt root_var { alt root_var {
some(r_id) { cx.ref_map.insert(id, r_id); } 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); 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<scope>) { sc: scope, v: vt<scope>) {
v.visit_expr(c, sc, v); v.visit_expr(c, sc, v);
let orig_invalid = *sc.invalid; 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<ast::def> { fn path_def(cx: ctx, ex: @ast::expr) -> option<ast::def> {
ret alt ex.node { ret alt ex.node {
ast::expr_path(_) { some(cx.tcx.def_map.get(ex.id)) } ast::expr_path(_) { some(cx.tcx.def_map.get(ex.id)) }
_ { none } _ { none }
} }
} }
fn path_def_id(cx: ctx, ex: @ast::expr) -> option::t<ast::node_id> { fn path_def_id(cx: ctx, ex: @ast::expr) -> option<ast::node_id> {
alt ex.node { alt ex.node {
ast::expr_path(_) { ast::expr_path(_) {
ret some(ast_util::def_id_of_def(cx.tcx.def_map.get(ex.id)).node); 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, type pattern_root = {id: node_id,
name: ident, name: ident,
mut: option::t<unsafe_ty>, mut: option<unsafe_ty>,
span: span}; span: span};
fn pattern_roots(tcx: ty::ctxt, mut: option::t<unsafe_ty>, pat: @ast::pat) fn pattern_roots(tcx: ty::ctxt, mut: option<unsafe_ty>, pat: @ast::pat)
-> [pattern_root] { -> [pattern_root] {
fn walk(tcx: ty::ctxt, mut: option::t<unsafe_ty>, pat: @ast::pat, fn walk(tcx: ty::ctxt, mut: option<unsafe_ty>, pat: @ast::pat,
&set: [pattern_root]) { &set: [pattern_root]) {
alt normalize_pat(tcx, pat).node { alt normalize_pat(tcx, pat).node {
ast::pat_wild | ast::pat_lit(_) | ast::pat_range(_, _) {} ast::pat_wild | ast::pat_lit(_) | ast::pat_range(_, _) {}
@ -642,7 +642,7 @@ fn pattern_roots(tcx: ty::ctxt, mut: option::t<unsafe_ty>, pat: @ast::pat)
// Wraps the expr_root in mut.rs to also handle roots that exist through // Wraps the expr_root in mut.rs to also handle roots that exist through
// return-by-reference // return-by-reference
fn expr_root(cx: ctx, ex: @ast::expr, autoderef: bool) fn expr_root(cx: ctx, ex: @ast::expr, autoderef: bool)
-> {ex: @ast::expr, mut: option::t<unsafe_ty>} { -> {ex: @ast::expr, mut: option<unsafe_ty>} {
let base_root = mut::expr_root(cx.tcx, ex, autoderef); let base_root = mut::expr_root(cx.tcx, ex, autoderef);
let unsafe_ty = none; let unsafe_ty = none;
for d in *base_root.ds { 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}; ret {ex: base_root.ex, mut: unsafe_ty};
} }
fn unsafe_set(from: option::t<unsafe_ty>) -> [unsafe_ty] { fn unsafe_set(from: option<unsafe_ty>) -> [unsafe_ty] {
alt from { some(t) { [t] } _ { [] } } alt from { some(t) { [t] } _ { [] } }
} }
fn find_invalid(id: node_id, lst: list<@invalid>) fn find_invalid(id: node_id, lst: list<@invalid>)
-> option::t<@invalid> { -> option<@invalid> {
let cur = lst; let cur = lst;
while true { while true {
alt cur { alt cur {

View file

@ -143,7 +143,7 @@ fn md_from_metadata<T>(val: debug_metadata) -> T unsafe {
} }
fn cached_metadata<T: copy>(cache: metadata_cache, mdtag: int, fn cached_metadata<T: copy>(cache: metadata_cache, mdtag: int,
eq: fn(md: T) -> bool) -> option::t<T> unsafe { eq: fn(md: T) -> bool) -> option<T> unsafe {
if cache.contains_key(mdtag) { if cache.contains_key(mdtag) {
let items = cache.get(mdtag); let items = cache.get(mdtag);
for item in items { 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, fn create_composite_type(type_tag: int, name: str, file: ValueRef, line: int,
size: int, align: int, offset: int, size: int, align: int, offset: int,
derived: option::t<ValueRef>, derived: option<ValueRef>,
members: option::t<[ValueRef]>) members: option<[ValueRef]>)
-> ValueRef { -> ValueRef {
let lldata = [lltag(type_tag), let lldata = [lltag(type_tag),
file, file,

View file

@ -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<ctx>, to: bool) fn clear_if_path(cx: ctx, ex: @expr, v: visit::vt<ctx>, to: bool)
-> option::t<node_id> { -> option<node_id> {
alt ex.node { alt ex.node {
expr_path(_) { expr_path(_) {
ret clear_def_if_path(cx, cx.def_map.get(ex.id), to); ret clear_def_if_path(cx, cx.def_map.get(ex.id), to);

View file

@ -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 arg_ts = ty::ty_fn_args(cx.tcx, ty::expr_ty(cx.tcx, f));
let i = 0u; let i = 0u;
for arg in args { 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<str> { fn is_immutable_def(cx: @ctx, def: def) -> option<str> {
alt def { alt def {
def_fn(_, _) | def_mod(_) | def_native_mod(_) | def_const(_) | def_fn(_, _) | def_mod(_) | def_native_mod(_) | def_const(_) |
def_use(_) { def_use(_) {

View file

@ -48,9 +48,9 @@ enum import_state {
todo(ast::node_id, ast::ident, @[ast::ident], span, scopes), todo(ast::node_id, ast::ident, @[ast::ident], span, scopes),
is_glob(@[ast::ident], scopes, span), is_glob(@[ast::ident], scopes, span),
resolving(span), resolving(span),
resolved(option::t<def>, /* value */ resolved(option<def>, /* value */
option::t<def>, /* type */ option<def>, /* type */
option::t<def>, /* module */ option<def>, /* module */
@[@_impl], /* impls */ @[@_impl], /* impls */
/* used for reporting unused import warning */ /* used for reporting unused import warning */
ast::ident, span), ast::ident, span),
@ -58,9 +58,9 @@ enum import_state {
enum glob_import_state { enum glob_import_state {
glob_resolving(span), glob_resolving(span),
glob_resolved(option::t<def>, /* value */ glob_resolved(option<def>, /* value */
option::t<def>, /* type */ option<def>, /* type */
option::t<def>), /* module */ option<def>), /* module */
} }
type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>; type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>;
@ -98,7 +98,7 @@ type mod_index = hashmap<ident, list<mod_index_entry>>;
type glob_imp_def = {def: def, item: @ast::view_item}; type glob_imp_def = {def: def, item: @ast::view_item};
type indexed_mod = { type indexed_mod = {
m: option::t<ast::_mod>, m: option<ast::_mod>,
index: mod_index, index: mod_index,
mutable glob_imports: [glob_imp_def], mutable glob_imports: [glob_imp_def],
glob_imported_names: hashmap<str, glob_import_state>, glob_imported_names: hashmap<str, glob_import_state>,
@ -113,7 +113,7 @@ type def_map = hashmap<node_id, def>;
type ext_map = hashmap<def_id, [ident]>; type ext_map = hashmap<def_id, [ident]>;
type exp_map = hashmap<str, @mutable [def]>; type exp_map = hashmap<str, @mutable [def]>;
type impl_map = hashmap<node_id, iscopes>; type impl_map = hashmap<node_id, iscopes>;
type impl_cache = hashmap<def_id, option::t<@[@_impl]>>; type impl_cache = hashmap<def_id, option<@[@_impl]>>;
type env = type env =
{cstore: cstore::cstore, {cstore: cstore::cstore,
@ -131,7 +131,7 @@ type env =
mutable data: [ast::node_id]}, mutable data: [ast::node_id]},
mutable reported: [{ident: str, sc: scope}], mutable reported: [{ident: str, sc: scope}],
mutable ignored_imports: [node_id], mutable ignored_imports: [node_id],
mutable current_tp: option::t<uint>, mutable current_tp: option<uint>,
mutable resolve_unexported: bool, mutable resolve_unexported: bool,
sess: session}; 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); maybe_insert(e, cap_item.id, dcur);
} }
fn maybe_insert(e: @env, id: node_id, def: option::t<def>) { fn maybe_insert(e: @env, id: node_id, def: option<def>) {
if option::is_some(def) { e.def_map.insert(id, option::get(def)); } 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<scopes>) {
fn follow_import(e: env, sc: scopes, path: [ident], sp: span) -> fn follow_import(e: env, sc: scopes, path: [ident], sp: span) ->
option::t<def> { option<def> {
let path_len = vec::len(path); let path_len = vec::len(path);
let dcur = lookup_in_scope_strict(e, sc, sp, path[0], ns_module); let dcur = lookup_in_scope_strict(e, sc, sp, path[0], ns_module);
let i = 1u; let i = 1u;
@ -623,7 +623,7 @@ fn resolve_constr(e: @env, c: @ast::constr, sc: scopes, _v: vt<scopes>) {
fn resolve_import(e: env, defid: ast::def_id, name: ast::ident, fn resolve_import(e: env, defid: ast::def_id, name: ast::ident,
ids: [ast::ident], sp: codemap::span, sc: scopes) { ids: [ast::ident], sp: codemap::span, sc: scopes) {
fn register(e: env, id: node_id, cx: ctxt, sp: codemap::span, fn register(e: env, id: node_id, cx: ctxt, sp: codemap::span,
name: ast::ident, lookup: fn(namespace) -> option::t<def>, name: ast::ident, lookup: fn(namespace) -> option<def>,
impls: [@_impl]) { impls: [@_impl]) {
let val = lookup(ns_val(ns_any_value)), typ = lookup(ns_type), let val = lookup(ns_val(ns_any_value)), typ = lookup(ns_type),
md = lookup(ns_module); md = lookup(ns_module);
@ -746,7 +746,7 @@ fn ns_name(ns: namespace) -> str {
enum ctxt { in_mod(def), in_scope(scopes), } enum ctxt { in_mod(def), in_scope(scopes), }
fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) { fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) {
fn find_fn_or_mod_scope(sc: scopes) -> option::t<scope> { fn find_fn_or_mod_scope(sc: scopes) -> option<scope> {
let sc = sc; let sc = sc;
while true { while true {
alt sc { alt sc {
@ -803,7 +803,7 @@ fn mk_unresolved_msg(id: ident, kind: str) -> str {
// Lookup helpers // Lookup helpers
fn lookup_path_strict(e: env, sc: scopes, sp: span, pth: ast::path_, fn lookup_path_strict(e: env, sc: scopes, sp: span, pth: ast::path_,
ns: namespace) -> option::t<def> { ns: namespace) -> option<def> {
let n_idents = vec::len(pth.idents); let n_idents = vec::len(pth.idents);
let headns = if n_idents == 1u { ns } else { ns_module }; 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, fn lookup_in_scope_strict(e: env, sc: scopes, sp: span, name: ident,
ns: namespace) -> option::t<def> { ns: namespace) -> option<def> {
alt lookup_in_scope(e, sc, sp, name, ns) { alt lookup_in_scope(e, sc, sp, name, ns) {
none { none {
unresolved_err(e, in_scope(sc), sp, name, ns_name(ns)); unresolved_err(e, in_scope(sc), sp, name, ns_name(ns));
@ -847,7 +847,7 @@ fn scope_is_fn(sc: scope) -> bool {
// Returns: // Returns:
// none - does not close // none - does not close
// some(node_id) - closes via the expr w/ node_id // some(node_id) - closes via the expr w/ node_id
fn scope_closes(sc: scope) -> option::t<node_id> { fn scope_closes(sc: scope) -> option<node_id> {
alt sc { alt sc {
scope_fn_expr(_, node_id, _) { some(node_id) } scope_fn_expr(_, node_id, _) { some(node_id) }
_ { none } _ { 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) fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace)
-> option::t<def> { -> option<def> {
fn in_scope(e: env, sp: span, name: ident, s: scope, ns: namespace) -> fn in_scope(e: env, sp: span, name: ident, s: scope, ns: namespace) ->
option::t<def> { option<def> {
alt s { alt s {
scope_crate { scope_crate {
ret lookup_in_local_mod(e, ast::crate_node_id, sp, 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]) fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param])
-> option::t<def> { -> option<def> {
let n = 0u; let n = 0u;
for tp: ast::ty_param in ty_params { for tp: ast::ty_param in ty_params {
if str::eq(tp.ident, name) && alt e.current_tp { 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::<def>; ret none::<def>;
} }
fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option::t<def_id> { fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option<def_id> {
let found = none; let found = none;
pat_util::pat_bindings(normalize_pat_def_map(e.def_map, pat)) 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<def_id> {
fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl, fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl,
ty_params: [ast::ty_param], ty_params: [ast::ty_param],
ns: namespace) -> option::t<def> { ns: namespace) -> option<def> {
alt ns { alt ns {
ns_val(ns_any_value) { ns_val(ns_any_value) {
for a: ast::arg in decl.inputs { 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, fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint,
loc_pos: uint, ns: namespace) -> option::t<def> { loc_pos: uint, ns: namespace) -> option<def> {
let i = vec::len(b.stmts); let i = vec::len(b.stmts);
while i > 0u { while i > 0u {
i -= 1u; i -= 1u;
@ -1132,7 +1132,7 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint,
ret none; ret none;
} }
fn found_def_item(i: @ast::item, ns: namespace) -> option::t<def> { fn found_def_item(i: @ast::item, ns: namespace) -> option<def> {
alt i.node { alt i.node {
ast::item_const(_, _) { ast::item_const(_, _) {
if ns == ns_val(ns_any_value) { if ns == ns_val(ns_any_value) {
@ -1167,7 +1167,7 @@ fn found_def_item(i: @ast::item, ns: namespace) -> option::t<def> {
} }
fn lookup_in_mod_strict(e: env, m: def, sp: span, name: ident, fn lookup_in_mod_strict(e: env, m: def, sp: span, name: ident,
ns: namespace, dr: dir) -> option::t<def> { ns: namespace, dr: dir) -> option<def> {
alt lookup_in_mod(e, m, sp, name, ns, dr) { alt lookup_in_mod(e, m, sp, name, ns, dr) {
none { none {
unresolved_err(e, in_mod(m), sp, name, ns_name(ns)); 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, fn lookup_in_mod(e: env, m: def, sp: span, name: ident, ns: namespace,
dr: dir) -> option::t<def> { dr: dir) -> option<def> {
let defid = def_id_of_def(m); let defid = def_id_of_def(m);
if defid.crate != ast::local_crate { if defid.crate != ast::local_crate {
// examining a module in an external 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}); ret ast::def_mod({crate: cnum, node: ast::crate_node_id});
} }
fn lookup_import(e: env, defid: def_id, ns: namespace) -> option::t<def> { fn lookup_import(e: env, defid: def_id, ns: namespace) -> option<def> {
// Imports are simply ignored when resolving themselves. // Imports are simply ignored when resolving themselves.
if vec::member(defid.node, e.ignored_imports) { ret none; } if vec::member(defid.node, e.ignored_imports) { ret none; }
alt e.imports.get(defid.node) { alt e.imports.get(defid.node) {
@ -1240,7 +1240,7 @@ fn lookup_import(e: env, defid: def_id, ns: namespace) -> option::t<def> {
} }
fn lookup_in_local_native_mod(e: env, node_id: node_id, sp: span, id: ident, fn lookup_in_local_native_mod(e: env, node_id: node_id, sp: span, id: ident,
ns: namespace) -> option::t<def> { ns: namespace) -> option<def> {
ret lookup_in_local_mod(e, node_id, sp, id, ns, inside); 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, fn lookup_in_local_mod(e: env, node_id: node_id, sp: span, id: ident,
ns: namespace, dr: dir) -> option::t<def> { ns: namespace, dr: dir) -> option<def> {
let info = e.mod_map.get(node_id); let info = e.mod_map.get(node_id);
if dr == outside && !is_exported(e, id, option::get(info.m)) { 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 // 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, fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident,
ns: namespace, dr: dir) -> option::t<def> { ns: namespace, dr: dir) -> option<def> {
fn lookup_in_mod_(e: env, def: glob_imp_def, sp: span, name: ident, fn lookup_in_mod_(e: env, def: glob_imp_def, sp: span, name: ident,
ns: namespace, dr: dir) -> option::t<glob_imp_def> { ns: namespace, dr: dir) -> option<glob_imp_def> {
alt def.item.node { alt def.item.node {
ast::view_item_import_glob(_, id) { ast::view_item_import_glob(_, id) {
if vec::member(id, e.ignored_imports) { ret none; } 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, fn lookup_glob_in_mod(e: env, info: @indexed_mod, sp: span, id: ident,
wanted_ns: namespace, dr: dir) -> option::t<def> { wanted_ns: namespace, dr: dir) -> option<def> {
// since we don't know what names we have in advance, // since we don't know what names we have in advance,
// absence takes the place of todo() // absence takes the place of todo()
if !info.glob_imported_names.contains_key(id) { 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) -> fn lookup_in_mie(e: env, mie: mod_index_entry, ns: namespace) ->
option::t<def> { option<def> {
alt mie { alt mie {
mie_view_item(_, id, _) { mie_view_item(_, id, _) {
if ns == ns_module { ret some(found_view_item(e, 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) -> fn lookup_external(e: env, cnum: int, ids: [ident], ns: namespace) ->
option::t<def> { option<def> {
for d: def in csearch::lookup_defs(e.sess.cstore, cnum, ids) { for d: def in csearch::lookup_defs(e.sess.cstore, cnum, ids) {
e.ext_map.insert(def_id_of_def(d), ids); e.ext_map.insert(def_id_of_def(d), ids);
if ns_ok(ns, ns_for_def(d)) { ret some(d); } 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) is_some(m) || is_some(v) || is_some(t)
} }
fn maybe_add_reexport(e: @env, path: str, def: option::t<def>) { fn maybe_add_reexport(e: @env, path: str, def: option<def>) {
alt def { alt def {
some(def) { some(def) {
alt e.exp_map.find(path) { 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, fn find_impls_in_view_item(e: env, vi: @ast::view_item,
&impls: [@_impl], sc: option::t<iscopes>) { &impls: [@_impl], sc: option<iscopes>) {
fn lookup_imported_impls(e: env, id: ast::node_id, fn lookup_imported_impls(e: env, id: ast::node_id,
act: fn(@[@_impl])) { act: fn(@[@_impl])) {
alt e.imports.get(id) { 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], fn find_impls_in_item(e: env, i: @ast::item, &impls: [@_impl],
name: option::t<ident>, name: option<ident>,
ck_exports: option::t<ast::_mod>) { ck_exports: option<ast::_mod>) {
alt i.node { alt i.node {
ast::item_impl(_, ifce, _, mthds) { ast::item_impl(_, ifce, _, mthds) {
if alt name { some(n) { n == i.ident } _ { true } } && 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], fn find_impls_in_mod_by_id(e: env, defid: def_id, &impls: [@_impl],
name: option::t<ident>) { name: option<ident>) {
let cached; let cached;
alt e.impl_cache.find(defid) { alt e.impl_cache.find(defid) {
some(some(v)) { cached = v; } 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], fn find_impls_in_mod(e: env, m: def, &impls: [@_impl],
name: option::t<ident>) { name: option<ident>) {
alt m { alt m {
ast::def_mod(defid) { ast::def_mod(defid) {
find_impls_in_mod_by_id(e, defid, impls, name); find_impls_in_mod_by_id(e, defid, impls, name);

View file

@ -77,7 +77,7 @@ fn variant_opt(ccx: @crate_ctxt, pat_id: ast::node_id) -> opt {
} }
type bind_map = [{ident: ast::ident, val: ValueRef}]; type bind_map = [{ident: ast::ident, val: ValueRef}];
fn assoc(key: str, list: bind_map) -> option::t<ValueRef> { fn assoc(key: str, list: bind_map) -> option<ValueRef> {
for elt: {ident: ast::ident, val: ValueRef} in list { for elt: {ident: ast::ident, val: ValueRef} in list {
if str::eq(elt.ident, key) { ret some(elt.val); } if str::eq(elt.ident, key) { ret some(elt.val); }
} }
@ -88,7 +88,7 @@ type match_branch =
@{pats: [@ast::pat], @{pats: [@ast::pat],
bound: bind_map, bound: bind_map,
data: @{body: BasicBlockRef, data: @{body: BasicBlockRef,
guard: option::t<@ast::expr>, guard: option<@ast::expr>,
id_map: pat_id_map}}; id_map: pat_id_map}};
type match = [match_branch]; type match = [match_branch];
@ -120,7 +120,7 @@ fn expand_nested_bindings(m: match, col: uint, val: ValueRef) -> match {
result 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 { fn enter_match(m: match, col: uint, val: ValueRef, e: enter_pat) -> match {
let result = []; let result = [];
@ -153,7 +153,7 @@ fn enter_default(m: match, col: uint, val: ValueRef) -> match {
_ { false } _ { 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 if matches_always(p) { some([]) } else { none };
} }
ret enter_match(m, col, val, e); 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 { val: ValueRef) -> match {
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
fn e(ccx: @crate_ctxt, dummy: @ast::pat, opt: opt, size: uint, 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 { alt p.node {
ast::pat_enum(ctor, subpats) { ast::pat_enum(ctor, subpats) {
ret if opt_eq(variant_opt(ccx, p.id), opt) { 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 { match {
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
fn e(dummy: @ast::pat, fields: [ast::ident], p: @ast::pat) -> fn e(dummy: @ast::pat, fields: [ast::ident], p: @ast::pat) ->
option::t<[@ast::pat]> { option<[@ast::pat]> {
alt p.node { alt p.node {
ast::pat_rec(fpats, _) { ast::pat_rec(fpats, _) {
let pats = []; 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 { fn enter_tup(m: match, col: uint, val: ValueRef, n_elts: uint) -> match {
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
fn e(dummy: @ast::pat, n_elts: uint, p: @ast::pat) -> fn e(dummy: @ast::pat, n_elts: uint, p: @ast::pat) ->
option::t<[@ast::pat]> { option<[@ast::pat]> {
alt p.node { alt p.node {
ast::pat_tup(elts) { ret some(elts); } ast::pat_tup(elts) { ret some(elts); }
_ { ret some(vec::init_elt(n_elts, dummy)); } _ { 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 { fn enter_box(m: match, col: uint, val: ValueRef) -> match {
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; 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 { alt p.node {
ast::pat_box(sub) { ret some([sub]); } ast::pat_box(sub) { ret some([sub]); }
_ { ret some([dummy]); } _ { 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 { fn enter_uniq(m: match, col: uint, val: ValueRef) -> match {
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()}; 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 { alt p.node {
ast::pat_uniq(sub) { ret some([sub]); } ast::pat_uniq(sub) { ret some([sub]); }
_ { ret some([dummy]); } _ { ret some([dummy]); }
@ -682,7 +682,7 @@ fn trans_alt(cx: @block_ctxt, expr: @ast::expr, arms_: [ast::arm],
// Cached fail-on-fallthrough block // Cached fail-on-fallthrough block
let fail_cx = @mutable none; let fail_cx = @mutable none;
fn mk_fail(cx: @block_ctxt, sp: span, fn mk_fail(cx: @block_ctxt, sp: span,
done: @mutable option::t<BasicBlockRef>) -> BasicBlockRef { done: @mutable option<BasicBlockRef>) -> BasicBlockRef {
alt *done { some(bb) { ret bb; } _ { } } alt *done { some(bb) { ret bb; } _ { } }
let fail_cx = new_sub_block_ctxt(cx, "case_fallthrough"); let fail_cx = new_sub_block_ctxt(cx, "case_fallthrough");
base::trans_fail(fail_cx, some(sp), "non-exhaustive match failure");; base::trans_fail(fail_cx, some(sp), "non-exhaustive match failure");;

View file

@ -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, 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) { alt cx.fcx.derived_tydescs.find(t) {
some(info) { some(info) {
// If the tydesc escapes in this context, the cached derived // 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}; type get_tydesc_result = {kind: tydesc_kind, result: result};
fn get_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool, 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 { -> get_tydesc_result {
// Is the supplied type a type param? If so, return the passed-in tydesc. // 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 dtor_addr = common::get_res_dtor(ccx, did, inner_t);
let args = [cx.fcx.llretptr, null_env_ptr(cx)]; let args = [cx.fcx.llretptr, null_env_ptr(cx)];
for tp: ty::t in tps { 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; let td = get_tydesc(cx, tp, false, ti).result;
args += [td.val]; args += [td.val];
cx = td.bcx; 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, 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_take_glue, static_ti);
lazily_emit_tydesc_glue(cx, abi::tydesc_field_drop_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); 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, fn lazily_emit_all_generic_info_tydesc_glues(cx: @block_ctxt,
gi: generic_info) { 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); lazily_emit_all_tydesc_glue(cx, ti);
} }
} }
fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int, fn lazily_emit_tydesc_glue(cx: @block_ctxt, field: int,
static_ti: option::t<@tydesc_info>) { static_ti: option<@tydesc_info>) {
alt static_ti { alt static_ti {
none { } none { }
some(ti) { 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, 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); lazily_emit_tydesc_glue(cx, field, static_ti);
let static_glue_fn = none; 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) -> fn call_tydesc_glue(cx: @block_ctxt, v: ValueRef, t: ty::t, field: int) ->
@block_ctxt { @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; let {bcx: bcx, val: td} = get_tydesc(cx, t, false, ti).result;
call_tydesc_glue_full(bcx, v, td, field, ti); call_tydesc_glue_full(bcx, v, td, field, ti);
ret bcx; 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, 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 { -> @block_ctxt {
let {bcx, val: cond_val} = trans_temp_expr(cx, cond); 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 = { type generic_info = {
item_type: ty::t, item_type: ty::t,
static_tis: [option::t<@tydesc_info>], static_tis: [option<@tydesc_info>],
tydescs: [ValueRef], tydescs: [ValueRef],
param_bounds: @[ty::param_bounds], param_bounds: @[ty::param_bounds],
origins: option::t<typeck::dict_res> origins: option<typeck::dict_res>
}; };
enum lval_kind { enum lval_kind {
@ -2528,7 +2528,7 @@ type lval_maybe_callee = {bcx: @block_ctxt,
val: ValueRef, val: ValueRef,
kind: lval_kind, kind: lval_kind,
env: callee_env, env: callee_env,
generic: option::t<generic_info>}; generic: option<generic_info>};
fn null_env_ptr(bcx: @block_ctxt) -> ValueRef { fn null_env_ptr(bcx: @block_ctxt) -> ValueRef {
C_null(T_opaque_cbox_ptr(bcx_ccx(bcx))) 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 // - new_fn_ctxt
// - trans_args // - trans_args
fn trans_args(cx: @block_ctxt, llenv: ValueRef, fn trans_args(cx: @block_ctxt, llenv: ValueRef,
gen: option::t<generic_info>, es: [@ast::expr], fn_ty: ty::t, gen: option<generic_info>, es: [@ast::expr], fn_ty: ty::t,
dest: dest) dest: dest)
-> {bcx: @block_ctxt, -> {bcx: @block_ctxt,
args: [ValueRef], 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], 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 { dest: dest) -> @block_ctxt {
let t = node_id_type(bcx_ccx(bcx), id); let t = node_id_type(bcx_ccx(bcx), id);
let bcx = bcx; let bcx = bcx;
@ -3809,8 +3809,8 @@ fn trans_check_expr(cx: @block_ctxt, e: @ast::expr, s: str) -> @block_ctxt {
ret next_cx; ret next_cx;
} }
fn trans_fail_expr(bcx: @block_ctxt, sp_opt: option::t<span>, fn trans_fail_expr(bcx: @block_ctxt, sp_opt: option<span>,
fail_expr: option::t<@ast::expr>) -> @block_ctxt { fail_expr: option<@ast::expr>) -> @block_ctxt {
let bcx = bcx; let bcx = bcx;
alt fail_expr { alt fail_expr {
some(expr) { some(expr) {
@ -3836,13 +3836,13 @@ fn trans_fail_expr(bcx: @block_ctxt, sp_opt: option::t<span>,
} }
} }
fn trans_fail(bcx: @block_ctxt, sp_opt: option::t<span>, fail_str: str) -> fn trans_fail(bcx: @block_ctxt, sp_opt: option<span>, fail_str: str) ->
@block_ctxt { @block_ctxt {
let V_fail_str = C_cstr(bcx_ccx(bcx), fail_str); let V_fail_str = C_cstr(bcx_ccx(bcx), fail_str);
ret trans_fail_value(bcx, sp_opt, V_fail_str); ret trans_fail_value(bcx, sp_opt, V_fail_str);
} }
fn trans_fail_value(bcx: @block_ctxt, sp_opt: option::t<span>, fn trans_fail_value(bcx: @block_ctxt, sp_opt: option<span>,
V_fail_str: ValueRef) -> @block_ctxt { V_fail_str: ValueRef) -> @block_ctxt {
let ccx = bcx_ccx(bcx); let ccx = bcx_ccx(bcx);
let V_filename; let V_filename;
@ -3907,7 +3907,7 @@ fn trans_cont(cx: @block_ctxt) -> @block_ctxt {
ret trans_break_cont(cx, false); 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; let cleanup_cx = bcx, bcx = bcx;
alt e { alt e {
some(x) { bcx = trans_expr_save_in(bcx, x, bcx.fcx.llretptr); } 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 // You probably don't want to use this one. See the
// next three functions instead. // next three functions instead.
fn new_block_ctxt(cx: @fn_ctxt, parent: block_parent, kind: block_kind, fn new_block_ctxt(cx: @fn_ctxt, parent: block_parent, kind: block_kind,
name: str, block_span: option::t<span>) -> @block_ctxt { name: str, block_span: option<span>) -> @block_ctxt {
let s = ""; let s = "";
if cx.lcx.ccx.sess.opts.save_temps || if cx.lcx.ccx.sess.opts.save_temps ||
cx.lcx.ccx.sess.opts.debuginfo { 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. // 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<span>) -> @block_ctxt { fn new_top_block_ctxt(fcx: @fn_ctxt, sp: option<span>) -> @block_ctxt {
ret new_block_ctxt(fcx, parent_none, SCOPE_BLOCK, "function top level", ret new_block_ctxt(fcx, parent_none, SCOPE_BLOCK, "function top level",
sp); 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)); 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) _break: @block_ctxt, n: str, sp: span)
-> @block_ctxt { -> @block_ctxt {
ret new_block_ctxt(bcx.fcx, parent_some(bcx), ret new_block_ctxt(bcx.fcx, parent_some(bcx),
@ -4336,7 +4336,7 @@ fn mk_standard_basic_blocks(llfn: ValueRef) ->
// - trans_args // - trans_args
fn new_fn_ctxt_w_id(cx: @local_ctxt, llfndecl: ValueRef, fn new_fn_ctxt_w_id(cx: @local_ctxt, llfndecl: ValueRef,
id: ast::node_id, rstyle: ast::ret_style, id: ast::node_id, rstyle: ast::ret_style,
sp: option::t<span>) -> @fn_ctxt { sp: option<span>) -> @fn_ctxt {
let llbbs = mk_standard_basic_blocks(llfndecl); let llbbs = mk_standard_basic_blocks(llfndecl);
ret @{llfn: llfndecl, ret @{llfn: llfndecl,
llenv: llvm::LLVMGetParam(llfndecl, 1u as c_uint), 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}; lcx: cx};
} }
fn new_fn_ctxt(cx: @local_ctxt, llfndecl: ValueRef, sp: option::t<span>) fn new_fn_ctxt(cx: @local_ctxt, llfndecl: ValueRef, sp: option<span>)
-> @fn_ctxt { -> @fn_ctxt {
ret new_fn_ctxt_w_id(cx, llfndecl, -1, ast::return_val, sp); 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, fn collect_native_item(ccx: @crate_ctxt,
abi: @mutable option::t<ast::native_abi>, abi: @mutable option<ast::native_abi>,
i: @ast::native_item, i: @ast::native_item,
&&pt: [str], &&pt: [str],
_v: vt<[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<ast::native_abi>, fn collect_item(ccx: @crate_ctxt, abi: @mutable option<ast::native_abi>,
i: @ast::item, &&pt: [str], v: vt<[str]>) { i: @ast::item, &&pt: [str], v: vt<[str]>) {
let new_pt = pt + [i.ident]; let new_pt = pt + [i.ident];
alt i.node { alt i.node {

View file

@ -541,7 +541,7 @@ fn trans_expr_fn(bcx: @block_ctxt,
ret bcx; 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 { id: ast::node_id, dest: dest) -> @block_ctxt {
let f_res = trans_callee(cx, f); let f_res = trans_callee(cx, f);
ret trans_bind_1(cx, ty::expr_ty(bcx_tcx(cx), f), f_res, args, 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, fn trans_bind_1(cx: @block_ctxt, outgoing_fty: ty::t,
f_res: lval_maybe_callee, 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 { dest: dest) -> @block_ctxt {
let bound: [@ast::expr] = []; 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]; } } alt argopt { none { } some(e) { bound += [e]; } }
} }
let bcx = f_res.bcx; let bcx = f_res.bcx;
@ -781,10 +781,10 @@ fn make_opaque_cbox_free_glue(
fn trans_bind_thunk(cx: @local_ctxt, fn trans_bind_thunk(cx: @local_ctxt,
incoming_fty: ty::t, incoming_fty: ty::t,
outgoing_fty: ty::t, outgoing_fty: ty::t,
args: [option::t<@ast::expr>], args: [option<@ast::expr>],
cbox_ty: ty::t, cbox_ty: ty::t,
param_bounds: [ty::param_bounds], param_bounds: [ty::param_bounds],
target_fn: option::t<ValueRef>) target_fn: option<ValueRef>)
-> {val: ValueRef, ty: TypeRef} { -> {val: ValueRef, ty: TypeRef} {
// If we supported constraints on record fields, we could make the // If we supported constraints on record fields, we could make the
// constraints for this function: // constraints for this function:
@ -926,7 +926,7 @@ fn trans_bind_thunk(cx: @local_ctxt,
let outgoing_arg_index: uint = 0u; let outgoing_arg_index: uint = 0u;
let llout_arg_tys: [TypeRef] = let llout_arg_tys: [TypeRef] =
type_of_explicit_args(cx.ccx, outgoing_args); 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 out_arg = outgoing_args[outgoing_arg_index];
let llout_arg_ty = llout_arg_tys[outgoing_arg_index]; let llout_arg_ty = llout_arg_tys[outgoing_arg_index];
alt arg { alt arg {

View file

@ -43,10 +43,10 @@ type tydesc_info =
tydesc: ValueRef, tydesc: ValueRef,
size: ValueRef, size: ValueRef,
align: ValueRef, align: ValueRef,
mutable take_glue: option::t<ValueRef>, mutable take_glue: option<ValueRef>,
mutable drop_glue: option::t<ValueRef>, mutable drop_glue: option<ValueRef>,
mutable free_glue: option::t<ValueRef>, mutable free_glue: option<ValueRef>,
mutable cmp_glue: option::t<ValueRef>, mutable cmp_glue: option<ValueRef>,
ty_params: [uint]}; ty_params: [uint]};
/* /*
@ -90,7 +90,7 @@ type crate_ctxt =
ast_map: ast_map::map, ast_map: ast_map::map,
exp_map: resolve::exp_map, exp_map: resolve::exp_map,
item_symbols: hashmap<ast::node_id, str>, item_symbols: hashmap<ast::node_id, str>,
mutable main_fn: option::t<ValueRef>, mutable main_fn: option<ValueRef>,
link_meta: link::link_meta, link_meta: link::link_meta,
enum_sizes: hashmap<ty::t, uint>, enum_sizes: hashmap<ty::t, uint>,
discrims: hashmap<ast::def_id, ValueRef>, discrims: hashmap<ast::def_id, ValueRef>,
@ -122,7 +122,7 @@ type crate_ctxt =
shape_cx: shape::ctxt, shape_cx: shape::ctxt,
gc_cx: gc::ctxt, gc_cx: gc::ctxt,
crate_map: ValueRef, crate_map: ValueRef,
dbg_cx: option::t<@debuginfo::debug_ctxt>}; dbg_cx: option<@debuginfo::debug_ctxt>};
type local_ctxt = type local_ctxt =
{path: [str], {path: [str],
@ -134,7 +134,7 @@ type val_self_pair = {v: ValueRef, t: ty::t};
enum local_val { local_mem(ValueRef), local_imm(ValueRef), } 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 // Function context. Every LLVM function we create will have one of
// these. // these.
@ -231,8 +231,8 @@ type fn_ctxt =
mutable llderivedtydescs: BasicBlockRef, mutable llderivedtydescs: BasicBlockRef,
mutable lldynamicallocas: BasicBlockRef, mutable lldynamicallocas: BasicBlockRef,
mutable llreturn: BasicBlockRef, mutable llreturn: BasicBlockRef,
mutable llobstacktoken: option::t<ValueRef>, mutable llobstacktoken: option<ValueRef>,
mutable llself: option::t<val_self_pair>, mutable llself: option<val_self_pair>,
llargs: hashmap<ast::node_id, local_val>, llargs: hashmap<ast::node_id, local_val>,
lllocals: hashmap<ast::node_id, local_val>, lllocals: hashmap<ast::node_id, local_val>,
llupvars: hashmap<ast::node_id, ValueRef>, llupvars: hashmap<ast::node_id, ValueRef>,
@ -240,7 +240,7 @@ type fn_ctxt =
derived_tydescs: hashmap<ty::t, derived_tydesc_info>, derived_tydescs: hashmap<ty::t, derived_tydesc_info>,
id: ast::node_id, id: ast::node_id,
ret_style: ast::ret_style, ret_style: ast::ret_style,
span: option::t<span>, span: option<span>,
lcx: @local_ctxt}; lcx: @local_ctxt};
enum cleanup { enum cleanup {
@ -339,7 +339,7 @@ enum block_kind {
SCOPE_BLOCK, SCOPE_BLOCK,
// A basic block created from the body of a loop. Contains pointers to // 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". // 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 // A non-scope block is a basic block created as a translation artifact
// from translating code that expresses conditional logic rather than by // from translating code that expresses conditional logic rather than by
// explicit { ... } block structure in the source language. It's called a // explicit { ... } block structure in the source language. It's called a
@ -374,11 +374,11 @@ type block_ctxt =
kind: block_kind, kind: block_kind,
mutable cleanups: [cleanup], mutable cleanups: [cleanup],
mutable lpad_dirty: bool, mutable lpad_dirty: bool,
mutable lpad: option::t<BasicBlockRef>, mutable lpad: option<BasicBlockRef>,
block_span: option::t<span>, block_span: option<span>,
fcx: @fn_ctxt}; 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. // the infinite-enum check in rustboot gets upset.
enum block_parent { parent_none, parent_some(@block_ctxt), } enum block_parent { parent_none, parent_some(@block_ctxt), }

View file

@ -300,7 +300,7 @@ fn add_node(ccx: crate_ctxt, i: node_id, a: ts_ann) {
ccx.node_anns[i] = a; ccx.node_anns[i] = a;
} }
fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option::t<ts_ann> { fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option<ts_ann> {
if i as uint < vec::len(*ccx.node_anns) { if i as uint < vec::len(*ccx.node_anns) {
ret some::<ts_ann>(ccx.node_anns[i]); ret some::<ts_ann>(ccx.node_anns[i]);
} else { ret none::<ts_ann>; } } else { ret none::<ts_ann>; }
@ -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<def> { fn node_id_to_def(ccx: crate_ctxt, id: node_id) -> option<def> {
ret ccx.tcx.def_map.find(id); ret ccx.tcx.def_map.find(id);
} }
@ -691,7 +691,7 @@ fn pred_args_matches(pattern: [constr_arg_general_<inst>], desc: pred_args) ->
} }
fn find_instance_(pattern: [constr_arg_general_<inst>], descs: [pred_args]) -> fn find_instance_(pattern: [constr_arg_general_<inst>], descs: [pred_args]) ->
option::t<uint> { option<uint> {
for d: pred_args in descs { for d: pred_args in descs {
if pred_args_matches(pattern, d) { ret some(d.node.bit_num); } 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 rslt
} }
fn find_in_subst(id: node_id, s: subst) -> option::t<inst> { fn find_in_subst(id: node_id, s: subst) -> option<inst> {
for p: {from: inst, to: inst} in s { for p: {from: inst, to: inst} in s {
if id == p.from.node { ret some(p.to); } 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<def> { fn local_node_id_to_def(fcx: fn_ctxt, i: node_id) -> option<def> {
fcx.ccx.tcx.def_map.find(i) fcx.ccx.tcx.def_map.find(i)
} }
fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option::t<def_id> { fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option<def_id> {
alt local_node_id_to_def(fcx, i) { alt local_node_id_to_def(fcx, i) {
some(def_local(id, _)) | some(def_arg(id, _)) | some(def_binding(id)) | some(def_local(id, _)) | some(def_arg(id, _)) | some(def_binding(id)) |
some(def_upvar(id, _, _)) { some(def_upvar(id, _, _)) {
@ -820,7 +820,7 @@ fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option::t<def_id> {
} }
fn local_node_id_to_local_def_id(fcx: fn_ctxt, i: node_id) -> fn local_node_id_to_local_def_id(fcx: fn_ctxt, i: node_id) ->
option::t<node_id> { option<node_id> {
alt local_node_id_to_def_id(fcx, i) { alt local_node_id_to_def_id(fcx, i) {
some(did) { some(did.node) } some(did) { some(did.node) }
_ { none } _ { none }
@ -1053,7 +1053,7 @@ fn ast_constr_to_sp_constr(tcx: ty::ctxt, args: [arg], c: @constr) ->
ret respan(c.span, tconstr); ret respan(c.span, tconstr);
} }
type binding = {lhs: [inst], rhs: option::t<initializer>}; type binding = {lhs: [inst], rhs: option<initializer>};
fn local_to_bindings(tcx: ty::ctxt, loc: @local) -> binding { fn local_to_bindings(tcx: ty::ctxt, loc: @local) -> binding {
let lhs = []; let lhs = [];

View file

@ -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 // annotation for an if-expression with consequent conseq
// and alternative maybe_alt // and alternative maybe_alt
fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, 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_expr(fcx, antec);
find_pre_post_block(fcx, conseq); find_pre_post_block(fcx, conseq);
alt maybe_alt { 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 cmodes = callee_modes(fcx, operator.id);
let modes = []; let modes = [];
let i = 0; let i = 0;
for expr_opt: option::t<@expr> in maybe_args { for expr_opt: option<@expr> in maybe_args {
alt expr_opt { alt expr_opt {
none {/* no-op */ } none {/* no-op */ }
some(expr) { modes += [cmodes[i]]; args += [expr]; } some(expr) { modes += [cmodes[i]]; args += [expr]; }

View file

@ -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, fn find_pre_post_state_sub(fcx: fn_ctxt, pres: prestate, e: @expr,
parent: node_id, c: option::t<tsconstr>) -> bool { parent: node_id, c: option<tsconstr>) -> bool {
let changed = find_pre_post_state_expr(fcx, pres, e); let changed = find_pre_post_state_expr(fcx, pres, e);
changed = set_prestate_ann(fcx.ccx, parent, pres) || changed; 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, 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 { pres: prestate) -> bool {
let changed = let changed =
set_prestate_ann(fcx.ccx, id, pres) | 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 callee_ops = callee_arg_init_ops(fcx, operator.id);
let ops = []; let ops = [];
let i = 0; let i = 0;
for a_opt: option::t<@expr> in maybe_args { for a_opt: option<@expr> in maybe_args {
alt a_opt { alt a_opt {
none {/* no-op */ } none {/* no-op */ }
some(a) { ops += [callee_ops[i]]; args += [a]; } some(a) { ops += [callee_ops[i]]; args += [a]; }

View file

@ -217,7 +217,7 @@ type ctxt =
short_names_cache: hashmap<t, @str>, short_names_cache: hashmap<t, @str>,
needs_drop_cache: hashmap<t, bool>, needs_drop_cache: hashmap<t, bool>,
kind_cache: hashmap<t, kind>, kind_cache: hashmap<t, kind>,
ast_ty_to_ty_cache: hashmap<@ast::ty, option::t<t>>, ast_ty_to_ty_cache: hashmap<@ast::ty, option<t>>,
enum_var_cache: hashmap<def_id, @[variant_info]>, enum_var_cache: hashmap<def_id, @[variant_info]>,
iface_method_cache: hashmap<def_id, @[method]>, iface_method_cache: hashmap<def_id, @[method]>,
ty_param_bounds: hashmap<ast::node_id, param_bounds>}; ty_param_bounds: hashmap<ast::node_id, param_bounds>};
@ -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 { alt interner::get(*cx.ts, typ).struct {
ty_named(_, n) { some(n) } ty_named(_, n) { some(n) }
_ { none } _ { 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<uint> { fn type_param(cx: ctxt, ty: t) -> option<uint> {
alt struct(cx, ty) { alt struct(cx, ty) {
ty_param(id, _) { ret some(id); } ty_param(id, _) { ret some(id); }
_ {/* fall through */ } _ {/* 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<uint> { fn field_idx(id: ast::ident, fields: [field]) -> option<uint> {
let i = 0u; let i = 0u;
for f in fields { if f.ident == id { ret some(i); } i += 1u; } for f in fields { if f.ident == id { ret some(i); } i += 1u; }
ret none; 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<uint> { fn method_idx(id: ast::ident, meths: [method]) -> option<uint> {
let i = 0u; let i = 0u;
for m in meths { if m.ident == id { ret some(i); } i += 1u; } for m in meths { if m.ident == id { ret some(i); } i += 1u; }
ret none; ret none;
@ -1613,7 +1613,7 @@ fn sort_methods(meths: [method]) -> [method] {
ret std::sort::merge_sort(bind method_lteq(_, _), meths); ret std::sort::merge_sort(bind method_lteq(_, _), meths);
} }
fn occurs_check_fails(tcx: ctxt, sp: option::t<span>, vid: int, rt: t) -> fn occurs_check_fails(tcx: ctxt, sp: option<span>, vid: int, rt: t) ->
bool { bool {
if !type_contains_vars(tcx, rt) { if !type_contains_vars(tcx, rt) {
// Fast path // Fast path
@ -1821,7 +1821,7 @@ mod unify {
// Unifies two mutability flags. // Unifies two mutability flags.
fn unify_mut(expected: ast::mutability, actual: ast::mutability, fn unify_mut(expected: ast::mutability, actual: ast::mutability,
variance: variance) -> variance: variance) ->
option::t<(ast::mutability, variance)> { option<(ast::mutability, variance)> {
// If you're unifying on something mutable then we have to // If you're unifying on something mutable then we have to
// be invariant on the inner type // be invariant on the inner type
@ -1847,7 +1847,7 @@ mod unify {
ret none; ret none;
} }
fn unify_fn_proto(e_proto: ast::proto, a_proto: ast::proto, fn unify_fn_proto(e_proto: ast::proto, a_proto: ast::proto,
variance: variance) -> option::t<result> { variance: variance) -> option<result> {
// Prototypes form a diamond-shaped partial order: // Prototypes form a diamond-shaped partial order:
// //
// block // block
@ -2365,7 +2365,7 @@ mod unify {
while i < vec::len::<ufind::node>(vb.sets.nodes) { while i < vec::len::<ufind::node>(vb.sets.nodes) {
let sets = ""; let sets = "";
let j = 0u; let j = 0u;
while j < vec::len::<option::t<uint>>(vb.sets.nodes) { while j < vec::len::<option<uint>>(vb.sets.nodes) {
if ufind::find(vb.sets, j) == i { sets += #fmt[" %u", j]; } if ufind::find(vb.sets, j) == i { sets += #fmt[" %u", j]; }
j += 1u; j += 1u;
} }
@ -2383,10 +2383,10 @@ mod unify {
// Takes an optional span - complain about occurs check violations // Takes an optional span - complain about occurs check violations
// iff the span is present (so that if we already know we're going // iff the span is present (so that if we already know we're going
// to error anyway, we don't complain) // to error anyway, we don't complain)
fn fixup_vars(tcx: ty_ctxt, sp: option::t<span>, vb: @var_bindings, fn fixup_vars(tcx: ty_ctxt, sp: option<span>, vb: @var_bindings,
typ: t) -> fixup_result { typ: t) -> fixup_result {
fn subst_vars(tcx: ty_ctxt, sp: option::t<span>, vb: @var_bindings, fn subst_vars(tcx: ty_ctxt, sp: option<span>, vb: @var_bindings,
unresolved: @mutable option::t<int>, unresolved: @mutable option<int>,
vars_seen: std::list::list<int>, vid: int) -> t { vars_seen: std::list::list<int>, vid: int) -> t {
// Should really return a fixup_result instead of a t, but fold_ty // Should really return a fixup_result instead of a t, but fold_ty
// doesn't allow returning anything but a t. // doesn't allow returning anything but a t.
@ -2426,7 +2426,7 @@ mod unify {
some(var_id) { ret fix_err(var_id); } some(var_id) { ret fix_err(var_id); }
} }
} }
fn resolve_type_var(tcx: ty_ctxt, sp: option::t<span>, vb: @var_bindings, fn resolve_type_var(tcx: ty_ctxt, sp: option<span>, vb: @var_bindings,
vid: int) -> fixup_result { vid: int) -> fixup_result {
if vid as uint >= ufind::set_count(vb.sets) { ret fix_err(vid); } if vid as uint >= ufind::set_count(vb.sets) { ret fix_err(vid); }
let root_id = ufind::find(vb.sets, vid as uint); 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 result
} }
fn impl_iface(cx: ctxt, id: ast::def_id) -> option::t<t> { fn impl_iface(cx: ctxt, id: ast::def_id) -> option<t> {
if id.crate == ast::local_crate { if id.crate == ast::local_crate {
option::map(cx.tcache.find(id), {|it| it.ty}) option::map(cx.tcache.find(id), {|it| it.ty})
} else { } else {

View file

@ -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 // Returns the one-level-deep structure of the given type or none if it
// is not known yet. // is not known yet.
fn structure_of_maybe(fcx: @fn_ctxt, _sp: span, typ: ty::t) -> fn structure_of_maybe(fcx: @fn_ctxt, _sp: span, typ: ty::t) ->
option::t<ty::sty> { option<ty::sty> {
let r = let r =
ty::unify::resolve_type_structure(fcx.ccx.tcx, fcx.var_bindings, typ); ty::unify::resolve_type_structure(fcx.ccx.tcx, fcx.var_bindings, typ);
ret alt r { 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. // 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) -> fn ast_ty_to_ty_crate_infer(ccx: @crate_ctxt, &&ast_ty: @ast::ty) ->
option::t<ty::t> { option<ty::t> {
alt ast_ty.node { alt ast_ty.node {
ast::ty_infer { none } ast::ty_infer { none }
_ { some(ast_ty_to_ty_crate(ccx, ast_ty)) } _ { some(ast_ty_to_ty_crate(ccx, ast_ty)) }
@ -946,7 +946,7 @@ mod writeback {
export resolve_type_vars_in_expr; export resolve_type_vars_in_expr;
fn resolve_type_vars_in_type(fcx: @fn_ctxt, sp: span, typ: ty::t) -> fn resolve_type_vars_in_type(fcx: @fn_ctxt, sp: span, typ: ty::t) ->
option::t<ty::t> { option<ty::t> {
if !ty::type_contains_vars(fcx.ccx.tcx, typ) { ret some(typ); } 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, alt ty::unify::fixup_vars(fcx.ccx.tcx, some(sp), fcx.var_bindings,
typ) { typ) {
@ -1077,7 +1077,7 @@ fn gather_locals(ccx: @crate_ctxt,
decl: ast::fn_decl, decl: ast::fn_decl,
body: ast::blk, body: ast::blk,
id: ast::node_id, 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} = let {vb: vb, locals: locals, nvi: nvi} =
alt old_fcx { alt old_fcx {
none { none {
@ -1094,7 +1094,7 @@ fn gather_locals(ccx: @crate_ctxt,
let tcx = ccx.tcx; let tcx = ccx.tcx;
let next_var_id = fn@() -> int { let rv = *nvi; *nvi += 1; ret rv; }; let next_var_id = fn@() -> int { let rv = *nvi; *nvi += 1; ret rv; };
let assign = fn@(nid: ast::node_id, ty_opt: option::t<ty::t>) { let assign = fn@(nid: ast::node_id, ty_opt: option<ty::t>) {
let var_id = next_var_id(); let var_id = next_var_id();
locals.insert(nid, var_id); locals.insert(nid, var_id);
alt ty_opt { 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, fn lookup_method(fcx: @fn_ctxt, isc: resolve::iscopes,
name: ast::ident, ty: ty::t, sp: span) 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}> { origin: method_origin}> {
let tcx = fcx.ccx.tcx; 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 // A generic function to factor out common logic from call and bind
// expressions. // expressions.
fn check_call_or_bind(fcx: @fn_ctxt, sp: span, fty: ty::t, 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); let sty = structure_of(fcx, sp, fty);
// Grab the argument types // Grab the argument types
let arg_tys = alt sty { 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 // A generic function for checking call expressions
fn check_call(fcx: @fn_ctxt, sp: span, f: @ast::expr, args: [@ast::expr]) fn check_call(fcx: @fn_ctxt, sp: span, f: @ast::expr, args: [@ast::expr])
-> bool { -> bool {
let args_opt_0: [option::t<@ast::expr>] = []; let args_opt_0: [option<@ast::expr>] = [];
for arg: @ast::expr in args { for arg: @ast::expr in args {
args_opt_0 += [some::<@ast::expr>(arg)]; 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 // A generic function for checking the then and else in an if
// or if-check // or if-check
fn check_then_else(fcx: @fn_ctxt, thn: ast::blk, 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 { _sp: span) -> bool {
let (if_t, if_bot) = let (if_t, if_bot) =
alt elsopt { alt elsopt {
@ -1737,7 +1737,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
ret if_bot; ret if_bot;
} }
fn binop_method(op: ast::binop) -> option::t<str> { fn binop_method(op: ast::binop) -> option<str> {
alt op { alt op {
ast::add | ast::subtract | ast::mul | ast::div | ast::rem | ast::add | ast::subtract | ast::mul | ast::div | ast::rem |
ast::bitxor | ast::bitand | ast::bitor | ast::lsl | ast::lsr | 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, fn lookup_op_method(fcx: @fn_ctxt, op_ex: @ast::expr, self_t: ty::t,
opname: str, opname: str,
args: [option::t<@ast::expr>]) -> option::t<ty::t> { args: [option<@ast::expr>]) -> option<ty::t> {
let isc = fcx.ccx.impl_map.get(op_ex.id); let isc = fcx.ccx.impl_map.get(op_ex.id);
alt lookup_method(fcx, isc, opname, self_t, op_ex.span) { alt lookup_method(fcx, isc, opname, self_t, op_ex.span) {
some({method_ty, n_tps: 0u, substs, origin}) { 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)} {vars: vars, ty: ty::substitute_type_params(fcx.ccx.tcx, vars, tp)}
} }
fn get_self_info(ccx: @crate_ctxt) -> option::t<self_info> { fn get_self_info(ccx: @crate_ctxt) -> option<self_info> {
ret vec::last(ccx.self_infos); ret vec::last(ccx.self_infos);
} }
@ -2633,7 +2633,7 @@ fn check_fn(ccx: @crate_ctxt,
decl: ast::fn_decl, decl: ast::fn_decl,
body: ast::blk, body: ast::blk,
id: ast::node_id, 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| ... }. // If old_fcx is some(...), this is a block fn { |x| ... }.
// In that case, the purity is inherited from the context. // In that case, the purity is inherited from the context.
let purity = alt old_fcx { let purity = alt old_fcx {

View file

@ -8,7 +8,7 @@ type spanned<T> = {node: T, span: span};
type ident = str; type ident = str;
// Functions may or may not have names. // Functions may or may not have names.
type fn_ident = option::t<ident>; type fn_ident = option<ident>;
// FIXME: with typestate constraint, could say // FIXME: with typestate constraint, could say
// idents and types are the same length, and are // idents and types are the same length, and are
@ -87,7 +87,7 @@ enum meta_item_ {
type blk = spanned<blk_>; type blk = spanned<blk_>;
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}; id: node_id, rules: blk_check_mode};
type pat = {id: node_id, node: pat_, span: span}; type pat = {id: node_id, node: pat_, span: span};
@ -106,7 +106,7 @@ enum pat_ {
// After the resolution phase, code should never pattern- // After the resolution phase, code should never pattern-
// match on a pat directly! Always call pat_util::normalize_pat -- // match on a pat directly! Always call pat_util::normalize_pat --
// it turns any pat_idents that refer to nullary enums into pat_enums. // 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_enum(@path, [@pat]),
pat_rec([field_pat], bool), pat_rec([field_pat], bool),
pat_tup([@pat]), pat_tup([@pat]),
@ -180,7 +180,7 @@ enum init_op { init_assign, init_move, }
type initializer = {op: init_op, expr: @expr}; type initializer = {op: init_op, expr: @expr};
type local_ = // FIXME: should really be a refinement on pat type local_ = // FIXME: should really be a refinement on pat
{ty: @ty, pat: @pat, init: option::t<initializer>, id: node_id}; {ty: @ty, pat: @pat, init: option<initializer>, id: node_id};
type local = spanned<local_>; type local = spanned<local_>;
@ -190,7 +190,7 @@ enum let_style { let_copy, let_ref, }
enum decl_ { decl_local([(let_style, @local)]), decl_item(@item), } 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}; type field_ = {mut: mutability, ident: ident, expr: @expr};
@ -204,15 +204,15 @@ type expr = {id: node_id, node: expr_, span: span};
enum expr_ { enum expr_ {
expr_vec([@expr], mutability), expr_vec([@expr], mutability),
expr_rec([field], option::t<@expr>), expr_rec([field], option<@expr>),
expr_call(@expr, [@expr], bool), expr_call(@expr, [@expr], bool),
expr_tup([@expr]), expr_tup([@expr]),
expr_bind(@expr, [option::t<@expr>]), expr_bind(@expr, [option<@expr>]),
expr_binary(binop, @expr, @expr), expr_binary(binop, @expr, @expr),
expr_unary(unop, @expr), expr_unary(unop, @expr),
expr_lit(@lit), expr_lit(@lit),
expr_cast(@expr, @ty), expr_cast(@expr, @ty),
expr_if(@expr, blk, option::t<@expr>), expr_if(@expr, blk, option<@expr>),
expr_while(@expr, blk), expr_while(@expr, blk),
expr_for(@local, @expr, blk), expr_for(@local, @expr, blk),
expr_do_while(blk, @expr), expr_do_while(blk, @expr),
@ -233,10 +233,10 @@ enum expr_ {
expr_field(@expr, ident, [@ty]), expr_field(@expr, ident, [@ty]),
expr_index(@expr, @expr), expr_index(@expr, @expr),
expr_path(@path), expr_path(@path),
expr_fail(option::t<@expr>), expr_fail(option<@expr>),
expr_break, expr_break,
expr_cont, expr_cont,
expr_ret(option::t<@expr>), expr_ret(option<@expr>),
expr_be(@expr), expr_be(@expr),
expr_log(int, @expr, @expr), expr_log(int, @expr, @expr),
@ -248,7 +248,7 @@ enum expr_ {
/* FIXME Would be nice if expr_check desugared /* FIXME Would be nice if expr_check desugared
to expr_if_check. */ to expr_if_check. */
expr_if_check(@expr, blk, option::t<@expr>), expr_if_check(@expr, blk, option<@expr>),
expr_mac(mac), expr_mac(mac),
} }
@ -274,7 +274,7 @@ enum blk_sort {
type mac = spanned<mac_>; type mac = spanned<mac_>;
enum mac_ { enum mac_ {
mac_invoc(@path, @expr, option::t<str>), mac_invoc(@path, @expr, option<str>),
mac_embed_type(@ty), mac_embed_type(@ty),
mac_embed_block(blk), mac_embed_block(blk),
mac_ellipsis, mac_ellipsis,
@ -415,7 +415,7 @@ type native_mod =
type variant_arg = {ty: @ty, id: node_id}; type variant_arg = {ty: @ty, id: node_id};
type variant_ = {name: ident, attrs: [attribute], args: [variant_arg], 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<variant_>; type variant = spanned<variant_>;
@ -465,7 +465,7 @@ enum item_ {
item_res(fn_decl /* dtor */, [ty_param], blk, item_res(fn_decl /* dtor */, [ty_param], blk,
node_id /* dtor id */, node_id /* ctor id */), node_id /* dtor id */, node_id /* ctor id */),
item_iface([ty_param], [ty_method]), item_iface([ty_param], [ty_method]),
item_impl([ty_param], option::t<@ty> /* iface */, item_impl([ty_param], option<@ty> /* iface */,
@ty /* self */, [@method]), @ty /* self */, [@method]),
} }

View file

@ -203,7 +203,7 @@ fn block_from_expr(e: @expr) -> blk {
ret {node: blk_, span: e.span}; 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_ { blk_ {
{view_items: [], stmts: stmts1, expr: expr1, id: id1, rules: default_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 } if is_unguarded(a) { some(a.pats) } else { none }
} }

View file

@ -67,7 +67,7 @@ fn lookup_byte_pos(map: codemap, pos: uint) -> loc {
enum opt_span { 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_none,
os_some(@span), os_some(@span),
} }

View file

@ -6,10 +6,10 @@ import std::map::new_str_hash;
import codemap; import codemap;
type syntax_expander = type syntax_expander =
fn@(ext_ctxt, span, @ast::expr, option::t<str>) -> @ast::expr; fn@(ext_ctxt, span, @ast::expr, option<str>) -> @ast::expr;
type macro_def = {ident: str, ext: syntax_extension}; type macro_def = {ident: str, ext: syntax_extension};
type macro_definer = type macro_definer =
fn@(ext_ctxt, span, @ast::expr, option::t<str>) -> macro_def; fn@(ext_ctxt, span, @ast::expr, option<str>) -> macro_def;
enum syntax_extension { enum syntax_extension {
normal(syntax_expander), normal(syntax_expander),

View file

@ -3,7 +3,7 @@ import base::*;
import syntax::ast; import syntax::ast;
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr,
_body: option::t<str>) -> @ast::expr { _body: option<str>) -> @ast::expr {
let args: [@ast::expr] = let args: [@ast::expr] =
alt arg.node { alt arg.node {
ast::expr_vec(elts, _) { elts } ast::expr_vec(elts, _) { elts }

View file

@ -10,7 +10,7 @@ import base::*;
export expand_syntax_ext; export expand_syntax_ext;
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr,
_body: option::t<str>) -> @ast::expr { _body: option<str>) -> @ast::expr {
let args: [@ast::expr] = let args: [@ast::expr] =
alt arg.node { alt arg.node {
ast::expr_vec(elts, _) { elts } 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"); cx.span_fatal(sp, "malformed #env call");
} }
// FIXME: if this was more thorough it would manufacture an // FIXME: if this was more thorough it would manufacture an
// option::t<str> rather than just an maybe-empty string. // option<str> rather than just an maybe-empty string.
let var = expr_to_str(cx, args[0], "#env requires a string"); let var = expr_to_str(cx, args[0], "#env requires a string");
alt generic_os::getenv(var) { alt generic_os::getenv(var) {

View file

@ -13,7 +13,7 @@ import codemap::span;
export expand_syntax_ext; export expand_syntax_ext;
fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: @ast::expr, fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: @ast::expr,
_body: option::t<str>) -> @ast::expr { _body: option<str>) -> @ast::expr {
let args: [@ast::expr] = let args: [@ast::expr] =
alt arg.node { alt arg.node {
ast::expr_vec(elts, _) { elts } ast::expr_vec(elts, _) { elts }

View file

@ -3,7 +3,7 @@ import base::*;
import syntax::ast; import syntax::ast;
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr,
_body: option::t<str>) -> @ast::expr { _body: option<str>) -> @ast::expr {
let args: [@ast::expr] = let args: [@ast::expr] =
alt arg.node { alt arg.node {
ast::expr_vec(elts, _) { elts } ast::expr_vec(elts, _) { elts }

View file

@ -3,7 +3,7 @@ import syntax::ast;
import std::io::writer_util; import std::io::writer_util;
fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr, fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: @ast::expr,
_body: option::t<str>) -> @ast::expr { _body: option<str>) -> @ast::expr {
cx.print_backtrace(); cx.print_backtrace();
std::io::stdout().write_line(print::pprust::expr_to_str(arg)); std::io::stdout().write_line(print::pprust::expr_to_str(arg));

View file

@ -15,7 +15,7 @@ import ast::{ident, path, ty, blk_, expr, path_, expr_path,
export add_new_extension; export add_new_extension;
fn path_to_ident(pth: @path) -> option::t<ident> { fn path_to_ident(pth: @path) -> option<ident> {
if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u { if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u {
ret some(pth.node.idents[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), // If we want better match failure error messages (like in Fortifying Syntax),
// we'll want to return something indicating amount of progress and location // we'll want to return something indicating amount of progress and location
// of failure instead of `none`. // of failure instead of `none`.
type match_result = option::t<arb_depth<matchable>>; type match_result = option<arb_depth<matchable>>;
type selector = fn@(matchable) -> match_result; type selector = fn@(matchable) -> match_result;
fn elts_to_ell(cx: ext_ctxt, elts: [@expr]) -> 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 idx: uint = 0u;
let res = none; let res = none;
for elt: @expr in elts { for elt: @expr in elts {
@ -104,8 +104,8 @@ fn elts_to_ell(cx: ext_ctxt, elts: [@expr]) ->
} }
} }
fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> option::t<U>, v: [T]) -> fn option_flatten_map<T: copy, U: copy>(f: fn@(T) -> option<U>, v: [T]) ->
option::t<[U]> { option<[U]> {
let res = []; let res = [];
for elem: T in v { for elem: T in v {
alt f(elem) { none { ret none; } some(fv) { res += [fv]; } } 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 bindings. Most of the work is done in p_t_s, which generates the
selectors. */ selectors. */
fn use_selectors_to_bind(b: binders, e: @expr) -> option::t<bindings> { fn use_selectors_to_bind(b: binders, e: @expr) -> option<bindings> {
let res = new_str_hash::<arb_depth<matchable>>(); let res = new_str_hash::<arb_depth<matchable>>();
//need to do this first, to check vec lengths. //need to do this first, to check vec lengths.
for sel: selector in b.literal_ast_matchers { for sel: selector in b.literal_ast_matchers {
@ -223,8 +223,8 @@ fn follow(m: arb_depth<matchable>, idx_path: @mutable [uint]) ->
ret res; ret res;
} }
fn follow_for_trans(cx: ext_ctxt, mmaybe: option::t<arb_depth<matchable>>, fn follow_for_trans(cx: ext_ctxt, mmaybe: option<arb_depth<matchable>>,
idx_path: @mutable [uint]) -> option::t<matchable> { idx_path: @mutable [uint]) -> option<matchable> {
alt mmaybe { alt mmaybe {
none { ret none } none { ret none }
some(m) { some(m) {
@ -269,7 +269,7 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
alt repeat_me_maybe { alt repeat_me_maybe {
none { } none { }
some(repeat_me) { 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 /* we need to walk over all the free vars in lockstep, except for
the leaves, which are just duplicated */ the leaves, which are just duplicated */
free_vars(b, repeat_me) {|fv| 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<ident> { fn block_to_ident(blk: blk_) -> option<ident> {
if vec::len(blk.stmts) != 0u { ret none; } if vec::len(blk.stmts) != 0u { ret none; }
ret alt blk.expr { ret alt blk.expr {
some(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, fn add_new_extension(cx: ext_ctxt, sp: span, arg: @expr,
_body: option::t<str>) -> base::macro_def { _body: option<str>) -> base::macro_def {
let args: [@ast::expr] = let args: [@ast::expr] =
alt arg.node { alt arg.node {
ast::expr_vec(elts, _) { elts } 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<str> = none; let macro_name: option<str> = none;
let clauses: [@clause] = []; let clauses: [@clause] = [];
for arg: @expr in args { for arg: @expr in args {
alt arg.node { alt arg.node {
@ -751,7 +751,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: @expr,
ext: normal(ext)}; ext: normal(ext)};
fn generic_extension(cx: ext_ctxt, sp: span, arg: @expr, fn generic_extension(cx: ext_ctxt, sp: span, arg: @expr,
_body: option::t<str>, clauses: [@clause]) -> @expr { _body: option<str>, clauses: [@clause]) -> @expr {
for c: @clause in clauses { for c: @clause in clauses {
alt use_selectors_to_bind(c.params, arg) { alt use_selectors_to_bind(c.params, arg) {
some(bindings) { ret transcribe(cx, bindings, c.body); } some(bindings) { ret transcribe(cx, bindings, c.body); }

View file

@ -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], fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive],
prefix: str, suffix: option::t<str>) prefix: str, suffix: option<str>)
-> (ast::_mod, [ast::attribute]) { -> (ast::_mod, [ast::attribute]) {
#debug("eval crate prefix: %s", prefix); #debug("eval crate prefix: %s", prefix);
#debug("eval crate suffix: %s", #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 We build the path to the companion mod by combining the prefix and the
optional suffix then adding the .rs extension. optional suffix then adding the .rs extension.
*/ */
fn parse_companion_mod(cx: ctx, prefix: str, suffix: option::t<str>) fn parse_companion_mod(cx: ctx, prefix: str, suffix: option<str>)
-> ([@ast::view_item], [@ast::item], [ast::attribute]) { -> ([@ast::view_item], [@ast::item], [ast::attribute]) {
fn companion_file(prefix: str, suffix: option::t<str>) -> str { fn companion_file(prefix: str, suffix: option<str>) -> str {
ret alt suffix { ret alt suffix {
option::some(s) { fs::connect(prefix, s) } option::some(s) { fs::connect(prefix, s) }
option::none { prefix } option::none { prefix }

View file

@ -148,7 +148,7 @@ fn consume_block_comment(rdr: reader) {
be consume_whitespace_and_comments(rdr); be consume_whitespace_and_comments(rdr);
} }
fn scan_exponent(rdr: reader) -> option::t<str> { fn scan_exponent(rdr: reader) -> option<str> {
let c = rdr.curr; let c = rdr.curr;
let rslt = ""; let rslt = "";
if c == 'e' || c == 'E' { if c == 'e' || c == 'E' {

View file

@ -542,7 +542,7 @@ fn parse_fn_block_arg(p: parser) -> ast::arg {
ret {mode: m, ty: t, ident: i, id: p.get_id()}; ret {mode: m, ty: t, ident: i, id: p.get_id()};
} }
fn parse_seq_to_before_gt<T: copy>(sep: option::t<token::token>, fn parse_seq_to_before_gt<T: copy>(sep: option<token::token>,
f: fn(parser) -> T, f: fn(parser) -> T,
p: parser) -> [T] { p: parser) -> [T] {
let first = true; let first = true;
@ -559,7 +559,7 @@ fn parse_seq_to_before_gt<T: copy>(sep: option::t<token::token>,
ret v; ret v;
} }
fn parse_seq_to_gt<T: copy>(sep: option::t<token::token>, fn parse_seq_to_gt<T: copy>(sep: option<token::token>,
f: fn(parser) -> T, p: parser) -> [T] { f: fn(parser) -> T, p: parser) -> [T] {
let v = parse_seq_to_before_gt(sep, f, p); let v = parse_seq_to_before_gt(sep, f, p);
expect_gt(p); expect_gt(p);
@ -567,7 +567,7 @@ fn parse_seq_to_gt<T: copy>(sep: option::t<token::token>,
ret v; ret v;
} }
fn parse_seq_lt_gt<T: copy>(sep: option::t<token::token>, fn parse_seq_lt_gt<T: copy>(sep: option<token::token>,
f: fn(parser) -> T, f: fn(parser) -> T,
p: parser) -> spanned<[T]> { p: parser) -> spanned<[T]> {
let lo = p.span.lo; let lo = p.span.lo;
@ -586,7 +586,7 @@ fn parse_seq_to_end<T: copy>(ket: token::token, sep: seq_sep,
} }
type seq_sep = { type seq_sep = {
sep: option::t<token::token>, sep: option<token::token>,
trailing_opt: bool // is trailing separator optional? 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)); ret pexpr(mk_mac_expr(p, lo, p.span.hi, ast::mac_ellipsis));
} else if eat_word(p, "bind") { } else if eat_word(p, "bind") {
let e = parse_expr_res(p, RESTRICT_NO_CALL_EXPRS); 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 { alt p.token {
token::UNDERSCORE { p.bump(); ret none; } token::UNDERSCORE { p.bump(); ret none; }
_ { ret some(parse_expr(p)); } _ { ret some(parse_expr(p)); }
@ -1202,13 +1202,13 @@ fn parse_assign_expr(p: parser) -> @ast::expr {
fn parse_if_expr_1(p: parser) -> fn parse_if_expr_1(p: parser) ->
{cond: @ast::expr, {cond: @ast::expr,
then: ast::blk, then: ast::blk,
els: option::t<@ast::expr>, els: option<@ast::expr>,
lo: uint, lo: uint,
hi: uint} { hi: uint} {
let lo = p.last_span.lo; let lo = p.last_span.lo;
let cond = parse_expr(p); let cond = parse_expr(p);
let thn = parse_block(p); let thn = parse_block(p);
let els: option::t<@ast::expr> = none; let els: option<@ast::expr> = none;
let hi = thn.span.hi; let hi = thn.span.hi;
if eat_word(p, "else") { if eat_word(p, "else") {
let elexpr = parse_else_expr(p); let elexpr = parse_else_expr(p);
@ -1364,7 +1364,7 @@ fn parse_expr_res(p: parser, r: restriction) -> @ast::expr {
ret e; ret e;
} }
fn parse_initializer(p: parser) -> option::t<ast::initializer> { fn parse_initializer(p: parser) -> option<ast::initializer> {
alt p.token { alt p.token {
token::EQ { token::EQ {
p.bump(); 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") { if eat_word(p, "const") {
ret some(parse_item_const(p, attrs)); ret some(parse_item_const(p, attrs));
} else if eat_word(p, "inline") { } 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 // A type to distingush between the parsing of item attributes or syntax
// extensions, which both begin with token.POUND // extensions, which both begin with token.POUND
type attr_or_ext = option::t<either::t<[ast::attribute], @ast::expr>>; type attr_or_ext = option<either::t<[ast::attribute], @ast::expr>>;
fn parse_outer_attrs_or_ext( fn parse_outer_attrs_or_ext(
p: parser, p: parser,
@ -2292,7 +2292,7 @@ fn parse_use(p: parser) -> ast::view_item_ {
} }
fn parse_rest_import_name(p: parser, first: ast::ident, fn parse_rest_import_name(p: parser, first: ast::ident,
def_ident: option::t<ast::ident>) -> def_ident: option<ast::ident>) ->
ast::view_item_ { ast::view_item_ {
let identifiers: [ast::ident] = [first]; let identifiers: [ast::ident] = [first];
let glob: bool = false; let glob: bool = false;

View file

@ -28,9 +28,9 @@ fn no_ann() -> pp_ann {
type ps = type ps =
@{s: pp::printer, @{s: pp::printer,
cm: option::t<codemap>, cm: option<codemap>,
comments: option::t<[lexer::cmnt]>, comments: option<[lexer::cmnt]>,
literals: option::t<[lexer::lit]>, literals: option<[lexer::lit]>,
mutable cur_cmnt: uint, mutable cur_cmnt: uint,
mutable cur_lit: uint, mutable cur_lit: uint,
mutable boxes: [pp::breaks], 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, 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"); head(s, "if");
if chk { word_nbsp(s, "check"); } if chk { word_nbsp(s, "check"); }
print_maybe_parens_discrim(s, test); print_maybe_parens_discrim(s, test);
space(s.s); space(s.s);
print_block(s, blk); 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 { alt els {
some(_else) { some(_else) {
alt _else.node { alt _else.node {
@ -809,7 +809,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
} }
} }
ast::expr_bind(func, args) { 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 { alt expr {
some(expr) { print_expr(s, expr); } some(expr) { print_expr(s, expr); }
_ { word(s.s, "_"); } _ { word(s.s, "_"); }
@ -1411,8 +1411,8 @@ fn print_mt(s: ps, mt: ast::mt) {
} }
fn print_ty_fn(s: ps, opt_proto: option<ast::proto>, fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
decl: ast::fn_decl, id: option::t<ast::ident>, decl: ast::fn_decl, id: option<ast::ident>,
tps: option::t<[ast::ty_param]>) { tps: option<[ast::ty_param]>) {
ibox(s, indent_unit); ibox(s, indent_unit);
word(s.s, opt_proto_to_str(opt_proto)); word(s.s, opt_proto_to_str(opt_proto));
alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } } alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } }
@ -1442,7 +1442,7 @@ fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
} }
fn maybe_print_trailing_comment(s: ps, span: codemap::span, fn maybe_print_trailing_comment(s: ps, span: codemap::span,
next_pos: option::t<uint>) { next_pos: option<uint>) {
let cm; let cm;
alt s.cm { some(ccm) { cm = ccm; } _ { ret; } } alt s.cm { some(ccm) { cm = ccm; } _ { ret; } }
alt next_comment(s) { 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 lit_to_str(l: @ast::lit) -> str { be to_str(l, print_literal); }
fn next_lit(s: ps, pos: uint) -> option::t<lexer::lit> { fn next_lit(s: ps, pos: uint) -> option<lexer::lit> {
alt s.literals { alt s.literals {
some(lits) { some(lits) {
while s.cur_lit < vec::len(lits) { while s.cur_lit < vec::len(lits) {
@ -1621,7 +1621,7 @@ fn to_str<T>(t: T, f: fn@(ps, T)) -> str {
io::mem_buffer_str(buffer) io::mem_buffer_str(buffer)
} }
fn next_comment(s: ps) -> option::t<lexer::cmnt> { fn next_comment(s: ps) -> option<lexer::cmnt> {
alt s.comments { alt s.comments {
some(cmnts) { some(cmnts) {
if s.cur_cmnt < vec::len(cmnts) { if s.cur_cmnt < vec::len(cmnts) {

View file

@ -264,7 +264,7 @@ fn visit_decl<E>(d: @decl, e: E, v: vt<E>) {
} }
} }
fn visit_expr_opt<E>(eo: option::t<@expr>, e: E, v: vt<E>) { fn visit_expr_opt<E>(eo: option<@expr>, e: E, v: vt<E>) {
alt eo { none { } some(ex) { v.visit_expr(ex, e, v); } } alt eo { none { } some(ex) { v.visit_expr(ex, e, v); } }
} }
@ -295,7 +295,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
} }
expr_bind(callee, args) { expr_bind(callee, args) {
v.visit_expr(callee, e, v); 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_binary(_, a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
expr_unary(_, a) { v.visit_expr(a, e, v); } expr_unary(_, a) { v.visit_expr(a, e, v); }

View file

@ -18,9 +18,9 @@ export relative_target_lib_path;
export get_cargo_root; export get_cargo_root;
export libdir; export libdir;
type pick<T> = fn(path: fs::path) -> option::t<T>; type pick<T> = fn(path: fs::path) -> option<T>;
fn pick_file(file: fs::path, path: fs::path) -> option::t<fs::path> { fn pick_file(file: fs::path, path: fs::path) -> option<fs::path> {
if fs::basename(path) == file { option::some(path) } if fs::basename(path) == file { option::some(path) }
else { option::none } else { option::none }
} }
@ -32,7 +32,7 @@ iface filesearch {
fn get_target_lib_file_path(file: fs::path) -> fs::path; fn get_target_lib_file_path(file: fs::path) -> fs::path;
} }
fn mk_filesearch(maybe_sysroot: option::t<fs::path>, fn mk_filesearch(maybe_sysroot: option<fs::path>,
target_triple: str, target_triple: str,
addl_lib_search_paths: [fs::path]) -> filesearch { addl_lib_search_paths: [fs::path]) -> filesearch {
type filesearch_impl = {sysroot: fs::path, type filesearch_impl = {sysroot: fs::path,
@ -64,7 +64,7 @@ fn mk_filesearch(maybe_sysroot: option::t<fs::path>,
} }
// FIXME #1001: This can't be an obj method // FIXME #1001: This can't be an obj method
fn search<T: copy>(filesearch: filesearch, pick: pick<T>) -> option::t<T> { fn search<T: copy>(filesearch: filesearch, pick: pick<T>) -> option<T> {
for lib_search_path in filesearch.lib_search_paths() { for lib_search_path in filesearch.lib_search_paths() {
#debug("searching %s", lib_search_path); #debug("searching %s", lib_search_path);
for path in fs::list_dir(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>) -> fs::path { fn get_sysroot(maybe_sysroot: option<fs::path>) -> fs::path {
alt maybe_sysroot { alt maybe_sysroot {
option::some(sr) { sr } option::some(sr) { sr }
option::none { get_default_sysroot() } option::none { get_default_sysroot() }

View file

@ -33,7 +33,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
}; };
modestr + ty_to_str(cx, input.ty) modestr + ty_to_str(cx, input.ty)
} }
fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option::t<ast::ident>, fn fn_to_str(cx: ctxt, proto: ast::proto, ident: option<ast::ident>,
inputs: [arg], output: t, cf: ast::ret_style, inputs: [arg], output: t, cf: ast::ret_style,
constrs: [@constr]) -> str { constrs: [@constr]) -> str {
let s = proto_to_str(proto); let s = proto_to_str(proto);

View file

@ -24,9 +24,9 @@ type config =
stage_id: str, stage_id: str,
mode: mode, mode: mode,
run_ignored: bool, run_ignored: bool,
filter: option::t<str>, filter: option<str>,
runtool: option::t<str>, runtool: option<str>,
rustcflags: option::t<str>, rustcflags: option<str>,
verbose: bool}; verbose: bool};
type cx = {config: config, procsrv: procsrv::handle}; type cx = {config: config, procsrv: procsrv::handle};

View file

@ -84,11 +84,11 @@ fn log_config(config: config) {
logv(c, #fmt["\n"]); logv(c, #fmt["\n"]);
} }
fn opt_str(maybestr: option::t<str>) -> str { fn opt_str(maybestr: option<str>) -> str {
alt maybestr { option::some(s) { s } option::none { "(none)" } } alt maybestr { option::some(s) { s } option::none { "(none)" } }
} }
fn str_opt(maybestr: str) -> option::t<str> { fn str_opt(maybestr: str) -> option<str> {
if maybestr != "(none)" { option::some(maybestr) } else { option::none } if maybestr != "(none)" { option::some(maybestr) } else { option::none }
} }

View file

@ -14,10 +14,10 @@ type test_props = {
// Lines that should be expected, in order, on standard out // Lines that should be expected, in order, on standard out
error_patterns: [str], error_patterns: [str],
// Extra flags to pass to the compiler // Extra flags to pass to the compiler
compile_flags: option::t<str>, compile_flags: option<str>,
// If present, the name of a file that this test should match when // If present, the name of a file that this test should match when
// pretty-printed // pretty-printed
pp_exact: option::t<str> pp_exact: option<str>
}; };
// Load any test directives embedded in the file // 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<str> { fn parse_error_pattern(line: str) -> option<str> {
parse_name_value_directive(line, "error-pattern") parse_name_value_directive(line, "error-pattern")
} }
fn parse_compile_flags(line: str) -> option::t<str> { fn parse_compile_flags(line: str) -> option<str> {
parse_name_value_directive(line, "compile-flags") parse_name_value_directive(line, "compile-flags")
} }
fn parse_pp_exact(line: str, testfile: str) -> option::t<str> { fn parse_pp_exact(line: str, testfile: str) -> option<str> {
alt parse_name_value_directive(line, "pp-exact") { alt parse_name_value_directive(line, "pp-exact") {
option::some(s) { option::some(s) } option::some(s) { option::some(s) }
option::none { option::none {
@ -104,7 +104,7 @@ fn parse_name_directive(line: str, directive: str) -> bool {
} }
fn parse_name_value_directive(line: str, fn parse_name_value_directive(line: str,
directive: str) -> option::t<str> { directive: str) -> option<str> {
let keycolon = directive + ":"; let keycolon = directive + ":";
if str::find(line, keycolon) >= 0 { if str::find(line, keycolon) >= 0 {
let colon = str::find(line, keycolon) as uint; let colon = str::find(line, keycolon) as uint;

View file

@ -26,7 +26,7 @@ export reqchan;
type reqchan = chan<request>; type reqchan = chan<request>;
type handle = type handle =
{task: option::t<(task::task, port<task::task_notification>)>, {task: option<(task::task, port<task::task_notification>)>,
chan: reqchan}; chan: reqchan};
enum request { exec([u8], [u8], [[u8]], chan<response>), stop, } enum request { exec([u8], [u8], [[u8]], chan<response>), stop, }
@ -54,7 +54,7 @@ fn close(handle: handle) {
} }
fn run(handle: handle, lib_path: str, prog: str, args: [str], fn run(handle: handle, lib_path: str, prog: str, args: [str],
input: option::t<str>) -> {status: int, out: str, err: str} { input: option<str>) -> {status: int, out: str, err: str} {
let p = port(); let p = port();
let ch = chan(p); let ch = chan(p);
send(handle.chan, 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}; ret {status: status, out: output, err: errput};
} }
fn writeclose(fd: fd_t, s: option::t<str>) { fn writeclose(fd: fd_t, s: option<str>) {
if option::is_some(s) { if option::is_some(s) {
let writer = io::fd_writer(fd, false); let writer = io::fd_writer(fd, false);
writer.write_str(option::get(s)); writer.write_str(option::get(s));

View file

@ -298,7 +298,7 @@ fn exec_compiled_test(cx: cx, props: test_props, testfile: str) -> procres {
fn compose_and_run(cx: cx, testfile: str, fn compose_and_run(cx: cx, testfile: str,
make_args: fn@(config, str) -> procargs, lib_path: str, make_args: fn@(config, str) -> procargs, lib_path: str,
input: option::t<str>) -> procres { input: option<str>) -> procres {
let procargs = make_args(cx.config, testfile); let procargs = make_args(cx.config, testfile);
ret program_output(cx, testfile, lib_path, procargs.prog, procargs.args, ret program_output(cx, testfile, lib_path, procargs.prog, procargs.args,
input); 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))}; ret {prog: args[0], args: vec::slice(args, 1u, vec::len(args))};
} }
fn split_maybe_args(argstr: option::t<str>) -> [str] { fn split_maybe_args(argstr: option<str>) -> [str] {
fn rm_whitespace(v: [str]) -> [str] { fn rm_whitespace(v: [str]) -> [str] {
fn flt(&&s: str) -> option::t<str> { fn flt(&&s: str) -> option<str> {
if !is_whitespace(s) { option::some(s) } else { option::none } if !is_whitespace(s) { option::some(s) } else { option::none }
} }
@ -355,7 +355,7 @@ fn split_maybe_args(argstr: option::t<str>) -> [str] {
} }
fn program_output(cx: cx, testfile: str, lib_path: str, prog: str, fn program_output(cx: cx, testfile: str, lib_path: str, prog: str,
args: [str], input: option::t<str>) -> procres { args: [str], input: option<str>) -> procres {
let cmdline = let cmdline =
{ {
let cmdline = make_cmdline(lib_path, prog, args); let cmdline = make_cmdline(lib_path, prog, args);

View file

@ -1,6 +1,6 @@
// Top-level, visible-everywhere definitions. // 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. // enum constructors.
import option::{some, none}; import option::{some, none};

View file

@ -122,7 +122,7 @@ fn spawn(+f: fn~()) -> task {
} }
fn spawn_inner(-f: fn~(), fn spawn_inner(-f: fn~(),
notify: option<comm::chan<task_notification>>) -> task unsafe { notify: option::t<comm::chan<task_notification>>) -> task unsafe {
let closure: *rust_closure = unsafe::reinterpret_cast(ptr::addr_of(f)); let closure: *rust_closure = unsafe::reinterpret_cast(ptr::addr_of(f));
#debug("spawn: closure={%x,%x}", (*closure).fnptr, (*closure).envptr); #debug("spawn: closure={%x,%x}", (*closure).fnptr, (*closure).envptr);
let id = rustrt::new_task(); let id = rustrt::new_task();

View file

@ -46,7 +46,7 @@ enum t<T> {
t({ base: *mutable T, len: uint, rsrc: @dtor_res}) t({ base: *mutable T, len: uint, rsrc: @dtor_res})
} }
resource dtor_res(dtor: option::t<fn@()>) { resource dtor_res(dtor: option<fn@()>) {
alt dtor { alt dtor {
option::none { } option::none { }
option::some(f) { f(); } option::some(f) { f(); }

View file

@ -38,7 +38,7 @@ Function: create
// FIXME eventually, a proper datatype plus an exported impl would be // FIXME eventually, a proper datatype plus an exported impl would be
// preferrable // preferrable
fn create<T: copy>() -> t<T> { fn create<T: copy>() -> t<T> {
type cell<T> = option::t<T>; type cell<T> = option<T>;
let initial_capacity: uint = 32u; // 2^5 let initial_capacity: uint = 32u; // 2^5
/** /**

View file

@ -50,7 +50,7 @@ fn doc_at(data: @[u8], start: uint) -> doc {
ret {data: data, start: elt_size.next, end: end}; ret {data: data, start: elt_size.next, end: end};
} }
fn maybe_get_doc(d: doc, tg: uint) -> option::t<doc> { fn maybe_get_doc(d: doc, tg: uint) -> option<doc> {
let pos = d.start; let pos = d.start;
while pos < d.end { while pos < d.end {
let elt_tag = vint_at(*d.data, pos); let elt_tag = vint_at(*d.data, pos);

View file

@ -127,7 +127,7 @@ fn dylib_filename(base: str) -> str { ret "lib" + base + ".so"; }
/// Returns the directory containing the running program /// Returns the directory containing the running program
/// followed by a path separator /// followed by a path separator
fn get_exe_path() -> option::t<fs::path> unsafe { fn get_exe_path() -> option<fs::path> unsafe {
let bufsize = 1023u; let bufsize = 1023u;
// FIXME: path "strings" will likely need fixing... // FIXME: path "strings" will likely need fixing...
let path = str::from_bytes(vec::init_elt(bufsize, 0u8)); let path = str::from_bytes(vec::init_elt(bufsize, 0u8));

View file

@ -13,7 +13,7 @@ of features.
*/ */
import option::{some, none}; import option::{some, none};
import option = option::t; import option = option;
export treemap; export treemap;
export init; export init;

View file

@ -16,7 +16,7 @@ Function: getenv
Get the value of an environment variable Get the value of an environment variable
*/ */
fn getenv(n: str) -> option::t<str> { } fn getenv(n: str) -> option<str> { }
#[cfg(bogus)] #[cfg(bogus)]
/* /*
@ -29,7 +29,7 @@ fn setenv(n: str, v: str) { }
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")] #[cfg(target_os = "freebsd")]
fn getenv(n: str) -> option::t<str> unsafe { fn getenv(n: str) -> option<str> unsafe {
let s = str::as_buf(n, {|buf| os::libc::getenv(buf) }); let s = str::as_buf(n, {|buf| os::libc::getenv(buf) });
ret if unsafe::reinterpret_cast(s) == 0 { ret if unsafe::reinterpret_cast(s) == 0 {
option::none::<str> option::none::<str>
@ -55,7 +55,7 @@ fn setenv(n: str, v: str) {
} }
#[cfg(target_os = "win32")] #[cfg(target_os = "win32")]
fn getenv(n: str) -> option::t<str> { fn getenv(n: str) -> option<str> {
let nsize = 256u; let nsize = 256u;
while true { while true {
let v: [u8] = []; let v: [u8] = [];

View file

@ -148,7 +148,7 @@ fn name_str(nm: name) -> str {
ret alt nm { short(ch) { str::from_char(ch) } long(s) { s } }; ret alt nm { short(ch) { str::from_char(ch) } long(s) { s } };
} }
fn find_opt(opts: [opt], nm: name) -> option::t<uint> { fn find_opt(opts: [opt], nm: name) -> option<uint> {
vec::position_pred(opts, { |opt| opt.name == nm }) 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 Returns the string argument supplied to a matching option or none
*/ */
fn opt_maybe_str(m: match, nm: str) -> option::t<str> { fn opt_maybe_str(m: match, nm: str) -> option<str> {
let vals = opt_vals(m, nm); let vals = opt_vals(m, nm);
if vec::len::<optval>(vals) == 0u { ret none::<str>; } if vec::len::<optval>(vals) == 0u { ret none::<str>; }
ret alt vals[0] { val(s) { some::<str>(s) } _ { none::<str> } }; ret alt vals[0] { val(s) { some::<str>(s) } _ { none::<str> } };
@ -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 but no argument was provided, and the argument if the option was
present and an argument was provided. present and an argument was provided.
*/ */
fn opt_default(m: match, nm: str, def: str) -> option::t<str> { fn opt_default(m: match, nm: str, def: str) -> option<str> {
let vals = opt_vals(m, nm); let vals = opt_vals(m, nm);
if vec::len::<optval>(vals) == 0u { ret none::<str>; } if vec::len::<optval>(vals) == 0u { ret none::<str>; }
ret alt vals[0] { val(s) { some::<str>(s) } _ { some::<str>(def) } } ret alt vals[0] { val(s) { some::<str>(s) } _ { some::<str>(def) } }

View file

@ -525,13 +525,13 @@ mod fsync {
type arg<t> = { type arg<t> = {
val: t, val: t,
opt_level: option::t<level>, opt_level: option<level>,
fsync_fn: fn@(t, level) -> int fsync_fn: fn@(t, level) -> int
}; };
// fsync file after executing blk // fsync file after executing blk
// FIXME find better way to create resources within lifetime of outer res // FIXME find better way to create resources within lifetime of outer res
fn FILE_res_sync(&&file: FILE_res, opt_level: option::t<level>, fn FILE_res_sync(&&file: FILE_res, opt_level: option<level>,
blk: fn(&&res<os::libc::FILE>)) { blk: fn(&&res<os::libc::FILE>)) {
blk(res({ blk(res({
val: *file, opt_level: opt_level, val: *file, opt_level: opt_level,
@ -542,7 +542,7 @@ mod fsync {
} }
// fsync fd after executing blk // fsync fd after executing blk
fn fd_res_sync(&&fd: fd_res, opt_level: option::t<level>, fn fd_res_sync(&&fd: fd_res, opt_level: option<level>,
blk: fn(&&res<fd_t>)) { blk: fn(&&res<fd_t>)) {
blk(res({ blk(res({
val: *fd, opt_level: opt_level, val: *fd, opt_level: opt_level,
@ -556,7 +556,7 @@ mod fsync {
iface t { fn fsync(l: level) -> int; } iface t { fn fsync(l: level) -> int; }
// Call o.fsync after executing blk // Call o.fsync after executing blk
fn obj_sync(&&o: t, opt_level: option::t<level>, blk: fn(&&res<t>)) { fn obj_sync(&&o: t, opt_level: option<level>, blk: fn(&&res<t>)) {
blk(res({ blk(res({
val: o, opt_level: opt_level, val: o, opt_level: opt_level,
fsync_fn: fn@(&&o: t, l: level) -> int { ret o.fsync(l); } fsync_fn: fn@(&&o: t, l: level) -> int { ret o.fsync(l); }

View file

@ -74,7 +74,7 @@ fn rest(s: str) -> str {
str::char_slice(s, 1u, str::char_len(s)) str::char_slice(s, 1u, str::char_len(s))
} }
fn from_str_str(s: str) -> (option::t<json>, str) { fn from_str_str(s: str) -> (option<json>, str) {
let pos = 0u; let pos = 0u;
let len = str::byte_len(s); let len = str::byte_len(s);
let escape = false; let escape = false;
@ -107,7 +107,7 @@ fn from_str_str(s: str) -> (option::t<json>, str) {
ret (none, s); ret (none, s);
} }
fn from_str_list(s: str) -> (option::t<json>, str) { fn from_str_list(s: str) -> (option<json>, str) {
if str::char_at(s, 0u) != '[' { ret (none, s); } if str::char_at(s, 0u) != '[' { ret (none, s); }
let s0 = str::trim_left(rest(s)); let s0 = str::trim_left(rest(s));
let vals = []; let vals = [];
@ -133,7 +133,7 @@ fn from_str_list(s: str) -> (option::t<json>, str) {
ret (none, s0); ret (none, s0);
} }
fn from_str_dict(s: str) -> (option::t<json>, str) { fn from_str_dict(s: str) -> (option<json>, str) {
if str::char_at(s, 0u) != '{' { ret (none, s); } if str::char_at(s, 0u) != '{' { ret (none, s); }
let s0 = str::trim_left(rest(s)); let s0 = str::trim_left(rest(s));
let vals = map::new_str_hash::<json>(); let vals = map::new_str_hash::<json>();
@ -170,7 +170,7 @@ fn from_str_dict(s: str) -> (option::t<json>, str) {
(none, s) (none, s)
} }
fn from_str_float(s: str) -> (option::t<json>, str) { fn from_str_float(s: str) -> (option<json>, str) {
let pos = 0u; let pos = 0u;
let len = str::byte_len(s); let len = str::byte_len(s);
let res = 0f; let res = 0f;
@ -226,7 +226,7 @@ fn from_str_float(s: str) -> (option::t<json>, str) {
ret (some(num(neg * res)), str::char_slice(s, pos, str::char_len(s))); ret (some(num(neg * res)), str::char_slice(s, pos, str::char_len(s)));
} }
fn from_str_bool(s: str) -> (option::t<json>, str) { fn from_str_bool(s: str) -> (option<json>, str) {
if (str::starts_with(s, "true")) { if (str::starts_with(s, "true")) {
(some(boolean(true)), str::slice(s, 4u, str::byte_len(s))) (some(boolean(true)), str::slice(s, 4u, str::byte_len(s)))
} else if (str::starts_with(s, "false")) { } else if (str::starts_with(s, "false")) {
@ -236,7 +236,7 @@ fn from_str_bool(s: str) -> (option::t<json>, str) {
} }
} }
fn from_str_null(s: str) -> (option::t<json>, str) { fn from_str_null(s: str) -> (option<json>, str) {
if (str::starts_with(s, "null")) { if (str::starts_with(s, "null")) {
(some(null), str::slice(s, 4u, str::byte_len(s))) (some(null), str::slice(s, 4u, str::byte_len(s)))
} else { } else {
@ -244,7 +244,7 @@ fn from_str_null(s: str) -> (option::t<json>, str) {
} }
} }
fn from_str_helper(s: str) -> (option::t<json>, str) { fn from_str_helper(s: str) -> (option<json>, str) {
let s = str::trim_left(s); let s = str::trim_left(s);
if str::is_empty(s) { ret (none, s); } if str::is_empty(s) { ret (none, s); }
let start = str::char_at(s, 0u); let start = str::char_at(s, 0u);
@ -264,7 +264,7 @@ Function: from_str
Deserializes a json value from a string. Deserializes a json value from a string.
*/ */
fn from_str(s: str) -> option::t<json> { fn from_str(s: str) -> option<json> {
let (j, _) = from_str_helper(s); let (j, _) = from_str_helper(s);
j j
} }

View file

@ -123,7 +123,7 @@ fn dylib_filename(base: str) -> str { ret "lib" + base + ".so"; }
/// Returns the directory containing the running program /// Returns the directory containing the running program
/// followed by a path separator /// followed by a path separator
fn get_exe_path() -> option::t<fs::path> { fn get_exe_path() -> option<fs::path> {
let bufsize = 1023u; let bufsize = 1023u;
// FIXME: path "strings" will likely need fixing... // FIXME: path "strings" will likely need fixing...
let path = str::from_bytes(vec::init_elt(bufsize, 0u8)); let path = str::from_bytes(vec::init_elt(bufsize, 0u8));

View file

@ -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 When function `f` returns true then an option containing the element
is returned. If `f` matches no elements then none is returned. is returned. If `f` matches no elements then none is returned.
*/ */
fn find<T: copy, U: copy>(ls: list<T>, f: fn(T) -> option::t<U>) fn find<T: copy, U: copy>(ls: list<T>, f: fn(T) -> option<U>)
-> option::t<U> { -> option<U> {
let ls = ls; let ls = ls;
while true { while true {
alt ls { alt ls {
@ -259,7 +259,7 @@ mod tests {
#[test] #[test]
fn test_find_success() { fn test_find_success() {
fn match(&&i: int) -> option::t<int> { fn match(&&i: int) -> option<int> {
ret if i == 2 { option::some(i) } else { option::none::<int> }; ret if i == 2 { option::some(i) } else { option::none::<int> };
} }
let l = from_vec([0, 1, 2]); let l = from_vec([0, 1, 2]);
@ -268,7 +268,7 @@ mod tests {
#[test] #[test]
fn test_find_fail() { fn test_find_fail() {
fn match(&&_i: int) -> option::t<int> { ret option::none::<int>; } fn match(&&_i: int) -> option<int> { ret option::none::<int>; }
let l = from_vec([0, 1, 2]); let l = from_vec([0, 1, 2]);
let empty = list::nil::<int>; let empty = list::nil::<int>;
assert (list::find(l, match) == option::none::<int>); assert (list::find(l, match) == option::none::<int>);

View file

@ -131,7 +131,7 @@ fn target_os() -> str { ret "macos"; }
fn dylib_filename(base: str) -> str { ret "lib" + base + ".dylib"; } fn dylib_filename(base: str) -> str { ret "lib" + base + ".dylib"; }
fn get_exe_path() -> option::t<fs::path> { fn get_exe_path() -> option<fs::path> {
// FIXME: This doesn't handle the case where the buffer is too small // FIXME: This doesn't handle the case where the buffer is too small
// FIXME: path "strings" will likely need fixing... // FIXME: path "strings" will likely need fixing...
let bufsize = 1023u32; let bufsize = 1023u32;

View file

@ -75,14 +75,14 @@ iface map<K: copy, V: copy> {
Get the value for the specified key. If the key does not exist Get the value for the specified key. If the key does not exist
in the map then returns none. in the map then returns none.
*/ */
fn find(K) -> option::t<V>; fn find(K) -> option<V>;
/* /*
Method: remove Method: remove
Remove and return a value from the map. If the key does not exist Remove and return a value from the map. If the key does not exist
in the map then returns none. in the map then returns none.
*/ */
fn remove(K) -> option::t<V>; fn remove(K) -> option<V>;
/* /*
Method: items Method: items
@ -205,7 +205,7 @@ mod chained {
} }
} }
fn get<K: copy, V: copy>(tbl: t<K,V>, k: K) -> core::option::t<V> { fn get<K: copy, V: copy>(tbl: t<K,V>, k: K) -> core::option<V> {
alt search_tbl(tbl, k, tbl.hasher(k)) { alt search_tbl(tbl, k, tbl.hasher(k)) {
not_found { not_found {
ret core::option::none; ret core::option::none;
@ -221,7 +221,7 @@ mod chained {
} }
} }
fn remove<K: copy, V: copy>(tbl: t<K,V>, k: K) -> core::option::t<V> { fn remove<K: copy, V: copy>(tbl: t<K,V>, k: K) -> core::option<V> {
alt search_tbl(tbl, k, tbl.hasher(k)) { alt search_tbl(tbl, k, tbl.hasher(k)) {
not_found { not_found {
ret core::option::none; ret core::option::none;
@ -306,9 +306,9 @@ mod chained {
fn get(k: K) -> V { option::get(get(self, k)) } fn get(k: K) -> V { option::get(get(self, k)) }
fn find(k: K) -> option::t<V> { get(self, k) } fn find(k: K) -> option<V> { get(self, k) }
fn remove(k: K) -> option::t<V> { remove(self, k) } fn remove(k: K) -> option<V> { remove(self, k) }
fn items(blk: fn(K, V)) { items(self, blk); } fn items(blk: fn(K, V)) { items(self, blk); }

View file

@ -481,7 +481,7 @@ mod iterator {
node::content(x) { ret node::leaf_iterator::start(x) } node::content(x) { ret node::leaf_iterator::start(x) }
} }
} }
fn next(it: node::leaf_iterator::t) -> option::t<node::leaf> { fn next(it: node::leaf_iterator::t) -> option<node::leaf> {
ret node::leaf_iterator::next(it); ret node::leaf_iterator::next(it);
} }
} }
@ -492,7 +492,7 @@ mod iterator {
node::content(x) { ret node::char_iterator::start(x) } node::content(x) { ret node::char_iterator::start(x) }
} }
} }
fn next(it: node::char_iterator::t) -> option::t<char> { fn next(it: node::char_iterator::t) -> option<char> {
ret node::char_iterator::next(it) ret node::char_iterator::next(it)
} }
} }
@ -952,7 +952,7 @@ mod node {
- `option::some(x)` otherwise, in which case `x` has the same contents - `option::some(x)` otherwise, in which case `x` has the same contents
as `node` bot lower height and/or fragmentation. 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; } if height(node) < hint_max_node_height { ret option::none; }
//1. Gather all leaves as a forest //1. Gather all leaves as a forest
let forest = [mutable]; let forest = [mutable];
@ -1230,7 +1230,7 @@ mod node {
} }
} }
fn next(it: t) -> option::t<leaf> { fn next(it: t) -> option<leaf> {
if it.stackpos < 0 { ret option::none; } if it.stackpos < 0 { ret option::none; }
while true { while true {
let current = it.stack[it.stackpos]; let current = it.stack[it.stackpos];
@ -1254,7 +1254,7 @@ mod node {
mod char_iterator { mod char_iterator {
type t = { type t = {
leaf_iterator: leaf_iterator::t, leaf_iterator: leaf_iterator::t,
mutable leaf: option::t<leaf>, mutable leaf: option<leaf>,
mutable leaf_byte_pos: uint mutable leaf_byte_pos: uint
}; };
@ -1274,7 +1274,7 @@ mod node {
} }
} }
fn next(it: t) -> option::t<char> { fn next(it: t) -> option<char> {
while true { while true {
alt(get_current_or_next_leaf(it)) { alt(get_current_or_next_leaf(it)) {
option::none { ret option::none; } option::none { ret option::none; }
@ -1294,7 +1294,7 @@ mod node {
fail;//unreachable fail;//unreachable
} }
fn get_current_or_next_leaf(it: t) -> option::t<leaf> { fn get_current_or_next_leaf(it: t) -> option<leaf> {
alt(it.leaf) { alt(it.leaf) {
option::some(_) { ret it.leaf } option::some(_) { ret it.leaf }
option::none { option::none {
@ -1311,7 +1311,7 @@ mod node {
} }
} }
fn get_next_char_in_leaf(it: t) -> option::t<char> { fn get_next_char_in_leaf(it: t) -> option<char> {
alt(it.leaf) { alt(it.leaf) {
option::none { ret option::none } option::none { ret option::none }
option::some(aleaf) { option::some(aleaf) {

View file

@ -12,7 +12,7 @@ import core::option::{some, none};
/* /*
Type: smallintmap Type: smallintmap
*/ */
type smallintmap<T> = @{mutable v: [mutable option::t<T>]}; type smallintmap<T> = @{mutable v: [mutable option<T>]};
/* /*
Function: mk Function: mk
@ -20,7 +20,7 @@ Function: mk
Create a smallintmap Create a smallintmap
*/ */
fn mk<T>() -> smallintmap<T> { fn mk<T>() -> smallintmap<T> {
let v: [mutable option::t<T>] = [mutable]; let v: [mutable option<T>] = [mutable];
ret @{mutable v: v}; 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. the specified key then the original value is replaced.
*/ */
fn insert<T: copy>(m: smallintmap<T>, key: uint, val: T) { fn insert<T: copy>(m: smallintmap<T>, key: uint, val: T) {
vec::grow_set::<option::t<T>>(m.v, key, none::<T>, some::<T>(val)); vec::grow_set::<option<T>>(m.v, key, none::<T>, some::<T>(val));
} }
/* /*
@ -40,8 +40,8 @@ Function: find
Get the value for the specified key. If the key does not exist Get the value for the specified key. If the key does not exist
in the map then returns none in the map then returns none
*/ */
fn find<T: copy>(m: smallintmap<T>, key: uint) -> option::t<T> { fn find<T: copy>(m: smallintmap<T>, key: uint) -> option<T> {
if key < vec::len::<option::t<T>>(m.v) { ret m.v[key]; } if key < vec::len::<option<T>>(m.v) { ret m.v[key]; }
ret none::<T>; ret none::<T>;
} }
@ -73,11 +73,11 @@ fn contains_key<T: copy>(m: smallintmap<T>, key: uint) -> bool {
// FIXME: Are these really useful? // FIXME: Are these really useful?
fn truncate<T: copy>(m: smallintmap<T>, len: uint) { fn truncate<T: copy>(m: smallintmap<T>, len: uint) {
m.v = vec::slice_mut::<option::t<T>>(m.v, 0u, len); m.v = vec::slice_mut::<option<T>>(m.v, 0u, len);
} }
fn max_key<T>(m: smallintmap<T>) -> uint { fn max_key<T>(m: smallintmap<T>) -> uint {
ret vec::len::<option::t<T>>(m.v); ret vec::len::<option<T>>(m.v);
} }
/* /*
@ -98,7 +98,7 @@ impl <V: copy> of map::map<uint, V> for smallintmap<V> {
insert(self, key, value); insert(self, key, value);
ret !exists; ret !exists;
} }
fn remove(&&key: uint) -> option::t<V> { fn remove(&&key: uint) -> option<V> {
if key >= vec::len(self.v) { ret none; } if key >= vec::len(self.v) { ret none; }
let old = self.v[key]; let old = self.v[key];
self.v[key] = none; self.v[key] = none;
@ -108,7 +108,7 @@ impl <V: copy> of map::map<uint, V> for smallintmap<V> {
contains_key(self, key) contains_key(self, key)
} }
fn get(&&key: uint) -> V { get(self, key) } fn get(&&key: uint) -> V { get(self, key) }
fn find(&&key: uint) -> option::t<V> { find(self, key) } fn find(&&key: uint) -> option<V> { find(self, key) }
fn rehash() { fail } fn rehash() { fail }
fn items(it: fn(&&uint, V)) { fn items(it: fn(&&uint, V)) {
let idx = 0u; let idx = 0u;

View file

@ -12,7 +12,7 @@ import rand;
/* /*
Function: mkdtemp Function: mkdtemp
*/ */
fn mkdtemp(prefix: str, suffix: str) -> option::t<str> { fn mkdtemp(prefix: str, suffix: str) -> option<str> {
let r = rand::mk_rng(); let r = rand::mk_rng();
let i = 0u; let i = 0u;
while (i < 1000u) { while (i < 1000u) {

View file

@ -56,7 +56,7 @@ fn test_main(args: [str], tests: [test_desc]) {
if !run_tests_console(opts, tests) { fail "Some tests failed"; } if !run_tests_console(opts, tests) { fail "Some tests failed"; }
} }
type test_opts = {filter: option::t<str>, run_ignored: bool}; type test_opts = {filter: option<str>, run_ignored: bool};
type opt_res = either::t<test_opts, str>; type opt_res = either::t<test_opts, str>;
@ -248,7 +248,7 @@ fn filter_tests(opts: test_opts,
}; };
fn filter_fn(test: test_desc, filter_str: str) -> fn filter_fn(test: test_desc, filter_str: str) ->
option::t<test_desc> { option<test_desc> {
if str::find(test.name, filter_str) >= 0 { if str::find(test.name, filter_str) >= 0 {
ret option::some(test); ret option::some(test);
} else { ret option::none; } } else { ret option::none; }
@ -263,7 +263,7 @@ fn filter_tests(opts: test_opts,
filtered = if !opts.run_ignored { filtered = if !opts.run_ignored {
filtered filtered
} else { } else {
fn filter(test: test_desc) -> option::t<test_desc> { fn filter(test: test_desc) -> option<test_desc> {
if test.ignore { if test.ignore {
ret option::some({name: test.name, ret option::some({name: test.name,
fn: test.fn, fn: test.fn,

View file

@ -10,7 +10,7 @@ red-black tree or something else.
*/ */
import core::option::{some, none}; import core::option::{some, none};
import option = core::option::t; import option = core::option;
export treemap; export treemap;
export init; export init;

View file

@ -6,7 +6,7 @@ import option::{some, none};
// A very naive implementation of union-find with unsigned integer nodes. // 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 // Maintains the invariant that the root of a node is always equal to or less
// than the node itself. // than the node itself.
type node = option::t<uint>; type node = option<uint>;
type ufind = {mutable nodes: [mutable node]}; type ufind = {mutable nodes: [mutable node]};

View file

@ -111,7 +111,7 @@ fn waitpid(pid: pid_t) -> i32 { ret rustrt::rust_process_wait(pid); }
fn getcwd() -> str { ret rustrt::rust_getcwd(); } fn getcwd() -> str { ret rustrt::rust_getcwd(); }
fn get_exe_path() -> option::t<fs::path> { fn get_exe_path() -> option<fs::path> {
// FIXME: This doesn't handle the case where the buffer is too small // FIXME: This doesn't handle the case where the buffer is too small
// FIXME: path "strings" will likely need fixing... // FIXME: path "strings" will likely need fixing...
let bufsize = 1023u; let bufsize = 1023u;

View file

@ -12,7 +12,7 @@
use std; use std;
import option = option::t; import option = option;
import option::some; import option::some;
import option::none; import option::none;
import str; import str;

View file

@ -10,7 +10,7 @@
use std; use std;
import option = option::t; import option = option;
import option::{some, none}; import option::{some, none};
import std::{map, io, time}; import std::{map, io, time};
import io::reader_util; import io::reader_util;

View file

@ -6,7 +6,7 @@ import option::some;
// error-pattern: mismatched types // 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; } } } fn foo(t: bar) -> int { alt t { t1(_, some(x)) { ret x * 3; } _ { fail; } } }

View file

@ -5,7 +5,7 @@ import option::some;
// error-pattern: mismatched types // error-pattern: mismatched types
enum bar { t1((), option::t<[int]>), t2, } enum bar { t1((), option<[int]>), t2, }
fn foo(t: bar) { fn foo(t: bar) {
alt t { alt t {

View file

@ -1,6 +1,6 @@
// -*- rust -*- // -*- rust -*-
// xfail-test // xfail-test
// error-pattern:option::t // error-pattern:option
use std; use std;
import vec::*; import vec::*;

View file

@ -7,9 +7,9 @@ import option::none;
enum sty { ty_nil, } enum sty { ty_nil, }
type raw_t = {struct: sty, cname: option::t<str>, hash: uint}; type raw_t = {struct: sty, cname: option<str>, hash: uint};
fn mk_raw_ty(st: sty, cname: option::t<str>) -> raw_t { fn mk_raw_ty(st: sty, cname: option<str>) -> raw_t {
ret {struct: st, cname: cname, hash: 0u}; ret {struct: st, cname: cname, hash: 0u};
} }

View file

@ -1,11 +1,8 @@
use std; use std;
import option; import option;
import option::t;
import option::none;
import option::some;
fn foo<T>(y: option::t<T>) { fn foo<T>(y: option<T>) {
let x: int; let x: int;
let rs: [int] = []; let rs: [int] = [];
/* tests that x doesn't get put in the precondition for the /* tests that x doesn't get put in the precondition for the

View file

@ -6,7 +6,7 @@
use std; use std;
import option = option::t; import option = option;
import option::some; import option::some;
import option::none; import option::none;
import str; import str;

View file

@ -1,7 +1,7 @@
use std; use std;
import option; import option;
fn f<T>(&o: option::t<T>) { fn f<T>(&o: option<T>) {
assert o == option::none; assert o == option::none;
} }

View file

@ -6,7 +6,7 @@ import option;
import option::some; import option::some;
import option::none; import option::none;
enum t { foo(int, uint), bar(int, option::t<int>), } enum t { foo(int, uint), bar(int, option<int>), }
fn nested(o: t) { fn nested(o: t) {
alt o { alt o {

View file

@ -9,7 +9,7 @@ import option;
enum opt_span { 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_none,
os_some(@span), os_some(@span),
} }