diff options
| author | bors <bors@rust-lang.org> | 2013-07-31 22:52:31 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-07-31 22:52:31 -0700 |
| commit | 8ec70ae5de0e33ab62732c59b0b2b0620cb8dce9 (patch) | |
| tree | d3ec524a3c9192408a0400e723a5f59388774c9f /src/libstd | |
| parent | 0c716c66fbd164bf0d96a77e2c6389f8f6702b23 (diff) | |
| parent | b57ffef37e6e2196ad948ab2f6944d242c3aaaf1 (diff) | |
| download | rust-8ec70ae5de0e33ab62732c59b0b2b0620cb8dce9.tar.gz rust-8ec70ae5de0e33ab62732c59b0b2b0620cb8dce9.zip | |
auto merge of #8162 : thestinger/rust/no-copy, r=brson
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/condition.rs | 14 | ||||
| -rw-r--r-- | src/libstd/os.rs | 34 | ||||
| -rw-r--r-- | src/libstd/rt/io/extensions.rs | 10 | ||||
| -rw-r--r-- | src/libstd/rt/io/net/tcp.rs | 8 | ||||
| -rw-r--r-- | src/libstd/rt/io/net/udp.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/io/option.rs | 8 | ||||
| -rw-r--r-- | src/libstd/run.rs | 16 | ||||
| -rw-r--r-- | src/libstd/str.rs | 2 |
8 files changed, 47 insertions, 47 deletions
diff --git a/src/libstd/condition.rs b/src/libstd/condition.rs index 1f7f96d93c3..4d8857c9d1b 100644 --- a/src/libstd/condition.rs +++ b/src/libstd/condition.rs @@ -73,7 +73,7 @@ struct Trap<'self, T, U> { } impl<'self, T, U> Trap<'self, T, U> { - pub fn in<V>(&self, inner: &'self fn() -> V) -> V { + pub fn inside<V>(&self, inner: &'self fn() -> V) -> V { let _g = Guard { cond: self.cond }; debug!("Trap: pushing handler to TLS"); local_data::set(self.cond.key, self.handler); @@ -119,7 +119,7 @@ mod test { debug!("nested_trap_test_inner: in handler"); inner_trapped = true; 0 - }).in { + }).inside { debug!("nested_trap_test_inner: in protected block"); trouble(1); } @@ -134,7 +134,7 @@ mod test { do sadness::cond.trap(|_j| { debug!("nested_trap_test_outer: in handler"); outer_trapped = true; 0 - }).in { + }).inside { debug!("nested_guard_test_outer: in protected block"); nested_trap_test_inner(); trouble(1); @@ -152,7 +152,7 @@ mod test { let i = 10; debug!("nested_reraise_trap_test_inner: handler re-raising"); sadness::cond.raise(i) - }).in { + }).inside { debug!("nested_reraise_trap_test_inner: in protected block"); trouble(1); } @@ -167,7 +167,7 @@ mod test { do sadness::cond.trap(|_j| { debug!("nested_reraise_trap_test_outer: in handler"); outer_trapped = true; 0 - }).in { + }).inside { debug!("nested_reraise_trap_test_outer: in protected block"); nested_reraise_trap_test_inner(); } @@ -182,7 +182,7 @@ mod test { do sadness::cond.trap(|j| { debug!("test_default: in handler"); sadness::cond.raise_default(j, || { trapped=true; 5 }) - }).in { + }).inside { debug!("test_default: in protected block"); trouble(1); } @@ -205,7 +205,7 @@ mod test { do sadness::cond.trap(|_| { trapped = true; 0 - }).in { + }).inside { sadness::cond.raise(0); } assert!(trapped); diff --git a/src/libstd/os.rs b/src/libstd/os.rs index ac03735894a..2802fc30c33 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -389,17 +389,17 @@ pub fn fsync_fd(fd: c_int, _l: io::fsync::Level) -> c_int { } pub struct Pipe { - in: c_int, + input: c_int, out: c_int } #[cfg(unix)] pub fn pipe() -> Pipe { unsafe { - let mut fds = Pipe {in: 0 as c_int, + let mut fds = Pipe {input: 0 as c_int, out: 0 as c_int }; - assert_eq!(libc::pipe(&mut fds.in), (0 as c_int)); - return Pipe {in: fds.in, out: fds.out}; + assert_eq!(libc::pipe(&mut fds.input), (0 as c_int)); + return Pipe {input: fds.input, out: fds.out}; } } @@ -413,14 +413,14 @@ pub fn pipe() -> Pipe { // 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 core::run. - let mut fds = Pipe {in: 0 as c_int, + let mut fds = Pipe {input: 0 as c_int, out: 0 as c_int }; - let res = libc::pipe(&mut fds.in, 1024 as ::libc::c_uint, + let res = libc::pipe(&mut fds.input, 1024 as ::libc::c_uint, (libc::O_BINARY | libc::O_NOINHERIT) as c_int); assert_eq!(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 Pipe {in: fds.in, out: fds.out}; + assert!((fds.input != -1 as c_int && fds.input != 0 as c_int)); + assert!((fds.out != -1 as c_int && fds.input != 0 as c_int)); + return Pipe {input: fds.input, out: fds.out}; } } @@ -1931,11 +1931,11 @@ mod tests { let tempdir = getcwd(); // would like to use $TMPDIR, // doesn't seem to work on Linux assert!((tempdir.to_str().len() > 0u)); - let in = tempdir.push("in.txt"); + let input = tempdir.push("in.txt"); let out = tempdir.push("out.txt"); /* Write the temp input file */ - let ostream = do in.to_str().as_c_str |fromp| { + let ostream = do input.to_str().as_c_str |fromp| { do "w+b".as_c_str |modebuf| { libc::fopen(fromp, modebuf) } @@ -1950,16 +1950,16 @@ mod tests { len as size_t) } assert_eq!(libc::fclose(ostream), (0u as c_int)); - let in_mode = in.get_mode(); - let rs = os::copy_file(&in, &out); - if (!os::path_exists(&in)) { - fail!("%s doesn't exist", in.to_str()); + let in_mode = input.get_mode(); + let rs = os::copy_file(&input, &out); + if (!os::path_exists(&input)) { + fail!("%s doesn't exist", input.to_str()); } assert!((rs)); - let rslt = run::process_status("diff", [in.to_str(), out.to_str()]); + let rslt = run::process_status("diff", [input.to_str(), out.to_str()]); assert_eq!(rslt, 0); assert_eq!(out.get_mode(), in_mode); - assert!((remove_file(&in))); + assert!((remove_file(&input))); assert!((remove_file(&out))); } } diff --git a/src/libstd/rt/io/extensions.rs b/src/libstd/rt/io/extensions.rs index c6654e9dabe..2d21bf0f9dc 100644 --- a/src/libstd/rt/io/extensions.rs +++ b/src/libstd/rt/io/extensions.rs @@ -330,7 +330,7 @@ impl<T: Reader> ReaderUtil for T { } else { read_error::cond.raise(e) } - }).in { + }).inside { while keep_reading { self.push_bytes(&mut buf, DEFAULT_BUF_SIZE) } @@ -640,7 +640,7 @@ mod test { None }; do read_error::cond.trap(|_| { - }).in { + }).inside { let byte = reader.read_byte(); assert!(byte == None); } @@ -679,7 +679,7 @@ mod test { fn read_bytes_eof() { let mut reader = MemReader::new(~[10, 11]); do read_error::cond.trap(|_| { - }).in { + }).inside { assert!(reader.read_bytes(4) == ~[10, 11]); } } @@ -720,7 +720,7 @@ mod test { let mut reader = MemReader::new(~[10, 11]); let mut buf = ~[8, 9]; do read_error::cond.trap(|_| { - }).in { + }).inside { reader.push_bytes(&mut buf, 4); assert!(buf == ~[8, 9, 10, 11]); } @@ -743,7 +743,7 @@ mod test { } }; let mut buf = ~[8, 9]; - do read_error::cond.trap(|_| { } ).in { + do read_error::cond.trap(|_| { } ).inside { reader.push_bytes(&mut buf, 4); } assert!(buf == ~[8, 9, 10]); diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/rt/io/net/tcp.rs index c997373bf9d..82278875fa5 100644 --- a/src/libstd/rt/io/net/tcp.rs +++ b/src/libstd/rt/io/net/tcp.rs @@ -156,7 +156,7 @@ mod test { do io_error::cond.trap(|e| { assert!(e.kind == PermissionDenied); called = true; - }).in { + }).inside { let addr = Ipv4(0, 0, 0, 0, 1); let listener = TcpListener::bind(addr); assert!(listener.is_none()); @@ -172,7 +172,7 @@ mod test { do io_error::cond.trap(|e| { assert!(e.kind == ConnectionRefused); called = true; - }).in { + }).inside { let addr = Ipv4(0, 0, 0, 0, 1); let stream = TcpStream::connect(addr); assert!(stream.is_none()); @@ -320,7 +320,7 @@ mod test { // NB: ECONNRESET on linux, EPIPE on mac assert!(e.kind == ConnectionReset || e.kind == BrokenPipe); stop = true; - }).in { + }).inside { stream.write(buf); } if stop { break } @@ -349,7 +349,7 @@ mod test { // NB: ECONNRESET on linux, EPIPE on mac assert!(e.kind == ConnectionReset || e.kind == BrokenPipe); stop = true; - }).in { + }).inside { stream.write(buf); } if stop { break } diff --git a/src/libstd/rt/io/net/udp.rs b/src/libstd/rt/io/net/udp.rs index 8e654de47f0..d186ad15f4a 100644 --- a/src/libstd/rt/io/net/udp.rs +++ b/src/libstd/rt/io/net/udp.rs @@ -117,7 +117,7 @@ mod test { do io_error::cond.trap(|e| { assert!(e.kind == PermissionDenied); called = true; - }).in { + }).inside { let addr = Ipv4(0, 0, 0, 0, 1); let socket = UdpSocket::bind(addr); assert!(socket.is_none()); diff --git a/src/libstd/rt/io/option.rs b/src/libstd/rt/io/option.rs index d71ef55d3ad..7dadc653e6c 100644 --- a/src/libstd/rt/io/option.rs +++ b/src/libstd/rt/io/option.rs @@ -100,7 +100,7 @@ mod test { do io_error::cond.trap(|err| { assert_eq!(err.kind, PreviousIoError); called = true; - }).in { + }).inside { writer.write([0, 0, 0]); } assert!(called); @@ -109,7 +109,7 @@ mod test { do io_error::cond.trap(|err| { assert_eq!(err.kind, PreviousIoError); called = true; - }).in { + }).inside { writer.flush(); } assert!(called); @@ -136,7 +136,7 @@ mod test { do read_error::cond.trap(|err| { assert_eq!(err.kind, PreviousIoError); called = true; - }).in { + }).inside { reader.read(buf); } assert!(called); @@ -145,7 +145,7 @@ mod test { do io_error::cond.trap(|err| { assert_eq!(err.kind, PreviousIoError); called = true; - }).in { + }).inside { assert!(reader.eof()); } assert!(called); diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 2a8d29214fa..122bc42c4cc 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -152,7 +152,7 @@ impl Process { let (in_pipe, in_fd) = match options.in_fd { None => { let pipe = os::pipe(); - (Some(pipe), pipe.in) + (Some(pipe), pipe.input) }, Some(fd) => (None, fd) }; @@ -175,7 +175,7 @@ impl Process { in_fd, out_fd, err_fd); unsafe { - for in_pipe.iter().advance |pipe| { libc::close(pipe.in); } + for in_pipe.iter().advance |pipe| { libc::close(pipe.input); } for out_pipe.iter().advance |pipe| { libc::close(pipe.out); } for err_pipe.iter().advance |pipe| { libc::close(pipe.out); } } @@ -184,8 +184,8 @@ impl Process { pid: res.pid, handle: res.handle, input: in_pipe.map(|pipe| pipe.out), - output: out_pipe.map(|pipe| os::fdopen(pipe.in)), - error: err_pipe.map(|pipe| os::fdopen(pipe.in)), + output: out_pipe.map(|pipe| os::fdopen(pipe.input)), + error: err_pipe.map(|pipe| os::fdopen(pipe.input)), exit_code: None, } } @@ -1025,7 +1025,7 @@ mod tests { let mut proc = run::Process::new("cat", [], run::ProcessOptions { dir: None, env: None, - in_fd: Some(pipe_in.in), + in_fd: Some(pipe_in.input), out_fd: Some(pipe_out.out), err_fd: Some(pipe_err.out) }); @@ -1034,14 +1034,14 @@ mod tests { assert!(proc.output_redirected()); assert!(proc.error_redirected()); - os::close(pipe_in.in); + os::close(pipe_in.input); os::close(pipe_out.out); os::close(pipe_err.out); let expected = ~"test"; writeclose(pipe_in.out, expected); - let actual = readclose(pipe_out.in); - readclose(pipe_err.in); + let actual = readclose(pipe_out.input); + readclose(pipe_err.input); proc.finish(); assert_eq!(expected, actual); diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 1026b454c07..b0ae719e00f 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -2863,7 +2863,7 @@ mod tests { assert_eq!(err, ~"from_bytes: input is not UTF-8; first bad byte is 255"); error_happened = true; ~"" - }).in { + }).inside { from_bytes(bb) }; assert!(error_happened); |
