Commit Graph

28823 Commits

Author SHA1 Message Date
bors
176df98a19 auto merge of #14044 : hirschenberger/rust/lint_mut_match, r=alexcrichton
fixing #13866
2014-05-09 06:26:33 -07:00
bors
65205652b8 auto merge of #14043 : sanxiyn/rust/attr-reference, r=alexcrichton
Attribute grammar in reference manual allowed `#[foo, bar]`, which does not match parser behavior.

Also rename nonterminals to match parser code.

Fix #13825.
2014-05-09 04:36:33 -07:00
Niko Matsakis
ed7c849057 Currently trans uses Vec<ty::t> to represent substitutions instead of a proper
ty::substs struct. This is a holdover from the olden days of yore. This patch
removes the last vestiges of that practice. This is part of the work
I was doing on #5527.
2014-05-09 05:56:44 -04:00
Niko Matsakis
b6c9dbd3e4 Check lifetime parameters when we do check for supertrait impls. Fixes #14050. 2014-05-09 05:55:42 -04:00
Niko Matsakis
fa43727781 Rename resolve_regions to resolve_regions_and_report_errors 2014-05-09 05:55:42 -04:00
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