diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-09-21 19:37:57 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-23 17:15:00 -0700 |
| commit | 4a78f9b16620489855da93c19be56f59431416f6 (patch) | |
| tree | 4b164738698203f474003682d5f0a5e23aa13377 /src/rustc | |
| parent | 92752a462a055d6478bd96dab37a740514992106 (diff) | |
| download | rust-4a78f9b16620489855da93c19be56f59431416f6.tar.gz rust-4a78f9b16620489855da93c19be56f59431416f6.zip | |
core: Demode option
Diffstat (limited to 'src/rustc')
33 files changed, 111 insertions, 111 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index c2d4925838e..22d7451c6ae 100644 --- a/src/rustc/back/link.rs +++ b/src/rustc/back/link.rs @@ -688,7 +688,7 @@ fn link_binary(sess: session, } let dir = cratepath.dirname(); if dir != ~"" { vec::push(cc_args, ~"-L" + dir); } - let libarg = unlib(sess.targ_cfg, option::get(cratepath.filestem())); + let libarg = unlib(sess.targ_cfg, cratepath.filestem().get()); vec::push(cc_args, ~"-l" + libarg); } @@ -717,7 +717,7 @@ fn link_binary(sess: session, // be rpathed if sess.targ_cfg.os == session::os_macos { vec::push(cc_args, ~"-Wl,-install_name,@rpath/" - + option::get(output.filename())); + + output.filename().get()); } } diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index d0f281f8128..6fe6cab58e0 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -254,7 +254,7 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg, time(time_passes, ~"lint checking", || lint::check_crate(ty_cx, crate)); if upto == cu_no_trans { return {crate: crate, tcx: Some(ty_cx)}; } - let outputs = option::get(outputs); + let outputs = outputs.get(); let maps = {mutbl_map: mutbl_map, root_map: root_map, @@ -353,7 +353,7 @@ fn pretty_print_input(sess: session, cfg: ast::crate_cfg, input: input, let ann = match ppm { ppm_typed => { {pre: ann_paren_for_expr, - post: |a| ann_typed_post(option::get(tcx), a) } + post: |a| ann_typed_post(tcx.get(), a) } } ppm_identified | ppm_expanded_identified => { {pre: ann_paren_for_expr, post: ann_identified_post} @@ -516,7 +516,7 @@ fn build_session_options(binary: ~str, let extra_debuginfo = opt_present(matches, ~"xg"); let debuginfo = opt_present(matches, ~"g") || extra_debuginfo; let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot"); - let sysroot_opt = option::map(sysroot_opt, |m| Path(m)); + let sysroot_opt = sysroot_opt.map(|m| Path(m)); let target_opt = getopts::opt_maybe_str(matches, ~"target"); let save_temps = getopts::opt_present(matches, ~"save-temps"); match output_type { @@ -695,7 +695,7 @@ fn build_output_filenames(input: input, }; let stem = match input { - file_input(ifile) => option::get(ifile.filestem()), + file_input(ifile) => ifile.filestem().get(), str_input(_) => ~"rust_out" }; diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs index dff272ee9be..3d055237669 100644 --- a/src/rustc/driver/rustc.rs +++ b/src/rustc/driver/rustc.rs @@ -171,12 +171,12 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) { let sopts = build_session_options(binary, matches, demitter); let sess = build_session(sopts, demitter); let odir = getopts::opt_maybe_str(matches, ~"out-dir"); - let odir = option::map(odir, |o| Path(o)); + let odir = odir.map(|o| Path(o)); let ofile = getopts::opt_maybe_str(matches, ~"o"); - let ofile = option::map(ofile, |o| Path(o)); + let ofile = ofile.map(|o| Path(o)); let cfg = build_configuration(sess, binary, input); let pretty = - option::map(getopts::opt_default(matches, ~"pretty", + option::map(&getopts::opt_default(matches, ~"pretty", ~"normal"), |a| parse_pretty(sess, a) ); match pretty { diff --git a/src/rustc/front/config.rs b/src/rustc/front/config.rs index 792d944169a..4c262e3dc65 100644 --- a/src/rustc/front/config.rs +++ b/src/rustc/front/config.rs @@ -104,7 +104,7 @@ fn fold_block(cx: ctxt, b: ast::blk_, fld: fold::ast_fold) -> let filtered_stmts = vec::filter_map(b.stmts, filter); return {view_items: b.view_items, stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)), - expr: option::map(b.expr, |x| fld.fold_expr(x)), + expr: option::map(&b.expr, |x| fld.fold_expr(x)), id: b.id, rules: b.rules}; } diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index dd90168d5c0..cb304c419e5 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -176,7 +176,7 @@ fn get_dep_hashes(cstore: cstore) -> ~[~str] { } fn get_path(cstore: cstore, d: ast::def_id) -> ~[~str] { - option::map_default(p(cstore).mod_path_map.find(d), ~[], + option::map_default(&p(cstore).mod_path_map.find(d), ~[], |ds| str::split_str(*ds, ~"::")) } // Local Variables: diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index 51c6b6148ce..181b8c6f104 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -92,7 +92,7 @@ fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option<ebml::Doc> { } fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc { - return option::get(maybe_find_item(item_id, items)); + return maybe_find_item(item_id, items).get(); } // Looks up an item in the given metadata and returns an ebml doc pointing @@ -202,7 +202,7 @@ fn each_reexport(d: ebml::Doc, f: fn(ebml::Doc) -> bool) { fn field_mutability(d: ebml::Doc) -> ast::class_mutability { // Use maybe_get_doc in case it's a method option::map_default( - ebml::maybe_get_doc(d, tag_class_mut), + &ebml::maybe_get_doc(d, tag_class_mut), ast::class_immutable, |d| { match ebml::doc_as_u8(d) as char { @@ -213,7 +213,7 @@ fn field_mutability(d: ebml::Doc) -> ast::class_mutability { } fn variant_disr_val(d: ebml::Doc) -> Option<int> { - do option::chain(ebml::maybe_get_doc(d, tag_disr_val)) |val_doc| { + do option::chain(&ebml::maybe_get_doc(d, tag_disr_val)) |val_doc| { int::parse_bytes(ebml::doc_data(val_doc), 10u) } } @@ -384,7 +384,7 @@ fn get_impl_method(intr: ident_interner, cdata: cmd, id: ast::node_id, found = Some(translate_def_id(cdata, m_did)); } } - option::get(found) + found.get() } fn get_class_method(intr: ident_interner, cdata: cmd, id: ast::node_id, diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 91d7c723694..3424ea8dd57 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -602,7 +602,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item, struct_def.fields, struct_def.methods, index); /* Encode the dtor */ - do option::iter(struct_def.dtor) |dtor| { + do struct_def.dtor.iter |dtor| { vec::push(*index, {val: dtor.node.id, pos: ebml_w.writer.tell()}); encode_info_for_ctor(ecx, ebml_w, dtor.node.id, ecx.tcx.sess.ident_of( @@ -635,7 +635,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item, } /* Encode the dtor */ /* Encode id for dtor */ - do option::iter(struct_def.dtor) |dtor| { + do struct_def.dtor.iter |dtor| { do ebml_w.wr_tag(tag_item_dtor) { encode_def_id(ebml_w, local_def(dtor.node.id)); } diff --git a/src/rustc/metadata/filesearch.rs b/src/rustc/metadata/filesearch.rs index 25abcb1b7eb..77d06bd2d29 100644 --- a/src/rustc/metadata/filesearch.rs +++ b/src/rustc/metadata/filesearch.rs @@ -74,7 +74,7 @@ fn search<T: Copy>(filesearch: filesearch, pick: pick<T>) -> Option<T> { for os::list_dir_path(lib_search_path).each |path| { debug!("testing %s", path.to_str()); let maybe_picked = pick(*path); - if option::is_some(maybe_picked) { + if maybe_picked.is_some() { debug!("picked %s", path.to_str()); rslt = maybe_picked; break; @@ -82,7 +82,7 @@ fn search<T: Copy>(filesearch: filesearch, pick: pick<T>) -> Option<T> { debug!("rejected %s", path.to_str()); } } - if option::is_some(rslt) { break; } + if rslt.is_some() { break; } } return rslt; } diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index c45b189d697..e11793a36d0 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -75,7 +75,7 @@ fn find_library_crate_aux(cx: ctxt, let mut matches = ~[]; filesearch::search(filesearch, |path| { debug!("inspecting file %s", path.to_str()); - let f: ~str = option::get(path.filename()); + let f: ~str = path.filename().get(); if !(str::starts_with(f, prefix) && str::ends_with(f, suffix)) { debug!("skipping %s, doesn't look like %s*%s", path.to_str(), prefix, suffix); diff --git a/src/rustc/middle/astencode.rs b/src/rustc/middle/astencode.rs index 4678b1cb90a..acb7bb1bf2c 100644 --- a/src/rustc/middle/astencode.rs +++ b/src/rustc/middle/astencode.rs @@ -719,7 +719,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, debug!("Encoding side tables for id %d", id); - do option::iter(tcx.def_map.find(id)) |def| { + do option::iter(&tcx.def_map.find(id)) |def| { do ebml_w.tag(c::tag_table_def) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -727,7 +727,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } } } - do option::iter((*tcx.node_types).find(id as uint)) |ty| { + do option::iter(&(*tcx.node_types).find(id as uint)) |ty| { do ebml_w.tag(c::tag_table_node_type) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -736,7 +736,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } } - do option::iter(tcx.node_type_substs.find(id)) |tys| { + do option::iter(&tcx.node_type_substs.find(id)) |tys| { do ebml_w.tag(c::tag_table_node_type_subst) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -745,7 +745,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } } - do option::iter(tcx.freevars.find(id)) |fv| { + do option::iter(&tcx.freevars.find(id)) |fv| { do ebml_w.tag(c::tag_table_freevars) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -757,7 +757,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } let lid = {crate: ast::local_crate, node: id}; - do option::iter(tcx.tcache.find(lid)) |tpbt| { + do option::iter(&tcx.tcache.find(lid)) |tpbt| { do ebml_w.tag(c::tag_table_tcache) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -766,7 +766,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } } - do option::iter(tcx.ty_param_bounds.find(id)) |pbs| { + do option::iter(&tcx.ty_param_bounds.find(id)) |pbs| { do ebml_w.tag(c::tag_table_param_bounds) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -789,13 +789,13 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, // } //} - do option::iter(maps.mutbl_map.find(id)) |_m| { + do option::iter(&maps.mutbl_map.find(id)) |_m| { do ebml_w.tag(c::tag_table_mutbl) { ebml_w.id(id); } } - do option::iter(maps.last_use_map.find(id)) |m| { + do option::iter(&maps.last_use_map.find(id)) |m| { do ebml_w.tag(c::tag_table_last_use) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -806,7 +806,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } } - do option::iter(maps.method_map.find(id)) |mme| { + do option::iter(&maps.method_map.find(id)) |mme| { do ebml_w.tag(c::tag_table_method_map) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -815,7 +815,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } } - do option::iter(maps.vtable_map.find(id)) |dr| { + do option::iter(&maps.vtable_map.find(id)) |dr| { do ebml_w.tag(c::tag_table_vtable_map) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { @@ -824,7 +824,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, } } - do option::iter(tcx.adjustments.find(id)) |adj| { + do option::iter(&tcx.adjustments.find(id)) |adj| { do ebml_w.tag(c::tag_table_adjustments) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs index e01790641f0..a0f8ad4a4d4 100644 --- a/src/rustc/middle/check_alt.rs +++ b/src/rustc/middle/check_alt.rs @@ -67,7 +67,7 @@ fn check_arms(tcx: ty::ctxt, arms: ~[arm]) { } _ => () } - if option::is_none(arm.guard) { vec::push(seen, v); } + if arm.guard.is_none() { vec::push(seen, v); } } } } @@ -233,7 +233,7 @@ fn is_useful_specialized(tcx: ty::ctxt, m: matrix, v: ~[@pat], ctor: ctor, arity: uint, lty: ty::t) -> useful { let ms = vec::filter_map(m, |r| specialize(tcx, r, ctor, arity, lty) ); let could_be_useful = is_useful( - tcx, ms, option::get(specialize(tcx, v, ctor, arity, lty))); + tcx, ms, specialize(tcx, v, ctor, arity, lty).get()); match could_be_useful { useful_ => useful(lty, ctor), u => u @@ -287,7 +287,7 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> Option<ctor> { ty::ty_enum(eid, _) => { let mut found = ~[]; for m.each |r| { - do option::iter(pat_ctor_id(tcx, r[0])) |id| { + do option::iter(&pat_ctor_id(tcx, r[0])) |id| { if !vec::contains(found, id) { vec::push(found, id); } } } diff --git a/src/rustc/middle/check_const.rs b/src/rustc/middle/check_const.rs index 0a1de0d11a4..e194a907ffd 100644 --- a/src/rustc/middle/check_const.rs +++ b/src/rustc/middle/check_const.rs @@ -27,7 +27,7 @@ fn check_item(sess: session, ast_map: ast_map::map, } item_enum(enum_definition, _) => { for enum_definition.variants.each |var| { - do option::iter(var.node.disr_expr) |ex| { + do option::iter(&var.node.disr_expr) |ex| { v.visit_expr(ex, true, v); } } diff --git a/src/rustc/middle/const_eval.rs b/src/rustc/middle/const_eval.rs index e26b3e55eed..b0206d4b95f 100644 --- a/src/rustc/middle/const_eval.rs +++ b/src/rustc/middle/const_eval.rs @@ -375,7 +375,7 @@ fn lit_to_const(lit: @lit) -> const_val { lit_int(n, _) => const_int(n), lit_uint(n, _) => const_uint(n), lit_int_unsuffixed(n) => const_int(n), - lit_float(n, _) => const_float(option::get(float::from_str(*n)) as f64), + lit_float(n, _) => const_float(float::from_str(*n).get() as f64), lit_nil => const_int(0i64), lit_bool(b) => const_bool(b) } diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index b5bd685d835..0f918ba92a9 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -248,7 +248,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) { }; // Handle any kind bounds on type parameters - do option::iter(cx.tcx.node_type_substs.find(id_to_use)) |ts| { + do option::iter(&cx.tcx.node_type_substs.find(id_to_use)) |ts| { let bounds = match e.node { expr_path(_) => { let did = ast_util::def_id_of_def(cx.tcx.def_map.get(e.id)); @@ -373,7 +373,7 @@ fn check_stmt(stmt: @stmt, cx: ctx, v: visit::vt<ctx>) { fn check_ty(aty: @ty, cx: ctx, v: visit::vt<ctx>) { match aty.node { ty_path(_, id) => { - do option::iter(cx.tcx.node_type_substs.find(id)) |ts| { + do option::iter(&cx.tcx.node_type_substs.find(id)) |ts| { let did = ast_util::def_id_of_def(cx.tcx.def_map.get(id)); let bounds = ty::lookup_item_type(cx.tcx, did).bounds; do vec::iter2(ts, *bounds) |ty, bound| { diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 293c23d84d1..1d6a8d8a630 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -1168,7 +1168,7 @@ impl Resolver { // Record the def ID of this struct. self.structs.insert(local_def(item.id), - is_some(struct_definition.ctor)); + struct_definition.ctor.is_some()); visit_item(item, new_parent, visitor); } @@ -1607,7 +1607,7 @@ impl Resolver { let modules = HashMap(); // Create all the items reachable by paths. - for each_path(self.session.cstore, get(root.def_id).crate) + for each_path(self.session.cstore, root.def_id.get().crate) |path_entry| { debug!("(building reduced graph for external crate) found path \ diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index 07727113741..203074a2c1d 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -354,7 +354,7 @@ fn enter_opt(bcx: block, m: &[@Match/&r], opt: &Opt, col: uint, match p.node { ast::pat_enum(_, subpats) => { if opt_eq(tcx, &variant_opt(tcx, p.id), opt) { - Some(option::get_default(subpats, + Some(option::get_default(&subpats, vec::from_elem(variant_size, dummy))) } else { @@ -872,12 +872,12 @@ fn compile_submatch(bcx: block, /* For an empty match, a fall-through case must exist */ - assert(m.len() > 0u || is_some(chk)); + assert(m.len() > 0u || chk.is_some()); let _icx = bcx.insn_ctxt("alt::compile_submatch"); let mut bcx = bcx; let tcx = bcx.tcx(), dm = tcx.def_map; if m.len() == 0u { - Br(bcx, option::get(chk)()); + Br(bcx, chk.get()()); return; } if m[0].pats.len() == 0u { @@ -1019,7 +1019,7 @@ fn compile_submatch(bcx: block, }; let defaults = enter_default(else_cx, dm, m, col, val); - let exhaustive = option::is_none(chk) && defaults.len() == 0u; + let exhaustive = chk.is_none() && defaults.len() == 0u; let len = opts.len(); let mut i = 0u; diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 469e86da04e..964b418b765 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -777,7 +777,7 @@ fn in_lpad_scope_cx(bcx: block, f: fn(scope_info)) { loop { match bcx.kind { block_scope(inf) => { - if inf.cleanups.len() > 0u || is_none(bcx.parent) { + if inf.cleanups.len() > 0u || bcx.parent.is_none() { f(inf); return; } } @@ -1042,7 +1042,7 @@ fn new_block(cx: fn_ctxt, parent: Option<block>, +kind: block_kind, llvm::LLVMAppendBasicBlock(cx.llfn, buf) }); let bcx = mk_block(llbb, parent, move kind, is_lpad, opt_node_info, cx); - do option::iter(parent) |cx| { + do option::iter(&parent) |cx| { if cx.unreachable { Unreachable(bcx); } }; return bcx; @@ -1164,12 +1164,12 @@ fn cleanup_and_leave(bcx: block, upto: Option<BasicBlockRef>, } cur = match cur.parent { Some(next) => next, - None => { assert is_none(upto); break; } + None => { assert upto.is_none(); break; } }; } match leave { Some(target) => Br(bcx, target), - None => { Resume(bcx, Load(bcx, option::get(bcx.fcx.personality))); } + None => { Resume(bcx, Load(bcx, bcx.fcx.personality.get())); } } } @@ -1251,7 +1251,7 @@ fn alloc_local(cx: block, local: @ast::local) -> block { }; let val = alloc_ty(cx, t); if cx.sess().opts.debuginfo { - do option::iter(simple_name) |name| { + do option::iter(&simple_name) |name| { str::as_c_str(cx.ccx().sess.str_of(name), |buf| { llvm::LLVMSetValueName(val, buf) }); @@ -1601,7 +1601,7 @@ fn trans_closure(ccx: @crate_ctxt, path: path, decl: ast::fn_decl, /* avoids the need for special cases to assign a type to the constructor body (since it has no explicit return) */ && - (option::is_none(body.node.expr) || + (body.node.expr.is_none() || ty::type_is_bot(block_ty) || ty::type_is_nil(block_ty)) { bcx = controlflow::trans_block(bcx, body, expr::Ignore); @@ -1728,7 +1728,7 @@ fn trans_class_ctor(ccx: @crate_ctxt, path: path, decl: ast::fn_decl, let selfdatum = datum::scratch_datum(bcx_top, rslt_ty, true); // Initialize dtor flag (if any) to 1 - if option::is_some(ty::ty_dtor(bcx_top.tcx(), parent_id)) { + if ty::ty_dtor(bcx_top.tcx(), parent_id).is_some() { let flag = GEPi(bcx_top, selfdatum.val, [0, 1]); Store(bcx_top, C_u8(1), flag); } @@ -1761,7 +1761,7 @@ fn trans_class_dtor(ccx: @crate_ctxt, path: path, /* Look up the parent class's def_id */ let mut class_ty = ty::lookup_item_type(tcx, parent_id).ty; /* Substitute in the class type if necessary */ - do option::iter(psubsts) |ss| { + do option::iter(&psubsts) |ss| { class_ty = ty::subst_tps(tcx, ss.tys, class_ty); } @@ -1779,7 +1779,7 @@ fn trans_class_dtor(ccx: @crate_ctxt, path: path, /* If we're monomorphizing, register the monomorphized decl for the dtor */ - do option::iter(hash_id) |h_id| { + do option::iter(&hash_id) |h_id| { ccx.monomorphized.insert(h_id, lldecl); } /* Translate the dtor body */ @@ -1889,12 +1889,12 @@ fn trans_struct_def(ccx: @crate_ctxt, struct_def: @ast::struct_def, let psubsts = {tys: ty::ty_params_to_tys(ccx.tcx, tps), vtables: None, bounds: @~[]}; - do option::iter(struct_def.ctor) |ctor| { + do option::iter(&struct_def.ctor) |ctor| { trans_class_ctor(ccx, *path, ctor.node.dec, ctor.node.body, get_item_val(ccx, ctor.node.id), psubsts, ctor.node.id, local_def(id), ctor.span); } - do option::iter(struct_def.dtor) |dtor| { + do option::iter(&struct_def.dtor) |dtor| { trans_class_dtor(ccx, *path, dtor.node.body, dtor.node.id, None, None, local_def(id)); }; @@ -2070,7 +2070,7 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id, let t = ty::node_id_to_type(ccx.tcx, id); match ccx.item_symbols.find(id) { Some(s) => s, - None if is_none(substs) => { + None if substs.is_none() => { let s = mangle_exported_name( ccx, vec::append(path, ~[path_name(ccx.names(~"dtor"))]), diff --git a/src/rustc/middle/trans/callee.rs b/src/rustc/middle/trans/callee.rs index f79fd8c97e7..308ff75c82e 100644 --- a/src/rustc/middle/trans/callee.rs +++ b/src/rustc/middle/trans/callee.rs @@ -394,8 +394,8 @@ fn trans_call_inner( if ty::type_is_bot(ret_ty) { Unreachable(bcx); } else if ret_in_loop { - bcx = do with_cond(bcx, Load(bcx, option::get(ret_flag))) |bcx| { - do option::iter(copy bcx.fcx.loop_ret) |lret| { + bcx = do with_cond(bcx, Load(bcx, ret_flag.get())) |bcx| { + do option::iter(© bcx.fcx.loop_ret) |lret| { Store(bcx, C_bool(true), lret.flagptr); Store(bcx, C_bool(false), bcx.fcx.llretptr); } diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs index 7bc97551e6e..38526c223a1 100644 --- a/src/rustc/middle/trans/closure.rs +++ b/src/rustc/middle/trans/closure.rs @@ -279,7 +279,7 @@ fn build_closure(bcx0: block, // If this is a `for` loop body, add two special environment // variables: - do option::iter(include_ret_handle) |flagptr| { + do option::iter(&include_ret_handle) |flagptr| { // Flag indicating we have returned (a by-ref bool): let flag_datum = Datum {val: flagptr, ty: ty::mk_bool(tcx), mode: ByRef, source: FromLvalue}; @@ -375,9 +375,9 @@ fn trans_expr_fn(bcx: block, trans_closure(ccx, sub_path, decl, body, llfn, no_self, bcx.fcx.param_substs, id, |fcx| { load_environment(fcx, cdata_ty, cap_vars, - option::is_some(ret_handle), ck); + ret_handle.is_some(), ck); }, |bcx| { - if option::is_some(is_loop_body) { + if is_loop_body.is_some() { Store(bcx, C_bool(true), bcx.fcx.llretptr); } }); diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index a7c0bfb81cd..fce97516194 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -1333,7 +1333,7 @@ fn find_vtable(tcx: ty::ctxt, ps: ¶m_substs, } i += 1u; } - option::get(ps.vtables)[vtable_off] + ps.vtables.get()[vtable_off] } fn dummy_substs(tps: ~[ty::t]) -> ty::substs { diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs index 40530a54bd8..9944daefea4 100644 --- a/src/rustc/middle/trans/debuginfo.rs +++ b/src/rustc/middle/trans/debuginfo.rs @@ -164,7 +164,7 @@ fn cached_metadata<T: Copy>(cache: metadata_cache, mdtag: int, fn create_compile_unit(cx: @crate_ctxt) -> @metadata<compile_unit_md> unsafe { let cache = get_cache(cx); - let crate_name = option::get(cx.dbg_cx).crate_file; + let crate_name = cx.dbg_cx.get().crate_file; let tg = CompileUnitTag; match cached_metadata::<@metadata<compile_unit_md>>(cache, tg, |md| md.data.name == crate_name) { @@ -194,7 +194,7 @@ fn create_compile_unit(cx: @crate_ctxt) } fn get_cache(cx: @crate_ctxt) -> metadata_cache { - option::get(cx.dbg_cx).llmetadata + cx.dbg_cx.get().llmetadata } fn get_file_path_and_dir(work_dir: &str, full_path: &str) -> (~str, ~str) { @@ -236,13 +236,13 @@ fn line_from_span(cm: codemap::codemap, sp: span) -> uint { fn create_block(cx: block) -> @metadata<block_md> { let cache = get_cache(cx.ccx()); let mut cx = cx; - while option::is_none(cx.node_info) { + while cx.node_info.is_none() { match cx.parent { Some(b) => cx = b, None => fail } } - let sp = option::get(cx.node_info).span; + let sp = cx.node_info.get().span; let start = codemap::lookup_char_pos(cx.sess().codemap, sp.lo); let fname = start.file.name; @@ -395,7 +395,7 @@ fn create_record(cx: @crate_ctxt, t: ty::t, fields: ~[ast::ty_field], let file_node = create_file(cx, fname); let scx = create_structure(file_node, cx.sess.str_of( - option::get(cx.dbg_cx).names(~"rec")), + cx.dbg_cx.get().names(~"rec")), line_from_span(cx.sess.codemap, span) as int); for fields.each |field| { @@ -452,15 +452,15 @@ fn create_composite_type(type_tag: int, name: ~str, file: ValueRef, line: int, lli64(align), // align lli32/*64*/(offset), // offset lli32(0), // flags - if option::is_none(derived) { + if derived.is_none() { llnull() } else { // derived from - option::get(derived) + derived.get() }, - if option::is_none(members) { + if members.is_none() { llnull() } else { //members - llmdnode(option::get(members)) + llmdnode(members.get()) }, lli32(0), // runtime language llnull() @@ -711,12 +711,12 @@ fn update_source_pos(cx: block, s: span) { fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> { let cx = fcx.ccx; - let dbg_cx = option::get(cx.dbg_cx); + let dbg_cx = cx.dbg_cx.get(); debug!("~~"); log(debug, fcx.id); - let sp = option::get(fcx.span); + let sp = fcx.span.get(); log(debug, codemap::span_to_str(sp, cx.sess.codemap)); let (ident, ret_ty, id) = match cx.tcx.items.get(fcx.id) { diff --git a/src/rustc/middle/trans/foreign.rs b/src/rustc/middle/trans/foreign.rs index 7b37305705f..6f018fcd1b1 100644 --- a/src/rustc/middle/trans/foreign.rs +++ b/src/rustc/middle/trans/foreign.rs @@ -392,7 +392,7 @@ fn x86_64_tys(atys: ~[TypeRef], } let mut (ret_ty, ret_attr) = x86_64_ty(rty, is_ret_bysret, StructRetAttribute); - let sret = option::is_some(ret_attr); + let sret = ret_attr.is_some(); if sret { arg_tys = vec::append(~[ret_ty], arg_tys); ret_ty = { cast: false, @@ -623,7 +623,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt, let arg_ptr = BitCast(bcx, arg_ptr, T_ptr(atys[i].ty)); Load(bcx, arg_ptr) - } else if option::is_some(attrs[i]) { + } else if attrs[i].is_some() { GEPi(bcx, llargbundle, [0u, i]) } else { load_inbounds(bcx, llargbundle, [0u, i]) @@ -938,7 +938,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item, let tp_sz = shape::llsize_of_real(ccx, lltp_ty), out_sz = shape::llsize_of_real(ccx, llout_ty); if tp_sz != out_sz { - let sp = match ccx.tcx.items.get(option::get(ref_id)) { + let sp = match ccx.tcx.items.get(ref_id.get()) { ast_map::node_expr(e) => e.span, _ => fail ~"reinterpret_cast or forget has non-expr arg" }; @@ -1105,7 +1105,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, let n = vec::len(atys); while i < n { let mut argval = get_param(llwrapfn, i + j); - if option::is_some(attrs[i]) { + if attrs[i].is_some() { argval = Load(bcx, argval); store_inbounds(bcx, argval, llargbundle, [0u, i]); diff --git a/src/rustc/middle/trans/glue.rs b/src/rustc/middle/trans/glue.rs index 34a812aac00..8ac42bc2284 100644 --- a/src/rustc/middle/trans/glue.rs +++ b/src/rustc/middle/trans/glue.rs @@ -316,7 +316,7 @@ fn call_tydesc_glue_full(++bcx: block, v: ValueRef, tydesc: ValueRef, // When static type info is available, avoid casting parameter because the // function already has the right type. Otherwise cast to generic pointer. - let llrawptr = if is_none(static_ti) || is_none(static_glue_fn) { + let llrawptr = if static_ti.is_none() || static_glue_fn.is_none() { PointerCast(bcx, v, T_ptr(T_i8())) } else { v @@ -397,7 +397,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) { } ty::ty_class(did, ref substs) => { // Call the dtor if there is one - do option::map_default(ty::ty_dtor(bcx.tcx(), did), bcx) |dt_id| { + do option::map_default(&ty::ty_dtor(bcx.tcx(), did), bcx) |dt_id| { trans_class_drop(bcx, v, dt_id, did, substs) } } diff --git a/src/rustc/middle/trans/meth.rs b/src/rustc/middle/trans/meth.rs index a0a207a85d3..33df35cca52 100644 --- a/src/rustc/middle/trans/meth.rs +++ b/src/rustc/middle/trans/meth.rs @@ -206,7 +206,7 @@ fn trans_static_method_callee(bcx: block, fn method_from_methods(ms: ~[@ast::method], name: ast::ident) -> ast::def_id { - local_def(option::get(vec::find(ms, |m| m.ident == name)).id) + local_def(option::get(&vec::find(ms, |m| m.ident == name)).id) } fn method_with_name(ccx: @crate_ctxt, impl_id: ast::def_id, diff --git a/src/rustc/middle/trans/monomorphize.rs b/src/rustc/middle/trans/monomorphize.rs index 74513357e14..8a68ef4823b 100644 --- a/src/rustc/middle/trans/monomorphize.rs +++ b/src/rustc/middle/trans/monomorphize.rs @@ -99,7 +99,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, ccx.stats.n_monos += 1; - let depth = option::get_default(ccx.monomorphizing.find(fn_id), 0u); + let depth = option::get_default(&ccx.monomorphizing.find(fn_id), 0u); // Random cut-off -- code that needs to instantiate the same function // recursively more than ten times can probably safely be assumed to be // causing an infinite expansion. @@ -132,13 +132,13 @@ fn monomorphic_fn(ccx: @crate_ctxt, } ast_map::node_foreign_item(i, _, _) => { let d = mk_lldecl(); - foreign::trans_intrinsic(ccx, d, i, pt, option::get(psubsts), + foreign::trans_intrinsic(ccx, d, i, pt, psubsts.get(), ref_id); d } ast_map::node_variant(v, enum_item, _) => { let tvs = ty::enum_variants(ccx.tcx, local_def(enum_item.id)); - let this_tv = option::get(vec::find(*tvs, |tv| { + let this_tv = option::get(&vec::find(*tvs, |tv| { tv.id.node == fn_id.node})); let d = mk_lldecl(); set_inline_hint(d); @@ -166,7 +166,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, let d = mk_lldecl(); let tp_tys = ty::ty_params_to_tys(ccx.tcx, tps); trans_class_ctor(ccx, pt, ctor.node.dec, ctor.node.body, d, - option::get_default(psubsts, + option::get_default(&psubsts, {tys:tp_tys, vtables: None, bounds: @~[]}), fn_id.node, parent_id, ctor.span); d diff --git a/src/rustc/middle/trans/reachable.rs b/src/rustc/middle/trans/reachable.rs index 7febec13add..3c4439c918f 100644 --- a/src/rustc/middle/trans/reachable.rs +++ b/src/rustc/middle/trans/reachable.rs @@ -104,14 +104,14 @@ fn traverse_public_item(cx: ctx, item: @item) { } } item_class(struct_def, tps) => { - do option::iter(struct_def.ctor) |ctor| { + do option::iter(&struct_def.ctor) |ctor| { cx.rmap.insert(ctor.node.id, ()); if tps.len() > 0u || attr::find_inline_attr(ctor.node.attrs) != attr::ia_none { traverse_inline_body(cx, ctor.node.body); } } - do option::iter(struct_def.dtor) |dtor| { + do option::iter(&struct_def.dtor) |dtor| { cx.rmap.insert(dtor.node.id, ()); if tps.len() > 0u || attr::find_inline_attr(dtor.node.attrs) != attr::ia_none { diff --git a/src/rustc/middle/trans/reflect.rs b/src/rustc/middle/trans/reflect.rs index 4fda4d7264f..cdd11ee85c5 100644 --- a/src/rustc/middle/trans/reflect.rs +++ b/src/rustc/middle/trans/reflect.rs @@ -58,7 +58,7 @@ impl reflector { fn visit(ty_name: ~str, args: ~[ValueRef]) { let tcx = self.bcx.tcx(); - let mth_idx = option::get(ty::method_idx( + let mth_idx = option::get(&ty::method_idx( tcx.sess.ident_of(~"visit_" + ty_name), *self.visitor_methods)); let mth_ty = ty::mk_fn(tcx, self.visitor_methods[mth_idx].fty); diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index 46fd9cefb7f..34a499c7e13 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -351,11 +351,11 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> ~[u8] { // same as records, unless there's a dtor let tps = substs.tps; let m_dtor_did = ty::ty_dtor(ccx.tcx, did); - let mut s = if option::is_some(m_dtor_did) { + let mut s = if m_dtor_did.is_some() { ~[shape_res] } else { ~[shape_struct] }, sub = ~[]; - do option::iter(m_dtor_did) |dtor_did| { + do m_dtor_did.iter |dtor_did| { let ri = @{did: dtor_did, parent_id: Some(did), tps: tps}; let id = ccx.shape_cx.resources.intern(ri); add_u16(s, id as u16); @@ -601,7 +601,7 @@ fn gen_resource_shapes(ccx: @crate_ctxt) -> ValueRef { for uint::range(0u, len) |i| { let ri = ccx.shape_cx.resources.get(i); for ri.tps.each() |s| { assert !ty::type_has_params(*s); } - do option::iter(ri.parent_id) |id| { + do ri.parent_id.iter |id| { dtors += ~[trans::base::get_res_dtor(ccx, ri.did, id, ri.tps)]; } } @@ -630,7 +630,7 @@ fn force_declare_tydescs(ccx: @crate_ctxt) { for uint::range(0u, len) |i| { let ri = ccx.shape_cx.resources.get(i); for ri.tps.each() |s| { assert !ty::type_has_params(*s); } - do option::iter(ri.parent_id) |id| { + do ri.parent_id.iter |id| { trans::base::get_res_dtor(ccx, ri.did, id, ri.tps); } } @@ -782,7 +782,7 @@ fn simplify_type(tcx: ty::ctxt, typ: ty::t) -> ty::t { // Reduce a class type to a record type in which all the fields are // simplified ty::ty_class(did, ref substs) => { - let simpl_fields = (if is_some(ty::ty_dtor(tcx, did)) { + let simpl_fields = (if ty::ty_dtor(tcx, did).is_some() { // remember the drop flag ~[{ident: syntax::parse::token::special_idents::dtor, mt: {ty: ty::mk_u8(tcx), diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index 5da1221cfc3..8a0873f0585 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -146,7 +146,7 @@ fn type_needs_inner(cx: ctx, use_: uint, ty: ty::t, ty::ty_fn(_) | ty::ty_ptr(_) | ty::ty_rptr(_, _) | ty::ty_trait(_, _, _) => false, ty::ty_enum(did, substs) => { - if option::is_none(list::find(enums_seen, |id| *id == did)) { + if option::is_none(&list::find(enums_seen, |id| *id == did)) { let seen = @Cons(did, enums_seen); for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| { for vec::each(v.args) |aty| { @@ -234,10 +234,10 @@ fn mark_for_expr(cx: ctx, e: @expr) { let base_ty = ty::node_id_to_type(cx.ccx.tcx, base.id); type_needs(cx, use_repr, ty::type_autoderef(cx.ccx.tcx, base_ty)); - do option::iter(cx.ccx.maps.method_map.find(e.id)) |mth| { + do option::iter(&cx.ccx.maps.method_map.find(e.id)) |mth| { match mth.origin { typeck::method_static(did) => { - do option::iter(cx.ccx.tcx.node_type_substs.find(e.id)) |ts| { + do cx.ccx.tcx.node_type_substs.find(e.id).iter |ts| { do vec::iter2(type_uses_for(cx.ccx, did, ts.len()), ts) |uses, subst| { type_needs(cx, uses, subst)} } @@ -289,7 +289,7 @@ fn handle_body(cx: ctx, body: blk) { }, visit_block: |b, cx, v| { visit::visit_block(b, cx, v); - do option::iter(b.node.expr) |e| { + do option::iter(&b.node.expr) |e| { node_type_needs(cx, use_repr, e.id); } }, diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index d18c48ae94d..4f753f7163c 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1691,7 +1691,7 @@ fn type_needs_drop(cx: ctxt, ty: t) -> bool { } ty_class(did, ref substs) => { // Any class with a dtor needs a drop - option::is_some(ty_dtor(cx, did)) || { + ty_dtor(cx, did).is_some() || { for vec::each(ty::class_items_as_fields(cx, did, substs)) |f| { if type_needs_drop(cx, f.mt.ty) { accum = true; } } @@ -3454,7 +3454,7 @@ fn impl_traits(cx: ctxt, id: ast::def_id) -> ~[t] { _}, _)) => { - do option::map_default(opt_trait, ~[]) |trait_ref| { + do option::map_default(&opt_trait, ~[]) |trait_ref| { ~[node_id_to_type(cx, trait_ref.ref_id)] } } @@ -3519,7 +3519,7 @@ fn ty_dtor(cx: ctxt, class_id: def_id) -> Option<def_id> { } fn has_dtor(cx: ctxt, class_id: def_id) -> bool { - option::is_some(ty_dtor(cx, class_id)) + ty_dtor(cx, class_id).is_some() } fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path { diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index 85465eb7d3c..cfc14999430 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -176,7 +176,7 @@ trait get_and_find_region { impl isr_alist: get_and_find_region { fn get(br: ty::bound_region) -> ty::region { - option::get(self.find(br)) + self.find(br).get() } fn find(br: ty::bound_region) -> Option<ty::region> { @@ -227,7 +227,7 @@ fn check_fn(ccx: @crate_ctxt, // the node_id of the body block. let {isr, self_info, fn_ty} = { - let old_isr = option::map_default(old_fcx, @Nil, + let old_isr = option::map_default(&old_fcx, @Nil, |fcx| fcx.in_scope_regions); replace_bound_regions_in_fn_ty(tcx, old_isr, self_info, fn_ty, |br| ty::re_free(body.node.id, br)) @@ -239,7 +239,7 @@ fn check_fn(ccx: @crate_ctxt, debug!("check_fn(arg_tys=%?, ret_ty=%?, self_info.self_ty=%?)", arg_tys.map(|a| ty_to_str(tcx, *a)), ty_to_str(tcx, ret_ty), - option::map(self_info, |s| ty_to_str(tcx, s.self_ty))); + option::map(&self_info, |s| ty_to_str(tcx, s.self_ty))); // ______________________________________________________________________ // Create the function context. This is either derived from scratch or, @@ -258,7 +258,7 @@ fn check_fn(ccx: @crate_ctxt, }; let indirect_ret_ty = if indirect_ret { - let ofcx = option::get(old_fcx); + let ofcx = old_fcx.get(); match ofcx.indirect_ret_ty { Some(t) => Some(t), None => Some(ofcx.ret_ty) @@ -316,7 +316,7 @@ fn check_fn(ccx: @crate_ctxt, // force any remaining type vars to be resolved. // If we have an enclosing function scope, our type variables will be // resolved when the enclosing scope finishes up. - if option::is_none(old_fcx) { + if old_fcx.is_none() { vtable::resolve_in_block(fcx, body); regionck::regionck_fn(fcx, decl, body); writeback::resolve_type_vars_in_fn(fcx, decl, body, self_info); @@ -451,7 +451,7 @@ fn check_struct(ccx: @crate_ctxt, struct_def: @ast::struct_def, let tcx = ccx.tcx; let self_ty = ty::node_id_to_type(tcx, id); - do option::iter(struct_def.ctor) |ctor| { + do option::iter(&struct_def.ctor) |ctor| { let class_t = {self_ty: self_ty, self_id: ctor.node.self_id, def_id: local_def(id), @@ -463,7 +463,7 @@ fn check_struct(ccx: @crate_ctxt, struct_def: @ast::struct_def, Some(class_t)); } - do option::iter(struct_def.dtor) |dtor| { + do option::iter(&struct_def.dtor) |dtor| { let class_t = {self_ty: self_ty, self_id: dtor.node.self_id, def_id: local_def(id), @@ -935,7 +935,7 @@ fn lookup_field_ty(tcx: ty::ctxt, substs: &ty::substs) -> Option<ty::t> { let o_field = vec::find(items, |f| f.ident == fieldname); - do option::map(o_field) |f| { + do o_field.map() |f| { ty::lookup_field_type(tcx, class_id, f.id, substs) } } @@ -1864,7 +1864,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, fcx.write_ty(id, typ); } ast::expr_rec(fields, base) => { - option::iter(base, |b| { check_expr(fcx, b, expected); }); + option::iter(&base, |b| { check_expr(fcx, b, expected); }); let expected = if expected.is_none() && base.is_some() { Some(fcx.expr_ty(base.get())) } else { expected }; diff --git a/src/rustc/middle/typeck/check/alt.rs b/src/rustc/middle/typeck/check/alt.rs index 14de7871e91..61d85b2dbfa 100644 --- a/src/rustc/middle/typeck/check/alt.rs +++ b/src/rustc/middle/typeck/check/alt.rs @@ -163,7 +163,7 @@ fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path, tcx.sess.span_fatal(pat.span, s); } - do option::iter(subpats) |pats| { + do subpats.iter() |pats| { do vec::iter2(pats, arg_types) |subpat, arg_ty| { check_pat(pcx, subpat, arg_ty); } diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index 3c58eb57189..630ac8c13a1 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -497,7 +497,7 @@ fn convert_struct(ccx: @crate_ctxt, tpt: ty::ty_param_bounds_and_ty, id: ast::node_id) { let tcx = ccx.tcx; - do option::iter(struct_def.ctor) |ctor| { + do option::iter(&struct_def.ctor) |ctor| { // Write the ctor type let t_args = ctor.node.dec.inputs.map( |a| ty_of_arg(ccx, type_rscope(rp), *a, None) ); @@ -522,7 +522,7 @@ fn convert_struct(ccx: @crate_ctxt, ty: t_ctor}); } - do option::iter(struct_def.dtor) |dtor| { + do option::iter(&struct_def.dtor) |dtor| { // Write the dtor type let t_dtor = ty::mk_fn( tcx, |
