about summary refs log tree commit diff
path: root/src/librustc/back
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2013-10-05 19:49:32 -0700
committerKevin Ballard <kevin@sb.org>2013-10-15 22:18:30 -0700
commitd6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd (patch)
treee197783b86700e71d94c9bc6d0254eb25b16cc0c /src/librustc/back
parented539e14712539473c3e89604cb69e2307110772 (diff)
path2: Adjust the API to remove all the _str mutation methods
Add a new trait BytesContainer that is implemented for both byte vectors
and strings.

Convert Path::from_vec and ::from_str to one function, Path::new().

Remove all the _str-suffixed mutation methods (push, join, with_*,
set_*) and modify the non-suffixed versions to use BytesContainer.
Diffstat (limited to 'src/librustc/back')
-rw-r--r--src/librustc/back/link.rs8
-rw-r--r--src/librustc/back/rpath.rs22
2 files changed, 15 insertions, 15 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index d5cd78f54f7..404efa25ff3 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -249,7 +249,7 @@ pub mod write {
             llvm::LLVMInitializeMipsAsmParser();
 
             if sess.opts.save_temps {
-                do output.with_extension_str("no-opt.bc").with_c_str |buf| {
+                do output.with_extension("no-opt.bc").with_c_str |buf| {
                     llvm::LLVMWriteBitcodeToFile(llmod, buf);
                 }
             }
@@ -317,7 +317,7 @@ pub mod write {
             llvm::LLVMDisposePassManager(mpm);
 
             if sess.opts.save_temps {
-                do output.with_extension_str("bc").with_c_str |buf| {
+                do output.with_extension("bc").with_c_str |buf| {
                     llvm::LLVMWriteBitcodeToFile(llmod, buf);
                 }
             }
@@ -921,7 +921,7 @@ pub fn link_binary(sess: Session,
         let out_dirname = out_filename.dir_path();
         debug2!("dirname(out_filename): {}", out_dirname.display());
 
-        out_filename.with_filename_str(long_libname)
+        out_filename.with_filename(long_libname)
     } else {
         out_filename.clone()
     };
@@ -977,7 +977,7 @@ pub fn link_args(sess: Session,
 
     let output = if *sess.building_library {
         let long_libname = output_dll_filename(sess.targ_cfg.os, lm);
-        out_filename.with_filename_str(long_libname)
+        out_filename.with_filename(long_libname)
     } else {
         out_filename.clone()
     };
diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs
index b3fb6be686d..b7ae9c1ecb5 100644
--- a/src/librustc/back/rpath.rs
+++ b/src/librustc/back/rpath.rs
@@ -46,7 +46,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path)
 fn get_sysroot_absolute_rt_lib(sess: session::Session) -> Path {
     let r = filesearch::relative_target_lib_path(sess.opts.target_triple);
     let mut p = sess.filesearch.sysroot().join_path(&r);
-    p.push_str(os::dll_filename("rustrt"));
+    p.push(os::dll_filename("rustrt"));
     p
 }
 
@@ -147,7 +147,7 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> ~str {
     let install_prefix = env!("CFG_PREFIX");
 
     let tlib = filesearch::relative_target_lib_path(target_triple);
-    let mut path = Path::from_str(install_prefix);
+    let mut path = Path::new(install_prefix);
     path.push_path(&tlib);
     let path = os::make_absolute(&path);
     // FIXME (#9639): This needs to handle non-utf8 paths
@@ -186,8 +186,8 @@ mod test {
     #[test]
     fn test_prefix_rpath() {
         let res = get_install_prefix_rpath("triple");
-        let mut d = Path::from_str(env!("CFG_PREFIX"));
-        d.push_str("lib/rustc/triple/lib");
+        let mut d = Path::new(env!("CFG_PREFIX"));
+        d.push("lib/rustc/triple/lib");
         debug2!("test_prefix_path: {} vs. {}",
                res.to_str(),
                d.display());
@@ -200,7 +200,7 @@ mod test {
     #[test]
     fn test_prefix_rpath_abs() {
         let res = get_install_prefix_rpath("triple");
-        assert!(Path::from_str(res).is_absolute());
+        assert!(Path::new(res).is_absolute());
     }
 
     #[test]
@@ -224,7 +224,7 @@ mod test {
     fn test_rpath_relative() {
       let o = session::OsLinux;
       let res = get_rpath_relative_to_output(o,
-            &Path::from_str("bin/rustc"), &Path::from_str("lib/libstd.so"));
+            &Path::new("bin/rustc"), &Path::new("lib/libstd.so"));
       assert_eq!(res.as_slice(), "$ORIGIN/../lib");
     }
 
@@ -233,7 +233,7 @@ mod test {
     fn test_rpath_relative() {
         let o = session::OsFreebsd;
         let res = get_rpath_relative_to_output(o,
-            &Path::from_str("bin/rustc"), &Path::from_str("lib/libstd.so"));
+            &Path::new("bin/rustc"), &Path::new("lib/libstd.so"));
         assert_eq!(res.as_slice(), "$ORIGIN/../lib");
     }
 
@@ -242,15 +242,15 @@ mod test {
     fn test_rpath_relative() {
         let o = session::OsMacos;
         let res = get_rpath_relative_to_output(o,
-                                               &Path::from_str("bin/rustc"),
-                                               &Path::from_str("lib/libstd.so"));
+                                               &Path::new("bin/rustc"),
+                                               &Path::new("lib/libstd.so"));
         assert_eq!(res.as_slice(), "@executable_path/../lib");
     }
 
     #[test]
     fn test_get_absolute_rpath() {
-        let res = get_absolute_rpath(&Path::from_str("lib/libstd.so"));
-        let lib = os::make_absolute(&Path::from_str("lib"));
+        let res = get_absolute_rpath(&Path::new("lib/libstd.so"));
+        let lib = os::make_absolute(&Path::new("lib"));
         debug2!("test_get_absolute_rpath: {} vs. {}",
                res.to_str(), lib.display());