Commit Graph

28714 Commits

Author SHA1 Message Date
bors
52002154c7 auto merge of #14035 : alexcrichton/rust/experimental, r=huonw
This was intended as part of the I/O timeouts commit, but it was mistakenly
forgotten. The type of the timeout argument is not guaranteed to remain constant
into the future.
2014-05-09 02:41:36 -07:00
bors
ab369c4353 auto merge of #14025 : tbrooks8/rust/big_uint_doc, r=alexcrichton
I changed the documentation for the BigUint to reflection the deprecation of ~[T] in favor of Vec<T>.
2014-05-09 00:51:35 -07:00
bors
fcf25ae83d auto merge of #14019 : brson/rust/docs, r=alexcrichton
Just small bits of polish.
2014-05-08 23:01:40 -07:00
Kevin Ballard
33cc0efa3d Remove <no-bounds> on trait objects
Printing <no-bounds> on trait objects comes from a time when trait
objects had a non-empty default bounds set. As they no longer have any
default bounds, printing <no-bounds> is just noise.
2014-05-08 21:37:57 -07:00
bors
a990920c6f auto merge of #13963 : kballard/rust/remove_owned_vec_from_iterator, r=pcwalton
With `~[T]` no longer growable, the `FromIterator` impl for `~[T]` doesn't make
much sense. Not only that, but nearly everywhere it is used is to convert from
a `Vec<T>` into a `~[T]`, for the sake of maintaining existing APIs. This turns
out to be a performance loss, as it means every API that returns `~[T]`, even a
supposedly non-copying one, is in fact doing extra allocations and memcpy's.
Even `&[T].to_owned()` is going through `Vec<T>` first.

Remove the `FromIterator` impl for `~[T]`, and adjust all the APIs that relied
on it to start using `Vec<T>` instead. This includes rewriting
`&[T].to_owned()` to be more efficient, among other performance wins.

Also add a new mechanism to go from `Vec<T>` -> `~[T]`, just in case anyone
truly needs that, using the new trait `FromVec`.

[breaking-change]
2014-05-08 21:01:42 -07:00
bors
c0a25e4fdc auto merge of #14001 : alexcrichton/rust/issue-11680, r=pcwalton
The code in resolve erroneously assumed that private enums weren't visited, so
the logic was adjusted to check to see if the enum definition itself was public.

Closes #11680
2014-05-08 19:12:05 -07:00
Kevin Ballard
0381ad4fdf vim: Fix an indentation issue with cindent
cindent handles the following case incorrectly:

impl X {
    b: int,
    //
    c: int,
}

if you try and insert a new line after the `c` declaration.

To fix this, fix the get_line_trimmed() function to work properly, and
then extend GetRustIndent to keep searching backwards until it finds a
non-blank line after trimming. This lets it handle the trailing comma
case properly, as if the comment were never there.

Fixes #14041.
2014-05-08 19:04:23 -07:00
bors
74172341aa auto merge of #14010 : richo/rust/tests/11493, r=alexcrichton
Is this what you had in mind?

Closes #11493
2014-05-08 17:16:43 -07:00
Luqman Aden
b55423a852 libstd: Check TMPDIR for android as well and if not set use '/data/local/tmp' instead of '/data/tmp'. 2014-05-08 19:53:04 -04:00
Flavio Percoco
d90b4daac9 core: Allow kinds derivings 2014-05-09 00:08:26 +02:00
bors
c4f0980d2e auto merge of #13990 : nikomatsakis/rust/issue-5527-cleanup-writeback, r=pcwalton
As part of #5527 I had to make some changes here and I just couldn't take it anymore. Refactor the writeback code. Should be functionally equivalent to the old stuff.

r? @pcwalton
2014-05-08 14:16:41 -07:00
Falco Hirschenberger
de92d42d4c Fix false lint warnings in match arms with multiple patterns
fixing #13866
2014-05-08 21:48:45 +02:00
bors
d8781b36fc auto merge of #13985 : alexcrichton/rust/libfmt, r=brson
This code does not belong in libstd, and rather belongs in a dedicated crate. In
the future, the syntax::ext::format module should move to the fmt_macros crate
(hence the name of the crate), but for now the fmt_macros crate will only
contain the format string parser.

The entire fmt_macros crate is marked #[experimental] because it is not meant
for general consumption, only the format!() interface is officially supported,
not the internals.

This is a breaking change for anyone using the internals of std::fmt::parse.
Some of the flags have moved to std::fmt::rt, while the actual parsing support
has all moved to the fmt_macros library.

[breaking-change]
2014-05-08 12:26:39 -07:00
Kevin Ballard
dc30c48381 Move partition/partitioned/concat/connect tests back into slice
There was no reason to remove them from slice. They're testing methods
defined in slice, so that's where they belong.

Leave vec with copies of the partition/partitioned tests because it has
its own implementation of those methods.
2014-05-08 12:08:01 -07:00
Kevin Ballard
f582150159 Restore Decodable impl for ~[T]
Bring back the Decodable impl for ~[T], this time using FromVec. It's
still not recommended that anyone use this, but at least it's available
if necessary.
2014-05-08 12:08:01 -07:00
Kevin Ballard
9fb8741b2e Handle breakage after libcore split
API Changes:

- &[T] and ~[T] no longer support the addition operator (+)
2014-05-08 12:08:01 -07:00
Kevin Ballard
300d865fa4 Add a mechanism to convert from Vec<T> to ~[T]
Add a new trait FromVec with one self-less method from_vec(). This is
kind of like FromIterator, but it consumes a Vec<T>. It's only
implemented for ~[T], but the idea is post-DST it can be implemented for
any Boxed<[T]>.
2014-05-08 12:08:00 -07:00
Kevin Ballard
dbbb847bf0 Handle fallout in bench tests 2014-05-08 12:06:22 -07:00
Kevin Ballard
eab6bb2ece Handle fallout in documentation
Tweak the tutorial's section on vectors and strings, to slightly clarify
the difference between fixed-size vectors, vectors, and slices.
2014-05-08 12:06:22 -07:00
Kevin Ballard
752048a271 Handle more fallout
os::args() no longer auto-borrows to &[~str].
2014-05-08 12:06:22 -07:00
Kevin Ballard
fa82ef23b8 Handle fallout in librustuv
API Changes:

- GetAddrInfoRequest::run() returns Result<Vec<..>, ..>
- Process::spawn() returns Result<(.., Vec<..>), ..>
2014-05-08 12:06:22 -07:00
Kevin Ballard
fac0d4e135 Clean up unused imports 2014-05-08 12:06:22 -07:00
Kevin Ballard
1d57da783b Handle fallout in libnative
API Changes:

- GetAddrInfoRequest::run() returns Result<Vec<..>, ..>
- Process::spawn() returns Result(.., Vec<..>), ..>
2014-05-08 12:06:22 -07:00
Kevin Ballard
a99eff3fca Handle fallout in librustc 2014-05-08 12:06:22 -07:00
Kevin Ballard
cd3f31d9d1 Handle fallout in libserialize
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>
2014-05-08 12:06:22 -07:00
Kevin Ballard
2a0dac6f58 Handle fallout for vector addition
Adding two vectors now results in a Vec<T> instead of a ~[T].

Implement Add on Vec<T>.
2014-05-08 12:06:22 -07:00
Kevin Ballard
cc42b61936 Handle fallout in io::net::addrinfo, io::process, and rt::rtio
API Changes:

- get_host_addresses() returns IoResult<Vec<IpAddr>>
- Process.extra_io is Vec<Option<io::PipeStream>>
2014-05-08 12:06:22 -07:00
Kevin Ballard
f340fb9b12 Handle fallout in os
os::env(), os::args(), and related functions now use Vec<T> instead of
~[T].
2014-05-08 12:06:21 -07:00
Kevin Ballard
001a8741b4 Handle fallout in iter, option, result, and sync::arc
API changes:

- UnsafeArc::newN() returns Vec<UnsafeArc<T>>
2014-05-08 12:06:21 -07:00
Kevin Ballard
11613fc1c0 Handle fallout in std::ascii and std::strconv
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)
2014-05-08 12:06:21 -07:00
Kevin Ballard
bbc35eada9 Handle fallout in std::strbuf 2014-05-08 12:06:21 -07:00
Kevin Ballard
44e8021b59 Even more fallout, this time in std::str
- StrSlice.to_utf16() now returns a Vec<u8>.
- Other miscellaneous fallout in std::str.
2014-05-08 12:06:21 -07:00
Kevin Ballard
8e42fde4e7 More fallout from removing FromIterator on ~[T] 2014-05-08 12:06:21 -07:00
Kevin Ballard
189dc5f30b Move slice::raw::from_buf_raw() to vec::raw::from_buf()
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.
2014-05-08 12:06:21 -07:00
Kevin Ballard
3296bd7e46 Rename slice::unzip() to vec::unzip()
unzip() has nothing to do with slices, so it belongs in vec.
2014-05-08 12:06:21 -07:00
Kevin Ballard
21dae8e1e0 More fallout from removing FromIterator on ~[T]
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>)
2014-05-08 12:06:21 -07:00
Kevin Ballard
4af84313d6 Rewrite &[T].to_owned() to allocate directly
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]).
2014-05-08 12:06:21 -07:00
Kevin Ballard
bf1e065371 Remove FromIterator impl for ~[T]
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]
2014-05-08 12:06:21 -07:00
Alex Crichton
426d022732 std: Ignore a flaky test on freebsd
This test runs successfully manually, but the bots are having trouble getting
this test to pass. Ignore it on freebsd for now.
2014-05-08 11:08:57 -07:00
Seo Sanghyeon
a4b7b8df40 Correct attribute grammar in reference manual 2014-05-09 01:45:44 +09:00
Alex Crichton
80487ddcad std: Extract format string parsing out of libstd
This code does not belong in libstd, and rather belongs in a dedicated crate. In
the future, the syntax::ext::format module should move to the fmt_macros crate
(hence the name of the crate), but for now the fmt_macros crate will only
contain the format string parser.

The entire fmt_macros crate is marked #[experimental] because it is not meant
for general consumption, only the format!() interface is officially supported,
not the internals.

This is a breaking change for anyone using the internals of std::fmt::parse.
Some of the flags have moved to std::fmt::rt, while the actual parsing support
has all moved to the fmt_macros library.

[breaking-change]
2014-05-08 09:35:59 -07:00
bors
aa6725407a auto merge of #14032 : pcwalton/rust/detildestr, r=alexcrichton
r? @brson
2014-05-08 09:06:42 -07:00
Patrick Walton
7f8f3dcf17 libsyntax: Remove uses of ~str from libsyntax, and fix fallout 2014-05-08 08:38:23 -07:00
bors
e454851813 auto merge of #14033 : alexcrichton/rust/fix-mk-install, r=huonw
Forgot to update the installation procedure with the knowledge that libcore is
only available as an rlib, not as a dylib.

Closes #14026
2014-05-08 06:11:37 -07:00
bors
574cbe5b07 auto merge of #13986 : alexcrichton/rust/box-keyword, r=thestinger
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.
2014-05-08 03:06:37 -07:00
Alex Crichton
f83d4f060a std: Mark timeout methods experimental
This was intended as part of the I/O timeouts commit, but it was mistakenly
forgotten. The type of the timeout argument is not guaranteed to remain constant
into the future.
2014-05-08 01:45:08 -07:00
bors
b9ff86e27f auto merge of #13835 : alexcrichton/rust/localdata, r=brson
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]
2014-05-08 01:26:39 -07:00
bors
c39b1cb1be auto merge of #13814 : alexcrichton/rust/read-timeout, r=brson
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.
2014-05-08 00:01:41 -07:00
Alex Crichton
418f197351 Test fixes and rebase conflicts 2014-05-07 23:58:55 -07:00
Alex Crichton
ab92ea526d std: Modernize the local_data api
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]
2014-05-07 23:43:39 -07:00