about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2014-12-26Relax `Arc` bounds don't require Sync+SendFlavio Percoco-3/+2
Besides the above making sense, it'll also allow us to make `RacyCell` private and use UnsafeCell instead.
2014-12-26Implement `Sync` for some windows sys typesFlavio Percoco-0/+8
2014-12-26Move RacyCell to `std::comm`Flavio Percoco-1/+2
RacyCell is not exactly what we'd like as a final implementation for this. Therefore, we're moving it under `std::comm` and also making it private.
2014-12-26Make Send and Sync traits unsafeFlavio Percoco-10/+18
2014-12-26Require types to opt-in SyncFlavio Percoco-4/+20
2014-12-25Map EEXIST to PathAlreadyExists error, closes #20226Florian Hahn-0/+4
2014-12-25Parse fully-qualified associated types in generics without whitespaceP1start-4/+4
This breaks code that looks like this: let x = foo as bar << 13; Change such code to look like this: let x = (foo as bar) << 13; Closes #17362. [breaking-change]
2014-12-25auto merge of #20024 : mneumann/rust/dragonfly-fixes3, r=alexcrichtonbors-1/+11
2014-12-24Fix backtrace demanglingSteven Fackler-4/+4
Closes #20209
2014-12-22Test fixes and rebase conflictsAlex Crichton-1/+1
2014-12-21Fallout of std::str stabilizationAlex Crichton-13/+11
2014-12-21std: Stabilize the std::str moduleAlex Crichton-1/+38
This commit starts out by consolidating all `str` extension traits into one `StrExt` trait to be included in the prelude. This means that `UnicodeStrPrelude`, `StrPrelude`, and `StrAllocating` have all been merged into one `StrExt` exported by the standard library. Some functionality is currently duplicated with the `StrExt` present in libcore. This commit also currently avoids any methods which require any form of pattern to operate. These functions will be stabilized via a separate RFC. Next, stability of methods and structures are as follows: Stable * from_utf8_unchecked * CowString - after moving to std::string * StrExt::as_bytes * StrExt::as_ptr * StrExt::bytes/Bytes - also made a struct instead of a typedef * StrExt::char_indices/CharIndices - CharOffsets was renamed * StrExt::chars/Chars * StrExt::is_empty * StrExt::len * StrExt::lines/Lines * StrExt::lines_any/LinesAny * StrExt::slice_unchecked * StrExt::trim * StrExt::trim_left * StrExt::trim_right * StrExt::words/Words - also made a struct instead of a typedef Unstable * from_utf8 - the error type was changed to a `Result`, but the error type has yet to prove itself * from_c_str - this function will be handled by the c_str RFC * FromStr - this trait will have an associated error type eventually * StrExt::escape_default - needs iterators at least, unsure if it should make the cut * StrExt::escape_unicode - needs iterators at least, unsure if it should make the cut * StrExt::slice_chars - this function has yet to prove itself * StrExt::slice_shift_char - awaiting conventions about slicing and shifting * StrExt::graphemes/Graphemes - this functionality may only be in libunicode * StrExt::grapheme_indices/GraphemeIndices - this functionality may only be in libunicode * StrExt::width - this functionality may only be in libunicode * StrExt::utf16_units - this functionality may only be in libunicode * StrExt::nfd_chars - this functionality may only be in libunicode * StrExt::nfkd_chars - this functionality may only be in libunicode * StrExt::nfc_chars - this functionality may only be in libunicode * StrExt::nfkc_chars - this functionality may only be in libunicode * StrExt::is_char_boundary - naming is uncertain with container conventions * StrExt::char_range_at - naming is uncertain with container conventions * StrExt::char_range_at_reverse - naming is uncertain with container conventions * StrExt::char_at - naming is uncertain with container conventions * StrExt::char_at_reverse - naming is uncertain with container conventions * StrVector::concat - this functionality may be replaced with iterators, but it's not certain at this time * StrVector::connect - as with concat, may be deprecated in favor of iterators Deprecated * StrAllocating and UnicodeStrPrelude have been merged into StrExit * eq_slice - compiler implementation detail * from_str - use the inherent parse() method * is_utf8 - call from_utf8 instead * replace - call the method instead * truncate_utf16_at_nul - this is an implementation detail of windows and does not need to be exposed. * utf8_char_width - moved to libunicode * utf16_items - moved to libunicode * is_utf16 - moved to libunicode * Utf16Items - moved to libunicode * Utf16Item - moved to libunicode * Utf16Encoder - moved to libunicode * AnyLines - renamed to LinesAny and made a struct * SendStr - use CowString<'static> instead * str::raw - all functionality is deprecated * StrExt::into_string - call to_string() instead * StrExt::repeat - use iterators instead * StrExt::char_len - use .chars().count() instead * StrExt::is_alphanumeric - use .chars().all(..) * StrExt::is_whitespace - use .chars().all(..) Pending deprecation -- while slicing syntax is being worked out, these methods are all #[unstable] * Str - while currently used for generic programming, this trait will be replaced with one of [], deref coercions, or a generic conversion trait. * StrExt::slice - use slicing syntax instead * StrExt::slice_to - use slicing syntax instead * StrExt::slice_from - use slicing syntax instead * StrExt::lev_distance - deprecated with no replacement Awaiting stabilization due to patterns and/or matching * StrExt::contains * StrExt::contains_char * StrExt::split * StrExt::splitn * StrExt::split_terminator * StrExt::rsplitn * StrExt::match_indices * StrExt::split_str * StrExt::starts_with * StrExt::ends_with * StrExt::trim_chars * StrExt::trim_left_chars * StrExt::trim_right_chars * StrExt::find * StrExt::rfind * StrExt::find_str * StrExt::subslice_offset
2014-12-21rollup merge of #20029: vhbit/ios-no-rtAlex Crichton-2/+2
2014-12-21Remove a ton of public reexportsCorey Farwell-5/+7
Remove most of the public reexports mentioned in #19253 These are all leftovers from the enum namespacing transition In particular: * src/libstd/num/strconv.rs * ExponentFormat * SignificantDigits * SignFormat * src/libstd/path/windows.rs * PathPrefix * src/libstd/sys/windows/timer.rs * Req * src/libcollections/str.rs * MaybeOwned * src/libstd/collections/hash/map.rs * Entry * src/libstd/collections/hash/table.rs * BucketState * src/libstd/dynamic_lib.rs * Rtld * src/libstd/io/net/ip.rs * IpAddr * src/libstd/os.rs * MemoryMapKind * MapOption * MapError * src/libstd/sys/common/net.rs * SocketStatus * InAddr * src/libstd/sys/unix/timer.rs * Req [breaking-change]
2014-12-20Fix the fallout of removing feature(import_shadowing).Eduard Burtescu-30/+21
2014-12-19load_self() needs to be publicMichael Neumann-1/+1
2014-12-19iOS: fallout of runtime removalValerii Hiora-2/+2
2014-12-19Several fixes for DragonFly (rebase)Michael Neumann-1/+11
2014-12-18Rebasing fixes.Aaron Turon-13/+21
2014-12-18std: Move the panic flag to its own thread localAlex Crichton-11/+0
This flag is somewhat tied to the `unwind` module rather than the `thread_info` module, so this commit moves it into that module as well as allowing the same OS thread to call `unwind::try` multiple times. Previously once a thread panicked its panic flag was never reset, even after exiting the panic handler.
2014-12-18std: Lower abstractions for thread_local/at_exitAlex Crichton-20/+42
The current implementations use `std::sync` primitives, but these primitives currently end up relying on `thread_info` and a local `Thread` being available (mainly for checking the panicking flag). To get around this, this commit lowers the abstractions used by the windows thread_local implementation as well as the at_exit_imp module. Both of these modules now use a `sys::Mutex` and a `static mut` and manage the allocation/locking manually.
2014-12-18Revise std::thread API to join by defaultAaron Turon-31/+35
This commit is part of a series that introduces a `std::thread` API to replace `std::task`. In the new API, `spawn` returns a `JoinGuard`, which by default will join the spawned thread when dropped. It can also be used to join explicitly at any time, returning the thread's result. Alternatively, the spawned thread can be explicitly detached (so no join takes place). As part of this change, Rust processes now terminate when the main thread exits, even if other detached threads are still running, moving Rust closer to standard threading models. This new behavior may break code that was relying on the previously implicit join-all. In addition to the above, the new thread API also offers some built-in support for building blocking abstractions in user space; see the module doc for details. Closes #18000 [breaking-change]
2014-12-18Avoid .take().unwrap() with FnOnce closuresAlex Crichton-3/+2
2014-12-18Fix compilation on linuxAlex Crichton-1/+1
2014-12-18Fallout from new thread APIAaron Turon-41/+25
2014-12-18Revise rt::unwindAaron Turon-6/+24
2014-12-18Remove rt::{mutex, exclusive}Aaron Turon-7/+6
2014-12-18Introduce std::threadAaron Turon-0/+60
Also removes: * `std::task` * `std::rt::task` * `std::rt::thread` Notes for the new API are in a follow-up commit. Closes #18000
2014-12-18Remove rt::bookkeepingAaron Turon-2/+1
This commit removes the runtime bookkeeping previously used to ensure that all Rust tasks were joined before the runtime was shut down. This functionality will be replaced by an RAII style `Thread` API, that will also offer a detached mode. Since this changes the semantics of shutdown, it is a: [breaking-change]
2014-12-18Refactor std::os to use sys::osAaron Turon-6/+327
2014-12-18libs: merge librustrt into libstdAaron Turon-8/+2146
This commit merges the `rustrt` crate into `std`, undoing part of the facade. This merger continues the paring down of the runtime system. Code relying on the public API of `rustrt` will break; some of this API is now available through `std::rt`, but is likely to change and/or be removed very soon. [breaking-change]
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-13/+13
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-15Remove internal uses of `marker::NoCopy`Jorge Aparicio-3/+0
2014-12-14Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`)Niko Matsakis-5/+5
2014-12-14Rewrite threading infrastructure, introducing `Thunk` to representNiko Matsakis-5/+11
boxed `FnOnce` closures.
2014-12-13Get rid of all the remaining uses of `refN`/`valN`/`mutN`/`TupleN`Jorge Aparicio-2/+2
2014-12-13libstd: use tuple indexingJorge Aparicio-4/+4
2014-12-13libstd: use unboxed closuresJorge Aparicio-31/+41
2014-12-11Register new snapshotsAlex Crichton-2/+2
2014-12-09rollup merge of #19620: retep998/memorymapAlex Crichton-1/+1
2014-12-09rollup merge of #19577: aidancully/masterAlex Crichton-1/+17
pthread_key_create can be 0. addresses issue #19567.
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-11/+11
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-07Make MemoryMap use HANDLE on Windows.Peter Atashian-1/+1
Also fixes some conflicting module names. Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-12-06libstd: remove unnecessary `to_string()` callsJorge Aparicio-5/+5
2014-12-06libstd: remove unnecessary `as_mut_slice` callsJorge Aparicio-1/+1
2014-12-06libstd: remove unnecessary `as_slice()` callsJorge Aparicio-5/+5
2014-12-05prefer "FIXME" to "TODO".Aidan Cully-1/+1
2014-12-05Utilize fewer reexportsCorey Farwell-1/+1
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05work around portability issue on FreeBSD, in which the key returned fromAidan Cully-1/+17
pthread_key_create can be 0.
2014-12-05rollup merge of #19454: nodakai/libstd-reap-failed-childCorey Richardson-10/+33
After the library successfully called `fork(2)`, the child does several setup works such as setting UID, GID and current directory before it calls `exec(2)`. When those setup works failed, the child exits but the parent didn't call `waitpid(2)` and left it as a zombie. This patch also add several sanity checks. They shouldn't make any noticeable impact to runtime performance. The new test case in `libstd/io/process.rs` calls the ps command to check if the new code can really reap a zombie. The output of `ps -A -o pid,sid,command` should look like this: ``` PID SID COMMAND 1 1 /sbin/init 2 0 [kthreadd] 3 0 [ksoftirqd/0] ... 12562 9237 ./spawn-failure 12563 9237 [spawn-failure] <defunct> 12564 9237 [spawn-failure] <defunct> ... 12592 9237 [spawn-failure] <defunct> 12593 9237 ps -A -o pid,sid,command 12884 12884 /bin/zsh 12922 12922 /bin/zsh ... ``` where `./spawn-failure` is my test program which intentionally leaves many zombies. Filtering the output with the "SID" (session ID) column is a quick way to tell if a process (zombie) was spawned by my own test program. Then the number of "defunct" lines is the number of zombie children.