about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2013-10-15 23:32:14 -0700
committerKevin Ballard <kevin@sb.org>2013-10-16 11:18:06 -0700
commit6eade9e9143e496167d66298e8bbac5d9dfa3e19 (patch)
treed5cf6690f8ac9f7dfecb73774a1b5f7b5149c196
parent40b324f0dec364a9fa71f9f8b47b8ab156f6d61e (diff)
path2: Update for latest master
Also fix some issues that crept into earlier commits during the conflict
resoution for the rebase.
-rw-r--r--src/compiletest/header.rs2
-rw-r--r--src/compiletest/runtest.rs4
-rw-r--r--src/libextra/glob.rs6
-rw-r--r--src/librustpkg/package_source.rs21
-rw-r--r--src/librustpkg/path_util.rs4
-rw-r--r--src/librustpkg/rustpkg.rs14
-rw-r--r--src/librustpkg/source_control.rs4
-rw-r--r--src/librustpkg/tests.rs37
-rw-r--r--src/librustpkg/util.rs6
-rw-r--r--src/librustpkg/workspace.rs2
-rw-r--r--src/libstd/os.rs4
-rw-r--r--src/libstd/path/posix.rs4
-rw-r--r--src/libstd/path/windows.rs27
13 files changed, 76 insertions, 59 deletions
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index efe681ce830..541aa082f51 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -164,7 +164,7 @@ fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> {
       Some(s) => Some(Path::new(s)),
       None => {
         if parse_name_directive(line, "pp-exact") {
-            testfile.filename().map_move(|s| Path::new(s))
+            testfile.filename().map(|s| Path::new(s))
         } else {
             None
         }
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 9c6edb8d566..627a80ace69 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -663,7 +663,7 @@ fn make_lib_name(config: &config, auxfile: &Path, testfile: &Path) -> Path {
 fn make_exe_name(config: &config, testfile: &Path) -> Path {
     let mut f = output_base_name(config, testfile);
     if !os::EXE_SUFFIX.is_empty() {
-        match f.filename().map_move(|s| s + os::EXE_SUFFIX.as_bytes()) {
+        match f.filename().map(|s| s + os::EXE_SUFFIX.as_bytes()) {
             Some(v) => f.set_filename(v),
             None => ()
         }
@@ -752,7 +752,7 @@ fn make_out_name(config: &config, testfile: &Path, extension: &str) -> Path {
 
 fn aux_output_dir_name(config: &config, testfile: &Path) -> Path {
     let mut f = output_base_name(config, testfile);
-    match f.filename().map_move(|s| s + bytes!(".libaux")) {
+    match f.filename().map(|s| s + bytes!(".libaux")) {
         Some(v) => f.set_filename(v),
         None => ()
     }
diff --git a/src/libextra/glob.rs b/src/libextra/glob.rs
index 83456777c40..031545c1cd2 100644
--- a/src/libextra/glob.rs
+++ b/src/libextra/glob.rs
@@ -98,7 +98,7 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> GlobIterator {
         root.push(pat_root.get_ref());
     }
 
-    let root_len = pat_root.map_move_default(0u, |p| p.as_vec().len());
+    let root_len = pat_root.map_default(0u, |p| p.as_vec().len());
     let dir_patterns = pattern.slice_from(root_len.min(&pattern.len()))
                        .split_terminator_iter(is_sep).map(|s| Pattern::new(s)).to_owned_vec();
 
@@ -303,7 +303,7 @@ impl Pattern {
      */
     pub fn matches_path(&self, path: &Path) -> bool {
         // FIXME (#9639): This needs to handle non-utf8 paths
-        do path.as_str().map_move_default(false) |s| {
+        do path.as_str().map_default(false) |s| {
             self.matches(s)
         }
     }
@@ -321,7 +321,7 @@ impl Pattern {
      */
     pub fn matches_path_with(&self, path: &Path, options: MatchOptions) -> bool {
         // FIXME (#9639): This needs to handle non-utf8 paths
-        do path.as_str().map_move_default(false) |s| {
+        do path.as_str().map_default(false) |s| {
             self.matches_with(s, options)
         }
     }
diff --git a/src/librustpkg/package_source.rs b/src/librustpkg/package_source.rs
index 874a30394d1..fba6cba9116 100644
--- a/src/librustpkg/package_source.rs
+++ b/src/librustpkg/package_source.rs
@@ -104,7 +104,7 @@ impl PkgSrc {
 
             let mut result = build_dir.join("src");
             result.push(&id.path.dir_path());
-            result.push_str(format!("{}-{}", id.short_name, id.version.to_str()));
+            result.push(format!("{}-{}", id.short_name, id.version.to_str()));
             to_try.push(result.clone());
             output_names.push(result);
             let mut other_result = build_dir.join("src");
@@ -174,17 +174,19 @@ impl PkgSrc {
                     }
                     match ok_d {
                         Some(ref d) => {
-                            if d.is_parent_of(&id.path)
-                                || d.is_parent_of(&versionize(&id.path, &id.version)) {
+                            if d.is_ancestor_of(&id.path)
+                                || d.is_ancestor_of(&versionize(&id.path, &id.version)) {
                                 // Strip off the package ID
                                 source_workspace = d.clone();
-                                for _ in id.path.components().iter() {
-                                    source_workspace = source_workspace.pop();
+                                for _ in id.path.component_iter() {
+                                    source_workspace.pop();
                                 }
                                 // Strip off the src/ part
-                                source_workspace = source_workspace.pop();
+                                source_workspace.pop();
                                 // Strip off the build/<target-triple> part to get the workspace
-                                destination_workspace = source_workspace.pop().pop();
+                                destination_workspace = source_workspace.clone();
+                                destination_workspace.pop();
+                                destination_workspace.pop();
                             }
                             break;
                         }
@@ -244,9 +246,10 @@ impl PkgSrc {
     pub fn fetch_git(local: &Path, pkgid: &PkgId) -> Option<Path> {
         use conditions::git_checkout_failed::cond;
 
+        let cwd = os::getcwd();
         debug2!("Checking whether {} (path = {}) exists locally. Cwd = {}, does it? {:?}",
                 pkgid.to_str(), pkgid.path.display(),
-                os::getcwd().display(),
+                cwd.display(),
                 os::path_exists(&pkgid.path));
 
         match safe_git_clone(&pkgid.path, &pkgid.version, local) {
@@ -400,7 +403,7 @@ impl PkgSrc {
                     // into account. I'm not sure if the workcache really likes seeing the
                     // output as "Some(\"path\")". But I don't know what to do about it.
                     // FIXME (#9639): This needs to handle non-utf8 paths
-                    let result = result.map(|p|p.as_str().unwrap());
+                    let result = result.as_ref().map(|p|p.as_str().unwrap());
                     debug2!("Result of compiling {} was {}", subpath.display(), result.to_str());
                     result.to_str()
                 }
diff --git a/src/librustpkg/path_util.rs b/src/librustpkg/path_util.rs
index 69c3f6e0f1c..f5b2251a2a6 100644
--- a/src/librustpkg/path_util.rs
+++ b/src/librustpkg/path_util.rs
@@ -462,7 +462,7 @@ pub fn versionize(p: &Path, v: &Version) -> Path {
 pub fn chmod_read_only(p: &Path) -> bool {
     #[fixed_stack_segment];
     unsafe {
-        do p.to_str().with_c_str |src_buf| {
+        do p.with_c_str |src_buf| {
             libc::chmod(src_buf, S_IRUSR as libc::c_int) == 0 as libc::c_int
         }
     }
@@ -472,7 +472,7 @@ pub fn chmod_read_only(p: &Path) -> bool {
 pub fn chmod_read_only(p: &Path) -> bool {
     #[fixed_stack_segment];
     unsafe {
-        do p.to_str().with_c_str |src_buf| {
+        do p.with_c_str |src_buf| {
             libc::chmod(src_buf, S_IRUSR as libc::mode_t) == 0
                 as libc::c_int
         }
diff --git a/src/librustpkg/rustpkg.rs b/src/librustpkg/rustpkg.rs
index 7b10bf2a551..985dcd805ce 100644
--- a/src/librustpkg/rustpkg.rs
+++ b/src/librustpkg/rustpkg.rs
@@ -247,8 +247,9 @@ impl CtxMethods for BuildContext {
                 dest_ws = determine_destination(os::getcwd(),
                                                 self.context.use_rust_path_hack,
                                                 workspace);
-                let mut pkg_src = PkgSrc::new(workspace.clone(), false, pkgid.clone());
-                dest_ws = Some(self.build(&mut pkg_src, what));
+                let mut pkg_src = PkgSrc::new(workspace.clone(), dest_ws.clone(),
+                                              false, pkgid.clone());
+                self.build(&mut pkg_src, what);
                 true
             };
             // n.b. If this builds multiple packages, it only returns the workspace for
@@ -430,7 +431,7 @@ impl CtxMethods for BuildContext {
             match git_result {
                 CheckedOutSources => make_read_only(&out_dir),
                 // FIXME (#9639): This needs to handle non-utf8 paths
-                _ => cond.raise((pkgid.path.as_str().unwrap(), out_dir.clone()))
+                _ => cond.raise((pkgid.path.as_str().unwrap().to_owned(), out_dir.clone()))
             };
             let default_ws = default_workspace();
             debug2!("Calling build recursively with {:?} and {:?}", default_ws.display(),
@@ -562,7 +563,7 @@ impl CtxMethods for BuildContext {
 
         let result = self.install_no_build(pkg_src.build_workspace(),
                                            &pkg_src.destination_workspace,
-                                           &id).map(|s| Path::new(*s));
+                                           &id).map(|s| Path::new(s.as_slice()));
         debug2!("install: id = {}, about to call discover_outputs, {:?}",
                id.to_str(), result.map(|p| p.display().to_str()));
         installed_files = installed_files + result;
@@ -580,7 +581,7 @@ impl CtxMethods for BuildContext {
         use conditions::copy_failed::cond;
 
         debug2!("install_no_build: assuming {} comes from {} with target {}",
-               id.to_str(), build_workspace.to_str(), target_workspace.to_str());
+               id.to_str(), build_workspace.display(), target_workspace.display());
 
         // Now copy stuff into the install dirs
         let maybe_executable = built_executable_in_workspace(id, build_workspace);
@@ -631,8 +632,7 @@ impl CtxMethods for BuildContext {
                     let mut target_lib = sub_target_lib
                         .clone().expect(format!("I built {} but apparently \
                                              didn't install it!", lib.display()));
-                    let target_lib = target_lib
-                        .set_filename(lib.filename().expect("weird target lib"));
+                    target_lib.set_filename(lib.filename().expect("weird target lib"));
                     if !(os::mkdir_recursive(&target_lib.dir_path(), U_RWX) &&
                          os::copy_file(lib, &target_lib)) {
                         cond.raise(((*lib).clone(), target_lib.clone()));
diff --git a/src/librustpkg/source_control.rs b/src/librustpkg/source_control.rs
index 2fc925a8a6a..3c879af34cf 100644
--- a/src/librustpkg/source_control.rs
+++ b/src/librustpkg/source_control.rs
@@ -107,7 +107,9 @@ pub fn make_read_only(target: &Path) {
 pub fn git_clone_url(source: &str, target: &Path, v: &Version) {
     use conditions::git_checkout_failed::cond;
 
-    let outp = run::process_output("git", [~"clone", source.to_str(), target.to_str()]);
+    // FIXME (#9639): This needs to handle non-utf8 paths
+    let outp = run::process_output("git", [~"clone", source.to_owned(),
+                                           target.as_str().unwrap().to_owned()]);
     if outp.status != 0 {
          debug2!("{}", str::from_utf8_owned(outp.output.clone()));
          debug2!("{}", str::from_utf8_owned(outp.error));
diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs
index 4e8bcbb1cec..d367399c0bf 100644
--- a/src/librustpkg/tests.rs
+++ b/src/librustpkg/tests.rs
@@ -88,7 +88,7 @@ fn writeFile(file_path: &Path, contents: &str) {
 
 fn mk_emptier_workspace(tag: &str) -> TempDir {
     let workspace = TempDir::new(tag).expect("couldn't create temp dir");
-    let package_dir = workspace.path().push("src");
+    let package_dir = workspace.path().join("src");
     assert!(os::mkdir_recursive(&package_dir, U_RWX));
     workspace
 }
@@ -110,9 +110,10 @@ fn mk_workspace(workspace: &Path, short_name: &Path, version: &Version) -> Path
 
 fn mk_temp_workspace(short_name: &Path, version: &Version) -> (TempDir, Path) {
     let workspace_dir = mk_empty_workspace(short_name, version, "temp_workspace");
+    // FIXME (#9639): This needs to handle non-utf8 paths
     let package_dir = workspace_dir.path().join_many([~"src",
                                                       format!("{}-{}",
-                                                              short_name.to_str(),
+                                                              short_name.as_str().unwrap(),
                                                               version.to_str())]);
 
     debug2!("Created {} and does it exist? {:?}", package_dir.display(),
@@ -912,7 +913,8 @@ fn rust_path_test() {
     // FIXME (#9639): This needs to handle non-utf8 paths
     command_line_test_with_env([~"install", ~"foo"],
                                &cwd,
-                               Some(~[(~"RUST_PATH", dir_for_path.path().as_str().unwrap())]));
+                               Some(~[(~"RUST_PATH",
+                                       dir_for_path.path().as_str().unwrap().to_owned())]));
     assert_executable_exists(dir_for_path.path(), "foo");
 }
 
@@ -1078,7 +1080,7 @@ fn do_rebuild_dep_dates_change() {
     command_line_test([~"build", ~"foo"], workspace);
     let bar_lib_name = lib_output_file_name(workspace, "bar");
     let bar_date = datestamp(&bar_lib_name);
-    debug2!("Datestamp on {} is {:?}", bar_lib_name.to_str(), bar_date);
+    debug2!("Datestamp on {} is {:?}", bar_lib_name.display(), bar_date);
     touch_source_file(workspace, &dep_id);
     command_line_test([~"build", ~"foo"], workspace);
     let new_bar_date = datestamp(&bar_lib_name);
@@ -1326,6 +1328,7 @@ fn rust_path_hack_test(hack_flag: bool) {
    let workspace = workspace.path();
    let dest_workspace = mk_empty_workspace(&Path::new("bar"), &NoVersion, "dest_workspace");
    let dest_workspace = dest_workspace.path();
+   let foo_path = workspace.join_many(["src", "foo-0.1"]);
    let rust_path = Some(~[(~"RUST_PATH",
        format!("{}:{}",
                dest_workspace.as_str().unwrap(),
@@ -1568,7 +1571,7 @@ fn dash_S() {
     let workspace = workspace.path();
     let test_sys = test_sysroot();
     // FIXME (#9639): This needs to handle non-utf8 paths
-    command_line_test([test_sysroot().as_str().unwrap().to_owned(),
+    command_line_test([test_sys.as_str().unwrap().to_owned(),
                        ~"build",
                        ~"-S",
                        ~"foo"],
@@ -1809,7 +1812,7 @@ fn test_recursive_deps() {
     let c_id = PkgId::new("c");
     let b_workspace = create_local_package_with_dep(&b_id, &c_id);
     let b_workspace = b_workspace.path();
-    writeFile(&b_workspace.join_many(["src", "c-0.1", "lib.rs"])),
+    writeFile(&b_workspace.join_many(["src", "c-0.1", "lib.rs"]),
                "pub fn g() {}");
     let a_workspace = create_local_package(&a_id);
     let a_workspace = a_workspace.path();
@@ -1879,7 +1882,7 @@ fn test_target_specific_install_dir() {
                        ~"install",
                        ~"foo"],
                       workspace);
-    assert!(os::path_is_dir(&workspace.join_many(["lib", host_triple()])));
+    assert!(os::path_is_dir(&workspace.join_many([~"lib", host_triple()])));
     assert_lib_exists(workspace, &Path::new("foo"), NoVersion);
     assert!(os::list_dir(&workspace.join("lib")).len() == 1);
     assert!(os::path_is_dir(&workspace.join("bin")));
@@ -2051,7 +2054,7 @@ fn test_installed_read_only() {
     let repo = init_git_repo(&temp_pkg_id.path);
     let repo = repo.path();
     debug2!("repo = {}", repo.display());
-    let repo_subdir = repo.join_many_str(["mockgithub.com", "catamorphism", "test-pkg"]);
+    let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg"]);
     debug2!("repo_subdir = {}", repo_subdir.display());
 
     writeFile(&repo_subdir.join("main.rs"),
@@ -2077,8 +2080,8 @@ fn test_installed_read_only() {
     assert!(is_rwx(&built_lib));
 
     // Make sure sources are (a) under "build" and (b) read-only
-    let src1 = target_build_dir(&ws).join_many_str(["src", temp_pkg_id.to_str(), "main.rs"]);
-    let src2 = target_build_dir(&ws).join_many_str(["src", temp_pkg_id.to_str(), "lib.rs"]);
+    let src1 = target_build_dir(&ws).join_many([~"src", temp_pkg_id.to_str(), ~"main.rs"]);
+    let src2 = target_build_dir(&ws).join_many([~"src", temp_pkg_id.to_str(), ~"lib.rs"]);
     assert!(os::path_exists(&src1));
     assert!(os::path_exists(&src2));
     assert!(is_read_only(&src1));
@@ -2091,9 +2094,9 @@ fn test_installed_local_changes() {
     let repo = init_git_repo(&temp_pkg_id.path);
     let repo = repo.path();
     debug2!("repo = {}", repo.display());
-    let repo_subdir = repo.join_many_str(["mockgithub.com", "catamorphism", "test-pkg"]);
+    let repo_subdir = repo.join_many(["mockgithub.com", "catamorphism", "test-pkg"]);
     debug2!("repo_subdir = {}", repo_subdir.display());
-    assert!(os::mkdir_recursive(&repo.join_many_str([".rust", "src"]), U_RWX));
+    assert!(os::mkdir_recursive(&repo.join_many([".rust", "src"]), U_RWX));
 
     writeFile(&repo_subdir.join("main.rs"),
               "fn main() { let _x = (); }");
@@ -2109,10 +2112,10 @@ fn test_installed_local_changes() {
     // Now start a new workspace and clone it into it
     let hacking_workspace = mk_emptier_workspace("hacking_workspace");
     let hacking_workspace = hacking_workspace.path();
-    let target_dir = hacking_workspace.join_many_str(["src",
-                                                      "mockgithub.com",
-                                                      "catamorphism",
-                                                      "test-pkg-0.1"]);
+    let target_dir = hacking_workspace.join_many(["src",
+                                                  "mockgithub.com",
+                                                  "catamorphism",
+                                                  "test-pkg-0.1"]);
     debug2!("---- git clone {} {}", repo_subdir.display(), target_dir.display());
 
     let c_res = safe_git_clone(&repo_subdir, &NoVersion, &target_dir);
@@ -2159,7 +2162,7 @@ fn test_compile_error() {
     let foo_id = PkgId::new("foo");
     let foo_workspace = create_local_package(&foo_id);
     let foo_workspace = foo_workspace.path();
-    let main_crate = foo_workspace.join_many_str(["src", "foo-0.1", "main.rs"]);
+    let main_crate = foo_workspace.join_many(["src", "foo-0.1", "main.rs"]);
     // Write something bogus
     writeFile(&main_crate, "pub fn main() { if 42 != ~\"the answer\" { fail!(); } }");
     let result = command_line_test_partial([~"build", ~"foo"], foo_workspace);
diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs
index 23d9af77c01..66c1aaea1ed 100644
--- a/src/librustpkg/util.rs
+++ b/src/librustpkg/util.rs
@@ -482,9 +482,9 @@ impl<'self> Visitor<()> for ViewItemVisitor<'self> {
                                                      dep.as_str().unwrap(),
                                                      digest_only_date(dep));
                             // Also, add an additional search path
-                            debug2!("Installed {} into {}", dep.display(),
-                                    dep.dir_path().display());
-                            (self.save)(dep.dir_path());
+                            let dep_dir = dep.dir_path();
+                            debug2!("Installed {} into {}", dep.display(), dep_dir.display());
+                            (self.save)(dep_dir);
                         }
                         for &(ref what, ref dep) in inputs_disc.iter() {
                             if *what == ~"file" {
diff --git a/src/librustpkg/workspace.rs b/src/librustpkg/workspace.rs
index a24767f1e68..13d70f15332 100644
--- a/src/librustpkg/workspace.rs
+++ b/src/librustpkg/workspace.rs
@@ -63,7 +63,7 @@ pub fn cwd_to_workspace() -> Option<(Path, PkgId)> {
         let srcpath = path.join("src");
         if srcpath.is_ancestor_of(&cwd) {
             let rel = cwd.path_relative_from(&srcpath);
-            let rel_s = rel.and_then_ref(|p|p.as_str());
+            let rel_s = rel.as_ref().and_then(|p|p.as_str());
             if rel_s.is_some() {
                 return Some((path, PkgId::new(rel_s.unwrap())));
             }
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 8701365d321..348bfd5c61a 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -509,11 +509,11 @@ pub fn self_exe_path() -> Option<Path> {
             use os::win32::fill_utf16_buf_and_decode;
             do fill_utf16_buf_and_decode() |buf, sz| {
                 libc::GetModuleFileNameW(0u as libc::DWORD, buf, sz)
-            }.map_move(|s| s.into_bytes())
+            }.map(|s| s.into_bytes())
         }
     }
 
-    load_self().and_then(|path| Path::new_opt(path).map(|p| { p.pop(); p }))
+    load_self().and_then(|path| Path::new_opt(path).map(|mut p| { p.pop(); p }))
 }
 
 
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index 5eea65a5b91..271937dfcf2 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -791,7 +791,7 @@ mod tests {
             (s: $path:expr, $op:ident, $exp:expr, opt) => (
                 {
                     let path = Path::new($path);
-                    let left = path.$op().map(|&x| str::from_utf8_slice(x));
+                    let left = path.$op().map(|x| str::from_utf8_slice(x));
                     assert_eq!(left, $exp);
                 }
             );
@@ -1313,7 +1313,7 @@ mod tests {
                     let path = Path::new($path);
                     let other = Path::new($other);
                     let res = path.path_relative_from(&other);
-                    assert_eq!(res.and_then_ref(|x| x.as_str()), $exp);
+                    assert_eq!(res.as_ref().and_then(|x| x.as_str()), $exp);
                 }
             )
         )
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs
index 9576e62f439..0ee0d9c79d1 100644
--- a/src/libstd/path/windows.rs
+++ b/src/libstd/path/windows.rs
@@ -258,7 +258,7 @@ impl GenericPathUnsafe for Path {
             // if me is verbatim, we need to pre-normalize the new path
             let path_ = if is_verbatim(me) { Path::normalize__(path, None) }
                         else { None };
-            let pathlen = path_.map_default(path.len(), |p| p.len());
+            let pathlen = path_.as_ref().map_default(path.len(), |p| p.len());
             let mut s = str::with_capacity(me.repr.len() + 1 + pathlen);
             s.push_str(me.repr);
             let plen = me.prefix_len();
@@ -368,7 +368,7 @@ impl GenericPath for Path {
 
     #[inline]
     fn filename<'a>(&'a self) -> Option<&'a [u8]> {
-        self.filename_str().map_move(|x| x.as_bytes())
+        self.filename_str().map(|x| x.as_bytes())
     }
 
     /// See `GenericPath::filename_str` for info.
@@ -388,13 +388,13 @@ impl GenericPath for Path {
     #[inline]
     fn filestem_str<'a>(&'a self) -> Option<&'a str> {
         // filestem() returns a byte vector that's guaranteed valid UTF-8
-        self.filestem().map_move(cast::transmute)
+        self.filestem().map(cast::transmute)
     }
 
     #[inline]
     fn extension_str<'a>(&'a self) -> Option<&'a str> {
         // extension() returns a byte vector that's guaranteed valid UTF-8
-        self.extension().map_move(cast::transmute)
+        self.extension().map(cast::transmute)
     }
 
     fn dir_path(&self) -> Path {
@@ -728,16 +728,25 @@ impl Path {
                             DiskPrefix => {
                                 let len = prefix_len(prefix) + is_abs as uint;
                                 let mut s = s.slice_to(len).to_owned();
-                                s[0] = s[0].to_ascii().to_upper().to_byte();
+                                unsafe {
+                                    str::raw::as_owned_vec(&mut s)[0] =
+                                        s[0].to_ascii().to_upper().to_byte();
+                                }
                                 if is_abs {
-                                    s[2] = sep as u8; // normalize C:/ to C:\
+                                    // normalize C:/ to C:\
+                                    unsafe {
+                                        str::raw::as_owned_vec(&mut s)[2] = sep as u8;
+                                    }
                                 }
                                 Some(s)
                             }
                             VerbatimDiskPrefix => {
                                 let len = prefix_len(prefix) + is_abs as uint;
                                 let mut s = s.slice_to(len).to_owned();
-                                s[4] = s[4].to_ascii().to_upper().to_byte();
+                                unsafe {
+                                    str::raw::as_owned_vec(&mut s)[4] =
+                                        s[4].to_ascii().to_upper().to_byte();
+                                }
                                 Some(s)
                             }
                             _ => {
@@ -2204,10 +2213,10 @@ mod tests {
                     let other = Path::new($other);
                     let res = path.path_relative_from(&other);
                     let exp = $exp;
-                    assert!(res.and_then_ref(|x| x.as_str()) == exp,
+                    assert!(res.as_ref().and_then(|x| x.as_str()) == exp,
                             "`{}`.path_relative_from(`{}`): Expected {:?}, got {:?}",
                             path.as_str().unwrap(), other.as_str().unwrap(), exp,
-                            res.and_then_ref(|x| x.as_str()));
+                            res.as_ref().and_then(|x| x.as_str()));
                 }
             )
         )