1. 09 5月, 2014 15 次提交
    • K
      Handle fallout in libserialize · cd3f31d9
      Kevin Ballard 提交于
      API Changes:
      
      - from_base64() returns Result<Vec<u8>, FromBase64Error>
      - from_hex() returns Result<Vec<u8>, FromHexError>
      - json::List is a Vec<Json>
      - Decodable is no longer implemented on ~[T] (but Encodable still is)
      - DecoderHelpers::read_to_vec() returns a Result<Vec<T>, E>
      cd3f31d9
    • K
      Handle fallout for vector addition · 2a0dac6f
      Kevin Ballard 提交于
      Adding two vectors now results in a Vec<T> instead of a ~[T].
      
      Implement Add on Vec<T>.
      2a0dac6f
    • K
      Handle fallout in io::net::addrinfo, io::process, and rt::rtio · cc42b619
      Kevin Ballard 提交于
      API Changes:
      
      - get_host_addresses() returns IoResult<Vec<IpAddr>>
      - Process.extra_io is Vec<Option<io::PipeStream>>
      cc42b619
    • K
      Handle fallout in os · f340fb9b
      Kevin Ballard 提交于
      os::env(), os::args(), and related functions now use Vec<T> instead of
      ~[T].
      f340fb9b
    • K
      Handle fallout in iter, option, result, and sync::arc · 001a8741
      Kevin Ballard 提交于
      API changes:
      
      - UnsafeArc::newN() returns Vec<UnsafeArc<T>>
      001a8741
    • K
      Handle fallout in std::ascii and std::strconv · 11613fc1
      Kevin Ballard 提交于
      API changes:
      
      - OwnedAsciiCast returns Vec<Ascii> instead of ~[Ascii]
      - OwnedAsciiCast is implemented on Vec<u8>
      - AsciiStr.to_lower/upper() returns Vec<Ascii>
      - IntoBytes::into_bytes() returns Vec<u8>
      - float_to_str_bytes_common() returns (Vec<u8>, bool)
      11613fc1
    • K
      Handle fallout in std::strbuf · bbc35ead
      Kevin Ballard 提交于
      bbc35ead
    • K
      Even more fallout, this time in std::str · 44e8021b
      Kevin Ballard 提交于
      - StrSlice.to_utf16() now returns a Vec<u8>.
      - Other miscellaneous fallout in std::str.
      44e8021b
    • K
      More fallout from removing FromIterator on ~[T] · 8e42fde4
      Kevin Ballard 提交于
      8e42fde4
    • K
      Move slice::raw::from_buf_raw() to vec::raw::from_buf() · 189dc5f3
      Kevin Ballard 提交于
      Change from_buf_raw() to return a Vec<T> instead of a ~[T]. As such, it
      belongs in vec, in the newly-created vec::raw module.
      189dc5f3
    • K
      Rename slice::unzip() to vec::unzip() · 3296bd7e
      Kevin Ballard 提交于
      unzip() has nothing to do with slices, so it belongs in vec.
      3296bd7e
    • K
      More fallout from removing FromIterator on ~[T] · 21dae8e1
      Kevin Ballard 提交于
      A few methods in slice that used to return ~[T] now return Vec<T>:
      
      - VectorVector.concat/connect_vec() returns Vec<T>
      - slice::unzip() returns (Vec<T>, Vec<U>)
      - ImmutableCloneableVector.partitioned() returns (Vec<T>, Vec<T>)
      - OwnedVector.partition() returns (Vec<T>, Vec<T>)
      21dae8e1
    • K
      Rewrite &[T].to_owned() to allocate directly · 4af84313
      Kevin Ballard 提交于
      This used to create a Vec<T> and then call .move_iter().collect() to
      convert to a ~[T]. We can't do that anymore, so construct the ~[T] in
      place instead. This has the added benefit of avoiding an unnecessary
      memory copy (from the Vec<T> to the ~[T]).
      4af84313
    • K
      Remove FromIterator impl for ~[T] · bf1e0653
      Kevin Ballard 提交于
      As part of the shift from ~[T] to Vec<T>, recently ~[T] was made
      non-growable. However, the FromIterator implementation for ~[T] was left
      intact (albeit implemented inefficiently), which basically provided a
      loophole to grow a ~[T] despite its non-growable nature. This is a
      problem, both for performance reasons and because it encourages APIs to
      continue returning ~[T] when they should return Vec<T>. Removing
      FromIterator forces these APIs to adopt the correct type.
      
      Furthermore, during today's weekly meeting it was decided that we should
      remove all instances of ~[T] from the standard libraries in favor of
      Vec<T>. Removing the FromIterator impl makes sense to do as a result.
      
      This commit only includes the removal of the FromIterator impl. The
      subsequent commits involve handling all of the breakage that results,
      including changing APIs to use Vec<T> instead of ~[T]. The precise API
      changes are documented in the subsequent commit messages, but each
      commit is not individually marked as a breaking change.
      
      Finally, a new trait FromVec is introduced that provides a mechanism to
      convert Vec<T> back into ~[T] if truly necessary. It is a bit awkward to
      use by design, and is anticipated that it will be more useful in a
      post-DST world to convert to an arbitrary Foo<[T]> smart pointer.
      
      [breaking-change]
      bf1e0653
    • B
      auto merge of #14032 : pcwalton/rust/detildestr, r=alexcrichton · aa672540
      bors 提交于
      r? @brson
      aa672540
  2. 08 5月, 2014 21 次提交
    • P
      7f8f3dcf
    • B
      auto merge of #14033 : alexcrichton/rust/fix-mk-install, r=huonw · e4548518
      bors 提交于
      Forgot to update the installation procedure with the knowledge that libcore is
      only available as an rlib, not as a dylib.
      
      Closes #14026
      e4548518
    • B
      auto merge of #13986 : alexcrichton/rust/box-keyword, r=thestinger · 574cbe5b
      bors 提交于
      This keyword is about to be used much more often than it was a few weeks ago,
      it's time to tell editors about the new keyword.
      574cbe5b
    • B
      auto merge of #13835 : alexcrichton/rust/localdata, r=brson · b9ff86e2
      bors 提交于
      This commit brings the local_data api up to modern rust standards with a few key
      improvements:
      
      * All functionality is now exposed as a method on the keys themselves. Instead
        of importing std::local_data, you now use "key.set()" and "key.get()".
      
      * All closures have been removed in favor of RAII functionality. This means that
        get() and get_mut() no long require closures, but rather return
        Option<SmartPointer> where the smart pointer takes care of relinquishing the
        borrow and also implements the necessary Deref traits
      
      * The modify() function was removed to cut the local_data interface down to its
        bare essentials (similarly to how RefCell removed set/get).
      
      [breaking-change]
      b9ff86e2
    • B
      auto merge of #13814 : alexcrichton/rust/read-timeout, r=brson · c39b1cb1
      bors 提交于
      This PR is an implementation of `set_timeout`, `set_read_timeout`, and `set_write_timeout` for TCP, UDP, and Unix streams (named pipes on windows).
      
      The implementation was much more difficult than I imagined it was going to be throughout the 9 categories ({tcp, udp, unix} x {windows, unix, green}). The major snag is that libuv doesn't support canceling writes, so I chose to word the `set_write_timeout` documentation in such a way that it accomadates the behavior seen when running around with libgreen.
      
      The first commit is from #13751, and I just included it to pre-emptively avoid rebase conflicts. The following commits are relevant to this PR. The tests aren't quite passing on windows just yet, but I should have those working by tomorrow once my VM is back up and running. For now, I wanted to see what others' thoughts were on this strategy.
      c39b1cb1
    • A
      Test fixes and rebase conflicts · 418f1973
      Alex Crichton 提交于
      418f1973
    • A
      std: Modernize the local_data api · ab92ea52
      Alex Crichton 提交于
      This commit brings the local_data api up to modern rust standards with a few key
      improvements:
      
      * The `pop` and `set` methods have been combined into one method, `replace`
      
      * The `get_mut` method has been removed. All interior mutability should be done
        through `RefCell`.
      
      * All functionality is now exposed as a method on the keys themselves. Instead
        of importing std::local_data, you now use "key.replace()" and "key.get()".
      
      * All closures have been removed in favor of RAII functionality. This means that
        get() and get_mut() no long require closures, but rather return
        Option<SmartPointer> where the smart pointer takes care of relinquishing the
        borrow and also implements the necessary Deref traits
      
      * The modify() function was removed to cut the local_data interface down to its
        bare essentials (similarly to how RefCell removed set/get).
      
      [breaking-change]
      ab92ea52
    • A
      native: Implement timeouts for windows pipes · 8e953021
      Alex Crichton 提交于
      This is the last remaining networkig object to implement timeouts for. This
      takes advantage of the CancelIo function and the already existing asynchronous
      I/O functionality of pipes.
      8e953021
    • A
      rustuv: Implement timeouts for unix networking · b2c6d6fd
      Alex Crichton 提交于
      This commit implements the set{,_read,_write}_timeout() methods for the
      libuv-based networking I/O objects. The implementation details are commented
      thoroughly throughout the implementation.
      b2c6d6fd
    • A
      native: Implement timeouts for unix networking · 295e0a04
      Alex Crichton 提交于
      This commit has an implementation of the previous commit's timeout interface for
      I/O objects on unix platforms. For implementation details, see the large comment
      at the end of libnative/io/net.rs which talks about the general strategy taken.
      
      Thankfully, all of these implementations can share code because they're
      performing all the same operations.
      
      This commit does not implement timeouts for named pipes on windows, only tcp/udp
      objects on windows (which are quite similar to their unix equivalents).
      295e0a04
    • A
      std: Add I/O timeouts to networking objects · e27f27c8
      Alex Crichton 提交于
      These timeouts all follow the same pattern as established by the timeouts on
      acceptors. There are three methods: set_timeout, set_read_timeout, and
      set_write_timeout. Each of these sets a point in the future after which
      operations will time out.
      
      Timeouts with cloned objects are a little trickier. Each object is viewed as
      having its own timeout, unaffected by other objects' timeouts. Additionally,
      timeouts do not propagate when a stream is cloned or when a cloned stream has
      its timeouts modified.
      
      This commit is just the public interface which will be exposed for timeouts, the
      implementation will come in later commits.
      e27f27c8
    • A
      mk: Fix make install · 6aefce6f
      Alex Crichton 提交于
      Forgot to update the installation procedure with the knowledge that libcore is
      only available as an rlib, not as a dylib.
      
      Closes #14026
      6aefce6f
    • B
      auto merge of #13976 : pnkfelix/rust/fsk-fix-13965, r=alexcrichton · 26632d54
      bors 提交于
      Fix #13965.
      
      This commit adopts the second strategy I outlined in #13965, where the bulk of the code is still "smoke tested" (in the sense that rustdoc attempts to run it, sending all of the generated output into a locally allocated `MemWriter`).  The part of the code that is ignored (but included in the presentation) is isolated to a three-line `main` function that invokes the core rendering routine.
      
      In the generated rustdoc output, this leads to a small break between the two code blocks, but I do not think this is a large issue.
      26632d54
    • B
      auto merge of #13964 : alexcrichton/rust/more-buffers, r=brson · e0fcb4eb
      bors 提交于
      This will allow methods like read_line() on RefReader, LimitReader, etc.
      e0fcb4eb
    • B
      auto merge of #13751 : alexcrichton/rust/io-close-read, r=brson · ab22d99e
      bors 提交于
      Two new methods were added to TcpStream and UnixStream:
      
          fn close_read(&mut self) -> IoResult<()>;
          fn close_write(&mut self) -> IoResult<()>;
      
      These two methods map to shutdown()'s behavior (the system call on unix),
      closing the reading or writing half of a duplex stream. These methods are
      primarily added to allow waking up a pending read in another task. By closing
      the reading half of a connection, all pending readers will be woken up and will
      return with EndOfFile. The close_write() method was added for symmetry with
      close_read(), and I imagine that it will be quite useful at some point.
      
      Implementation-wise, librustuv got the short end of the stick this time. The
      native versions just delegate to the shutdown() syscall (easy). The uv versions
      can leverage uv_shutdown() for tcp/unix streams, but only for closing the
      writing half. Closing the reading half is done through some careful dancing to
      wake up a pending reader.
      
      As usual, windows likes to be different from unix. The windows implementation
      uses shutdown() for sockets, but shutdown() is not available for named pipes.
      Instead, CancelIoEx was used with same fancy synchronization to make sure
      everyone knows what's up.
      
      cc #11165
      ab22d99e
    • A
      std: Add close_{read,write}() methods to I/O · ec9ade93
      Alex Crichton 提交于
      Two new methods were added to TcpStream and UnixStream:
      
          fn close_read(&mut self) -> IoResult<()>;
          fn close_write(&mut self) -> IoResult<()>;
      
      These two methods map to shutdown()'s behavior (the system call on unix),
      closing the reading or writing half of a duplex stream. These methods are
      primarily added to allow waking up a pending read in another task. By closing
      the reading half of a connection, all pending readers will be woken up and will
      return with EndOfFile. The close_write() method was added for symmetry with
      close_read(), and I imagine that it will be quite useful at some point.
      
      Implementation-wise, librustuv got the short end of the stick this time. The
      native versions just delegate to the shutdown() syscall (easy). The uv versions
      can leverage uv_shutdown() for tcp/unix streams, but only for closing the
      writing half. Closing the reading half is done through some careful dancing to
      wake up a pending reader.
      
      As usual, windows likes to be different from unix. The windows implementation
      uses shutdown() for sockets, but shutdown() is not available for named pipes.
      Instead, CancelIoEx was used with same fancy synchronization to make sure
      everyone knows what's up.
      
      cc #11165
      ec9ade93
    • B
      auto merge of #14005 : alexcrichton/rust/extern-unsafe, r=pcwalton · c217a844
      bors 提交于
      Previously, the parser would not allow you to simultaneously implement a
      function with a different abi as well as being unsafe at the same time. This
      extends the parser to allow functions of the form:
      
          unsafe extern fn foo() {
              // ...
          }
      
      The closure type grammar was also changed to reflect this reversal, types
      previously written as "extern unsafe fn()" must now be written as
      "unsafe extern fn()". The parser currently has a hack which allows the old
      style, but this will go away once a snapshot has landed.
      
      Closes #10025
      
      [breaking-change]
      c217a844
    • B
      auto merge of #13726 : michaelwoerister/rust/lldb-autotests, r=alexcrichton · 828ffab6
      bors 提交于
      This pull request contains preparations for adding LLDB autotests:
      + the debuginfo tests are split into debuginfo-gdb and debuginfo-lldb
        + the `compiletest` tool is updated to support the debuginfo-lldb mode
        + tests.mk is modified to provide debuginfo-gdb and debuginfo-lldb make targets
        + GDB test cases are moved from `src/test/debug-info` to `src/test/debuginfo-gdb`
      + configure will now look for LLDB and set the appropriate CFG variables
      + the `lldb_batchmode.py` script is added to `src/etc`. It emulates GDB's batch mode
      
      The LLDB autotests themselves are not part of this PR. Those will probable require some manual work on the test bots to make them work for the first time. Better to get these unproblematic preliminaries out of the way in a separate step.
      828ffab6
    • B
      auto merge of #13901 : alexcrichton/rust/facade, r=brson · 87115fd0
      bors 提交于
      This is the second step in implementing #13851. This PR cannot currently land until a snapshot exists with #13892, but I imagine that this review will take longer.
      
      This PR refactors a large amount of functionality outside of the standard library into a new library, libcore. This new library has 0 dependencies (in theory). In practice, this library currently depends on these symbols being available:
      
      * `rust_begin_unwind` and `rust_fail_bounds_check` - These are the two entry points of failure in libcore. The symbols are provided by libstd currently. In the future (see the bullets on #13851) this will be officially supported with nice error mesages. Additionally, there will only be one failure entry point once `std::fmt` migrates to libcore.
      * `memcpy` - This is often generated by LLVM. This is also quite trivial to implement for any platform, so I'm not too worried about this.
      * `memcmp` - This is required for comparing strings. This function is quite common *everywhere*, so I don't feel to bad about relying on a consumer of libcore to define it.
      * `malloc` and `free` - This is quite unfortunate, and is a temporary stopgap until we deal with the `~` situation. More details can be found in the module `core::should_not_exist`
      * `fmod` and `fmodf` - These exist because the `Rem` trait is defined in libcore, so the `Rem` implementation for floats must also be defined in libcore. I imagine that any platform using floating-point modulus will have these symbols anyway, and otherwise they will be optimized out.
      * `fdim` and `fdimf` - Like `fmod`, these are from the `Signed` trait being defined in libcore. I don't expect this to be much of a problem
      
      These dependencies all "Just Work" for now because libcore only exists as an rlib, not as a dylib.
      
      The commits themselves are organized to show that the overall diff of this extraction is not all that large. Most modules were able to be moved with very few modifications. The primary module left out of this iteration is `std::fmt`. I plan on migrating the `fmt` module to libcore, but I chose to not do so at this time because it had implications on the `Writer` trait that I wanted to deal with in isolation. There are a few breaking changes in these commits, but they are fairly minor, and are all labeled with `[breaking-change]`.
      
      The nastiest parts of this movement come up with `~[T]` and `~str` being language-defined types today. I believe that much of this nastiness will get better over time as we migrate towards `Vec<T>` and `Str` (or whatever the types will be named). There will likely always be some extension traits, but the situation won't be as bad as it is today.
      
      Known deficiencies:
      
      * rustdoc will get worse in terms of readability. This is the next issue I will tackle as part of #13851. If others think that the rustdoc change should happen first, I can also table this to fix rustdoc first.
      * The compiler reveals that all these types are reexports via error messages like `core::option::Option`. This is filed as #13065, and I believe that issue would have a higher priority now. I do not currently plan on fixing that as part of #13851. If others believe that this issue should be fixed, I can also place it on the roadmap for #13851.
      
      I recommend viewing these changes on a commit-by-commit basis. The overall change is likely too overwhelming to take in.
      87115fd0
    • A
      Test fixes and rebase conflicts · 07caa224
      Alex Crichton 提交于
      07caa224
    • M
  3. 07 5月, 2014 4 次提交