about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-11 21:28:37 -0700
committerbors <bors@rust-lang.org>2013-05-11 21:28:37 -0700
commit1f62b23411abcfbe66eeea294f4258f1bb169e7d (patch)
treedf582703e2f47eb1ee746e7c92fe1ff596d7d7a7 /src/libstd
parent35e6ce548f2008331c0fa50f1cff30ab7b412ab7 (diff)
parenta279d6510251ebd3956c74ffe4b12bd49074da9c (diff)
downloadrust-1f62b23411abcfbe66eeea294f4258f1bb169e7d.tar.gz
rust-1f62b23411abcfbe66eeea294f4258f1bb169e7d.zip
auto merge of #6431 : catamorphism/rust/warnings, r=catamorphism
Just cleaning up warnings.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ebml.rs7
-rw-r--r--src/libstd/fileinput.rs29
-rw-r--r--src/libstd/future.rs40
-rw-r--r--src/libstd/json.rs13
-rw-r--r--src/libstd/net_tcp.rs24
-rw-r--r--src/libstd/num/bigint.rs2
-rw-r--r--src/libstd/std.rc3
-rw-r--r--src/libstd/test.rs3
8 files changed, 27 insertions, 94 deletions
diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs
index a57a16fb87d..98618e4928b 100644
--- a/src/libstd/ebml.rs
+++ b/src/libstd/ebml.rs
@@ -634,13 +634,6 @@ pub mod writer {
     use core::vec;
 
     // ebml writing
-    #[cfg(stage0)]
-    pub struct Encoder {
-        writer: @io::Writer,
-        priv mut size_positions: ~[uint],
-    }
-
-    #[cfg(not(stage0))]
     pub struct Encoder {
         writer: @io::Writer,
         priv size_positions: ~[uint],
diff --git a/src/libstd/fileinput.rs b/src/libstd/fileinput.rs
index 2c5cbc1cbf9..c3622fad53b 100644
--- a/src/libstd/fileinput.rs
+++ b/src/libstd/fileinput.rs
@@ -94,8 +94,6 @@ total line count).
     }
 */
 
-#[allow(deprecated_mutable_fields)];
-
 use core::io::ReaderUtil;
 
 /**
@@ -212,8 +210,8 @@ impl FileInput {
     pub fn next_file(&self) -> bool {
         // No more files
 
-        // Compiler whines about "illegal borrow unless pure" for
-        // files.is_empty()
+        // unsafe block can be removed after the next snapshot
+        // (next one after 2013-05-03)
         if unsafe { self.fi.files.is_empty() } {
             self.fi.current_reader = None;
             return false;
@@ -337,7 +335,8 @@ impl io::Reader for FileInput {
     fn eof(&self) -> bool {
         // we've run out of files, and current_reader is either None or eof.
 
-        // compiler whines about illegal borrows for files.is_empty()
+        // unsafe block can be removed after the next snapshot
+        // (next one after 2013-05-03)
         (unsafe { self.fi.files.is_empty() }) &&
             match self.fi.current_reader { None => true, Some(r) => r.eof() }
 
@@ -380,8 +379,7 @@ Fails when attempting to read from a file that can't be opened.
 */
 #[cfg(stage0)]
 pub fn input(f: &fn(&str) -> bool) {
-    let mut i = FileInput::from_args();
-    i.each_line(f);
+    FileInput::from_args().each_line(f);
 }
 /**
 Iterate directly over the command line arguments (no arguments implies
@@ -391,7 +389,7 @@ Fails when attempting to read from a file that can't be opened.
 */
 #[cfg(not(stage0))]
 pub fn input(f: &fn(&str) -> bool) -> bool {
-    let mut i = FileInput::from_args();
+    let i = FileInput::from_args();
     i.each_line(f)
 }
 
@@ -404,8 +402,7 @@ Fails when attempting to read from a file that can't be opened.
 */
 #[cfg(stage0)]
 pub fn input_state(f: &fn(&str, FileInputState) -> bool) {
-    let mut i = FileInput::from_args();
-    i.each_line_state(f);
+    FileInput::from_args().each_line_state(f);
 }
 /**
 Iterate directly over the command line arguments (no arguments
@@ -416,7 +413,7 @@ Fails when attempting to read from a file that can't be opened.
 */
 #[cfg(not(stage0))]
 pub fn input_state(f: &fn(&str, FileInputState) -> bool) -> bool {
-    let mut i = FileInput::from_args();
+    let i = FileInput::from_args();
     i.each_line_state(f)
 }
 
@@ -427,8 +424,7 @@ Fails when attempting to read from a file that can't be opened.
 */
 #[cfg(stage0)]
 pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) {
-    let mut i = FileInput::from_vec(files);
-    i.each_line(f);
+    FileInput::from_vec(files).each_line(f);
 }
 /**
 Iterate over a vector of files (an empty vector implies just `stdin`).
@@ -437,7 +433,7 @@ Fails when attempting to read from a file that can't be opened.
 */
 #[cfg(not(stage0))]
 pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) -> bool {
-    let mut i = FileInput::from_vec(files);
+    let i = FileInput::from_vec(files);
     i.each_line(f)
 }
 
@@ -450,8 +446,7 @@ Fails when attempting to read from a file that can't be opened.
 #[cfg(stage0)]
 pub fn input_vec_state(files: ~[Option<Path>],
                        f: &fn(&str, FileInputState) -> bool) {
-    let mut i = FileInput::from_vec(files);
-    i.each_line_state(f);
+    FileInput::from_vec(files).each_line_state(f);
 }
 /**
 Iterate over a vector of files (an empty vector implies just `stdin`)
@@ -462,7 +457,7 @@ Fails when attempting to read from a file that can't be opened.
 #[cfg(not(stage0))]
 pub fn input_vec_state(files: ~[Option<Path>],
                        f: &fn(&str, FileInputState) -> bool) -> bool {
-    let mut i = FileInput::from_vec(files);
+    let i = FileInput::from_vec(files);
     i.each_line_state(f)
 }
 
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index ac23ea1a6e2..9906be13cb9 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -29,17 +29,12 @@ use core::task;
 use core::util::replace;
 
 #[doc = "The future type"]
-#[cfg(stage0)]
-pub struct Future<A> {
-    priv mut state: FutureState<A>,
-}
-
-#[doc = "The future type"]
-#[cfg(not(stage0))]
 pub struct Future<A> {
     priv state: FutureState<A>,
 }
 
+// n.b. It should be possible to get rid of this.
+// Add a test, though -- tjc
 // FIXME(#2829) -- futures should not be copyable, because they close
 // over ~fn's that have pipes and so forth within!
 #[unsafe_destructor]
@@ -62,37 +57,6 @@ pub impl<A:Copy> Future<A> {
 }
 
 pub impl<A> Future<A> {
-    #[cfg(stage0)]
-    fn get_ref<'a>(&'a self) -> &'a A {
-        /*!
-        * Executes the future's closure and then returns a borrowed
-        * pointer to the result.  The borrowed pointer lasts as long as
-        * the future.
-        */
-        unsafe {
-            {
-                match self.state {
-                    Forced(ref mut v) => { return cast::transmute(v); }
-                    Evaluating => fail!(~"Recursive forcing of future!"),
-                    Pending(_) => {}
-                }
-            }
-            {
-                let state = replace(&mut self.state, Evaluating);
-                match state {
-                    Forced(_) | Evaluating => fail!(~"Logic error."),
-                    Pending(f) => {
-                        self.state = Forced(f());
-                        cast::transmute(self.get_ref())
-                    }
-                }
-            }
-        }
-    }
-
-    #[cfg(stage1)]
-    #[cfg(stage2)]
-    #[cfg(stage3)]
     fn get_ref<'a>(&'a mut self) -> &'a A {
         /*!
         * Executes the future's closure and then returns a borrowed
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index c815c9dd480..2acbcf5c7ec 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -220,13 +220,6 @@ impl serialize::Encoder for Encoder {
     }
 }
 
-#[cfg(stage0)]
-pub struct PrettyEncoder {
-    priv wr: @io::Writer,
-    priv mut indent: uint,
-}
-
-#[cfg(not(stage0))]
 pub struct PrettyEncoder {
     priv wr: @io::Writer,
     priv indent: uint,
@@ -845,12 +838,6 @@ pub fn from_str(s: &str) -> Result<Json, Error> {
     }
 }
 
-#[cfg(stage0)]
-pub struct Decoder {
-    priv mut stack: ~[Json],
-}
-
-#[cfg(not(stage0))]
 pub struct Decoder {
     priv stack: ~[Json],
 }
diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs
index 7e47106977f..20e1a272910 100644
--- a/src/libstd/net_tcp.rs
+++ b/src/libstd/net_tcp.rs
@@ -972,19 +972,17 @@ impl io::Reader for TcpSocketBuf {
 /// Implementation of `io::Reader` trait for a buffered `net::tcp::TcpSocket`
 impl io::Writer for TcpSocketBuf {
     pub fn write(&self, data: &[u8]) {
-        unsafe {
-            let socket_data_ptr: *TcpSocketData =
-                &(*((*(self.data)).sock).socket_data);
-            let w_result = write_common_impl(socket_data_ptr,
-                                             vec::slice(data,
-                                                        0,
-                                                        data.len()).to_vec());
-            if w_result.is_err() {
-                let err_data = w_result.get_err();
-                debug!(
-                    "ERROR sock_buf as io::writer.writer err: %? %?",
-                         err_data.err_name, err_data.err_msg);
-            }
+        let socket_data_ptr: *TcpSocketData =
+            &(*((*(self.data)).sock).socket_data);
+        let w_result = write_common_impl(socket_data_ptr,
+                                         vec::slice(data,
+                                                    0,
+                                                    data.len()).to_vec());
+        if w_result.is_err() {
+            let err_data = w_result.get_err();
+            debug!(
+                "ERROR sock_buf as io::writer.writer err: %? %?",
+                err_data.err_name, err_data.err_msg);
         }
     }
     fn seek(&self, dist: int, seek: io::SeekStyle) {
diff --git a/src/libstd/num/bigint.rs b/src/libstd/num/bigint.rs
index e64e97adfa3..7b39b200079 100644
--- a/src/libstd/num/bigint.rs
+++ b/src/libstd/num/bigint.rs
@@ -16,8 +16,6 @@ A BigUint is represented as an array of BigDigits.
 A BigInt is a combination of BigUint and Sign.
 */
 
-#[deny(deprecated_mutable_fields)];
-
 use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
 use core::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix};
 
diff --git a/src/libstd/std.rc b/src/libstd/std.rc
index 70bd5ceef98..915aab59a71 100644
--- a/src/libstd/std.rc
+++ b/src/libstd/std.rc
@@ -28,9 +28,6 @@ not required in or otherwise suitable for the core library.
 
 #[deny(non_camel_case_types)];
 
-// Allow mutable fields only in stage0.
-#[warn(deprecated_mutable_fields)];
-
 pub mod uv_ll;
 
 // General io and system-services modules
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index c320bcea77c..71cbc0d7a6a 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -410,9 +410,10 @@ type MonitorMsg = (TestDesc, TestResult);
 fn run_tests(opts: &TestOpts,
              tests: ~[TestDescAndFn],
              callback: @fn(e: TestEvent)) {
-    let mut filtered_tests = filter_tests(opts, tests);
 
+    let filtered_tests = filter_tests(opts, tests);
     let filtered_descs = filtered_tests.map(|t| copy t.desc);
+
     callback(TeFiltered(filtered_descs));
 
     let (filtered_tests, filtered_benchs) =