about summary refs log tree commit diff
path: root/src/librustc/metadata
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/metadata
parented539e14712539473c3e89604cb69e2307110772 (diff)
downloadrust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.tar.gz
rust-d6d9b926836b1f1c2b8b3fe4ab35dc63bec7ffcd.zip
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/metadata')
-rw-r--r--src/librustc/metadata/creader.rs4
-rw-r--r--src/librustc/metadata/filesearch.rs22
2 files changed, 13 insertions, 13 deletions
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs
index 8ece290293b..9700f68383a 100644
--- a/src/librustc/metadata/creader.rs
+++ b/src/librustc/metadata/creader.rs
@@ -143,7 +143,7 @@ fn visit_view_item(e: @mut Env, i: &ast::view_item) {
           let meta_items = match path_opt {
               None => meta_items.clone(),
               Some((p, _path_str_style)) => {
-                  let p_path = Path::from_str(p);
+                  let p_path = Path::new(p);
                   match p_path.filestem_str() {
                       None|Some("") =>
                           e.diag.span_bug(i.span, "Bad package path in `extern mod` item"),
@@ -275,7 +275,7 @@ fn resolve_crate(e: @mut Env,
         };
         let (lident, ldata) = loader::load_library_crate(&load_ctxt);
 
-        let cfilename = Path::from_str(lident);
+        let cfilename = Path::new(lident);
         let cdata = ldata;
 
         let attrs = decoder::get_crate_attributes(cdata);
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index 4e3daa7c185..6335df47d73 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -138,11 +138,11 @@ pub fn search(filesearch: @FileSearch, pick: pick) {
 
 pub fn relative_target_lib_path(target_triple: &str) -> Path {
     let dir = libdir();
-    let mut p = Path::from_str(dir);
+    let mut p = Path::new(dir.as_slice());
     assert!(p.is_relative());
-    p.push_str("rustc");
-    p.push_str(target_triple);
-    p.push_str(dir);
+    p.push("rustc");
+    p.push(target_triple);
+    p.push(dir);
     p
 }
 
@@ -153,8 +153,8 @@ fn make_target_lib_path(sysroot: &Path,
 
 fn make_rustpkg_target_lib_path(dir: &Path,
                         target_triple: &str) -> Path {
-    let mut p = dir.join_str(libdir());
-    p.push_str(target_triple);
+    let mut p = dir.join(libdir());
+    p.push(target_triple);
     p
 }
 
@@ -192,13 +192,13 @@ pub fn rust_path() -> ~[Path] {
         Some(env_path) => {
             let env_path_components: ~[&str] =
                 env_path.split_str_iter(PATH_ENTRY_SEPARATOR).collect();
-            env_path_components.map(|&s| Path::from_str(s))
+            env_path_components.map(|&s| Path::new(s))
         }
         None => ~[]
     };
     let cwd = os::getcwd();
     // now add in default entries
-    let cwd_dot_rust = cwd.join_str(".rust");
+    let cwd_dot_rust = cwd.join(".rust");
     if !env_rust_path.contains(&cwd_dot_rust) {
         env_rust_path.push(cwd_dot_rust);
     }
@@ -206,14 +206,14 @@ pub fn rust_path() -> ~[Path] {
         env_rust_path.push(cwd.clone());
     }
     do cwd.each_parent() |p| {
-        if !env_rust_path.contains(&p.join_str(".rust")) {
+        if !env_rust_path.contains(&p.join(".rust")) {
             push_if_exists(&mut env_rust_path, p);
         }
         true
     };
     let h = os::homedir();
     for h in h.iter() {
-        if !env_rust_path.contains(&h.join_str(".rust")) {
+        if !env_rust_path.contains(&h.join(".rust")) {
             push_if_exists(&mut env_rust_path, h);
         }
     }
@@ -223,7 +223,7 @@ pub fn rust_path() -> ~[Path] {
 
 /// Adds p/.rust into vec, only if it exists
 fn push_if_exists(vec: &mut ~[Path], p: &Path) {
-    let maybe_dir = p.join_str(".rust");
+    let maybe_dir = p.join(".rust");
     if os::path_exists(&maybe_dir) {
         vec.push(maybe_dir);
     }