1. 03 1月, 2015 3 次提交
  2. 02 1月, 2015 1 次提交
    • A
      std: Second pass stabilization of sync · f3a7ec70
      Alex Crichton 提交于
      This pass performs a second pass of stabilization through the `std::sync`
      module, avoiding modules/types that are being handled in other PRs (e.g.
      mutexes, rwlocks, condvars, and channels).
      
      The following items are now stable
      
      * `sync::atomic`
      * `sync::atomic::ATOMIC_BOOL_INIT` (was `INIT_ATOMIC_BOOL`)
      * `sync::atomic::ATOMIC_INT_INIT` (was `INIT_ATOMIC_INT`)
      * `sync::atomic::ATOMIC_UINT_INIT` (was `INIT_ATOMIC_UINT`)
      * `sync::Once`
      * `sync::ONCE_INIT`
      * `sync::Once::call_once` (was `doit`)
        * C == `pthread_once(..)`
        * Boost == `call_once(..)`
        * Windows == `InitOnceExecuteOnce`
      * `sync::Barrier`
      * `sync::Barrier::new`
      * `sync::Barrier::wait` (now returns a `bool`)
      * `sync::Semaphore::new`
      * `sync::Semaphore::acquire`
      * `sync::Semaphore::release`
      
      The following items remain unstable
      
      * `sync::SemaphoreGuard`
      * `sync::Semaphore::access` - it's unclear how this relates to the poisoning
                                    story of mutexes.
      * `sync::TaskPool` - the semantics of a failing task and whether a thread is
                           re-attached to a thread pool are somewhat unclear, and the
                           utility of this type in `sync` is question with respect to
                           the jobs of other primitives. This type will likely become
                           stable or move out of the standard library over time.
      * `sync::Future` - futures as-is have yet to be deeply re-evaluated with the
                         recent core changes to Rust's synchronization story, and will
                         likely become stable in the future but are unstable until
                         that time comes.
      
      [breaking-change]
      f3a7ec70
  3. 01 1月, 2015 1 次提交
  4. 31 12月, 2014 1 次提交
  5. 30 12月, 2014 4 次提交
    • A
      Test fixes and rebase conflicts · 470ae101
      Alex Crichton 提交于
      470ae101
    • A
      std: Second pass stabilization for `ptr` · 54452cdd
      Alex Crichton 提交于
      This commit performs a second pass for stabilization over the `std::ptr` module.
      The specific actions taken were:
      
      * The `RawPtr` trait was renamed to `PtrExt`
      * The `RawMutPtr` trait was renamed to `MutPtrExt`
      * The module name `ptr` is now stable.
      * These functions were all marked `#[stable]` with no modification:
        * `null`
        * `null_mut`
        * `swap`
        * `replace`
        * `read`
        * `write`
        * `PtrExt::is_null`
        * `PtrExt::offset`
      * These functions remain unstable:
        * `as_ref`, `as_mut` - the return value of an `Option` is not fully expressive
                               as null isn't the only bad value, and it's unclear
                               whether we want to commit to these functions at this
                               time. The reference/lifetime semantics as written are
                               also problematic in how they encourage arbitrary
                               lifetimes.
        * `zero_memory` - This function is currently not used at all in the
                          distribution, and in general it plays a broader role in the
                          "working with unsafe pointers" story. This story is not yet
                          fully developed, so at this time the function remains
                          unstable for now.
        * `read_and_zero` - This function remains unstable for largely the same
                            reasons as `zero_memory`.
      * These functions are now all deprecated:
        * `PtrExt::null` - call `ptr::null` or `ptr::null_mut` instead.
        * `PtrExt::to_uint` - use an `as` expression instead.
        * `PtrExt::is_not_null` - use `!p.is_null()` instead.
      54452cdd
    • A
      std: Second pass stabilization for `comm` · bc83a009
      Alex Crichton 提交于
      This commit is a second pass stabilization for the `std::comm` module,
      performing the following actions:
      
      * The entire `std::comm` module was moved under `std::sync::mpsc`. This movement
        reflects that channels are just yet another synchronization primitive, and
        they don't necessarily deserve a special place outside of the other
        concurrency primitives that the standard library offers.
      * The `send` and `recv` methods have all been removed.
      * The `send_opt` and `recv_opt` methods have been renamed to `send` and `recv`.
        This means that all send/receive operations return a `Result` now indicating
        whether the operation was successful or not.
      * The error type of `send` is now a `SendError` to implement a custom error
        message and allow for `unwrap()`. The error type contains an `into_inner`
        method to extract the value.
      * The error type of `recv` is now `RecvError` for the same reasons as `send`.
      * The `TryRecvError` and `TrySendError` types have had public reexports removed
        of their variants and the variant names have been tweaked with enum
        namespacing rules.
      * The `Messages` iterator is renamed to `Iter`
      
      This functionality is now all `#[stable]`:
      
      * `Sender`
      * `SyncSender`
      * `Receiver`
      * `std::sync::mpsc`
      * `channel`
      * `sync_channel`
      * `Iter`
      * `Sender::send`
      * `Sender::clone`
      * `SyncSender::send`
      * `SyncSender::try_send`
      * `SyncSender::clone`
      * `Receiver::recv`
      * `Receiver::try_recv`
      * `Receiver::iter`
      * `SendError`
      * `RecvError`
      * `TrySendError::{mod, Full, Disconnected}`
      * `TryRecvError::{mod, Empty, Disconnected}`
      * `SendError::into_inner`
      * `TrySendError::into_inner`
      
      This is a breaking change due to the modification of where this module is
      located, as well as the changing of the semantics of `send` and `recv`. Most
      programs just need to rename imports of `std::comm` to `std::sync::mpsc` and
      add calls to `unwrap` after a send or a receive operation.
      
      [breaking-change]
      bc83a009
    • A
      std: Stabilize the prelude module · c32d03f4
      Alex Crichton 提交于
      This commit is an implementation of [RFC 503][rfc] which is a stabilization
      story for the prelude. Most of the RFC was directly applied, removing reexports.
      Some reexports are kept around, however:
      
      * `range` remains until range syntax has landed to reduce churn.
      * `Path` and `GenericPath` remain until path reform lands. This is done to
        prevent many imports of `GenericPath` which will soon be removed.
      * All `io` traits remain until I/O reform lands so imports can be rewritten all
        at once to `std::io::prelude::*`.
      
      This is a breaking change because many prelude reexports have been removed, and
      the RFC can be consulted for the exact list of removed reexports, as well as to
      find the locations of where to import them.
      
      [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md
      [breaking-change]
      
      Closes #20068
      c32d03f4
  6. 28 12月, 2014 1 次提交
    • S
      Rename TaskRng to ThreadRng · 1e89bbcb
      Simonas Kazlauskas 提交于
      Since runtime is removed, rust has no tasks anymore and everything is moving
      from being task-* to thread-*. Let’s rename TaskRng as well!
      
      * Rename TaskRng to ThreadRng
      * Rename task_rng to thread_rng
      
      [breaking-change]
      1e89bbcb
  7. 22 12月, 2014 3 次提交
    • A
      Fallout of std::str stabilization · 082bfde4
      Alex Crichton 提交于
      082bfde4
    • A
      std: Stabilize the std::str module · 4908017d
      Alex Crichton 提交于
      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
      4908017d
    • C
      Remove a ton of public reexports · 98af642f
      Corey Farwell 提交于
      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]
      98af642f
  8. 20 12月, 2014 1 次提交
  9. 19 12月, 2014 8 次提交
    • J
      libstd: use `#[deriving(Copy)]` · a77e8a63
      Jorge Aparicio 提交于
      a77e8a63
    • A
      Revise std::thread API to join by default · a27fbac8
      Aaron Turon 提交于
      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]
      a27fbac8
    • A
      Fix compilation on linux · 7a6c54c4
      Alex Crichton 提交于
      7a6c54c4
    • A
      Fallout from new thread API · 43ae4b33
      Aaron Turon 提交于
      43ae4b33
    • A
      Make at_exit initialize lazily · c009bfdf
      Aaron Turon 提交于
      c009bfdf
    • A
      Allow args to work without rt initialization · b66681cd
      Aaron Turon 提交于
      b66681cd
    • A
      Refactor std::os to use sys::os · 74d07699
      Aaron Turon 提交于
      74d07699
    • A
      libs: merge librustrt into libstd · 2b3477d3
      Aaron Turon 提交于
      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]
      2b3477d3
  10. 15 12月, 2014 1 次提交
    • A
      std: Collapse SlicePrelude traits · 7741516a
      Alex Crichton 提交于
      This commit collapses the various prelude traits for slices into just one trait:
      
      * SlicePrelude/SliceAllocPrelude => SliceExt
      * CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt
      * OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt
      * PartialEqSlicePrelude => PartialEqSliceExt
      7741516a
  11. 14 12月, 2014 2 次提交
  12. 13 12月, 2014 1 次提交
  13. 12 12月, 2014 1 次提交
  14. 11 12月, 2014 1 次提交
  15. 10 12月, 2014 1 次提交
  16. 09 12月, 2014 1 次提交
    • N
      librustc: Make `Copy` opt-in. · 096a2860
      Niko Matsakis 提交于
      This change makes the compiler no longer infer whether types (structures
      and enumerations) implement the `Copy` trait (and thus are implicitly
      copyable). Rather, you must implement `Copy` yourself via `impl Copy for
      MyType {}`.
      
      A new warning has been added, `missing_copy_implementations`, to warn
      you if a non-generic public type has been added that could have
      implemented `Copy` but didn't.
      
      For convenience, you may *temporarily* opt out of this behavior by using
      `#![feature(opt_out_copy)]`. Note though that this feature gate will never be
      accepted and will be removed by the time that 1.0 is released, so you should
      transition your code away from using it.
      
      This breaks code like:
      
          #[deriving(Show)]
          struct Point2D {
              x: int,
              y: int,
          }
      
          fn main() {
              let mypoint = Point2D {
                  x: 1,
                  y: 1,
              };
              let otherpoint = mypoint;
              println!("{}{}", mypoint, otherpoint);
          }
      
      Change this code to:
      
          #[deriving(Show)]
          struct Point2D {
              x: int,
              y: int,
          }
      
          impl Copy for Point2D {}
      
          fn main() {
              let mypoint = Point2D {
                  x: 1,
                  y: 1,
              };
              let otherpoint = mypoint;
              println!("{}{}", mypoint, otherpoint);
          }
      
      This is the backwards-incompatible part of #13231.
      
      Part of RFC #3.
      
      [breaking-change]
      096a2860
  17. 08 12月, 2014 1 次提交
  18. 07 12月, 2014 1 次提交
  19. 06 12月, 2014 2 次提交
  20. 03 12月, 2014 1 次提交
  21. 27 11月, 2014 1 次提交
  22. 26 11月, 2014 2 次提交
  23. 23 11月, 2014 1 次提交
    • A
      std: Align `raw` modules with unsafe conventions · 8ca27a63
      Alex Crichton 提交于
      This commit is an implementation of [RFC 240][rfc] when applied to the standard
      library. It primarily deprecates the entirety of `string::raw`, `vec::raw`,
      `slice::raw`, and `str::raw` in favor of associated functions, methods, and
      other free functions. The detailed renaming is:
      
      * slice::raw::buf_as_slice => slice::with_raw_buf
      * slice::raw::mut_buf_as_slice => slice::with_raw_mut_buf
      * slice::shift_ptr => deprecated with no replacement
      * slice::pop_ptr => deprecated with no replacement
      * str::raw::from_utf8 => str::from_utf8_unchecked
      * str::raw::c_str_to_static_slice => str::from_c_str
      * str::raw::slice_bytes => deprecated for slice_unchecked (slight semantic diff)
      * str::raw::slice_unchecked => str.slice_unchecked
      * string::raw::from_parts => String::from_raw_parts
      * string::raw::from_buf_len => String::from_raw_buf_len
      * string::raw::from_buf => String::from_raw_buf
      * string::raw::from_utf8 => String::from_utf8_unchecked
      * vec::raw::from_buf => Vec::from_raw_buf
      
      All previous functions exist in their `#[deprecated]` form, and the deprecation
      messages indicate how to migrate to the newer variants.
      
      [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0240-unsafe-api-location.md
      [breaking-change]
      
      Closes #17863
      8ca27a63