about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-26 16:54:31 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-27 14:37:04 -0700
commit0c6e470a257fc546555aa10ededded4a77460a71 (patch)
treefb54281612401dba521efedab7626474c80195a9 /src/rustc
parent3a1582012eafb8b672e15b12b5424e72ea6096af (diff)
Convert core::result to camel case
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/driver/driver.rs10
-rw-r--r--src/rustc/driver/rustc.rs10
-rw-r--r--src/rustc/metadata/filesearch.rs36
-rw-r--r--src/rustc/middle/borrowck.rs8
-rw-r--r--src/rustc/middle/borrowck/gather_loans.rs20
-rw-r--r--src/rustc/middle/borrowck/loan.rs10
-rw-r--r--src/rustc/middle/borrowck/preserve.rs38
-rw-r--r--src/rustc/middle/ty.rs12
-rw-r--r--src/rustc/middle/typeck.rs6
-rw-r--r--src/rustc/middle/typeck/astconv.rs6
-rw-r--r--src/rustc/middle/typeck/check.rs36
-rw-r--r--src/rustc/middle/typeck/check/demand.rs12
-rw-r--r--src/rustc/middle/typeck/check/method.rs10
-rw-r--r--src/rustc/middle/typeck/check/regionck.rs20
-rw-r--r--src/rustc/middle/typeck/check/vtable.rs10
-rw-r--r--src/rustc/middle/typeck/check/writeback.rs8
-rw-r--r--src/rustc/middle/typeck/coherence.rs4
-rw-r--r--src/rustc/middle/typeck/infer.rs42
-rw-r--r--src/rustc/middle/typeck/infer/combine.rs92
-rw-r--r--src/rustc/middle/typeck/infer/glb.rs34
-rw-r--r--src/rustc/middle/typeck/infer/lattice.rs16
-rw-r--r--src/rustc/middle/typeck/infer/lub.rs28
-rw-r--r--src/rustc/middle/typeck/infer/region_var_bindings.rs50
-rw-r--r--src/rustc/middle/typeck/infer/resolve.rs8
-rw-r--r--src/rustc/middle/typeck/infer/sub.rs32
-rw-r--r--src/rustc/middle/typeck/infer/unify.rs20
-rw-r--r--src/rustc/middle/typeck/rscope.rs40
27 files changed, 309 insertions, 309 deletions
diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs
index ceded0cb6d9..8023194f3d9 100644
--- a/src/rustc/driver/driver.rs
+++ b/src/rustc/driver/driver.rs
@@ -8,7 +8,7 @@ import middle::{trans, freevars, kind, ty, typeck, lint};
 import syntax::print::{pp, pprust};
 import util::ppaux;
 import back::link;
-import result::{ok, err};
+import result::{Ok, Err};
 import std::getopts;
 import io::WriterUtil;
 import getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
@@ -715,8 +715,8 @@ mod test {
     fn test_switch_implies_cfg_test() {
         let matches =
             match getopts::getopts(~[~"--test"], opts()) {
-              ok(m) => m,
-              err(f) => fail ~"test_switch_implies_cfg_test: " +
+              Ok(m) => m,
+              Err(f) => fail ~"test_switch_implies_cfg_test: " +
                              getopts::fail_str(f)
             };
         let sessopts = build_session_options(matches, diagnostic::emit);
@@ -731,8 +731,8 @@ mod test {
     fn test_switch_implies_cfg_test_unless_cfg_test() {
         let matches =
             match getopts::getopts(~[~"--test", ~"--cfg=test"], opts()) {
-              ok(m) => m,
-              err(f) => {
+              Ok(m) => m,
+              Err(f) => {
                 fail ~"test_switch_implies_cfg_test_unless_cfg_test: " +
                     getopts::fail_str(f);
               }
diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs
index 0b58add3384..950c8ddb463 100644
--- a/src/rustc/driver/rustc.rs
+++ b/src/rustc/driver/rustc.rs
@@ -9,7 +9,7 @@ use syntax(vers = "0.3");
 import core::*;
 
 // -*- rust -*-
-import result::{ok, err};
+import result::{Ok, Err};
 import std::getopts;
 import std::map::hashmap;
 import getopts::{opt_present};
@@ -124,8 +124,8 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
 
     let matches =
         match getopts::getopts(args, opts()) {
-          ok(m) => m,
-          err(f) => {
+          Ok(m) => m,
+          Err(f) => {
             early_error(demitter, getopts::fail_str(f))
           }
         };
@@ -242,8 +242,8 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
 
         f(demitter)
     } {
-        result::ok(_) => { /* fallthrough */ }
-        result::err(_) => {
+        result::Ok(_) => { /* fallthrough */ }
+        result::Err(_) => {
             // Task failed without emitting a fatal diagnostic
             if comm::recv(p) == done {
                 diagnostic::emit(
diff --git a/src/rustc/metadata/filesearch.rs b/src/rustc/metadata/filesearch.rs
index 75324ebab4a..c0639a7bb8a 100644
--- a/src/rustc/metadata/filesearch.rs
+++ b/src/rustc/metadata/filesearch.rs
@@ -2,7 +2,7 @@
 // FIXME (#2658): I'm not happy how this module turned out. Should
 // probably just be folded into cstore.
 
-import result::result;
+import result::Result;
 export filesearch;
 export mk_filesearch;
 export pick;
@@ -43,12 +43,12 @@ fn mk_filesearch(maybe_sysroot: Option<Path>,
                       make_target_lib_path(&self.sysroot,
                                            self.target_triple));
             match get_cargo_lib_path_nearest() {
-              result::ok(p) => vec::push(paths, p),
-              result::err(_) => ()
+              result::Ok(p) => vec::push(paths, p),
+              result::Err(_) => ()
             }
             match get_cargo_lib_path() {
-              result::ok(p) => vec::push(paths, p),
-              result::err(_) => ()
+              result::Ok(p) => vec::push(paths, p),
+              result::Err(_) => ()
             }
             paths
         }
@@ -112,31 +112,31 @@ fn get_sysroot(maybe_sysroot: Option<Path>) -> Path {
     }
 }
 
-fn get_cargo_sysroot() -> result<Path, ~str> {
-    result::ok(get_default_sysroot().push_many([libdir(), ~"cargo"]))
+fn get_cargo_sysroot() -> Result<Path, ~str> {
+    result::Ok(get_default_sysroot().push_many([libdir(), ~"cargo"]))
 }
 
-fn get_cargo_root() -> result<Path, ~str> {
+fn get_cargo_root() -> Result<Path, ~str> {
     match os::getenv(~"CARGO_ROOT") {
-        Some(_p) => result::ok(Path(_p)),
+        Some(_p) => result::Ok(Path(_p)),
         None => match os::homedir() {
-          Some(_q) => result::ok(_q.push(".cargo")),
-          None => result::err(~"no CARGO_ROOT or home directory")
+          Some(_q) => result::Ok(_q.push(".cargo")),
+          None => result::Err(~"no CARGO_ROOT or home directory")
         }
     }
 }
 
-fn get_cargo_root_nearest() -> result<Path, ~str> {
+fn get_cargo_root_nearest() -> Result<Path, ~str> {
     do result::chain(get_cargo_root()) |p| {
         let cwd = os::getcwd();
         let cwd_cargo = cwd.push(".cargo");
         let mut par_cargo = cwd.pop().push(".cargo");
-        let mut rslt = result::ok(cwd_cargo);
+        let mut rslt = result::Ok(cwd_cargo);
 
         if !os::path_is_dir(&cwd_cargo) && cwd_cargo != p {
             while par_cargo != p {
                 if os::path_is_dir(&par_cargo) {
-                    rslt = result::ok(par_cargo);
+                    rslt = result::Ok(par_cargo);
                     break;
                 }
                 if par_cargo.components.len() == 1 {
@@ -150,15 +150,15 @@ fn get_cargo_root_nearest() -> result<Path, ~str> {
     }
 }
 
-fn get_cargo_lib_path() -> result<Path, ~str> {
+fn get_cargo_lib_path() -> Result<Path, ~str> {
     do result::chain(get_cargo_root()) |p| {
-        result::ok(p.push(libdir()))
+        result::Ok(p.push(libdir()))
     }
 }
 
-fn get_cargo_lib_path_nearest() -> result<Path, ~str> {
+fn get_cargo_lib_path_nearest() -> Result<Path, ~str> {
     do result::chain(get_cargo_root_nearest()) |p| {
-        result::ok(p.push(libdir()))
+        result::Ok(p.push(libdir()))
     }
 }
 
diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs
index 6f6c1fe9285..47c0c94b333 100644
--- a/src/rustc/middle/borrowck.rs
+++ b/src/rustc/middle/borrowck.rs
@@ -224,7 +224,7 @@ import util::ppaux::{ty_to_str, region_to_str, explain_region};
 import std::map::{int_hash, hashmap, set};
 import std::list;
 import std::list::{list, cons, nil};
-import result::{result, ok, err};
+import result::{Result, Ok, Err};
 import syntax::print::pprust;
 import util::common::indenter;
 import ty::to_str;
@@ -327,7 +327,7 @@ enum bckerr_code {
 type bckerr = {cmt: cmt, code: bckerr_code};
 
 // shorthand for something that fails with `bckerr` or succeeds with `T`
-type bckres<T> = result<T, bckerr>;
+type bckres<T> = Result<T, bckerr>;
 
 /// a complete record of a loan that was granted
 type loan = {lp: @loan_path, cmt: cmt, mutbl: ast::mutability};
@@ -404,8 +404,8 @@ impl borrowck_ctxt {
 
     fn report_if_err(bres: bckres<()>) {
         match bres {
-          ok(()) => (),
-          err(e) => self.report(e)
+          Ok(()) => (),
+          Err(e) => self.report(e)
         }
     }
 
diff --git a/src/rustc/middle/borrowck/gather_loans.rs b/src/rustc/middle/borrowck/gather_loans.rs
index c9e693e47bc..08f01f41941 100644
--- a/src/rustc/middle/borrowck/gather_loans.rs
+++ b/src/rustc/middle/borrowck/gather_loans.rs
@@ -276,9 +276,9 @@ impl gather_loan_ctxt {
           // error will be reported.
           Some(_) => {
             match self.bccx.loan(cmt, scope_r, req_mutbl) {
-              err(e) => { self.bccx.report(e); }
-              ok(loans) if loans.len() == 0 => {}
-              ok(loans) => {
+              Err(e) => { self.bccx.report(e); }
+              Ok(loans) if loans.len() == 0 => {}
+              Ok(loans) => {
                 match scope_r {
                   ty::re_scope(scope_id) => {
                     self.add_loans(scope_id, loans);
@@ -318,19 +318,19 @@ impl gather_loan_ctxt {
                     do self.bccx.preserve(cmt, scope_r,
                                           self.item_ub,
                                           self.root_ub).chain |pc2| {
-                        ok(pc1.combine(pc2))
+                        Ok(pc1.combine(pc2))
                     }
                 }
             };
 
             match result {
-              ok(pc_ok) => {
+              Ok(pc_ok) => {
                 // we were able guarantee the validity of the ptr,
                 // perhaps by rooting or because it is immutably
                 // rooted.  good.
                 self.bccx.stable_paths += 1;
               }
-              ok(pc_if_pure(e)) => {
+              Ok(pc_if_pure(e)) => {
                 // we are only able to guarantee the validity if
                 // the scope is pure
                 match scope_r {
@@ -353,7 +353,7 @@ impl gather_loan_ctxt {
                   }
                 }
               }
-              err(e) => {
+              Err(e) => {
                 // we cannot guarantee the validity of this pointer
                 self.bccx.report(e);
               }
@@ -376,7 +376,7 @@ impl gather_loan_ctxt {
           (m_const, _) |
           (m_imm, m_imm) |
           (m_mutbl, m_mutbl) => {
-            ok(pc_ok)
+            Ok(pc_ok)
           }
 
           (_, m_const) |
@@ -386,9 +386,9 @@ impl gather_loan_ctxt {
                      code: err_mutbl(req_mutbl, cmt.mutbl)};
             if req_mutbl == m_imm {
                 // you can treat mutable things as imm if you are pure
-                ok(pc_if_pure(e))
+                Ok(pc_if_pure(e))
             } else {
-                err(e)
+                Err(e)
             }
           }
         }
diff --git a/src/rustc/middle/borrowck/loan.rs b/src/rustc/middle/borrowck/loan.rs
index 15e307b6a93..0b0ad514be7 100644
--- a/src/rustc/middle/borrowck/loan.rs
+++ b/src/rustc/middle/borrowck/loan.rs
@@ -3,7 +3,7 @@
 // of the scope S, presuming that the returned set of loans `Ls` are honored.
 
 export public_methods;
-import result::{result, ok, err};
+import result::{Result, Ok, Err};
 
 impl borrowck_ctxt {
     fn loan(cmt: cmt,
@@ -13,8 +13,8 @@ impl borrowck_ctxt {
                               scope_region: scope_region,
                               loans: @dvec()});
         match lc.loan(cmt, mutbl) {
-          ok(()) => {ok(lc.loans)}
-          err(e) => {err(e)}
+          Ok(()) => {Ok(lc.loans)}
+          Err(e) => {Err(e)}
         }
     }
 }
@@ -47,11 +47,11 @@ impl loan_ctxt {
             (*self.loans).push({lp: option::get(cmt.lp),
                                 cmt: cmt,
                                 mutbl: mutbl});
-            ok(())
+            Ok(())
         } else {
             // The loan being requested lives longer than the data
             // being loaned out!
-            err({cmt:cmt, code:err_out_of_scope(scope_ub,
+            Err({cmt:cmt, code:err_out_of_scope(scope_ub,
                                                 self.scope_region)})
         }
     }
diff --git a/src/rustc/middle/borrowck/preserve.rs b/src/rustc/middle/borrowck/preserve.rs
index 7ce87a31b39..8e28a26f8d5 100644
--- a/src/rustc/middle/borrowck/preserve.rs
+++ b/src/rustc/middle/borrowck/preserve.rs
@@ -68,7 +68,7 @@ priv impl &preserve_ctxt {
             self.compare_scope(cmt, ty::re_scope(self.item_ub))
           }
           cat_special(sk_static_item) | cat_special(sk_method) => {
-            ok(pc_ok)
+            Ok(pc_ok)
           }
           cat_rvalue => {
             // when we borrow an rvalue, we can keep it rooted but only
@@ -147,7 +147,7 @@ priv impl &preserve_ctxt {
           }
           cat_deref(_, _, unsafe_ptr) => {
             // Unsafe pointers are the user's problem
-            ok(pc_ok)
+            Ok(pc_ok)
           }
           cat_deref(base, derefs, gc_ptr) => {
             // GC'd pointers of type @MT: if this pointer lives in
@@ -160,14 +160,14 @@ priv impl &preserve_ctxt {
                 let non_rooting_ctxt =
                     preserve_ctxt({root_managed_data: false with **self});
                 match (&non_rooting_ctxt).preserve(base) {
-                  ok(pc_ok) => {
-                    ok(pc_ok)
+                  Ok(pc_ok) => {
+                    Ok(pc_ok)
                   }
-                  ok(pc_if_pure(_)) => {
+                  Ok(pc_if_pure(_)) => {
                     debug!("must root @T, otherwise purity req'd");
                     self.attempt_root(cmt, base, derefs)
                   }
-                  err(e) => {
+                  Err(e) => {
                     debug!("must root @T, err: %s",
                            self.bccx.bckerr_code_to_str(e.code));
                     self.attempt_root(cmt, base, derefs)
@@ -251,25 +251,25 @@ priv impl &preserve_ctxt {
         match self.preserve(cmt_base) {
           // the base is preserved, but if we are not mutable then
           // purity is required
-          ok(pc_ok) => {
+          Ok(pc_ok) => {
             match cmt_base.mutbl {
               m_mutbl | m_const => {
-                ok(pc_if_pure({cmt:cmt, code:code}))
+                Ok(pc_if_pure({cmt:cmt, code:code}))
               }
               m_imm => {
-                ok(pc_ok)
+                Ok(pc_ok)
               }
             }
           }
 
           // the base requires purity too, that's fine
-          ok(pc_if_pure(e)) => {
-            ok(pc_if_pure(e))
+          Ok(pc_if_pure(e)) => {
+            Ok(pc_if_pure(e))
           }
 
           // base is not stable, doesn't matter
-          err(e) => {
-            err(e)
+          Err(e) => {
+            Err(e)
           }
         }
     }
@@ -279,9 +279,9 @@ priv impl &preserve_ctxt {
     fn compare_scope(cmt: cmt,
                      scope_ub: ty::region) -> bckres<preserve_condition> {
         if self.bccx.is_subregion_of(self.scope_region, scope_ub) {
-            ok(pc_ok)
+            Ok(pc_ok)
         } else {
-            err({cmt:cmt, code:err_out_of_scope(scope_ub,
+            Err({cmt:cmt, code:err_out_of_scope(scope_ub,
                                                 self.scope_region)})
         }
     }
@@ -306,7 +306,7 @@ priv impl &preserve_ctxt {
             // would be sort of pointless to avoid rooting the inner
             // box by rooting an outer box, as it would just keep more
             // memory live than necessary, so we set root_ub to none.
-            return err({cmt:cmt, code:err_root_not_permitted});
+            return Err({cmt:cmt, code:err_root_not_permitted});
         }
 
         let root_region = ty::re_scope(self.root_ub);
@@ -322,10 +322,10 @@ priv impl &preserve_ctxt {
                 #debug["Elected to root"];
                 let rk = {id: base.id, derefs: derefs};
                 self.bccx.root_map.insert(rk, scope_id);
-                return ok(pc_ok);
+                return Ok(pc_ok);
             } else {
                 #debug["Unable to root"];
-                return err({cmt:cmt,
+                return Err({cmt:cmt,
                          code:err_out_of_root_scope(root_region,
                                                     self.scope_region)});
             }
@@ -333,7 +333,7 @@ priv impl &preserve_ctxt {
 
           // we won't be able to root long enough
           _ => {
-              return err({cmt:cmt,
+              return Err({cmt:cmt,
                        code:err_out_of_root_scope(root_region,
                                                   self.scope_region)});
           }
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs
index b336a85ad9e..db7b8a356ca 100644
--- a/src/rustc/middle/ty.rs
+++ b/src/rustc/middle/ty.rs
@@ -2,7 +2,7 @@
 #[warn(deprecated_pattern)];
 
 import std::{map, smallintmap};
-import result::result;
+import result::Result;
 import std::map::hashmap;
 import driver::session;
 import session::session;
@@ -2613,24 +2613,24 @@ fn arg_mode(cx: ctxt, a: arg) -> ast::rmode { resolved_mode(cx, a.mode) }
 
 // Unifies `m1` and `m2`.  Returns unified value or failure code.
 fn unify_mode(cx: ctxt, modes: expected_found<ast::mode>)
-    -> result<ast::mode, type_err> {
+    -> Result<ast::mode, type_err> {
 
     let m1 = modes.expected;
     let m2 = modes.found;
     match (canon_mode(cx, m1), canon_mode(cx, m2)) {
       (m1, m2) if (m1 == m2) => {
-        result::ok(m1)
+        result::Ok(m1)
       }
       (ast::infer(_), ast::infer(id2)) => {
         cx.inferred_modes.insert(id2, m1);
-        result::ok(m1)
+        result::Ok(m1)
       }
       (ast::infer(id), m) | (m, ast::infer(id)) => {
         cx.inferred_modes.insert(id, m);
-        result::ok(m1)
+        result::Ok(m1)
       }
       (_, _) => {
-        result::err(terr_mode_mismatch(modes))
+        result::Err(terr_mode_mismatch(modes))
       }
     }
 }
diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs
index b1a93a70813..51c152f3948 100644
--- a/src/rustc/middle/typeck.rs
+++ b/src/rustc/middle/typeck.rs
@@ -38,7 +38,7 @@ independently:
 
 */
 
-import result::result;
+import result::Result;
 import syntax::{ast, ast_util, ast_map};
 import ast::spanned;
 import ast::{required, provided};
@@ -226,8 +226,8 @@ fn require_same_types(
     }
 
     match infer::mk_eqty(l_infcx, t1_is_expected, span, t1, t2) {
-      result::ok(()) => true,
-      result::err(ref terr) => {
+      result::Ok(()) => true,
+      result::Err(ref terr) => {
         l_tcx.sess.span_err(span, msg() + ~": " +
             ty::type_err_to_str(l_tcx, terr));
         false
diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs
index 9f915051765..d4d31cebff3 100644
--- a/src/rustc/middle/typeck/astconv.rs
+++ b/src/rustc/middle/typeck/astconv.rs
@@ -57,11 +57,11 @@ trait ast_conv {
 
 fn get_region_reporting_err(tcx: ty::ctxt,
                             span: span,
-                            res: result<ty::region, ~str>) -> ty::region {
+                            res: Result<ty::region, ~str>) -> ty::region {
 
     match res {
-      result::ok(r) => r,
-      result::err(e) => {
+      result::Ok(r) => r,
+      result::Err(e) => {
         tcx.sess.span_err(span, e);
         ty::re_static
       }
diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs
index 68b10624103..bc9762a43e5 100644
--- a/src/rustc/middle/typeck/check.rs
+++ b/src/rustc/middle/typeck/check.rs
@@ -553,17 +553,17 @@ impl @fn_ctxt: ast_conv {
 }
 
 impl @fn_ctxt: region_scope {
-    fn anon_region(span: span) -> result<ty::region, ~str> {
-        result::ok(self.infcx.next_region_var_nb(span))
+    fn anon_region(span: span) -> Result<ty::region, ~str> {
+        result::Ok(self.infcx.next_region_var_nb(span))
     }
-    fn named_region(span: span, id: ast::ident) -> result<ty::region, ~str> {
+    fn named_region(span: span, id: ast::ident) -> Result<ty::region, ~str> {
         do empty_rscope.named_region(span, id).chain_err |_e| {
             match self.in_scope_regions.find(ty::br_named(id)) {
-              Some(r) => result::ok(r),
+              Some(r) => result::Ok(r),
               None if id == syntax::parse::token::special_idents::blk
-                  => result::ok(self.block_region()),
+                  => result::Ok(self.block_region()),
               None => {
-                result::err(fmt!("named region `%s` not in scope here",
+                result::Err(fmt!("named region `%s` not in scope here",
                                  self.ccx.tcx.sess.str_of(id)))
               }
             }
@@ -656,35 +656,35 @@ impl @fn_ctxt {
     }
 
     fn mk_subty(a_is_expected: bool, span: span,
-                sub: ty::t, sup: ty::t) -> result<(), ty::type_err> {
+                sub: ty::t, sup: ty::t) -> Result<(), ty::type_err> {
         infer::mk_subty(self.infcx, a_is_expected, span, sub, sup)
     }
 
-    fn can_mk_subty(sub: ty::t, sup: ty::t) -> result<(), ty::type_err> {
+    fn can_mk_subty(sub: ty::t, sup: ty::t) -> Result<(), ty::type_err> {
         infer::can_mk_subty(self.infcx, sub, sup)
     }
 
     fn mk_assignty(expr: @ast::expr, borrow_lb: ast::node_id,
-                   sub: ty::t, sup: ty::t) -> result<(), ty::type_err> {
+                   sub: ty::t, sup: ty::t) -> Result<(), ty::type_err> {
         let anmnt = &{expr_id: expr.id, span: expr.span,
                       borrow_lb: borrow_lb};
         infer::mk_assignty(self.infcx, anmnt, sub, sup)
     }
 
     fn can_mk_assignty(expr: @ast::expr, borrow_lb: ast::node_id,
-                       sub: ty::t, sup: ty::t) -> result<(), ty::type_err> {
+                       sub: ty::t, sup: ty::t) -> Result<(), ty::type_err> {
         let anmnt = &{expr_id: expr.id, span: expr.span,
                       borrow_lb: borrow_lb};
         infer::can_mk_assignty(self.infcx, anmnt, sub, sup)
     }
 
     fn mk_eqty(a_is_expected: bool, span: span,
-               sub: ty::t, sup: ty::t) -> result<(), ty::type_err> {
+               sub: ty::t, sup: ty::t) -> Result<(), ty::type_err> {
         infer::mk_eqty(self.infcx, a_is_expected, span, sub, sup)
     }
 
     fn mk_subr(a_is_expected: bool, span: span,
-               sub: ty::region, sup: ty::region) -> result<(), ty::type_err> {
+               sub: ty::region, sup: ty::region) -> Result<(), ty::type_err> {
         infer::mk_subr(self.infcx, a_is_expected, span, sub, sup)
     }
 
@@ -1181,7 +1181,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
         match expected {
           Some(t) => {
             match resolve_type(fcx.infcx, t, force_tvar) {
-              result::ok(t) => unpack(ty::get(t).struct),
+              result::Ok(t) => unpack(ty::get(t).struct),
               _ => None
             }
           }
@@ -1551,8 +1551,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
         match expr_opt {
           None => match fcx.mk_eqty(false, expr.span,
                                     ret_ty, ty::mk_nil(tcx)) {
-            result::ok(_) => { /* fall through */ }
-            result::err(_) => {
+            result::Ok(_) => { /* fall through */ }
+            result::Err(_) => {
                 tcx.sess.span_err(
                     expr.span,
                     ~"`return;` in function returning non-nil");
@@ -1626,8 +1626,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
           Some(ty::ty_fn(fty)) => {
             match fcx.mk_subty(false, expr.span,
                                fty.output, ty::mk_bool(tcx)) {
-              result::ok(_) => (),
-              result::err(_) => {
+              result::Ok(_) => (),
+              result::Err(_) => {
                 tcx.sess.span_fatal(
                     expr.span, fmt!("a `loop` function's last argument \
                                      should return `bool`, not `%s`",
@@ -2417,7 +2417,7 @@ fn instantiate_path(fcx: @fn_ctxt,
 // resolution is possible, then an error is reported.
 fn structurally_resolved_type(fcx: @fn_ctxt, sp: span, tp: ty::t) -> ty::t {
     match infer::resolve_type(fcx.infcx, tp, force_tvar) {
-      result::ok(t_s) if !ty::type_is_var(t_s) => return t_s,
+      result::Ok(t_s) if !ty::type_is_var(t_s) => return t_s,
       _ => {
         fcx.ccx.tcx.sess.span_fatal
             (sp, ~"the type of this value must be known in this context");
diff --git a/src/rustc/middle/typeck/check/demand.rs b/src/rustc/middle/typeck/check/demand.rs
index f835cffca25..7dc1dc2606b 100644
--- a/src/rustc/middle/typeck/check/demand.rs
+++ b/src/rustc/middle/typeck/check/demand.rs
@@ -8,8 +8,8 @@ fn suptype(fcx: @fn_ctxt, sp: span,
     // n.b.: order of actual, expected is reversed
     match infer::mk_subty(fcx.infcx, false, sp,
                           actual, expected) {
-      result::ok(()) => { /* ok */ }
-      result::err(ref err) => {
+      result::Ok(()) => { /* ok */ }
+      result::Err(ref err) => {
         fcx.report_mismatched_types(sp, expected, actual, err);
       }
     }
@@ -19,8 +19,8 @@ fn eqtype(fcx: @fn_ctxt, sp: span,
           expected: ty::t, actual: ty::t) {
 
     match infer::mk_eqty(fcx.infcx, false, sp, actual, expected) {
-      result::ok(()) => { /* ok */ }
-      result::err(ref err) => {
+      result::Ok(()) => { /* ok */ }
+      result::Err(ref err) => {
         fcx.report_mismatched_types(sp, expected, actual, err);
       }
     }
@@ -31,8 +31,8 @@ fn assign(fcx: @fn_ctxt, sp: span, borrow_lb: ast::node_id,
           expected: ty::t, expr: @ast::expr) {
     let expr_ty = fcx.expr_ty(expr);
     match fcx.mk_assignty(expr, borrow_lb, expr_ty, expected) {
-      result::ok(()) => { /* ok */ }
-      result::err(ref err) => {
+      result::Ok(()) => { /* ok */ }
+      result::Err(ref err) => {
         fcx.report_mismatched_types(sp, expected, expr_ty, err);
       }
     }
diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs
index 8c983c1e957..0283758b749 100644
--- a/src/rustc/middle/typeck/check/method.rs
+++ b/src/rustc/middle/typeck/check/method.rs
@@ -434,7 +434,7 @@ struct lookup {
 
     fn check_type_match(impl_ty: ty::t,
                         mode: method_lookup_mode)
-        -> result<(), ty::type_err> {
+        -> Result<(), ty::type_err> {
         // Depending on our argument, we find potential matches by
         // checking subtypability, type assignability, or reference
         // subtypability. Collect the matches.
@@ -492,8 +492,8 @@ struct lookup {
             let matches = self.check_type_match(impl_ty, mode);
             debug!("matches = %?", matches);
             match matches {
-              result::err(_) => { /* keep looking */ }
-              result::ok(_) => {
+              result::Err(_) => { /* keep looking */ }
+              result::Ok(_) => {
                 if !self.candidate_impls.contains_key(im.did) {
                     let fty = self.ty_from_did(m.did);
                     self.candidates.push(
@@ -650,8 +650,8 @@ struct lookup {
                 // is not from an impl, this'll basically be a no-nop.
                 match self.fcx.mk_assignty(self.self_expr, self.borrow_lb,
                                            cand.self_ty, cand.rcvr_ty) {
-                  result::ok(_) => (),
-                  result::err(_) => {
+                  result::Ok(_) => (),
+                  result::Err(_) => {
                     self.tcx().sess.span_bug(
                         self.expr.span,
                         fmt!("%s was assignable to %s but now is not?",
diff --git a/src/rustc/middle/typeck/check/regionck.rs b/src/rustc/middle/typeck/check/regionck.rs
index 1b720e3386f..ee8c20592b4 100644
--- a/src/rustc/middle/typeck/check/regionck.rs
+++ b/src/rustc/middle/typeck/check/regionck.rs
@@ -187,8 +187,8 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) {
         // check_cast_for_escaping_regions() in kind.rs explaining how
         // it goes about doing that.
         match rcx.resolve_node_type(e.id) {
-          result::err(_) => { return; /* typeck will fail anyhow */ }
-          result::ok(target_ty) => {
+          result::Err(_) => { return; /* typeck will fail anyhow */ }
+          result::Ok(target_ty) => {
             match ty::get(target_ty).struct {
               ty::ty_trait(_, substs, _) => {
                 let trait_region = match substs.self_r {
@@ -213,8 +213,8 @@ fn visit_expr(e: @ast::expr, &&rcx: @rcx, v: rvt) {
 
       ast::expr_fn(*) | ast::expr_fn_block(*) => {
         match rcx.resolve_node_type(e.id) {
-          result::err(_) => return,   // Typechecking will fail anyhow.
-          result::ok(function_type) => {
+          result::Err(_) => return,   // Typechecking will fail anyhow.
+          result::Ok(function_type) => {
             match ty::get(function_type).struct {
               ty::ty_fn({
                 proto: proto_vstore(vstore_slice(region)), _
@@ -249,8 +249,8 @@ fn visit_node(id: ast::node_id, span: span, rcx: @rcx) -> bool {
     // is going to fail anyway, so just stop here and let typeck
     // report errors later on in the writeback phase.
     let ty = match rcx.resolve_node_type(id) {
-      result::err(_) => return true,
-      result::ok(ty) => ty
+      result::Err(_) => return true,
+      result::Ok(ty) => ty
     };
 
     // find the region where this expr evaluation is taking place
@@ -279,8 +279,8 @@ fn constrain_free_variables(
         let en_region = encl_region_of_def(rcx.fcx, def);
         match rcx.fcx.mk_subr(true, freevar.span,
                               region, en_region) {
-          result::ok(()) => {}
-          result::err(_) => {
+          result::Ok(()) => {}
+          result::Err(_) => {
             tcx.sess.span_err(
                 freevar.span,
                 ~"captured variable does not outlive the enclosing closure");
@@ -331,7 +331,7 @@ fn constrain_regions_in_type(
         }
 
         match rcx.fcx.mk_subr(true, span, encl_region, region) {
-          result::err(_) => {
+          result::Err(_) => {
             tcx.sess.span_err(
                 span,
                 fmt!("reference is not valid outside of its lifetime"));
@@ -341,7 +341,7 @@ fn constrain_regions_in_type(
                 region);
             rcx.errors_reported += 1u;
           }
-          result::ok(()) => {
+          result::Ok(()) => {
           }
         }
     }
diff --git a/src/rustc/middle/typeck/check/vtable.rs b/src/rustc/middle/typeck/check/vtable.rs
index f14931cb874..97bbe98f243 100644
--- a/src/rustc/middle/typeck/check/vtable.rs
+++ b/src/rustc/middle/typeck/check/vtable.rs
@@ -194,8 +194,8 @@ fn lookup_vtable(fcx: @fn_ctxt,
                             impl_self_ty(fcx, expr, im.did, false);
                         let im_bs = ty::lookup_item_type(tcx, im.did).bounds;
                         match fcx.mk_subty(false, expr.span, ty, for_ty) {
-                          result::err(_) => again,
-                          result::ok(()) => ()
+                          result::Err(_) => again,
+                          result::Ok(()) => ()
                         }
 
                         // check that desired trait type unifies
@@ -260,15 +260,15 @@ fn fixup_ty(fcx: @fn_ctxt,
 {
     let tcx = fcx.ccx.tcx;
     match resolve_type(fcx.infcx, ty, resolve_and_force_all_but_regions) {
-      result::ok(new_type) => Some(new_type),
-      result::err(e) if !is_early => {
+      result::Ok(new_type) => Some(new_type),
+      result::Err(e) if !is_early => {
         tcx.sess.span_fatal(
             expr.span,
             fmt!("cannot determine a type \
                   for this bounded type parameter: %s",
                  fixup_err_to_str(e)))
       }
-      result::err(_) => {
+      result::Err(_) => {
         None
       }
     }
diff --git a/src/rustc/middle/typeck/check/writeback.rs b/src/rustc/middle/typeck/check/writeback.rs
index 218cd906915..6bbd757ac98 100644
--- a/src/rustc/middle/typeck/check/writeback.rs
+++ b/src/rustc/middle/typeck/check/writeback.rs
@@ -11,8 +11,8 @@ fn resolve_type_vars_in_type(fcx: @fn_ctxt, sp: span, typ: ty::t) ->
     Option<ty::t> {
     if !ty::type_needs_infer(typ) { return Some(typ); }
     match resolve_type(fcx.infcx, typ, resolve_all | force_all) {
-      result::ok(new_type) => return Some(new_type),
-      result::err(e) => {
+      result::Ok(new_type) => return Some(new_type),
+      result::Err(e) => {
         if !fcx.ccx.tcx.sess.has_errors() {
             fcx.ccx.tcx.sess.span_err(
                 sp,
@@ -128,13 +128,13 @@ fn visit_local(l: @ast::local, wbcx: wb_ctxt, v: wb_vt) {
     let var_id = lookup_local(wbcx.fcx, l.span, l.node.id);
     let var_ty = ty::mk_var(wbcx.fcx.tcx(), var_id);
     match resolve_type(wbcx.fcx.infcx, var_ty, resolve_all | force_all) {
-      result::ok(lty) => {
+      result::Ok(lty) => {
         debug!("Type for local %s (id %d) resolved to %s",
                pat_to_str(l.node.pat, wbcx.fcx.ccx.tcx.sess.intr()),l.node.id,
                wbcx.fcx.infcx.ty_to_str(lty));
         write_ty_to_tcx(wbcx.fcx.ccx.tcx, l.node.id, lty);
       }
-      result::err(e) => {
+      result::Err(e) => {
         wbcx.fcx.ccx.tcx.sess.span_err(
             l.span,
             fmt!("cannot determine a type \
diff --git a/src/rustc/middle/typeck/coherence.rs b/src/rustc/middle/typeck/coherence.rs
index 63587cf4e3b..dfe6ce77bc1 100644
--- a/src/rustc/middle/typeck/coherence.rs
+++ b/src/rustc/middle/typeck/coherence.rs
@@ -31,7 +31,7 @@ import syntax::visit::{visit_mod};
 import util::ppaux::ty_to_str;
 
 import dvec::{DVec, dvec};
-import result::ok;
+import result::Ok;
 import std::map::{hashmap, int_hash};
 import uint::range;
 import vec::{len, push};
@@ -43,7 +43,7 @@ fn get_base_type(inference_context: infer_ctxt, span: span, original_type: t)
     match resolve_type(inference_context,
                      original_type,
                      resolve_ivar) {
-        ok(resulting_type) if !type_is_var(resulting_type) => {
+        Ok(resulting_type) if !type_is_var(resulting_type) => {
             resolved_type = resulting_type;
         }
         _ => {
diff --git a/src/rustc/middle/typeck/infer.rs b/src/rustc/middle/typeck/infer.rs
index a2b39f5db15..774f5a1f4e0 100644
--- a/src/rustc/middle/typeck/infer.rs
+++ b/src/rustc/middle/typeck/infer.rs
@@ -255,7 +255,7 @@ import middle::ty::{tv_vid, tvi_vid, region_vid, vid,
 import syntax::{ast, ast_util};
 import syntax::ast::{ret_style, purity};
 import util::ppaux::{ty_to_str, mt_to_str};
-import result::{result, ok, err, map_vec, map_vec2, iter_vec2};
+import result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2};
 import ty::{mk_fn, type_is_bot};
 import check::regionmanip::{replace_bound_regions_in_fn_ty};
 import driver::session::session;
@@ -309,7 +309,7 @@ type assignment = {
 type bound<T:copy> = Option<T>;
 type bounds<T:copy> = {lb: bound<T>, ub: bound<T>};
 
-type cres<T> = result<T,ty::type_err>;
+type cres<T> = Result<T,ty::type_err>;
 
 enum infer_ctxt = @{
     tcx: ty::ctxt,
@@ -358,8 +358,8 @@ fn fixup_err_to_str(f: fixup_err) -> ~str {
     }
 }
 
-type ures = result::result<(), ty::type_err>;
-type fres<T> = result::result<T, fixup_err>;
+type ures = result::Result<(), ty::type_err>;
+type fres<T> = result::Result<T, fixup_err>;
 
 fn new_vals_and_bindings<V:copy, T:copy>() -> vals_and_bindings<V, T> {
     vals_and_bindings {
@@ -463,14 +463,14 @@ fn resolve_region(cx: infer_ctxt, r: ty::region, modes: uint)
 fn resolve_borrowings(cx: infer_ctxt) {
     for cx.borrowings.each |item| {
         match resolve_region(cx, item.scope, resolve_all|force_all) {
-          ok(region) => {
+          Ok(region) => {
             debug!("borrowing for expr %d resolved to region %?, mutbl %?",
                    item.expr_id, region, item.mutbl);
             cx.tcx.borrowings.insert(
                 item.expr_id, {region: region, mutbl: item.mutbl});
           }
 
-          err(e) => {
+          Err(e) => {
             let str = fixup_err_to_str(e);
             cx.tcx.sess.span_err(
                 item.span,
@@ -481,13 +481,13 @@ fn resolve_borrowings(cx: infer_ctxt) {
 }
 
 trait then {
-    fn then<T:copy>(f: fn() -> result<T,ty::type_err>)
-        -> result<T,ty::type_err>;
+    fn then<T:copy>(f: fn() -> Result<T,ty::type_err>)
+        -> Result<T,ty::type_err>;
 }
 
 impl ures: then {
-    fn then<T:copy>(f: fn() -> result<T,ty::type_err>)
-        -> result<T,ty::type_err> {
+    fn then<T:copy>(f: fn() -> Result<T,ty::type_err>)
+        -> Result<T,ty::type_err> {
         self.chain(|_i| f())
     }
 }
@@ -500,8 +500,8 @@ trait cres_helpers<T> {
 impl<T:copy> cres<T>: cres_helpers<T> {
     fn to_ures() -> ures {
         match self {
-          ok(_v) => ok(()),
-          err(e) => err(e)
+          Ok(_v) => Ok(()),
+          Err(e) => Err(e)
         }
     }
 
@@ -510,14 +510,14 @@ impl<T:copy> cres<T>: cres_helpers<T> {
             if s == t {
                 self
             } else {
-                err(f())
+                Err(f())
             }
         }
     }
 }
 
 fn uok() -> ures {
-    ok(())
+    Ok(())
 }
 
 fn rollback_to<V:copy vid, T:copy>(
@@ -570,7 +570,7 @@ impl infer_ctxt {
     }
 
     /// Execute `f` and commit the bindings if successful
-    fn commit<T,E>(f: fn() -> result<T,E>) -> result<T,E> {
+    fn commit<T,E>(f: fn() -> Result<T,E>) -> Result<T,E> {
         assert !self.in_snapshot();
 
         debug!("commit()");
@@ -588,21 +588,21 @@ impl infer_ctxt {
     }
 
     /// Execute `f`, unroll bindings on failure
-    fn try<T,E>(f: fn() -> result<T,E>) -> result<T,E> {
+    fn try<T,E>(f: fn() -> Result<T,E>) -> Result<T,E> {
         debug!("try()");
         do indent {
             let snapshot = self.start_snapshot();
             let r = f();
             match r {
-              ok(_) => (),
-              err(_) => self.rollback_to(&snapshot)
+              Ok(_) => (),
+              Err(_) => self.rollback_to(&snapshot)
             }
             r
         }
     }
 
     /// Execute `f` then unroll any bindings it creates
-    fn probe<T,E>(f: fn() -> result<T,E>) -> result<T,E> {
+    fn probe<T,E>(f: fn() -> Result<T,E>) -> Result<T,E> {
         debug!("probe()");
         do indent {
             let snapshot = self.start_snapshot();
@@ -674,8 +674,8 @@ impl infer_ctxt {
 
     fn resolve_type_vars_if_possible(typ: ty::t) -> ty::t {
         match resolve_type(self, typ, resolve_nested_tvar | resolve_ivar) {
-          result::ok(new_type) => new_type,
-          result::err(_) => typ
+          result::Ok(new_type) => new_type,
+          result::Err(_) => typ
         }
     }
 }
diff --git a/src/rustc/middle/typeck/infer/combine.rs b/src/rustc/middle/typeck/infer/combine.rs
index 02727c46322..6f8fa5647a9 100644
--- a/src/rustc/middle/typeck/infer/combine.rs
+++ b/src/rustc/middle/typeck/infer/combine.rs
@@ -113,8 +113,8 @@ fn eq_regions<C: combine>(self: &C, a: ty::region, b: ty::region) -> ures {
             // found in the original error
             match e {
               ty::terr_regions_does_not_outlive(a1, b1) =>
-                err(ty::terr_regions_not_same(a1, b1)),
-              _ => err(e)
+                Err(ty::terr_regions_not_same(a1, b1)),
+              _ => Err(e)
             }
         }).to_ures()
     }
@@ -127,11 +127,11 @@ fn eq_opt_regions<C:combine>(
 
     match (a, b) {
       (None, None) => {
-        ok(None)
+        Ok(None)
       }
       (Some(a), Some(b)) => {
         do eq_regions(self, a, b).then {
-            ok(Some(a))
+            Ok(Some(a))
         }
       }
       (_, _) => {
@@ -162,21 +162,21 @@ fn super_substs<C:combine>(
         let polyty = ty::lookup_item_type(self.infcx().tcx, did);
         match (polyty.region_param, a, b) {
           (None, None, None) => {
-            ok(None)
+            Ok(None)
           }
           (Some(ty::rv_invariant), Some(a), Some(b)) => {
             do eq_regions(self, a, b).then {
-                ok(Some(a))
+                Ok(Some(a))
             }
           }
           (Some(ty::rv_covariant), Some(a), Some(b)) => {
             do self.regions(a, b).chain |r| {
-                ok(Some(r))
+                Ok(Some(r))
             }
           }
           (Some(ty::rv_contravariant), Some(a), Some(b)) => {
             do self.contraregions(a, b).chain |r| {
-                ok(Some(r))
+                Ok(Some(r))
             }
           }
           (_, _, _) => {
@@ -200,7 +200,7 @@ fn super_substs<C:combine>(
             do relate_region_param(self, did,
                                    a.self_r, b.self_r).chain |self_r|
             {
-                ok({self_r: self_r, self_ty: self_ty, tps: tps})
+                Ok({self_r: self_r, self_ty: self_ty, tps: tps})
             }
         }
     }
@@ -217,9 +217,9 @@ fn super_tps<C:combine>(
     if vec::same_length(as, bs) {
         iter_vec2(as, bs, |a, b| {
             eq_tys(self, a, b)
-        }).then(|| ok(as.to_vec()) )
+        }).then(|| Ok(as.to_vec()) )
     } else {
-        err(ty::terr_ty_param_size(
+        Err(ty::terr_ty_param_size(
             expected_found(self, as.len(), bs.len())))
     }
 }
@@ -232,17 +232,17 @@ fn super_self_tys<C:combine>(
 
     match (a, b) {
       (None, None) => {
-        ok(None)
+        Ok(None)
       }
       (Some(a), Some(b)) => {
-        eq_tys(self, a, b).then(|| ok(Some(a)) )
+        eq_tys(self, a, b).then(|| Ok(Some(a)) )
       }
       (None, Some(_)) |
       (Some(_), None) => {
         // I think it should never happen that we unify two substs and
         // one of them has a self_ty and one doesn't...? I could be
         // wrong about this.
-        err(ty::terr_self_substs)
+        Err(ty::terr_self_substs)
       }
     }
 }
@@ -252,10 +252,10 @@ fn super_flds<C:combine>(
 
     if a.ident == b.ident {
         self.mts(a.mt, b.mt)
-            .chain(|mt| ok({ident: a.ident, mt: mt}) )
-            .chain_err(|e| err(ty::terr_in_field(@e, a.ident)) )
+            .chain(|mt| Ok({ident: a.ident, mt: mt}) )
+            .chain_err(|e| Err(ty::terr_in_field(@e, a.ident)) )
     } else {
-        err(ty::terr_record_fields(
+        Err(ty::terr_record_fields(
             expected_found(self, a.ident, b.ident)))
     }
 }
@@ -274,7 +274,7 @@ fn super_args<C:combine>(
 
     do self.modes(a.mode, b.mode).chain |m| {
         do self.contratys(a.ty, b.ty).chain |t| {
-            ok({mode: m, ty: t})
+            Ok({mode: m, ty: t})
         }
     }
 }
@@ -286,16 +286,16 @@ fn super_vstores<C:combine>(
     match (a, b) {
       (ty::vstore_slice(a_r), ty::vstore_slice(b_r)) => {
         do self.contraregions(a_r, b_r).chain |r| {
-            ok(ty::vstore_slice(r))
+            Ok(ty::vstore_slice(r))
         }
       }
 
       _ if a == b => {
-        ok(a)
+        Ok(a)
       }
 
       _ => {
-        err(ty::terr_vstores_differ(vk, expected_found(self, a, b)))
+        Err(ty::terr_vstores_differ(vk, expected_found(self, a, b)))
       }
     }
 }
@@ -309,7 +309,7 @@ fn super_fns<C:combine>(
         if vec::same_length(a_args, b_args) {
             map_vec2(a_args, b_args, |a, b| self.args(a, b) )
         } else {
-            err(ty::terr_arg_count)
+            Err(ty::terr_arg_count)
         }
     }
 
@@ -321,7 +321,7 @@ fn super_fns<C:combine>(
                     // FIXME: uncomment if #2588 doesn't get accepted:
                     // self.infcx().constrvecs(a_f.constraints,
                     //                         b_f.constraints).then {||
-                        ok({purity: purity,
+                        Ok({purity: purity,
                             proto: p,
                             bounds: a_f.bounds, // XXX: This is wrong!
                             inputs: inputs,
@@ -354,15 +354,15 @@ fn super_tys<C:combine>(
 
       // Relate integral variables to other types
       (ty::ty_var_integral(a_id), ty::ty_var_integral(b_id)) => {
-        self.infcx().vars_integral(a_id, b_id).then(|| ok(a) )
+        self.infcx().vars_integral(a_id, b_id).then(|| Ok(a) )
       }
       (ty::ty_var_integral(a_id), ty::ty_int(_)) |
       (ty::ty_var_integral(a_id), ty::ty_uint(_)) => {
-        self.infcx().var_integral_sub_t(a_id, b).then(|| ok(a) )
+        self.infcx().var_integral_sub_t(a_id, b).then(|| Ok(a) )
       }
       (ty::ty_int(_), ty::ty_var_integral(b_id)) |
       (ty::ty_uint(_), ty::ty_var_integral(b_id)) => {
-        self.infcx().t_sub_var_integral(a, b_id).then(|| ok(a) )
+        self.infcx().t_sub_var_integral(a, b_id).then(|| Ok(a) )
       }
 
       (ty::ty_int(_), _) |
@@ -371,9 +371,9 @@ fn super_tys<C:combine>(
         let as = ty::get(a).struct;
         let bs = ty::get(b).struct;
         if as == bs {
-            ok(a)
+            Ok(a)
         } else {
-            err(ty::terr_sorts(expected_found(self, a, b)))
+            Err(ty::terr_sorts(expected_found(self, a, b)))
         }
       }
 
@@ -381,21 +381,21 @@ fn super_tys<C:combine>(
       (ty::ty_bool, _) => {
         let cfg = tcx.sess.targ_cfg;
         if ty::mach_sty(cfg, a) == ty::mach_sty(cfg, b) {
-            ok(a)
+            Ok(a)
         } else {
-            err(ty::terr_sorts(expected_found(self, a, b)))
+            Err(ty::terr_sorts(expected_found(self, a, b)))
         }
       }
 
       (ty::ty_param(a_p), ty::ty_param(b_p)) if a_p.idx == b_p.idx => {
-        ok(a)
+        Ok(a)
       }
 
       (ty::ty_enum(a_id, ref a_substs),
        ty::ty_enum(b_id, ref b_substs))
       if a_id == b_id => {
         do self.substs(a_id, a_substs, b_substs).chain |substs| {
-            ok(ty::mk_enum(tcx, a_id, substs))
+            Ok(ty::mk_enum(tcx, a_id, substs))
         }
       }
 
@@ -404,7 +404,7 @@ fn super_tys<C:combine>(
       if a_id == b_id => {
         do self.substs(a_id, a_substs, b_substs).chain |substs| {
             do self.vstores(ty::terr_trait, a_vstore, b_vstore).chain |vs| {
-                ok(ty::mk_trait(tcx, a_id, substs, vs))
+                Ok(ty::mk_trait(tcx, a_id, substs, vs))
             }
         }
       }
@@ -412,32 +412,32 @@ fn super_tys<C:combine>(
       (ty::ty_class(a_id, ref a_substs), ty::ty_class(b_id, ref b_substs))
       if a_id == b_id => {
         do self.substs(a_id, a_substs, b_substs).chain |substs| {
-            ok(ty::mk_class(tcx, a_id, substs))
+            Ok(ty::mk_class(tcx, a_id, substs))
         }
       }
 
       (ty::ty_box(a_mt), ty::ty_box(b_mt)) => {
         do self.mts(a_mt, b_mt).chain |mt| {
-            ok(ty::mk_box(tcx, mt))
+            Ok(ty::mk_box(tcx, mt))
         }
       }
 
       (ty::ty_uniq(a_mt), ty::ty_uniq(b_mt)) => {
         do self.mts(a_mt, b_mt).chain |mt| {
-            ok(ty::mk_uniq(tcx, mt))
+            Ok(ty::mk_uniq(tcx, mt))
         }
       }
 
       (ty::ty_ptr(a_mt), ty::ty_ptr(b_mt)) => {
         do self.mts(a_mt, b_mt).chain |mt| {
-            ok(ty::mk_ptr(tcx, mt))
+            Ok(ty::mk_ptr(tcx, mt))
         }
       }
 
       (ty::ty_rptr(a_r, a_mt), ty::ty_rptr(b_r, b_mt)) => {
         do self.contraregions(a_r, b_r).chain |r| {
             do self.mts(a_mt, b_mt).chain |mt| {
-                ok(ty::mk_rptr(tcx, r, mt))
+                Ok(ty::mk_rptr(tcx, r, mt))
             }
         }
       }
@@ -445,14 +445,14 @@ fn super_tys<C:combine>(
       (ty::ty_evec(a_mt, vs_a), ty::ty_evec(b_mt, vs_b)) => {
         do self.mts(a_mt, b_mt).chain |mt| {
             do self.vstores(ty::terr_vec, vs_a, vs_b).chain |vs| {
-                ok(ty::mk_evec(tcx, mt, vs))
+                Ok(ty::mk_evec(tcx, mt, vs))
             }
         }
       }
 
       (ty::ty_estr(vs_a), ty::ty_estr(vs_b)) => {
         do self.vstores(ty::terr_str, vs_a, vs_b).chain |vs| {
-            ok(ty::mk_estr(tcx,vs))
+            Ok(ty::mk_estr(tcx,vs))
         }
       }
 
@@ -460,9 +460,9 @@ fn super_tys<C:combine>(
         if vec::same_length(as, bs) {
             map_vec2(as, bs, |a,b| {
                 self.flds(a, b)
-            }).chain(|flds| ok(ty::mk_rec(tcx, flds)) )
+            }).chain(|flds| Ok(ty::mk_rec(tcx, flds)) )
         } else {
-            err(ty::terr_record_size(expected_found(self, as.len(),
+            Err(ty::terr_record_size(expected_found(self, as.len(),
                                                     bs.len())))
         }
       }
@@ -470,19 +470,19 @@ fn super_tys<C:combine>(
       (ty::ty_tup(as), ty::ty_tup(bs)) => {
         if vec::same_length(as, bs) {
             map_vec2(as, bs, |a, b| self.tys(a, b) )
-                .chain(|ts| ok(ty::mk_tup(tcx, ts)) )
+                .chain(|ts| Ok(ty::mk_tup(tcx, ts)) )
         } else {
-            err(ty::terr_tuple_size(expected_found(self, as.len(), bs.len())))
+            Err(ty::terr_tuple_size(expected_found(self, as.len(), bs.len())))
         }
       }
 
       (ty::ty_fn(ref a_fty), ty::ty_fn(ref b_fty)) => {
         do self.fns(a_fty, b_fty).chain |fty| {
-            ok(ty::mk_fn(tcx, fty))
+            Ok(ty::mk_fn(tcx, fty))
         }
       }
 
-      _ => err(ty::terr_sorts(expected_found(self, a, b)))
+      _ => Err(ty::terr_sorts(expected_found(self, a, b)))
     }
 }
 
diff --git a/src/rustc/middle/typeck/infer/glb.rs b/src/rustc/middle/typeck/infer/glb.rs
index 87b610d433b..7243efb9db7 100644
--- a/src/rustc/middle/typeck/infer/glb.rs
+++ b/src/rustc/middle/typeck/infer/glb.rs
@@ -26,17 +26,17 @@ impl Glb: combine {
           // the precise type from the mut side.
           (m_mutbl, m_const) => {
             Sub(*self).tys(a.ty, b.ty).chain(|_t| {
-                ok({ty: a.ty, mutbl: m_mutbl})
+                Ok({ty: a.ty, mutbl: m_mutbl})
             })
           }
           (m_const, m_mutbl) => {
             Sub(*self).tys(b.ty, a.ty).chain(|_t| {
-                ok({ty: b.ty, mutbl: m_mutbl})
+                Ok({ty: b.ty, mutbl: m_mutbl})
             })
           }
           (m_mutbl, m_mutbl) => {
             eq_tys(&self, a.ty, b.ty).then(|| {
-                ok({ty: a.ty, mutbl: m_mutbl})
+                Ok({ty: a.ty, mutbl: m_mutbl})
             })
           }
 
@@ -46,7 +46,7 @@ impl Glb: combine {
           (m_const, m_imm) |
           (m_imm, m_imm) => {
             self.tys(a.ty, b.ty).chain(|t| {
-                ok({ty: t, mutbl: m_imm})
+                Ok({ty: t, mutbl: m_imm})
             })
           }
 
@@ -54,14 +54,14 @@ impl Glb: combine {
           // sides and mutbl of only `m_const`.
           (m_const, m_const) => {
             self.tys(a.ty, b.ty).chain(|t| {
-                ok({ty: t, mutbl: m_const})
+                Ok({ty: t, mutbl: m_const})
             })
           }
 
           // There is no mutual subtype of these combinations.
           (m_mutbl, m_imm) |
           (m_imm, m_mutbl) => {
-              err(ty::terr_mutability)
+              Err(ty::terr_mutability)
           }
         }
     }
@@ -72,39 +72,39 @@ impl Glb: combine {
 
     fn protos(p1: ty::fn_proto, p2: ty::fn_proto) -> cres<ty::fn_proto> {
         match (p1, p2) {
-            (ty::proto_vstore(ty::vstore_slice(_)), _) => ok(p2),
-            (_, ty::proto_vstore(ty::vstore_slice(_))) => ok(p1),
+            (ty::proto_vstore(ty::vstore_slice(_)), _) => Ok(p2),
+            (_, ty::proto_vstore(ty::vstore_slice(_))) => Ok(p1),
             (ty::proto_vstore(v1), ty::proto_vstore(v2)) => {
                 self.infcx.try(|| {
                     do self.vstores(terr_fn, v1, v2).chain |vs| {
-                        ok(ty::proto_vstore(vs))
+                        Ok(ty::proto_vstore(vs))
                     }
                 }).chain_err(|_err| {
                     // XXX: Totally unsound, but fixed up later.
-                    ok(ty::proto_bare)
+                    Ok(ty::proto_bare)
                 })
             }
-            _ => ok(ty::proto_bare)
+            _ => Ok(ty::proto_bare)
         }
     }
 
     fn purities(a: purity, b: purity) -> cres<purity> {
         match (a, b) {
-          (pure_fn, _) | (_, pure_fn) => ok(pure_fn),
-          (extern_fn, _) | (_, extern_fn) => ok(extern_fn),
-          (impure_fn, _) | (_, impure_fn) => ok(impure_fn),
-          (unsafe_fn, unsafe_fn) => ok(unsafe_fn)
+          (pure_fn, _) | (_, pure_fn) => Ok(pure_fn),
+          (extern_fn, _) | (_, extern_fn) => Ok(extern_fn),
+          (impure_fn, _) | (_, impure_fn) => Ok(impure_fn),
+          (unsafe_fn, unsafe_fn) => Ok(unsafe_fn)
         }
     }
 
     fn ret_styles(r1: ret_style, r2: ret_style) -> cres<ret_style> {
         match (r1, r2) {
           (ast::return_val, ast::return_val) => {
-            ok(ast::return_val)
+            Ok(ast::return_val)
           }
           (ast::noreturn, _) |
           (_, ast::noreturn) => {
-            ok(ast::noreturn)
+            Ok(ast::noreturn)
           }
         }
     }
diff --git a/src/rustc/middle/typeck/infer/lattice.rs b/src/rustc/middle/typeck/infer/lattice.rs
index b5b694d6283..82f69df7fe6 100644
--- a/src/rustc/middle/typeck/infer/lattice.rs
+++ b/src/rustc/middle/typeck/infer/lattice.rs
@@ -20,7 +20,7 @@ impl Lub: lattice_ops {
         {ub: Some(t) with b}
     }
     fn ty_bot(t: ty::t) -> cres<ty::t> {
-        ok(t)
+        Ok(t)
     }
 }
 
@@ -30,7 +30,7 @@ impl Glb: lattice_ops {
         {lb: Some(t) with b}
     }
     fn ty_bot(_t: ty::t) -> cres<ty::t> {
-        ok(ty::mk_bot(self.infcx.tcx))
+        Ok(ty::mk_bot(self.infcx.tcx))
     }
 }
 
@@ -40,7 +40,7 @@ fn lattice_tys<L:lattice_ops combine>(
     debug!("%s.lattice_tys(%s, %s)", self.tag(),
            a.to_str(self.infcx()),
            b.to_str(self.infcx()));
-    if a == b { return ok(a); }
+    if a == b { return Ok(a); }
     do indent {
         match (ty::get(a).struct, ty::get(b).struct) {
           (ty::ty_bot, _) => self.ty_bot(b),
@@ -90,7 +90,7 @@ fn lattice_vars<L:lattice_ops combine>(
            b_vid.to_str(), b_bounds.to_str(self.infcx()));
 
     if a_vid == b_vid {
-        return ok(a_t);
+        return Ok(a_t);
     }
 
     // If both A and B have an UB type, then we can just compute the
@@ -99,8 +99,8 @@ fn lattice_vars<L:lattice_ops combine>(
     match (a_bnd, b_bnd) {
       (Some(a_ty), Some(b_ty)) => {
         match self.infcx().try(|| c_ts(a_ty, b_ty) ) {
-            ok(t) => return ok(t),
-            err(_) => { /*fallthrough */ }
+            Ok(t) => return Ok(t),
+            Err(_) => { /*fallthrough */ }
         }
       }
       _ => {/*fallthrough*/}
@@ -108,7 +108,7 @@ fn lattice_vars<L:lattice_ops combine>(
 
     // Otherwise, we need to merge A and B into one variable.  We can
     // then use either variable as an upper bound:
-    var_sub_var(self, a_vid, b_vid).then(|| ok(a_t) )
+    var_sub_var(self, a_vid, b_vid).then(|| Ok(a_t) )
 }
 
 fn lattice_var_and_t<L:lattice_ops combine>(
@@ -141,7 +141,7 @@ fn lattice_var_and_t<L:lattice_ops combine>(
         let a_bounds = self.with_bnd(a_bounds, b);
         do bnds(self, a_bounds.lb, a_bounds.ub).then {
             self.infcx().set(vb, a_id, root(a_bounds, nde_a.rank));
-            ok(b)
+            Ok(b)
         }
       }
     }
diff --git a/src/rustc/middle/typeck/infer/lub.rs b/src/rustc/middle/typeck/infer/lub.rs
index 78013a43422..c2477c695bf 100644
--- a/src/rustc/middle/typeck/infer/lub.rs
+++ b/src/rustc/middle/typeck/infer/lub.rs
@@ -13,7 +13,7 @@ impl Lub: combine {
     fn lub() -> Lub { Lub(*self) }
     fn glb() -> Glb { Glb(*self) }
 
-    fn bot_ty(b: ty::t) -> cres<ty::t> { ok(b) }
+    fn bot_ty(b: ty::t) -> cres<ty::t> { Ok(b) }
     fn ty_bot(b: ty::t) -> cres<ty::t> { self.bot_ty(b) } // commutative
 
     fn mts(a: ty::mt, b: ty::mt) -> cres<ty::mt> {
@@ -32,17 +32,17 @@ impl Lub: combine {
 
         match m {
           m_imm | m_const => {
-            self.tys(a.ty, b.ty).chain(|t| ok({ty: t, mutbl: m}) )
+            self.tys(a.ty, b.ty).chain(|t| Ok({ty: t, mutbl: m}) )
           }
 
           m_mutbl => {
             self.infcx.try(|| {
                 eq_tys(&self, a.ty, b.ty).then(|| {
-                    ok({ty: a.ty, mutbl: m})
+                    Ok({ty: a.ty, mutbl: m})
                 })
             }).chain_err(|_e| {
                 self.tys(a.ty, b.ty).chain(|t| {
-                    ok({ty: t, mutbl: m_const})
+                    Ok({ty: t, mutbl: m_const})
                 })
             })
           }
@@ -56,16 +56,16 @@ impl Lub: combine {
     // XXX: Wrong.
     fn protos(p1: ty::fn_proto, p2: ty::fn_proto) -> cres<ty::fn_proto> {
         match (p1, p2) {
-            (ty::proto_bare, _) => ok(p2),
-            (_, ty::proto_bare) => ok(p1),
+            (ty::proto_bare, _) => Ok(p2),
+            (_, ty::proto_bare) => Ok(p1),
             (ty::proto_vstore(v1), ty::proto_vstore(v2)) => {
                 self.infcx.try(|| {
                     do self.vstores(terr_fn, v1, v2).chain |vs| {
-                        ok(ty::proto_vstore(vs))
+                        Ok(ty::proto_vstore(vs))
                     }
                 }).chain_err(|_err| {
                     // XXX: Totally unsound, but fixed up later.
-                    ok(ty::proto_vstore(ty::vstore_slice(ty::re_static)))
+                    Ok(ty::proto_vstore(ty::vstore_slice(ty::re_static)))
                 })
             }
         }
@@ -73,18 +73,18 @@ impl Lub: combine {
 
     fn purities(a: purity, b: purity) -> cres<purity> {
         match (a, b) {
-          (unsafe_fn, _) | (_, unsafe_fn) => ok(unsafe_fn),
-          (impure_fn, _) | (_, impure_fn) => ok(impure_fn),
-          (extern_fn, _) | (_, extern_fn) => ok(extern_fn),
-          (pure_fn, pure_fn) => ok(pure_fn)
+          (unsafe_fn, _) | (_, unsafe_fn) => Ok(unsafe_fn),
+          (impure_fn, _) | (_, impure_fn) => Ok(impure_fn),
+          (extern_fn, _) | (_, extern_fn) => Ok(extern_fn),
+          (pure_fn, pure_fn) => Ok(pure_fn)
         }
     }
 
     fn ret_styles(r1: ret_style, r2: ret_style) -> cres<ret_style> {
         match (r1, r2) {
           (ast::return_val, _) |
-          (_, ast::return_val) => ok(ast::return_val),
-          (ast::noreturn, ast::noreturn) => ok(ast::noreturn)
+          (_, ast::return_val) => Ok(ast::return_val),
+          (ast::noreturn, ast::noreturn) => Ok(ast::noreturn)
         }
     }
 
diff --git a/src/rustc/middle/typeck/infer/region_var_bindings.rs b/src/rustc/middle/typeck/infer/region_var_bindings.rs
index a00a8eb722a..a39152e155e 100644
--- a/src/rustc/middle/typeck/infer/region_var_bindings.rs
+++ b/src/rustc/middle/typeck/infer/region_var_bindings.rs
@@ -306,8 +306,8 @@ because `&x` was created alone, but is relatable to `&A`.
 #[warn(deprecated_pattern)];
 
 import dvec::{DVec, dvec};
-import result::result;
-import result::{ok, err};
+import result::Result;
+import result::{Ok, Err};
 import std::map::{hashmap, uint_hash};
 import std::cell::{Cell, empty_cell};
 import std::list::{list, nil, cons};
@@ -478,21 +478,21 @@ impl RegionVarBindings {
         match (sub, sup) {
           (ty::re_var (sub_id), ty::re_var(sup_id)) => {
             self.add_constraint(ConstrainVarSubVar(sub_id, sup_id), span);
-            ok(())
+            Ok(())
           }
           (r, ty::re_var(sup_id)) => {
             self.add_constraint(ConstrainRegSubVar(r, sup_id), span);
-            ok(())
+            Ok(())
           }
           (ty::re_var(sub_id), r) => {
             self.add_constraint(ConstrainVarSubReg(sub_id, r), span);
-            ok(())
+            Ok(())
           }
           _ => {
             if self.is_subregion_of(sub, sup) {
-                ok(())
+                Ok(())
             } else {
-                err(ty::terr_regions_does_not_outlive(sub, sup))
+                Err(ty::terr_regions_does_not_outlive(sub, sup))
             }
           }
         }
@@ -505,7 +505,7 @@ impl RegionVarBindings {
         debug!("RegionVarBindings: lub_regions(%?, %?)", a, b);
         match (a, b) {
           (ty::re_static, _) | (_, ty::re_static) => {
-            ok(ty::re_static) // nothing lives longer than static
+            Ok(ty::re_static) // nothing lives longer than static
           }
 
           (ty::re_var(*), _) | (_, ty::re_var(*)) => {
@@ -515,7 +515,7 @@ impl RegionVarBindings {
           }
 
           _ => {
-            ok(self.lub_concrete_regions(a, b))
+            Ok(self.lub_concrete_regions(a, b))
           }
         }
     }
@@ -528,7 +528,7 @@ impl RegionVarBindings {
         match (a, b) {
           (ty::re_static, r) | (r, ty::re_static) => {
             // static lives longer than everything else
-            ok(r)
+            Ok(r)
           }
 
           (ty::re_var(*), _) | (_, ty::re_var(*)) => {
@@ -561,7 +561,7 @@ impl RegionVarBindings {
 
         let vars = TwoRegions { a: a, b: b };
         match combines.find(vars) {
-          Some(c) => ok(ty::re_var(c)),
+          Some(c) => Ok(ty::re_var(c)),
           None => {
             let c = self.new_region_var(span);
             combines.insert(vars, c);
@@ -571,7 +571,7 @@ impl RegionVarBindings {
             do relate(a, ty::re_var(c)).then {
                 do relate(b, ty::re_var(c)).then {
                     debug!("combine_vars() c=%?", ty::re_var(c));
-                    ok(ty::re_var(c))
+                    Ok(ty::re_var(c))
                 }
             }
           }
@@ -655,7 +655,7 @@ priv impl RegionVarBindings {
         match (a, b) {
           (ty::re_static, r) | (r, ty::re_static) => {
             // static lives longer than everything else
-            ok(r)
+            Ok(r)
           }
 
           (ty::re_var(v_id), _) | (_, ty::re_var(v_id)) => {
@@ -674,8 +674,8 @@ priv impl RegionVarBindings {
             // big the free region is precisely, the GLB is undefined.
             let rm = self.tcx.region_map;
             match region::nearest_common_ancestor(rm, f_id, s_id) {
-              Some(r_id) if r_id == f_id => ok(s),
-              _ => err(ty::terr_regions_no_overlap(b, a))
+              Some(r_id) if r_id == f_id => Ok(s),
+              _ => Err(ty::terr_regions_no_overlap(b, a))
             }
           }
 
@@ -683,7 +683,7 @@ priv impl RegionVarBindings {
           (ty::re_free(a_id, _), ty::re_free(b_id, _)) => {
             if a == b {
                 // Same scope or same free identifier, easy case.
-                ok(a)
+                Ok(a)
             } else {
                 // We want to generate the intersection of two
                 // scopes or two free regions.  So, if one of
@@ -691,9 +691,9 @@ priv impl RegionVarBindings {
                 // it.  Otherwise fail.
                 let rm = self.tcx.region_map;
                 match region::nearest_common_ancestor(rm, a_id, b_id) {
-                  Some(r_id) if a_id == r_id => ok(ty::re_scope(b_id)),
-                  Some(r_id) if b_id == r_id => ok(ty::re_scope(a_id)),
-                  _ => err(ty::terr_regions_no_overlap(b, a))
+                  Some(r_id) if a_id == r_id => Ok(ty::re_scope(b_id)),
+                  Some(r_id) if b_id == r_id => Ok(ty::re_scope(a_id)),
+                  _ => Err(ty::terr_regions_no_overlap(b, a))
                 }
             }
           }
@@ -706,9 +706,9 @@ priv impl RegionVarBindings {
           (ty::re_free(_, _), ty::re_bound(_)) |
           (ty::re_scope(_), ty::re_bound(_)) => {
             if a == b {
-                ok(a)
+                Ok(a)
             } else {
-                err(ty::terr_regions_no_overlap(b, a))
+                Err(ty::terr_regions_no_overlap(b, a))
             }
           }
         }
@@ -961,7 +961,7 @@ impl RegionVarBindings {
                        a_region: region,
                        b_region: region) -> bool {
             match self.glb_concrete_regions(a_region, b_region) {
-              ok(glb) => {
+              Ok(glb) => {
                 if glb == a_region {
                     false
                 } else {
@@ -971,7 +971,7 @@ impl RegionVarBindings {
                     true
                 }
               }
-              err(_) => {
+              Err(_) => {
                 a_node.value = ErrorValue;
                 false
               }
@@ -1101,8 +1101,8 @@ impl RegionVarBindings {
             for vec::each(upper_bounds) |upper_bound_2| {
                 match self.glb_concrete_regions(upper_bound_1.region,
                                                 upper_bound_2.region) {
-                  ok(_) => {}
-                  err(_) => {
+                  Ok(_) => {}
+                  Err(_) => {
 
                     if self.is_reported(dup_map,
                                         upper_bound_1.region,
diff --git a/src/rustc/middle/typeck/infer/resolve.rs b/src/rustc/middle/typeck/infer/resolve.rs
index b26c2facbcd..a921ca7bddd 100644
--- a/src/rustc/middle/typeck/infer/resolve.rs
+++ b/src/rustc/middle/typeck/infer/resolve.rs
@@ -92,9 +92,9 @@ impl resolve_state {
             debug!("Resolved to %s (modes=%x)",
                    ty_to_str(self.infcx.tcx, rty),
                    self.modes);
-            return ok(rty);
+            return Ok(rty);
           }
-          Some(e) => return err(e)
+          Some(e) => return Err(e)
         }
     }
 
@@ -102,8 +102,8 @@ impl resolve_state {
         self.err = None;
         let resolved = indent(|| self.resolve_region(orig) );
         match self.err {
-          None => ok(resolved),
-          Some(e) => err(e)
+          None => Ok(resolved),
+          Some(e) => Err(e)
         }
     }
 
diff --git a/src/rustc/middle/typeck/infer/sub.rs b/src/rustc/middle/typeck/infer/sub.rs
index c51ec05b471..7a039ae497a 100644
--- a/src/rustc/middle/typeck/infer/sub.rs
+++ b/src/rustc/middle/typeck/infer/sub.rs
@@ -34,8 +34,8 @@ impl Sub: combine {
                b.to_str(self.infcx));
         do indent {
             match self.infcx.region_vars.make_subregion(self.span, a, b) {
-              ok(()) => ok(a),
-              err(e) => err(e)
+              Ok(()) => Ok(a),
+              Err(e) => Err(e)
             }
         }
     }
@@ -44,18 +44,18 @@ impl Sub: combine {
         debug!("mts(%s <: %s)", a.to_str(self.infcx), b.to_str(self.infcx));
 
         if a.mutbl != b.mutbl && b.mutbl != m_const {
-            return err(ty::terr_mutability);
+            return Err(ty::terr_mutability);
         }
 
         match b.mutbl {
           m_mutbl => {
             // If supertype is mut, subtype must match exactly
             // (i.e., invariant if mut):
-            eq_tys(&self, a.ty, b.ty).then(|| ok(a) )
+            eq_tys(&self, a.ty, b.ty).then(|| Ok(a) )
           }
           m_imm | m_const => {
             // Otherwise we can be covariant:
-            self.tys(a.ty, b.ty).chain(|_t| ok(a) )
+            self.tys(a.ty, b.ty).chain(|_t| Ok(a) )
           }
         }
     }
@@ -63,22 +63,22 @@ impl Sub: combine {
     fn protos(a: ty::fn_proto, b: ty::fn_proto) -> cres<ty::fn_proto> {
         match (a, b) {
             (ty::proto_bare, _) =>
-                ok(ty::proto_bare),
+                Ok(ty::proto_bare),
 
             (ty::proto_vstore(ty::vstore_box),
              ty::proto_vstore(ty::vstore_slice(_))) =>
-                ok(ty::proto_vstore(ty::vstore_box)),
+                Ok(ty::proto_vstore(ty::vstore_box)),
 
             (ty::proto_vstore(ty::vstore_uniq),
              ty::proto_vstore(ty::vstore_slice(_))) =>
-                ok(ty::proto_vstore(ty::vstore_uniq)),
+                Ok(ty::proto_vstore(ty::vstore_uniq)),
 
             (_, ty::proto_bare) =>
-                err(ty::terr_proto_mismatch(expected_found(&self, a, b))),
+                Err(ty::terr_proto_mismatch(expected_found(&self, a, b))),
 
             (ty::proto_vstore(vs_a), ty::proto_vstore(vs_b)) => {
                 do self.vstores(ty::terr_fn, vs_a, vs_b).chain |vs_c| {
-                    ok(ty::proto_vstore(vs_c))
+                    Ok(ty::proto_vstore(vs_c))
                 }
             }
         }
@@ -99,23 +99,23 @@ impl Sub: combine {
     fn tys(a: ty::t, b: ty::t) -> cres<ty::t> {
         debug!("%s.tys(%s, %s)", self.tag(),
                a.to_str(self.infcx), b.to_str(self.infcx));
-        if a == b { return ok(a); }
+        if a == b { return Ok(a); }
         do indent {
             match (ty::get(a).struct, ty::get(b).struct) {
               (ty::ty_bot, _) => {
-                ok(a)
+                Ok(a)
               }
               (ty::ty_var(a_id), ty::ty_var(b_id)) => {
-                var_sub_var(&self, a_id, b_id).then(|| ok(a) )
+                var_sub_var(&self, a_id, b_id).then(|| Ok(a) )
               }
               (ty::ty_var(a_id), _) => {
-                var_sub_t(&self, a_id, b).then(|| ok(a) )
+                var_sub_t(&self, a_id, b).then(|| Ok(a) )
               }
               (_, ty::ty_var(b_id)) => {
-                t_sub_var(&self, a, b_id).then(|| ok(a) )
+                t_sub_var(&self, a, b_id).then(|| Ok(a) )
               }
               (_, ty::ty_bot) => {
-                err(ty::terr_sorts(expected_found(&self, a, b)))
+                Err(ty::terr_sorts(expected_found(&self, a, b)))
               }
               _ => {
                 super_tys(&self, a, b)
diff --git a/src/rustc/middle/typeck/infer/unify.rs b/src/rustc/middle/typeck/infer/unify.rs
index 11bbc6609f5..ed9daafeba3 100644
--- a/src/rustc/middle/typeck/infer/unify.rs
+++ b/src/rustc/middle/typeck/infer/unify.rs
@@ -69,12 +69,12 @@ fn merge_bnd<C: combine>(
     let _r = indenter();
 
     match (a, b) {
-      (None, None) => ok(None),
-      (Some(_), None) => ok(a),
-      (None, Some(_)) => ok(b),
+      (None, None) => Ok(None),
+      (Some(_), None) => Ok(a),
+      (None, Some(_)) => Ok(b),
       (Some(v_a), Some(v_b)) => {
         do merge_op(v_a, v_b).chain |v| {
-            ok(Some(v))
+            Ok(Some(v))
         }
       }
     }
@@ -96,7 +96,7 @@ fn merge_bnds<C: combine>(
                    a.lb.to_str(self.infcx()),
                    b.lb.to_str(self.infcx()),
                    lb.to_str(self.infcx()));
-            ok({lb: lb, ub: ub})
+            Ok({lb: lb, ub: ub})
         }
     }
 }
@@ -198,8 +198,8 @@ fn var_sub_var<C: combine>(self: &C,
       (Some(a_ub), Some(b_lb)) => {
         let r = self.infcx().try(|| self.sub().tys(a_ub, b_lb));
         match r {
-          ok(_ty) => return result::ok(()),
-          err(_) => { /*fallthrough */ }
+          Ok(_ty) => return result::Ok(()),
+          Err(_) => { /*fallthrough */ }
         }
       }
       _ => { /*fallthrough*/ }
@@ -311,7 +311,7 @@ impl infer_ctxt {
         // possible types.
         let intersection = intersection(a_pt, b_pt);
         if *intersection == INT_TY_SET_EMPTY {
-            return err(ty::terr_no_integral_type);
+            return Err(ty::terr_no_integral_type);
         }
 
         // Rank optimization
@@ -351,7 +351,7 @@ impl infer_ctxt {
             intersection(a_pt,
                          convert_integral_ty_to_int_ty_set(self.tcx, b));
         if *intersection == INT_TY_SET_EMPTY {
-            return err(ty::terr_no_integral_type);
+            return Err(ty::terr_no_integral_type);
         }
         self.set(vb, a_id, root(intersection, nde_a.rank));
         uok()
@@ -369,7 +369,7 @@ impl infer_ctxt {
             intersection(b_pt,
                          convert_integral_ty_to_int_ty_set(self.tcx, a));
         if *intersection == INT_TY_SET_EMPTY {
-            return err(ty::terr_no_integral_type);
+            return Err(ty::terr_no_integral_type);
         }
         self.set(vb, b_id, root(intersection, nde_b.rank));
         uok()
diff --git a/src/rustc/middle/typeck/rscope.rs b/src/rustc/middle/typeck/rscope.rs
index c18bbd12ae1..42a16ad5ab3 100644
--- a/src/rustc/middle/typeck/rscope.rs
+++ b/src/rustc/middle/typeck/rscope.rs
@@ -1,37 +1,37 @@
-import result::result;
+import result::Result;
 import syntax::parse::token::special_idents;
 
 trait region_scope {
-    fn anon_region(span: span) -> result<ty::region, ~str>;
-    fn named_region(span: span, id: ast::ident) -> result<ty::region, ~str>;
+    fn anon_region(span: span) -> Result<ty::region, ~str>;
+    fn named_region(span: span, id: ast::ident) -> Result<ty::region, ~str>;
 }
 
 enum empty_rscope { empty_rscope }
 impl empty_rscope: region_scope {
-    fn anon_region(_span: span) -> result<ty::region, ~str> {
-        result::ok(ty::re_static)
+    fn anon_region(_span: span) -> Result<ty::region, ~str> {
+        result::Ok(ty::re_static)
     }
-    fn named_region(_span: span, id: ast::ident) -> result<ty::region, ~str> {
-        if id == special_idents::static { result::ok(ty::re_static) }
-        else { result::err(~"only the static region is allowed here") }
+    fn named_region(_span: span, id: ast::ident) -> Result<ty::region, ~str> {
+        if id == special_idents::static { result::Ok(ty::re_static) }
+        else { result::Err(~"only the static region is allowed here") }
     }
 }
 
 enum type_rscope = Option<ty::region_variance>;
 impl type_rscope: region_scope {
-    fn anon_region(_span: span) -> result<ty::region, ~str> {
+    fn anon_region(_span: span) -> Result<ty::region, ~str> {
         match *self {
-          Some(_) => result::ok(ty::re_bound(ty::br_self)),
-          None => result::err(~"to use region types here, the containing \
+          Some(_) => result::Ok(ty::re_bound(ty::br_self)),
+          None => result::Err(~"to use region types here, the containing \
                                 type must be declared with a region bound")
         }
     }
-    fn named_region(span: span, id: ast::ident) -> result<ty::region, ~str> {
+    fn named_region(span: span, id: ast::ident) -> Result<ty::region, ~str> {
         do empty_rscope.named_region(span, id).chain_err |_e| {
             if id == special_idents::self_ {
                 self.anon_region(span)
             } else {
-                result::err(~"named regions other than `self` are not \
+                result::Err(~"named regions other than `self` are not \
                              allowed as part of a type declaration")
             }
         }
@@ -51,10 +51,10 @@ fn in_anon_rscope<RS: region_scope copy owned>(self: RS, r: ty::region)
     @anon_rscope({anon: r, base: self as region_scope})
 }
 impl @anon_rscope: region_scope {
-    fn anon_region(_span: span) -> result<ty::region, ~str> {
-        result::ok(self.anon)
+    fn anon_region(_span: span) -> Result<ty::region, ~str> {
+        result::Ok(self.anon)
     }
-    fn named_region(span: span, id: ast::ident) -> result<ty::region, ~str> {
+    fn named_region(span: span, id: ast::ident) -> Result<ty::region, ~str> {
         self.base.named_region(span, id)
     }
 }
@@ -69,14 +69,14 @@ fn in_binding_rscope<RS: region_scope copy owned>(self: RS)
     @binding_rscope { base: base, anon_bindings: 0 }
 }
 impl @binding_rscope: region_scope {
-    fn anon_region(_span: span) -> result<ty::region, ~str> {
+    fn anon_region(_span: span) -> Result<ty::region, ~str> {
         let idx = self.anon_bindings;
         self.anon_bindings += 1;
-        result::ok(ty::re_bound(ty::br_anon(idx)))
+        result::Ok(ty::re_bound(ty::br_anon(idx)))
     }
-    fn named_region(span: span, id: ast::ident) -> result<ty::region, ~str> {
+    fn named_region(span: span, id: ast::ident) -> Result<ty::region, ~str> {
         do self.base.named_region(span, id).chain_err |_e| {
-            result::ok(ty::re_bound(ty::br_named(id)))
+            result::Ok(ty::re_bound(ty::br_named(id)))
         }
     }
 }