about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-02-21 18:41:33 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-02-22 16:09:17 -0800
commit1144fdde1f658e957e6ab54f8bc199e40583e851 (patch)
treeee3950dc4e3bb68166d90f0a57467b1eec1c76a3 /src
parentce707363638c0dab5f60ff25489afcd67ba9d48d (diff)
downloadrust-1144fdde1f658e957e6ab54f8bc199e40583e851.tar.gz
rust-1144fdde1f658e957e6ab54f8bc199e40583e851.zip
librustpkg: De-mut librustdoc and librustpkg. rs=demuting
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/path_pass.rs8
-rw-r--r--src/librustpkg/rustpkg.rc4
-rw-r--r--src/librustpkg/util.rs31
3 files changed, 22 insertions, 21 deletions
diff --git a/src/librustdoc/path_pass.rs b/src/librustdoc/path_pass.rs
index ac50221445f..c03eb06d2dd 100644
--- a/src/librustdoc/path_pass.rs
+++ b/src/librustdoc/path_pass.rs
@@ -31,14 +31,14 @@ pub fn mk_pass() -> Pass {
 
 struct Ctxt {
     srv: astsrv::Srv,
-    mut path: ~[~str]
+    path: @mut ~[~str]
 }
 
 impl Clone for Ctxt {
     fn clone(&self) -> Ctxt {
         Ctxt {
             srv: self.srv.clone(),
-            path: copy self.path
+            path: @mut copy *self.path
         }
     }
 }
@@ -47,7 +47,7 @@ impl Clone for Ctxt {
 fn run(srv: astsrv::Srv, doc: doc::Doc) -> doc::Doc {
     let ctxt = Ctxt {
         srv: srv,
-        mut path: ~[]
+        path: @mut ~[]
     };
     let fold = Fold {
         ctxt: ctxt.clone(),
@@ -61,7 +61,7 @@ fn run(srv: astsrv::Srv, doc: doc::Doc) -> doc::Doc {
 
 fn fold_item(fold: &fold::Fold<Ctxt>, doc: doc::ItemDoc) -> doc::ItemDoc {
     doc::ItemDoc {
-        path: copy fold.ctxt.path,
+        path: copy *fold.ctxt.path,
         .. doc
     }
 }
diff --git a/src/librustpkg/rustpkg.rc b/src/librustpkg/rustpkg.rc
index 78db7dccb86..c16a56249ff 100644
--- a/src/librustpkg/rustpkg.rc
+++ b/src/librustpkg/rustpkg.rc
@@ -252,7 +252,7 @@ impl PackageScript {
 struct Ctx {
     cfgs: ~[~str],
     json: bool,
-    mut dep_cache: LinearMap<~str, bool>
+    dep_cache: @mut LinearMap<~str, bool>
 }
 
 impl Ctx {
@@ -912,7 +912,7 @@ pub fn main() {
     Ctx {
         cfgs: cfgs,
         json: json,
-        mut dep_cache: LinearMap::new()
+        dep_cache: @mut LinearMap::new()
     }.run(cmd, args);
 }
 
diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs
index 5e549d96490..64a6d9c5055 100644
--- a/src/librustpkg/util.rs
+++ b/src/librustpkg/util.rs
@@ -72,11 +72,11 @@ struct ReadyCtx {
     sess: session::Session,
     crate: @ast::crate,
     ext_cx: ext_ctxt,
-    mut path: ~[ast::ident],
-    mut fns: ~[ListenerFn]
+    path: ~[ast::ident],
+    fns: ~[ListenerFn]
 }
 
-fn fold_mod(_ctx: @ReadyCtx, m: ast::_mod,
+fn fold_mod(_ctx: @mut ReadyCtx, m: ast::_mod,
             fold: fold::ast_fold) -> ast::_mod {
     fn strip_main(item: @ast::item) -> @ast::item {
         @ast::item {
@@ -95,7 +95,7 @@ fn fold_mod(_ctx: @ReadyCtx, m: ast::_mod,
     }, fold)
 }
 
-fn fold_item(ctx: @ReadyCtx, item: @ast::item,
+fn fold_item(ctx: @mut ReadyCtx, item: @ast::item,
              fold: fold::ast_fold) -> Option<@ast::item> {
 
     ctx.path.push(item.ident);
@@ -133,7 +133,7 @@ fn fold_item(ctx: @ReadyCtx, item: @ast::item,
     res
 }
 
-fn add_pkg_module(ctx: @ReadyCtx, m: ast::_mod) -> ast::_mod {
+fn add_pkg_module(ctx: @mut ReadyCtx, m: ast::_mod) -> ast::_mod {
     let listeners = mk_listener_vec(ctx);
     let ext_cx = ctx.ext_cx;
     let item = quote_item! (
@@ -152,24 +152,25 @@ fn add_pkg_module(ctx: @ReadyCtx, m: ast::_mod) -> ast::_mod {
     }
 }
 
-fn mk_listener_vec(ctx: @ReadyCtx) -> @ast::expr {
+fn mk_listener_vec(ctx: @mut ReadyCtx) -> @ast::expr {
     let fns = ctx.fns;
     let descs = do fns.map |listener| {
         mk_listener_rec(ctx, *listener)
     };
-    build::mk_slice_vec_e(ctx.ext_cx, dummy_sp(), descs)
+    let ext_cx = ctx.ext_cx;
+    build::mk_slice_vec_e(ext_cx, dummy_sp(), descs)
 }
 
-fn mk_listener_rec(ctx: @ReadyCtx, listener: ListenerFn) -> @ast::expr {
-
+fn mk_listener_rec(ctx: @mut ReadyCtx, listener: ListenerFn) -> @ast::expr {
     let span = listener.span;
     let cmds = do listener.cmds.map |&cmd| {
-        build::mk_base_str(ctx.ext_cx, span, cmd)
+        let ext_cx = ctx.ext_cx;
+        build::mk_base_str(ext_cx, span, cmd)
     };
 
-    let cmds_expr = build::mk_slice_vec_e(ctx.ext_cx, span, cmds);
-    let cb_expr = build::mk_path(ctx.ext_cx, span, copy listener.path);
     let ext_cx = ctx.ext_cx;
+    let cmds_expr = build::mk_slice_vec_e(ext_cx, span, cmds);
+    let cb_expr = build::mk_path(ext_cx, span, copy listener.path);
 
     quote_expr!(
         Listener {
@@ -182,12 +183,12 @@ fn mk_listener_rec(ctx: @ReadyCtx, listener: ListenerFn) -> @ast::expr {
 /// Generate/filter main function, add the list of commands, etc.
 pub fn ready_crate(sess: session::Session,
                    crate: @ast::crate) -> @ast::crate {
-    let ctx = @ReadyCtx {
+    let ctx = @mut ReadyCtx {
         sess: sess,
         crate: crate,
         ext_cx: mk_ctxt(sess.parse_sess, copy sess.opts.cfg),
-        mut path: ~[],
-        mut fns: ~[]
+        path: ~[],
+        fns: ~[]
     };
     let precursor = @fold::AstFoldFns {
         // fold_crate: fold::wrap(|a, b| fold_crate(ctx, a, b)),