about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcargo/pgp.rs2
-rw-r--r--src/libcore/extfmt.rs13
-rw-r--r--src/libcore/gc.rs15
-rw-r--r--src/libcore/os.rs18
-rw-r--r--src/libcore/pipes.rs3
-rw-r--r--src/libcore/run.rs11
-rw-r--r--src/librustdoc/config.rs38
7 files changed, 45 insertions, 55 deletions
diff --git a/src/libcargo/pgp.rs b/src/libcargo/pgp.rs
index f6e0ebda925..fe7808bad5d 100644
--- a/src/libcargo/pgp.rs
+++ b/src/libcargo/pgp.rs
@@ -12,7 +12,7 @@ use core::os;
 use core::path::Path;
 use core::run;
 
-pub fn gpgv(args: ~[~str]) -> { status: int, out: ~str, err: ~str } {
+pub fn gpgv(args: ~[~str]) -> run::ProgramOutput {
     return run::program_output(~"gpgv", args);
 }
 
diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs
index 4d2a1b2afe0..aa4a7546f02 100644
--- a/src/libcore/extfmt.rs
+++ b/src/libcore/extfmt.rs
@@ -51,9 +51,6 @@
 //! * s - str (any flavor)
 //! * ? - arbitrary type (does not use the to_str trait)
 
-// Transitional
-#[allow(structural_records)]; // Macros -- needs a snapshot
-
 /*
 Syntax Extension: fmt
 
@@ -619,11 +616,11 @@ pub mod rt {
             let padstr = str::from_chars(vec::from_elem(diff, padchar));
             return s + padstr;
         }
-        let {might_zero_pad, signed} = match mode {
-          PadNozero => {might_zero_pad:false, signed:false},
-          PadSigned => {might_zero_pad:true,  signed:true },
-          PadFloat => {might_zero_pad:true,  signed:true},
-          PadUnsigned => {might_zero_pad:true,  signed:false}
+        let (might_zero_pad, signed) = match mode {
+          PadNozero   => (false, true),
+          PadSigned   => (true, true),
+          PadFloat    => (true, true),
+          PadUnsigned => (true, false)
         };
         pure fn have_precision(cv: Conv) -> bool {
             return match cv.precision { CountImplied => false, _ => true };
diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs
index d0c40ccf19a..3e3c327af5f 100644
--- a/src/libcore/gc.rs
+++ b/src/libcore/gc.rs
@@ -35,9 +35,6 @@ with destructors.
 
 */
 
-// Transitional
-#[allow(structural_records)];
-
 use cast;
 use container::{Container, Mutable, Map, Set};
 use io;
@@ -172,12 +169,14 @@ unsafe fn is_frame_in_segment(fp: *Word, segment: *StackSegment) -> bool {
     return begin <= frame && frame <= end;
 }
 
+struct Segment { segment: *StackSegment, boundary: bool }
+
 // Find and return the segment containing the given frame pointer. At
 // stack segment boundaries, returns true for boundary, so that the
 // caller can do any special handling to identify where the correct
 // return address is in the stack frame.
 unsafe fn find_segment_for_frame(fp: *Word, segment: *StackSegment)
-    -> {segment: *StackSegment, boundary: bool} {
+    -> Segment {
     // Check if frame is in either current frame or previous frame.
     let in_segment = is_frame_in_segment(fp, segment);
     let in_prev_segment = ptr::is_not_null((*segment).prev) &&
@@ -191,16 +190,16 @@ unsafe fn find_segment_for_frame(fp: *Word, segment: *StackSegment)
             is_frame_in_segment(fp, (*segment).next) {
             segment = (*segment).next;
         }
-        return {segment: segment, boundary: false};
+        return Segment {segment: segment, boundary: false};
     }
 
     // If frame is in previous frame, then we're at a boundary.
     if !in_segment && in_prev_segment {
-        return {segment: (*segment).prev, boundary: true};
+        return Segment {segment: (*segment).prev, boundary: true};
     }
 
     // Otherwise, we're somewhere on the inside of the frame.
-    return {segment: segment, boundary: false};
+    return Segment {segment: segment, boundary: false};
 }
 
 type Memory = uint;
@@ -224,7 +223,7 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
     for stackwalk::walk_stack |frame| {
         unsafe {
             let pc = last_ret;
-            let {segment: next_segment, boundary: boundary} =
+            let Segment {segment: next_segment, boundary: boundary} =
                 find_segment_for_frame(frame.fp, segment);
             segment = next_segment;
             // Each stack segment is bounded by a morestack frame. The
diff --git a/src/libcore/os.rs b/src/libcore/os.rs
index e3fe0a1aae2..38469c35cfa 100644
--- a/src/libcore/os.rs
+++ b/src/libcore/os.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(structural_records)];
-
 /*!
  * Higher-level interfaces to libc::* functions and operating system services.
  *
@@ -318,33 +316,37 @@ pub fn waitpid(pid: pid_t) -> c_int {
 }
 
 
+pub struct Pipe { mut in: c_int, mut out: c_int }
+
 #[cfg(unix)]
-pub fn pipe() -> {in: c_int, out: c_int} {
+pub fn pipe() -> Pipe {
     unsafe {
-        let mut fds = {in: 0 as c_int, out: 0 as c_int};
+        let mut fds = Pipe {mut in: 0 as c_int,
+                        mut out: 0 as c_int };
         assert (libc::pipe(ptr::mut_addr_of(&(fds.in))) == (0 as c_int));
-        return {in: fds.in, out: fds.out};
+        return Pipe {in: fds.in, out: fds.out};
     }
 }
 
 
 
 #[cfg(windows)]
-pub fn pipe() -> {in: c_int, out: c_int} {
+pub fn pipe() -> Pipe {
     unsafe {
         // Windows pipes work subtly differently than unix pipes, and their
         // inheritance has to be handled in a different way that I do not
         // fully understand. Here we explicitly make the pipe non-inheritable,
         // which means to pass it to a subprocess they need to be duplicated
         // first, as in rust_run_program.
-        let mut fds = { in: 0 as c_int, out: 0 as c_int };
+        let mut fds = Pipe { mut in: 0 as c_int,
+                    mut out: 0 as c_int };
         let res = libc::pipe(ptr::mut_addr_of(&(fds.in)),
                              1024 as c_uint,
                              (libc::O_BINARY | libc::O_NOINHERIT) as c_int);
         assert (res == 0 as c_int);
         assert (fds.in != -1 as c_int && fds.in != 0 as c_int);
         assert (fds.out != -1 as c_int && fds.in != 0 as c_int);
-        return {in: fds.in, out: fds.out};
+        return Pipe {in: fds.in, out: fds.out};
     }
 }
 
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index 3f0aecb887d..10aa4e41a0d 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -82,8 +82,7 @@ bounded and unbounded protocols allows for less code duplication.
 
 */
 
-// Transitional -- needs snapshot
-#[allow(structural_records)];
+#[allow(structural_records)]; // Macros -- needs another snapshot
 
 use cmp::Eq;
 use cast::{forget, reinterpret_cast, transmute};
diff --git a/src/libcore/run.rs b/src/libcore/run.rs
index c8187fa794d..43ecf350ff3 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(structural_records)];
-
 //! Process spawning
 use cast;
 use io;
@@ -301,6 +299,8 @@ fn read_all(rd: io::Reader) -> ~str {
     str::from_bytes(buf)
 }
 
+pub struct ProgramOutput {status: int, out: ~str, err: ~str}
+
 /**
  * Spawns a process, waits for it to exit, and returns the exit code, and
  * contents of stdout and stderr.
@@ -315,8 +315,7 @@ fn read_all(rd: io::Reader) -> ~str {
  * A record, {status: int, out: str, err: str} containing the exit code,
  * the contents of stdout and the contents of stderr.
  */
-pub fn program_output(prog: &str, args: &[~str]) ->
-   {status: int, out: ~str, err: ~str} {
+pub fn program_output(prog: &str, args: &[~str]) -> ProgramOutput {
     unsafe {
         let pipe_in = os::pipe();
         let pipe_out = os::pipe();
@@ -371,7 +370,9 @@ pub fn program_output(prog: &str, args: &[~str]) ->
             };
             count -= 1;
         };
-        return {status: status, out: move outs, err: move errs};
+        return ProgramOutput {status: status,
+                              out: move outs,
+                              err: move errs};
     }
 }
 
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 9ba23a20b50..90b18599620 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -14,6 +14,7 @@ use core::cmp;
 use core::os;
 use core::result;
 use core::run;
+use core::run::ProgramOutput;
 use core::vec;
 use core::result::Result;
 use std::getopts;
@@ -104,29 +105,18 @@ pub fn default_config(input_crate: &Path) -> Config {
     }
 }
 
-struct ProcOut {
-    status: int,
-    out: ~str,
-    err: ~str
-}
-
-type ProgramOutput = fn~((&str), (&[~str])) -> ProcOut;
+type Process = fn~((&str), (&[~str])) -> ProgramOutput;
 
-pub fn mock_program_output(_prog: &str, _args: &[~str]) -> ProcOut {
-    ProcOut {
+pub fn mock_program_output(_prog: &str, _args: &[~str]) -> ProgramOutput {
+    ProgramOutput {
         status: 0,
         out: ~"",
         err: ~""
     }
 }
 
-pub fn program_output(prog: &str, args: &[~str]) -> ProcOut {
-    let {status, out, err} = run::program_output(prog, args);
-    ProcOut {
-        status: status,
-        out: out,
-        err: err
-    }
+pub fn program_output(prog: &str, args: &[~str]) -> ProgramOutput {
+    run::program_output(prog, args)
 }
 
 pub fn parse_config(args: &[~str]) -> Result<Config, ~str> {
@@ -135,7 +125,7 @@ pub fn parse_config(args: &[~str]) -> Result<Config, ~str> {
 
 pub fn parse_config_(
     args: &[~str],
-    program_output: ProgramOutput
+    program_output: Process
 ) -> Result<Config, ~str> {
     let args = args.tail();
     let opts = vec::unzip(opts()).first();
@@ -159,7 +149,7 @@ pub fn parse_config_(
 fn config_from_opts(
     input_crate: &Path,
     matches: &getopts::Matches,
-    program_output: ProgramOutput
+    program_output: Process
 ) -> Result<Config, ~str> {
 
     let config = default_config(input_crate);
@@ -235,7 +225,7 @@ fn parse_output_style(output_style: &str) -> Result<OutputStyle, ~str> {
 fn maybe_find_pandoc(
     config: &Config,
     maybe_pandoc_cmd: Option<~str>,
-    program_output: ProgramOutput
+    program_output: Process
 ) -> Result<Option<~str>, ~str> {
     if config.output_format != PandocHtml {
         return result::Ok(maybe_pandoc_cmd);
@@ -272,8 +262,9 @@ fn should_find_pandoc() {
         output_format: PandocHtml,
         .. default_config(&Path("test"))
     };
-    let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> ProcOut {
-        ProcOut {
+    let mock_program_output = fn~(_prog: &str, _args: &[~str])
+        -> ProgramOutput {
+        ProgramOutput {
             status: 0, out: ~"pandoc 1.8.2.1", err: ~""
         }
     };
@@ -287,8 +278,9 @@ fn should_error_with_no_pandoc() {
         output_format: PandocHtml,
         .. default_config(&Path("test"))
     };
-    let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> ProcOut {
-        ProcOut {
+    let mock_program_output = fn~(_prog: &str, _args: &[~str])
+        -> ProgramOutput {
+        ProgramOutput {
             status: 1, out: ~"", err: ~""
         }
     };