Rollup merge of #29876 - cardoe:i586-build-fix, r=alexcrichton
On distros that use i486 or i586 in their CHOST, Rust will fail to build
because it is not handling i486 or i586 like i686 is handled. This
changes the match to do work for all instances of i?86 instead of just
i686. The Yocto Project still uses i586 as a target.
bors [Tue, 17 Nov 2015 04:08:11 +0000 (04:08 +0000)]
Auto merge of #29860 - steveklabnik:stackheapfixes, r=huonw
Fixes #29853
Fixes #29852
While these points are true, we're not going for 100% accuracy here,
this is introductory material. Changing these things would be more
confusing, but it is important to note that we're presenting an
abstraction here.
bors [Tue, 17 Nov 2015 02:21:20 +0000 (02:21 +0000)]
Auto merge of #29794 - semarie:openbsd-stdcpp-path, r=alexcrichton
under openbsd, the library path of libstdc++ need to be explicit (due
to the fact the default linker `cc` is gcc-4.2, and not gcc-4.9).
but when a recent LLVM is installed, rustc compilation pikes the bad
LLVM version (which live in /usr/local/lib, which is same directory of
libestdc++.so for gcc-4.9).
this patch move the libstdc++ path from RUST_FLAGS_<target> to special
variable, and use it *after* LLVM_LIBDIR_RUSTFLAGS_<target> in
arguments.
Tobias Bucher [Sun, 25 Oct 2015 12:05:34 +0000 (12:05 +0000)]
Ignore malformed environment strings like glibc does
Otherwise, the iterator and the functions for getting specific
environment variables might disagree, for environments like
FOOBAR
Variable names starting with equals sign are OK:
glibc only interprets equals signs not in the first position as
separators between variable name and variable value. Instead of skipping
them entirely, a leading equals sign is interpreted to be part of the
variable name.
Doug Goldstein [Mon, 16 Nov 2015 23:01:58 +0000 (17:01 -0600)]
mk/platform: support i486 and i586 target CHOST
On distros that use i486 or i586 in their CHOST, Rust will fail to build
because it is not handling i486 or i586 like i686 is handled. This
changes the match to do work for all instances of i?86 instead of just
i686. The Yocto Project still uses i586 as a target.
Steve Klabnik [Mon, 16 Nov 2015 21:22:48 +0000 (16:22 -0500)]
Rollup merge of #29796 - barosl:unresolved-import-extern-crate, r=steveklabnik
The command-line error message for E0432 does mention the possibility of missing the `extern crate` declaration, but the detailed error message for it doesn't.
Steve Klabnik [Mon, 16 Nov 2015 21:22:47 +0000 (16:22 -0500)]
Rollup merge of #29549 - brson:docidx, r=steveklabnik
I noticed the nomicon was not listed!
I also removed links to racer and rustfmt since they were not *doc-specific* links, just links to tools, as well as pointed the cargo link directly at the docs.
Removed all the community stuff. There are lots of other places to find this now, including the website.
With pending website changes this page will continue to be pared back, reflecting only what's in-tree, not general Rust docs.
bors [Mon, 16 Nov 2015 19:06:52 +0000 (19:06 +0000)]
Auto merge of #29580 - alexbool:smart-pointer-conversion, r=alexcrichton
Sometimes when writing generic code you want to abstract over
owning/pointer type so that calling code isn't restricted by one
concrete owning/pointer type. This commit makes possible such code:
```rust
fn i_will_work_with_arc<T: Into<Arc<MyTy>>>(t: T) {
let the_arc = t.into();
// Do something
}
i_will_work_with_arc(MyTy::new());
i_will_work_with_arc(Box::new(MyTy::new()));
let arc_that_i_already_have = Arc::new(MyTy::new());
i_will_work_with_arc(arc_that_i_already_have);
```
Please note that this patch doesn't work with DSTs.
Also to mention, I made those impls stable, and I don't know whether they should be actually stable from the beginning. Please tell me if this should be feature-gated.
Steve Klabnik [Mon, 16 Nov 2015 15:38:25 +0000 (10:38 -0500)]
Reaffirm that this is an abstraction
Fixes #29853
Fixes #29852
While these points are true, we're not going for 100% accuracy here,
this is introductory material. Changing these things would be more
confusing, but it is important to note that we're presenting an
abstraction here.
bors [Mon, 16 Nov 2015 09:22:51 +0000 (09:22 +0000)]
Auto merge of #29851 - shahn:hashset_doc_fix, r=steveklabnik
insert() returns bool, but it was wrongly stated that if the set had the
key already present, that key would be returned (this was probably
copied from the HashMap docs). Also remove a reference to the
module-level documentation, which doesn't make sense as it doesn't give
any more context.
bors [Mon, 16 Nov 2015 07:34:05 +0000 (07:34 +0000)]
Auto merge of #29845 - wthrowe:libdir, r=alexcrichton
This should get `--libdir` working as well as it was a couple of weeks ago. (That is, it still rewrites paths incorrectly but it no longer fails during `make install`.)
Fixes gentoo/gentoo-rust#28 and gentoo/gentoo-rust#29.
Sebastian Hahn [Mon, 16 Nov 2015 05:32:58 +0000 (06:32 +0100)]
Fix docs for HashSet::insert
insert() returns bool, but it was wrongly stated that if the set had the
key already present, that key would be returned (this was probably
copied from the HashMap docs). Also remove a reference to the
module-level documentation, which doesn't make sense as it doesn't give
any more context.
William Throwe [Sun, 15 Nov 2015 04:59:35 +0000 (23:59 -0500)]
Prepare to the correct directory with --libdir
This is to handle the case where CFG_LIBDIR is not a direct child of
CFG_PREFIX (in other words, where CFG_LIBDIR_RELATIVE has more than
one component).
bors [Sun, 15 Nov 2015 23:58:26 +0000 (23:58 +0000)]
Auto merge of #29788 - mitaa:module_name, r=arielb1
f357d55 caused a regression by retrieving item names from metadata, while previously using the last element of its absolute path (which in the case of a root module is the prefixed crate name since the stored path in metadata is empty)
bors [Sun, 15 Nov 2015 22:07:12 +0000 (22:07 +0000)]
Auto merge of #29387 - little-dude:rustfmt_librustc_resolve, r=nrc
Another rustfmt PR.
I ran rustfmt, then split the changes in multiple commits. First commit are the non-problematic changed. The others are all the little weirdness that caught my attention and could be discussed.
bors [Sat, 14 Nov 2015 04:14:22 +0000 (04:14 +0000)]
Auto merge of #29820 - wthrowe:makefile-fixes, r=brson
The first commit fixes the "jobserver unavailable" warning reported at gentoo/gentoo-rust#29. I don't think the warning is related to the compilation failure shown there.
The remaining commits are minor fixes I noticed while investigating the jobserver warning.
bors [Sat, 14 Nov 2015 02:05:05 +0000 (02:05 +0000)]
Auto merge of #29816 - nikomatsakis:incr-comp-visitor-refactor-hir-folder, r=nrc
Simplify HIR folder so that it only maps 1 item to 1 item, removing a bunch of asserts. This is a small refactoring on the way to my larger branch for moving items out of line in the tree and isolating attempts to access them.
bors [Fri, 13 Nov 2015 22:12:51 +0000 (22:12 +0000)]
Auto merge of #29808 - aphistic:trait-debug-example-fix, r=steveklabnik
The example given for the manual implementation of the core::fmt::Debug trait doesn't match the output after the code sample. This updates it so it matches.
William Throwe [Fri, 13 Nov 2015 20:01:07 +0000 (15:01 -0500)]
Clean up some "suspicious" whitespace in target.mk
Emacs warns that makefile lines that start with spaces followed by
tabs are "suspicious". These were harmless since they were
continuation lines, but getting rid of the warning is nice and this
version looks better.
William Throwe [Fri, 13 Nov 2015 19:54:25 +0000 (14:54 -0500)]
Escape some variables in llvm.mk
The important one is $(MAKE). make handles recipes containing the
literal string "$(MAKE)" specially, so it is important to make sure it
isn't evaluated until recipe invocation time.
bors [Fri, 13 Nov 2015 14:28:57 +0000 (14:28 +0000)]
Auto merge of #29811 - bluss:binary-heap-sift-less, r=gankro
BinaryHeap: Simplify sift down
Sift down was doing all too much work: it can stop directly when the
current element obeys the heap property in relation to its children.
In the old code, sift down didn't compare the element to sift down at
all, so it was maximally sifted down and relied on the sift up call to
put it in the correct location.
Ulrik Sverdrup [Fri, 13 Nov 2015 00:54:33 +0000 (01:54 +0100)]
BinaryHeap: Simplify sift down
Sift down was doing all too much work: it can stop directly when the
current element obeys the heap property in relation to its children.
In the old code, sift down didn't compare the element to sift down at
all, so it was maximally sifted down and relied on the sift up call to
put it in the correct location.
bors [Fri, 13 Nov 2015 01:44:58 +0000 (01:44 +0000)]
Auto merge of #29675 - bluss:merge-sort-fastpath, r=huonw
sort: Fast path for already sorted data
When merging two sorted blocks `left` and `right` if the last element in
`left` is <= the first in `right`, the blocks are already in sorted order.
Add this as an additional fast path by simply copying the whole left
block into the output and advancing the left pointer. The right block is
then treated the same way by the already present logic in the merge
loop.
Can reduce runtime of .sort() to less than 50% of the previous, if the data
was already perfectly sorted. Sorted data with a few swaps are also
sorted quicker than before. The overhead of one comparison per merge
seems to be negligible.