Commit Graph

34684 Commits

Author SHA1 Message Date
bors
4053e82acb auto merge of #19170 : erickt/rust/rustup, r=erickt
This closes #19168.

Please be careful reviewing this since this gets used all over the place. I've tested all the options and everything appears to be working though.
2014-12-04 15:03:39 +00:00
bors
6d965cc2c9 auto merge of #19167 : japaric/rust/rhs-cmp, r=aturon
Comparison traits have gained an `Rhs` input parameter that defaults to `Self`. And now the comparison operators can be overloaded to work between different types. In particular, this PR allows the following operations (and their commutative versions):

- `&str` == `String` == `CowString`
- `&[A]` == `&mut [B]` == `Vec<C>` == `CowVec<D>` == `[E, ..N]` (for `N` up to 32)
- `&mut A` == `&B` (for `Sized` `A` and `B`)

Where `A`, `B`, `C`, `D`, `E` may be different types that implement `PartialEq`. For example, these comparisons are now valid: `string == "foo"`, and `vec_of_strings == ["Hello", "world"]`.

[breaking-change]s

Since the `==` may now work on different types, operations that relied on the old "same type restriction" to drive type inference, will need to be type annotated. These are the most common fallout cases:

- `some_vec == some_iter.collect()`: `collect` needs to be type annotated: `collect::<Vec<_>>()`
- `slice == &[a, b, c]`: RHS doesn't get coerced to an slice, use an array instead `[a, b, c]`
- `lhs == []`: Change expression to `lhs.is_empty()`
- `lhs == some_generic_function()`: Type annotate the RHS as necessary

cc #19148

r? @aturon
2014-12-04 12:02:56 +00:00
bors
53e8bd641a auto merge of #19449 : nikomatsakis/rust/unboxed-closure-fn-impl, r=pcwalton
Implement the `Fn` trait for bare fn pointers in the compiler rather
than doing it using hard-coded impls. This means that it works also
for more complex fn types involving bound regions.
2014-12-04 08:52:47 +00:00
Niko Matsakis
f2731ffb52 Adjust nits from pcwalton. 2014-12-04 01:49:42 -05:00
Niko Matsakis
64bf5a8687 Add a cache so we don't create so many shims. 2014-12-04 01:49:42 -05:00
Niko Matsakis
39221a013f Implement the Fn trait for bare fn pointers in the compiler rather than doing it using hard-coded impls. This means that it works also for more complex fn types involving bound regions. Fixes #19126. 2014-12-04 01:49:42 -05:00
bors
3c89031e1f auto merge of #18613 : steveklabnik/rust/ownership_guide, r=huonw
This is a work in progress, but this should get *extensive* review, so I'm putting it up early and often.

This is the start of a draft of the new 'ownership guide,' which explains ownership, borrowing, etc. I'm feeling better about this framing than last time's, but we'll see.
2014-12-04 04:52:37 +00:00
bors
207a508411 auto merge of #18770 : pczarn/rust/hash_map-explicit-shrinking, r=Gankro
Part of enforcing capacity-related conventions, for #18424, the collections reform.

Implements `fn shrink_to_fit` for HashMap.
The `reserve` method now takes as an argument the *extra* space to reserve.
2014-12-04 01:07:48 +00:00
Erick Tryzelaar
f86737973a rustup: simplify downloading packages 2014-12-03 15:21:16 -08:00
Erick Tryzelaar
694500b07d rustup: extract the tarballs as part of installation 2014-12-03 15:20:24 -08:00
Erick Tryzelaar
bd8dac8f75 rustup: rewrite to protect against truncation
This closes #19168. It's possible that if the downloading of `rustup.sh`
is interrupted, bad things could happen, such as running a naked
"rm -rf /" instead of "rm -rf /path/to/tmpdir". This wraps rustup.sh's
functionality in a function that gets called at the last time that should
protect us from these truncation errors.
2014-12-03 15:18:52 -08:00
Erick Tryzelaar
8ca8e6fa4d rustup: factor out installing packages into a function 2014-12-03 15:17:36 -08:00
Erick Tryzelaar
b388dc61a5 rustup: factor out downloading and extracting the snapshot tarballs 2014-12-03 15:17:32 -08:00
bors
daa0745886 auto merge of #18749 : nikomatsakis/rust/builtin-bounds-like-other-traits, r=pcwalton
Treat builtin bounds like all other kinds of trait matches. Introduce a simple hashset in the fulfillment context to catch cases where we register the exact same obligation twice. This helps prevent duplicate error reports but also handles the recursive obligations created by builtin bounds.

r? @pcwalton 
cc @FlaPer87
2014-12-03 22:57:40 +00:00
Erick Tryzelaar
4f65d97bf8 rustup: factor out the install flags into a CFG_INSTALL_FLAGS variable 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
fcb31e8347 rustup: rename TMP_DIR to CFG_TMP_DIR 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
e688eb3b4f rustup: add a RUST_ prefix to the rust-specific variables 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
98f01f1f54 rustup: probe for the existance of tar 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
3b4ad726f1 rustup: make rustup executable 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
c7ae4a9664 whitespace cleanup 2014-12-03 14:40:33 -08:00
bors
dbc379a66e auto merge of #19502 : alexcrichton/rust/issue-19501, r=sfackler
I don't have enough time to investigate this thoroughly, so for now let's get
the queue moving by ignoring this test.

cc #19501
2014-12-03 18:52:48 +00:00
Alex Crichton
719c36c9b9 test: Ignore issue-19501 pretty for now
I don't have enough time to investigate this thoroughly, so for now let's get
the queue moving by ignoring this test.

cc #19501
2014-12-03 09:22:13 -08:00
Jorge Aparicio
5cfac94201 Deprecate Equiv 2014-12-03 10:41:48 -05:00
Jorge Aparicio
09707d70a4 Fix fallout 2014-12-03 10:41:48 -05:00
Jorge Aparicio
eac635de01 Remove unused transmutes from tests 2014-12-03 10:41:48 -05:00
Jorge Aparicio
b32b24d13a Replace equiv method calls with == operator sugar 2014-12-03 10:41:48 -05:00
Jorge Aparicio
2840d58dab Overload the == operator
- String == &str == CowString
- Vec ==  &[T] ==  &mut [T] == [T, ..N] == CowVec
- InternedString == &str
2014-12-03 10:41:42 -05:00
Steve Klabnik
7213704812 New Guide: Ownership
This replaces the previous "Lifetimes guide," since we are discussing
things from an owernship perspective now.
2014-12-03 03:27:17 -05:00
Niko Matsakis
931758c88a FIXME(#19481) -- workaround valgrind cleanup failure (but the code is nicer this way anyhow) 2014-12-02 20:17:55 -05:00
Niko Matsakis
594e21f19b Correct various compile-fail tests. Most of the changes are because we
now don't print duplicate errors within one context, so I sometimes
had to break functions into two functions.
2014-12-02 19:05:14 -05:00
Niko Matsakis
d85ff16173 Treat builtin bounds like all other kinds of trait matches. Introduce a simple hashset in the fulfillment context to catch cases where we register the exact same obligation twice. This helps prevent duplicate error reports but also handles the recursive obligations created by builtin bounds. 2014-12-02 19:05:14 -05:00
Jorge Aparicio
2578de9d60 Test PartialEq multidispatch 2014-12-02 18:52:50 -05:00
Jorge Aparicio
b258de7bda libcore: add Rhs input parameter to comparison traits 2014-12-02 18:52:50 -05:00
bors
3a325c666d auto merge of #19460 : steveklabnik/rust/conf_fixes, r=alexcrichton 2014-12-02 17:47:14 +00:00
Steve Klabnik
5a2048f7bb remove two unneccesary directories from configure 2014-12-02 09:21:28 -05:00
bors
738d9803ac auto merge of #19443 : nodakai/rust/another-missing-extracflags, r=alexcrichton
rust-lang/rust@102b1a5bf1 was not enough!
2014-12-02 12:02:06 +00:00
bors
2b35e6fa08 auto merge of #19357 : michaelwoerister/rust/fix-issue-18791, r=alexcrichton
One negative side-effect of this change is that there might be quite a bit of copying strings out of the codemap, i.e. one copy for every block that gets translated, just for taking a look at the last character of the block. If this turns out to cause a performance problem then `CodeMap::span_to_snippet()` could be changed return `Option<&str>` instead of `Option<String>`.

Fixes #18791
2014-12-02 10:06:58 +00:00
bors
8dbe63200d auto merge of #19427 : scialex/rust/doc-attr-macros, r=sfackler
this allows one to, for example, use #[doc = $macro_var ] in macros.
2014-12-02 07:22:02 +00:00
bors
8a210af7e5 auto merge of #19450 : jbapple/rust/pq-pop-time, r=Gankro
pop calls siftdown, siftdown calls siftdown_range, and siftdown_range
loops on an index that can start as low as 0 and approximately doubles
each iteration.
2014-12-02 02:52:15 +00:00
Jim Apple
0212dff902 Pop on binary heaps does not have constant time complexity.
pop calls siftdown, siftdown calls siftdown_range, and siftdown_range
loops on an index that can start as low as 0 and approximately doubles
each iteration.
2014-12-01 18:12:48 -08:00
Michael Woerister
61a0a7f0a3 debuginfo: Fix multi-byte character related bug in cleanup scope handling.
Also see issue #18791.
2014-12-01 16:22:00 -08:00
bors
5484d6f6d2 auto merge of #19439 : nodakai/rust/liblibc-getsid, r=acrichto
```
#include <unistd.h>

pid_t getsid(pid_t pid);

CONFORMING TO
       SVr4, POSIX.1-2001.
```
2014-12-02 00:22:00 +00:00
bors
21ba1d5e58 auto merge of #19405 : jfager/rust/de-match-pyramid, r=bstrie
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-12-01 21:56:53 +00:00
NODA, Kai
2d3de6686e test/run-make: another missing $(EXTRACFLAGS).
rust-lang/rust@102b1a5bf1 was not enough!

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-12-02 04:52:29 +08:00
NODA, Kai
2018510dd9 liblibc: getsid() was missing though setsid() was already there.
include <unistd.h>

pid_t getsid(pid_t pid);

CONFORMING TO
       SVr4, POSIX.1-2001.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-12-02 02:50:57 +08:00
bors
de95ad4c46 auto merge of #19436 : lifthrasiir/rust/rustdoc-short-src-paths, r=alexcrichton
Before: `doc/src/collections/home/lifthrasiir/git/rust/src/libcollections/vec.rs.html`
After: `doc/src/collections/vec.rs.html`

If the source code is in the parent dirs relative to the crate root, `..` is replaced with `up` as expected. Any other error like non-UTF-8 paths or drive-relative paths falls back to the absolute path.

There might be a way to improve on false negatives, but this alone should be enough for fixing #18370.
2014-12-01 17:51:55 +00:00
Alexander Light
d3bbfb48bd added negative test for macro expansion in attributes 2014-12-01 11:08:29 -05:00
Kang Seonghoon
08fb9aa2d2 rustdoc: Use relative paths in source renders.
Before: doc/src/collections/home/lifthrasiir/git/rust/src/libcollections/vec.rs.html
After: doc/src/collections/vec.rs.html

If the source code is in the parent dirs relative to the crate root,
`..` is replaced with `up` as expected. Any other error like non-UTF-8
paths or drive-relative paths falls back to the absolute path.

There might be a way to improve on false negatives, but this alone
should be enough for fixing #18370.
2014-12-01 20:53:11 +09:00
bors
09f04bf2c9 auto merge of #19417 : alexcrichton/rust/issue-19383, r=huonw
We only build LLVM for the host architecture, not the target architecture, so
this was just a minor typo in the parameters uses.

Closes #19383
2014-12-01 07:11:53 +00:00
bors
bda97e8557 auto merge of #19425 : frewsxcv/rust/patch-1, r=steveklabnik
![](http://img2.wikia.nocookie.net/__cb20140809223829/disney/images/5/56/Darkwing_Duck_Poster_Promo.jpg)
2014-12-01 05:11:50 +00:00