about summary refs log tree commit diff
path: root/src/libnative/io
AgeCommit message (Collapse)AuthorLines
2014-08-28Fallout from stabilizing core::optionAaron Turon-1/+1
2014-08-24native: clone/close_accept for win32 pipesAlex Crichton-40/+108
This commits takes a similar strategy to the previous commit to implement close_accept and clone for the native win32 pipes implementation. Closes #15595
2014-08-24native: Add some documentation for acceptAlex Crichton-0/+34
Document the new code for how close_accept and timeouts are implemented.
2014-08-24native: TCP close/close_accept for windowsAlex Crichton-78/+228
This commit implements TcpAcceptor::{close, close_accept} for windows via WSAEVENT types.
2014-08-24native: Implement clone/close_accept for unixAlex Crichton-46/+156
This commits implements {Tcp,Unix}Acceptor::{clone,close_accept} methods for unix. A windows implementation is coming in a later commit. The clone implementation is based on atomic reference counting (as with all other clones), and the close_accept implementation is based on selecting on a self-pipe which signals that a close has been seen.
2014-08-23Complete renaming of win32 to windowsVadim Chugunov-10/+9
2014-08-20libgreen: use FFI-safe typesCorey Richardson-1/+2
2014-08-20liblibc: don't use int/uint for intptr_t/uintptr_tCorey Richardson-0/+1
int/uint aren't considered FFI safe, replace them with the actual type they represent (i64/u64 or i32/u32). This is a breaking change, but at most a cast to `uint` or `int` needs to be added. [breaking-change]
2014-08-20Add #[repr(C)] to all the things!Corey Richardson-0/+13
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-18/+18
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
2014-08-15auto merge of #16435 : vadimcn/rust/windows, r=pcwaltonbors-1/+2
Using "win32" to mean "Windows" is confusing, especially now, that Rust supports win64 builds. Let's call spade a spade.
2014-08-12libnative: process spawning should not close inherited file descriptorsIvan Petkov-1/+1
* The caller should be responsible for cleaning up file descriptors * If a caller safely creates a file descriptor (via native::io::file::open) the returned structure (FileDesc) will try to clean up the file, failing in the process and writing error messages to the screen. * This should not happen as the caller has no public interface for telling the FileDesc structure to NOT free the underlying fd. * Alternatively, if another file is opened under the same fd held by the FileDesc structure returned by native::io::file::open, it will close the wrong file upon destruction.
2014-08-12Replace #[cfg(target_os = "win32")] with #[cfg(target_os = "windows")]Vadim Chugunov-1/+2
2014-08-12auto merge of #16284 : alexcrichton/rust/issue-16272, r=aturonbors-1/+4
There was a bug in both libnative and libuv which prevented child processes from being spawned correctly on windows when one of the arguments was an empty string. The libuv bug has since been fixed upstream, and the libnative bug was fixed as part of this commit. When updating libuv, this also includes a fix for #15149. Closes #15149 Closes #16272
2014-08-07windows: Fix INVALID_HANDLE_VALUEPeter Atashian-13/+13
Made INVALID_HANDLE_VALUE actually a HANDLE. Removed all useless casts during INVALID_HANDLE_VALUE comparisons. Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-07windows: Fix several tests on 64-bit.Peter Atashian-0/+20
Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-06auto merge of #16258 : aturon/rust/stabilize-atomics, r=alexcrichtonbors-12/+12
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-05native, rustuv: Fix spawning with empty argsAlex Crichton-1/+4
There was a bug in both libnative and libuv which prevented child processes from being spawned correctly on windows when one of the arguments was an empty string. The libuv bug has since been fixed upstream, and the libnative bug was fixed as part of this commit. When updating libuv, this also includes a fix for #15149. Closes #15149 Closes #16272
2014-08-05auto merge of #16243 : alexcrichton/rust/fix-utime-for-windows, r=brsonbors-2/+2
Apparently the units are in milliseconds, not in seconds!
2014-08-04stabilize atomics (now atomic)Aaron Turon-12/+12
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-04Change everything returning `libc::sockaddr_storage` to use an &mut out-ptr ↵Andrew Poelstra-27/+30
instead The BSD socket code does some cast tricks with the `libc::sockaddr*` structs, which causes useful data to be stored in struct padding. Since Load/Store instructions do not copy struct padding, this makes these structures dangerous to pass or return by value. In particular, https://github.com/rust-lang/rust/issues/15763 changes return semantics so that a Load instruction is used, breaking the TCP code. Once this PR is merged, that one should merge without error.
2014-08-02native: Fix utime() for windowsAlex Crichton-2/+2
Apparently the units are in milliseconds, not in seconds!
2014-08-01Fix misspelled comments.Joseph Crail-2/+2
2014-07-29Port Rust to DragonFlyBSDMichael Neumann-1/+13
Not included are two required patches: * LLVM: segmented stack support for DragonFly [1] * jemalloc: simple configure patches [1]: http://reviews.llvm.org/D4705
2014-07-26std: Stabilize unit, bool, ty, tuple, arc, anyAlex Crichton-17/+8
This commit applies stability attributes to the contents of these modules, summarized here: * The `unit` and `bool` modules have become #[unstable] as they are purely meant for documentation purposes and are candidates for removal. * The `ty` module has been deprecated, and the inner `Unsafe` type has been renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field has been removed as the compiler now always infers `UnsafeCell` to be invariant. The `new` method i stable, but the `value` field, `get` and `unwrap` methods are all unstable. * The `tuple` module has its name as stable, the naming of the `TupleN` traits as stable while the methods are all #[unstable]. The other impls in the module have appropriate stability for the corresponding trait. * The `arc` module has received the exact same treatment as the `rc` module previously did. * The `any` module has its name as stable. The `Any` trait is also stable, with a new private supertrait which now contains the `get_type_id` method. This is to make the method a private implementation detail rather than a public-facing detail. The two extension traits in the module are marked #[unstable] as they will not be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods have been renamed to downcast_{mut,ref} and are #[unstable]. The extension trait `BoxAny` has been clarified as to why it is unstable as it will not be necessary with DST. This is a breaking change because the `marker1` field was removed from the `UnsafeCell` type. To deal with this change, you can simply delete the field and only specify the value of the `data` field in static initializers. [breaking-change]
2014-07-24Test fixes from the rollupAlex Crichton-3/+3
Closes #15807 (Deprecate some unsafe functions in `str::raw` and remove `OwnedStr` trait) Closes #15859 (Implement `Show` for `CString` and fix warning compiling tests for libcollections) Closes #15911 (Updated LLVM for iOS) Closes #15925 (libsyntax: Remove `~self` and `mut ~self` from the language.) Closes #15930 (Add examples for Checked[Add|Sub|Mul|Div]) Closes #15933 (rustdoc: make table of contents optional) Closes #15937 (librustc: Make bare functions implement the `FnMut` trait.) Closes #15938 (librustc: Check structure constructors against their types.) Closes #15939 (rustdoc: Add a --crate-name option) Closes #15942 (Document trie collections) Closes #15943 (Document SmallIntMap)
2014-07-24libsyntax: Remove `~self` and `mut ~self` from the language.Patrick Walton-3/+6
This eliminates the last vestige of the `~` syntax. Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut ~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with the self-type parameter as specified in the implementation. Closes #13885. [breaking-change]
2014-07-24Add a null pointer check to CString::newAdolfo Ochagavía-5/+5
This also removes checks in other methods of `CString` Breaking changes: * `CString::new` now fails if `buf` is null. To avoid this add a check before creatng a new `CString` . * The `is_null` and `is_not_null` methods are deprecated, because a `CString` cannot be null. * Other methods which used to fail if the `CString` was null do not fail anymore [breaking-change]
2014-07-22auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichtonbors-0/+2
2014-07-21Add a ton of ignore-lexer-testCorey Richardson-0/+2
2014-07-15Deprecate `str::from_utf16`Adolfo Ochagavía-1/+1
Use `String::from_utf16` instead [breaking-change]
2014-07-13native: Search the child's PATH on win32Alex Crichton-1/+21
In order to have the spawning semantics be the same for unix/windows, the child's PATH environment variable needs to be searched rather than the parent's environment variable. If the child is inheriting the parent's PATH, then no action need be taken as windows will do the heavy lifting. If the child specifies its own PATH, then it is searched beforehand for the target program and the result is favored if a hit is found. cc #15149, but does not close the issue because libgreen still needs to be updated.
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