about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-04-30 11:52:07 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-04-30 11:52:07 -0700
commit85fbfa25d799c98a0aadf2faef3fc17400764daf (patch)
tree929d32253cfdbb303dadeecf7433466f6b27214c /src/libcore
parent2bb3b63ec4379b812aeceb690d78763ec55d3cbb (diff)
downloadrust-85fbfa25d799c98a0aadf2faef3fc17400764daf.tar.gz
rust-85fbfa25d799c98a0aadf2faef3fc17400764daf.zip
Revert "Eliminate a copy in syntax::parse::new_parser_from_file"
This reverts commit 2bb3b63ec4379b812aeceb690d78763ec55d3cbb.

(I was confused.)
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/core.rs2
-rw-r--r--src/libcore/io.rs18
-rw-r--r--src/libcore/str.rs21
3 files changed, 1 insertions, 40 deletions
diff --git a/src/libcore/core.rs b/src/libcore/core.rs
index 84c15385a7f..8681f7d2a1c 100644
--- a/src/libcore/core.rs
+++ b/src/libcore/core.rs
@@ -49,7 +49,7 @@ mod std {
 
 #[doc = "
 A standard function to use to indicate unreachable code. Because the
-function is guaranteed to fail, typestate will correctly identify
+function is guaranteed to fail typestate will correctly identify
 any code paths following the appearance of this function as unreachable.
 "]
 fn unreachable() -> ! {
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index f61b622f088..0c723fc8c63 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -650,24 +650,6 @@ fn read_whole_file_str(file: str) -> result<str, str> {
     })
 }
 
-/*
-  Returns the result as a unique boxed string rather than a string
- */
-fn read_whole_file_ref(file: str) -> result<~str, str> {
-     let f = os::as_c_charp(file, {|pathbuf|
-        os::as_c_charp("r", {|modebuf|
-            libc::fopen(pathbuf, modebuf)
-        })
-    });
-    ret if f as uint == 0u { result::err("error opening " + file) }
-        else unsafe {
-        let buf : ~mut [const u8] = ~mut [const];
-        let self = FILE_reader(f, true);
-        while (!self.eof()) { *buf += self.read_bytes(2048u); }
-        result::ok(str::unsafe::from_bytes_move(buf))
-    }
-}
-
 // FIXME implement this in a low-level way. Going through the abstractions is
 // pointless. // #2004
 fn read_whole_file(file: str) -> result<[u8], str> {
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 1fff066c025..12258f5eb27 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -124,19 +124,6 @@ fn from_bytes(vv: [u8]) -> str unsafe {
 }
 
 #[doc = "
-Convert a unique vector of bytes (passed by move)
-   to a unique boxed UTF-8 string
-
-# Failure
-
-Fails if invalid UTF-8
-"]
-fn from_bytes_move(-vv: ~mut [const u8]) -> ~str unsafe {
-   assert is_utf8(::unsafe::reinterpret_cast(vv));
-   ret unsafe::from_bytes_move(vv);
-}
-
-#[doc = "
 Convert a byte to a UTF-8 string
 
 # Failure
@@ -1644,7 +1631,6 @@ mod unsafe {
       from_buf,
       from_c_str,
       from_bytes,
-      from_bytes_move,
       slice_bytes,
       push_byte,
       pop_byte,
@@ -1699,13 +1685,6 @@ mod unsafe {
        ret scopy;
    }
 
-   unsafe fn from_bytes_move(-v: ~mut [const u8]) -> ~str unsafe {
-     *v += [0u8];
-     let s: ~str = ::unsafe::reinterpret_cast(v);
-     ::unsafe::forget(v);
-     s
-   }
-
    #[doc = "
    Converts a byte to a string.