about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-03-24std: Reexport std::rt::unwind::try in std::threadAlex Crichton-0/+49
This commit provides a safe, but unstable interface for the `try` functionality of running a closure and determining whether it panicked or not. There are two primary reasons that this function was previously marked `unsafe`: 1. A vanilla version of this function exposes the problem of exception safety by allowing a bare try/catch in the language. It is not clear whether this concern should be directly tied to `unsafe` in Rust at the API level. At this time, however, the bounds on `ffi::try` require the closure to be both `'static` and `Send` (mirroring those of `thread::spawn`). It may be possible to relax the bounds in the future, but for now it's the level of safety that we're willing to commit to. 2. Panicking while panicking will leak resources by not running destructors. Because panicking is still controlled by the standard library, safeguards remain in place to prevent this from happening. The new API is now called `catch_panic` and is marked as `#[unstable]` for now.
2015-03-23Test fixes and rebase conflicts, round 3Alex Crichton-3/+1
2015-03-23Test fixes and rebase conflicts, round 2Alex Crichton-26/+26
2015-03-23rollup merge of #23503: alexcrichton/fix-ptr-docsAlex Crichton-2/+2
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-23Test fixes and rebase conflicts, round 1Alex Crichton-1/+1
2015-03-23rollup merge of #23383: alexcrichton/fs-create-dir-allAlex Crichton-1/+1
Conflicts: src/libstd/fs/mod.rs
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-1/+284
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23rollup merge of #23648: steveklabnik/rollupAlex Crichton-8/+8
- Successful merges: #22954, #23119, #23509, #23561, #23590, #23607, #23608, #23618, #23622, #23639, #23641 - Failed merges: #23401
2015-03-23rollup merge of #23641: steveklabnik/gh23632Alex Crichton-5/+5
Fixes #23632
2015-03-23rollup merge of #23640: nagisa/thread-less-weakAlex Crichton-11/+8
This is more portable as far as linux is concerned.
2015-03-23rollup merge of #23637: apasel422/iterAlex Crichton-0/+25
2015-03-23rollup merge of #23634: WiSaGaN/bugfix/fix_dead_linkAlex Crichton-1/+1
2015-03-23rollup merge of #23633: tomjakubowski/rustdoc-array-primAlex Crichton-1/+18
Previously, impls for `[T; n]` were collected in the same place as impls for `[T]` and `&[T]`. This splits them out into their own primitive page in both core and std.
2015-03-23rollup merge of #23631: andersk/minstack-dlsymAlex Crichton-14/+26
Linking `__pthread_get_minstack`, even weakly, was causing Debian’s `dpkg-shlibdeps` to detect an unnecessarily strict versioned dependency on libc6. Closes #23628.
2015-03-23rollup merge of #23622: steveklabnik/gh23196Alex Crichton-0/+6
Fixes #23196
2015-03-23rollup merge of #23615: steveklabnik/gh23540Alex Crichton-2/+1
Closes #23540
2015-03-23rollup merge of #23608: nagisa/refine-cursor-docstringAlex Crichton-8/+5
r? @steveklabnik
2015-03-23rollup merge of #23607: mahkoh/cursorAlex Crichton-0/+1
Closes #23599 r? @alexcrichton
2015-03-23rollup merge of #23601: nikomatsakis/by-value-indexAlex Crichton-5/+112
This is a [breaking-change]. When indexing a generic map (hashmap, etc) using the `[]` operator, it is now necessary to borrow explicitly, so change `map[key]` to `map[&key]` (consistent with the `get` routine). However, indexing of string-valued maps with constant strings can now be written `map["abc"]`. r? @japaric cc @aturon @Gankro
2015-03-23rollup merge of #23579: Ms2ger/thread_local-unsafeAlex Crichton-5/+3
Conflicts: src/libstd/thread/local.rs
2015-03-23rollup merge of #23557: aturon/rfc-909Alex Crichton-91/+127
This commit implements [RFC 909](https://github.com/rust-lang/rfcs/pull/909): The `std::thread_local` module is now deprecated, and its contents are available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and `ScopedKey`. The macros remain exactly as they were, which means little if any code should break. Nevertheless, this is technically a: [breaking-change] Closes #23547
2015-03-23rollup merge of #23541: aturon/stab-errorAlex Crichton-7/+7
This small commit stabilizes the `Error` trait as-is, except that `Send` and `Debug` are added as constraints. The `Send` constraint is because most uses of `Error` will be for trait objects, and by default we would like these objects to be transferrable between threads. The `Debug` constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because types that implement `Display` should certainly implement `Debug` in any case. In the near future we expect to add `Any`-like downcasting features to `Error`, but this is waiting on some additional mechanisms (`Reflect`). It will be added before 1.0 via default methods. [breaking-change] r? @alexcrichton Closes #21790
2015-03-23rollup merge of #23538: aturon/conversionAlex Crichton-87/+314
Conflicts: src/librustc_back/rpath.rs
2015-03-23rollup merge of #23283: brson/rpathfixAlex Crichton-0/+3
Fix regression in -C rpath that causes failures with symlinks The new `relative_from` method no longer supports the case on unix where both paths are absolute, which `-C rpath` depended on. This version fixes the problem by copying the old path_relative_from function into the rpath module. Fixes #23140 After experimenting with the new `relative_from` function on `Path` I'm not sure what it's use case is. It no longer even figures out that the relative path from `/foo/bar` to `/foo/baz/qux` is `../baz/qux`.
2015-03-23Add generic conversion traitsAaron Turon-87/+314
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+283
2015-03-23Require feature attributes, and add them where necessaryBrian Anderson-1/+1
2015-03-23Rollup merge of #23641 - steveklabnik:gh23632, r=alexcrichtonSteve Klabnik-5/+5
Fixes #23632
2015-03-23Rollup merge of #23622 - steveklabnik:gh23196, r=alexcrichtonSteve Klabnik-0/+6
Fixes #23196
2015-03-23Rollup merge of #23608 - nagisa:refine-cursor-docstring, r=steveklabnikSteve Klabnik-8/+5
r? @steveklabnik
2015-03-23Rollup merge of #23607 - mahkoh:cursor, r=alexcrichtonSteve Klabnik-0/+1
Closes #23599 r? @alexcrichton
2015-03-23Rollup merge of #23509 - aturon:stab-entry, r=GankroSteve Klabnik-8/+8
This commit marks as `#[stable]` the `Entry` types for the maps provided by `std`. The main reason these had been left unstable previously was uncertainty about an eventual trait design, but several plausible designs have been proposed that all work fine with the current type definitions. r? @Gankro
2015-03-23rustdoc: Support for "array" primitiveTom Jakubowski-1/+18
Impls on `clean::Type::FixedVector` are now collected in the array primitive page instead of the slice primitive page. Also add a primitive docs for arrays to `std`.
2015-03-23Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses ofNiko Matsakis-1/+1
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about how to use `[]`.
2015-03-23Adjust Index/IndexMut impls. For generic collections, we takeNiko Matsakis-4/+111
references. For collections whose keys are integers, we take both references and by-value.
2015-03-23Implement RFC 909: move thread_local into threadAaron Turon-91/+127
This commit implements [RFC 909](https://github.com/rust-lang/rfcs/pull/909): The `std::thread_local` module is now deprecated, and its contents are available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and `ScopedKey`. The macros remain exactly as they were, which means little if any code should break. Nevertheless, this is technically a: [breaking-change] Closes #23547
2015-03-23Stabilize the Error traitAaron Turon-7/+7
This small commit stabilizes the `Error` trait as-is, except that `Send` and `Debug` are added as constraints. The `Send` constraint is because most uses of `Error` will be for trait objects, and by default we would like these objects to be transferrable between threads. The `Debug` constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because types that implement `Display` should certainly implement `Debug` in any case. In the near future we expect to add `Any`-like downcasting features to `Error`, but this is waiting on some additional mechanisms (`Reflect`). It will be added before 1.0 via default methods. [breaking-change]
2015-03-23prctl instead of pthread on linux for name setupSimonas Kazlauskas-11/+8
This is more portable as far as linux is concerned.
2015-03-23Clarify that slices don't just point to arraysSteve Klabnik-5/+5
Fixes #23632
2015-03-23Beef up BufRead::consume documentation.Steve Klabnik-0/+6
Fixes #23196
2015-03-23Clarify behavior of Path::relative_fromBrian Anderson-0/+3
2015-03-23derive missing trait implementations for cursorJulian Orth-0/+1
2015-03-23implement `Clone` for various iteratorsAndrew Paseltiner-0/+25
2015-03-23Fix dead link for std::sync::mpsc.Wangshan Lu-1/+1
2015-03-23min_stack_size: clarify both reasons to use dlsymAnders Kaseorg-5/+6
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23min_stack_size: update non-Linux implementation commentAnders Kaseorg-2/+2
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23Get __pthread_get_minstack at runtime with dlsymAnders Kaseorg-12/+23
Linking __pthread_get_minstack, even weakly, was causing Debian’s dpkg-shlibdeps to detect an unnecessarily strict versioned dependency on libc6. Closes #23628. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23Rollup merge of #23576 - barosl:mutex-doc, r=alexcrichtonManish Goregaokar-2/+2
2015-03-23Rollup merge of #23559 - aturon:future-proof-map-index, r=GankroManish Goregaokar-13/+1
This commit removes the `IndexMut` impls on `HashMap` and `BTreeMap`, in order to future-proof the API against the eventual inclusion of an `IndexSet` trait. Ideally, we would eventually be able to support: ```rust map[owned_key] = val; map[borrowed_key].mutating_method(arguments); &mut map[borrowed_key]; ``` but to keep the design space as unconstrained as possible, we do not currently want to support `IndexMut`, in case some other strategy will eventually be needed. Code currently using mutating index notation can use `get_mut` instead. [breaking-change] Closes #23448 r? @Gankro
2015-03-22Remove an unsafe function definition in __thread_local_inner.Ms2ger-5/+3
This fixes a build error when using thread_local!() in a deny(unsafe_code) scope in Servo for Android.