about summary refs log tree commit diff
path: root/src/libnative/io
AgeCommit message (Collapse)AuthorLines
2014-07-10io::process::Command: add fine-grained env builderAaron Turon-2/+2
This commit changes the `io::process::Command` API to provide fine-grained control over the environment: * The `env` method now inserts/updates a key/value pair. * The `env_remove` method removes a key from the environment. * The old `env` method, which sets the entire environment in one shot, is renamed to `env_set_all`. It can be used in conjunction with the finer-grained methods. This renaming is a breaking change. To support these new methods, the internal `env` representation for `Command` has been changed to an optional `HashMap` holding owned `CString`s (to support non-utf8 data). The `HashMap` is only materialized if the environment is updated. The implementation does not try hard to avoid allocation, since the cost of launching a process will dwarf any allocation cost. This patch also adds `PartialOrd`, `Eq`, and `Hash` implementations for `CString`. [breaking-change]
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-7/+7
[breaking-change]
2014-07-04auto merge of #15051 : retep998/rust/master, r=alexcrichtonbors-3/+203
This implementation does have the minor issue of not handling things correctly when a codepoint is split across multiple writes or reads, but its better than not having unicode support at all. Adds a Windows specific struct `WindowsTTY` in `libnative` and make `tty_open` create that struct on Windows. Adds needed functions and constants to `c_win32.rs`. Libuv still needs to be updated before #15028 can be closed.
2014-07-04windows: Unicode console support.Peter Atashian-3/+203
Adds a WindowsTTY for libnative that converts between UTF-8 and UTF-16. Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-07-04auto merge of #15403 : vhbit/rust/ios-llvm-fixme, r=pcwaltonbors-15/+2
It was required to get iOS compilable but since that time a couple of changes were introduced which cause the same bug to re-appear and broke build anyway. Fixing all of them doesn’t look a viable alternative to me as it will pollute the code too much. So it should be fixed from LLVM side and I hope LLVM will upstream corresponding changes in a month. Meanwhile, who wants to play with Rust on iOS is better to use a fork which uses patched LLVM: https://github.com/vhbit/rust/tree/ios . It may lag behind master a bit, but it is Travis-checked to compile successfully.
2014-07-04Removed LLVM bug workaroundValerii Hiora-15/+2
It was required to get iOS compilable but since that time a couple of changes were introduced which cause the same bug to re-appear and broke build anyway. Fixing all of them doesn’t look a viable alternative to me as it will pollute the code too much. So it should be fixed from LLVM side and I hope LLVM will upstream corresponding changes in a month. Meanwhile, who wants to play with Rust on iOS is better to use a fork which uses patched LLVM: https://github.com/vhbit/rust/tree/ios . It may lag behind master a bit, but it is Travis-checked to compile successfully.
2014-07-03Fix spelling errors.Joseph Crail-2/+2
2014-07-02Rename recvfrom -> recv_from, sendto -> send_to.OGINO Masanori-2/+2
POSIX has recvfrom(2) and sendto(2), but their name seem not to be suitable with Rust. We already renamed getpeername(2) and getsockname(2), so I think it makes sense. Alternatively, `receive_from` would be fine. However, we have `.recv()` so I chose `recv_from`. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-06-30auto merge of #14613 : schmee/rust/utf16-iterator, r=huonwbors-6/+14
Closes #14358. ~~The tests are not yet moved to `utf16_iter`, so this probably won't compile. I'm submitting this PR anyway so it can be reviewed and since it was mentioned in #14611.~~ EDIT: Tests now use `utf16_iter`. This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either `x.utf16_iter().collect::<Vec<u16>>()` (the type annotation may be optional), or just `x.utf16_iter()` directly, if it can be used in an iterator context. [breaking-change] cc @huonw
2014-06-30Add `utf16_units`John Schmidt-6/+14
This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either `x.utf16_units().collect::<Vec<u16>>()` (the type annotation may be optional), or just `x.utf16_units()` directly, if it can be used in an iterator context. Closes #14358 [breaking-change]
2014-06-29librustc: Remove the fallback to `int` for integers and `f64` forPatrick Walton-1/+1
floating point numbers for real. This will break code that looks like: let mut x = 0; while ... { x += 1; } println!("{}", x); Change that code to: let mut x = 0i; while ... { x += 1; } println!("{}", x); Closes #15201. [breaking-change]
2014-06-29c_str: replace .with_ref with .as_ptr throughout the codebase.Huon Wilson-24/+24
2014-06-28auto merge of #15208 : alexcrichton/rust/snapshots, r=pcwaltonbors-100/+109
This change registers new snapshots, allowing `*T` to be removed from the language. This is a large breaking change, and it is recommended that if compiler errors are seen that any FFI calls are audited to determine whether they should be actually taking `*mut T`.
2014-06-28Rename all raw pointers as necessaryAlex Crichton-100/+109
2014-06-26librustc: Ensure that proc upvars have static lifetime.Patrick Walton-0/+4
Since procs do not have lifetime bounds, we must do this to maintain safety. This can break code that incorrectly captured references in procedure types. Change such code to not do this, perhaps with a trait object instead. A better solution would be to add higher-rank lifetime support to procs. However, this would be a lot of work for a feature we want to remove in favor of unboxed closures. The corresponding "real fix" is #15067. Closes #14036. [breaking-change]
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-1/+1
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-24auto merge of #14963 : w3ln4/rust/master, r=alexcrichtonbors-3/+12
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
2014-06-24Added Mipsel architecture supportPawel Olzacki-3/+12
2014-06-18Deprecate the bytes!() macro.Simon Sapin-4/+4
Replace its usage with byte string literals, except in `bytes!()` tests. Also add a new snapshot, to be able to use the new b"foo" syntax. The src/etc/2014-06-rewrite-bytes-macros.py script automatically rewrites `bytes!()` invocations into byte string literals. Pass it filenames as arguments to generate a diff that you can inspect, or `--apply` followed by filenames to apply the changes in place. Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-18Shorten endian conversion method namesBrendan Zabarauskas-4/+4
The consensus on #14917 was that the proposed names were too long.
2014-06-18Merge the Bitwise and ByteOrder traits into the Int traitBrendan Zabarauskas-3/+2
This reduces the complexity of the trait hierarchy.
2014-06-18Use ByteOrder methods instead of free-standing functionsBrendan Zabarauskas-4/+5
2014-06-16std: Improve pipe() functionalityAlex Crichton-85/+128
* os::pipe() now returns IoResult<os::Pipe> * os::pipe() is now unsafe because it does not arrange for deallocation of file descriptors * os::Pipe fields are renamed from input to reader and out to write. * PipeStream::pair() has been added. This is a safe method to get a pair of pipes. * Dealing with pipes in native process bindings have been improved to be more robust in the face of failure and intermittent errors. This converts a few fail!() situations to Err situations. Closes #9458 cc #13538 Closes #14724 [breaking-change]
2014-06-16auto merge of #14900 : alexcrichton/rust/snapshots, r=huonwbors-55/+55
Closes #14898 Closes #14918
2014-06-16auto merge of #14715 : vhbit/rust/ios-pr2, r=alexcrichtonbors-4/+30
2014-06-15Register new snapshotsAlex Crichton-55/+55
2014-06-13Fix all violations of stronger guarantees for mutable borrowsCameron Zwarich-3/+2
Fix all violations in the Rust source tree of the stronger guarantee of a unique access path for mutable borrows as described in #12624.
2014-06-13Rolling up PRs in the queueAlex Crichton-10/+15
Closes #14797 (librustc: Fix the issue with labels shadowing variable names by making) Closes #14823 (Improve error messages for io::fs) Closes #14827 (libsyntax: Allow `+` to separate trait bounds from objects.) Closes #14834 (configure: Don't sync unused submodules) Closes #14838 (Remove typo on collections::treemap::UnionItems) Closes #14839 (Fix the unused struct field lint for struct variants) Closes #14840 (Clarify `Any` docs) Closes #14846 (rustc: [T, ..N] and [T, ..N+1] are not the same) Closes #14847 (Audit usage of NativeMutex) Closes #14850 (remove unnecessary PaX detection) Closes #14856 (librustc: Take in account mutability when casting array to raw ptr.) Closes #14859 (librustc: Forbid `transmute` from being called on types whose size is) Closes #14860 (Fix `quote_pat!` & parse outer attributes in `quote_item!`)
2014-06-12Basic iOS supportValerii Hiora-4/+30
2014-06-10auto merge of #14764 : jbcrail/rust/fix-more-comments, r=alexcrichtonbors-2/+2
2014-06-10auto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichtonbors-4/+12
This uncovered some dead code, most notably in middle/liveness.rs, which I think suggests there must be something fishy with that part of the code. The #[allow(dead_code)] annotations on some of the fields I am not super happy about but as I understand, marker type may disappear at some point.
2014-06-10Fix more misspelled comments and strings.Joseph Crail-2/+2
2014-06-09Test fixes from rollupAlex Crichton-2/+2
2014-06-09native: add more info to the native unimplemented error.Huon Wilson-1/+1
This refers to green, which (AFAICT) has everything implemented. In particular, this will help guide people to get working signal handling via libgreen.
2014-06-09std: Remove the as_utf16_p functionsAlex Crichton-146/+151
These functions are all much better expressed via RAII using the to_utf16() method on strings. This refactoring also takes this opportunity to properly handle when filenames aren't valid unicode when passed through to the windows I/O layer by properly returning I/O errors. All previous users of the `as_utf16_p` or `as_utf16_mut_p` functions will need to convert their code to using `foo.to_utf16().append_one(0)` to get a null-terminated utf16 string. [breaking-change]
2014-06-08Mark relevant structs with repr(C)Jakub Wieczorek-0/+2
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-4/+10
2014-06-06libs: Fix miscellaneous fallout of librustrtAlex Crichton-134/+114
2014-06-06native: Deal with the rtio changesAlex Crichton-298/+304
2014-06-06rtio: Remove usage of `Path`Alex Crichton-10/+10
The rtio interface is a thin low-level interface over the I/O subsystems, and the `Path` type is a little too high-level for this interface.
2014-06-05Fallout from the libcollections movementAlex Crichton-6/+9
2014-05-30windows: Allow snake_case errors for now.Kevin Butler-1/+3
2014-05-30lib{std,core,debug,rustuv,collections,native,regex}: Fix snake_case errors.Kevin Butler-1/+2
A number of functions/methods have been moved or renamed to align better with rust standard conventions. std::reflect::MovePtrAdaptor => MovePtrAdaptor::new debug::reflect::MovePtrAdaptor => MovePtrAdaptor::new std::repr::ReprVisitor => ReprVisitor::new debug::repr::ReprVisitor => ReprVisitor::new rustuv::homing::HomingIO.go_to_IO_home => go_to_io_home [breaking-change]
2014-05-29auto merge of #14487 : arielb1/rust/fix-13933, r=alexcrichtonbors-17/+23
Fix issue #13933 in a few files. A more complete fix would require core::raw::MutSlice.
2014-05-28auto merge of #14477 : alexcrichton/rust/issue-14456, r=brsonbors-52/+78
When spawning a process, stdio file descriptors can be configured to be ignored, which basically means that they'll be closed. Currently this is done by literally closing the file descriptors in the child, but this can have adverse side effects if the child process then opens a new file descriptor, assigning it to a stdio number. To work around the problems of the child, this commit alters the process spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on windows) when they are specified as being ignored. This should allow spawned programs to have more expected behavior when opening new files. Closes #14456
2014-05-28Issue #13933: Remove transmute_mut from IOAriel Ben-Yehuda-17/+23
The IO libraries casted self to mut so they can pass it to seek(SEEK_CUR, 0). Fix this by introducing a private seek function that takes &self - of course one should be careful with it if he lacks an exclusive reference to self.
2014-05-28auto merge of #14455 : crabtw/rust/mips, r=alexcrichtonbors-12/+56
Because IPv4 address conversion doesn't consider big-endian target, I add functions to handle that. These function names may need to be changed, but I can't come up with a good one.
2014-05-27native: Ignore stdio fds with /dev/nullAlex Crichton-52/+78
When spawning a process, stdio file descriptors can be configured to be ignored, which basically means that they'll be closed. Currently this is done by literally closing the file descriptors in the child, but this can have adverse side effects if the child process then opens a new file descriptor, assigning it to a stdio number. To work around the problems of the child, this commit alters the process spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on windows) when they are specified as being ignored. This should allow spawned programs to have more expected behavior when opening new files. Closes #14456
2014-05-27std: Rename strbuf operations to stringRicho Healey-1/+1
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-5/+5