Commit Graph

43066 Commits

Author SHA1 Message Date
bors
84254948c2 Auto merge of #25880 - nikomatsakis:const-fn-feature-gate-calls, r=alexcrichton
The previous feature gate assumed we would not define any (stable) const fns. But then @eddyb went and cleaned up the code. So this now extends the feature-gate to prohibit calls; but calls inside of macros are considered ok.

r? @alexcrichton
2015-05-29 17:38:40 +00:00
Niko Matsakis
808b411244 New tests for cross-crate usages of const fn and so forth 2015-05-29 11:52:59 -04:00
bors
2d447e40e2 Auto merge of #25857 - killercup:patch-14, r=steveklabnik
Thanks to @cers who reported this in killercup/trpl-ebook#14!

r? @steveklabnik
2015-05-29 14:53:59 +00:00
Niko Matsakis
2c5e784d6f add const_fn features 2015-05-29 09:42:54 -04:00
Niko Matsakis
1f29fd4eb0 add a test for const fn methods, as suggested by @pnkfelix 2015-05-29 09:42:54 -04:00
Niko Matsakis
57c75b6b10 permit const-fn in macro expansions 2015-05-29 09:42:54 -04:00
Niko Matsakis
710270d9c0 Add feature-gate to calling const fn 2015-05-29 09:42:53 -04:00
bors
2de64ef305 Auto merge of #25760 - Ms2ger:tagged_docs, r=Manishearth 2015-05-29 13:19:46 +00:00
bors
3a433b968b Auto merge of #25854 - liigo:patch-1, r=alexcrichton 2015-05-29 11:46:08 +00:00
bors
db1c761b7e Auto merge of #25838 - mbrubeck:doc-edit, r=steveklabnik
Fixes #25622. r? @steveklabnik
2015-05-29 10:13:05 +00:00
bors
b9eb606801 Auto merge of #25830 - steveklabnik:debug_docs, r=alexcrichton 2015-05-29 08:40:20 +00:00
bors
25fc917c65 Auto merge of #25747 - SimonSapin:map_ref, r=alexcrichton
For slightly complex data structures like `rustc_serialize::json::Json`, it is often convenient to have helper methods like `Json::as_string(&self) -> Option<&str>`  that return a borrow of some component of `&self`.

However, when `RefCell`s are involved, keeping a `Ref` around is required to hold a borrow to the insides of a `RefCell`. But `Ref` so far only references the entirety of the contents of a `RefCell`, not a component. But there is no reason it couldn’t: `Ref` internally contains just a data reference and a borrow count reference. The two can be dissociated.

This adds a `map_ref` function that creates a new `Ref` for some other data, but borrowing the same `RefCell` as an existing `Ref`.

Example:

```rust
struct RefCellJson(RefCell<Json>);

impl RefCellJson {
    fn as_string(&self) -> Option<Ref<str>> {
        map_ref(self.borrow(), |j| j.as_string())
    }
}
```

r? @alexcrichton
2015-05-29 07:07:07 +00:00
Simon Sapin
d0afa6ede3 Add map and filter_map associated functions to std::cell::Ref and RefMut
See design discussion in https://github.com/rust-lang/rust/pull/25747
2015-05-29 08:39:07 +02:00
bors
42a59aef71 Auto merge of #25832 - edunham:document-gh-issue-tags, r=alexcrichton
I took a guess at what they mean, but could be totally wrong. Please comment, and I'll update the PR with corrections!
2015-05-29 05:34:28 +00:00
bors
99c2f779d2 Auto merge of #25816 - sfackler:io-error-delegation, r=alexcrichton
The first commit simply forwards `io::Error`'s `cause` implementation to the inner error.

The second commit adds accessor methods for the inner error. Method names mirror those used elsewhere like `BufReader`.

r? @alexcrichton
2015-05-29 01:09:48 +00:00
edunham
177531e3d5 Document issue tracker tags
A discussion at https://github.com/rust-lang/rust/pull/25832 established what
the abbreviations mean.
2015-05-28 16:00:04 -07:00
bors
53941be981 Auto merge of #25744 - SimonSapin:cell-eq, r=alexcrichton
`core::cell::Cell<T>` and `core::cell::RefCell<T>` currently implement `PartialEq` when `T` does, and just defer to comparing `T` values. There is no reason the same shouldn’t apply to `Eq`.

This enables `#[derive(Eq, PartialEq)]` on e.g. structs that have a `RefCell` field.

r? @alexcrichton 

I’m unsure what to do with `#[stable]` attributes on `impl`s. `impl`s generated by `#[derive]` don’t have them.
2015-05-28 21:48:40 +00:00
Simon Sapin
c516eee503 Move std::cell::clone_ref to a clone associated function on std::cell::Ref
... and generalize the bounds on the value type.
2015-05-28 23:01:36 +02:00
bors
efebe45cc0 Auto merge of #25856 - bluss:binary-heap-hole, r=Gankro
collections: Make BinaryHeap panic safe in sift_up / sift_down

Use a struct called Hole that keeps track of an invalid location
in the vector and fills the hole on drop.

I include a run-pass test that the current BinaryHeap fails, and the new
one passes.

NOTE: The BinaryHeap will still be inconsistent after a comparison fails. It will
not have the heap property. What we fix is just that elements will be valid
values.

This is actually a performance win -- the new code does not bother to write in `zeroed()`
values in the holes, it just leaves them as they were.

Net result is something like a 5% decrease in runtime for `BinaryHeap::from_vec`. This
can be further improved by using unchecked indexing (I confirmed it makes a difference,
not a surprise with the non-sequential access going on), but let's leave that for another PR.
Safety first 😉 

Fixes #25842
2015-05-28 20:16:08 +00:00
Steve Klabnik
977d40fbfa Improve Debug documentation 2015-05-28 15:25:35 -04:00
Ulrik Sverdrup
5249cbb7fa collections: Make BinaryHeap panic safe in sift_up / sift_down
Use a struct called Hole that keeps track of an invalid location
in the vector and fills the hole on drop.

I include a run-pass test that the current BinaryHeap fails, and the new
one passes.

Fixes #25842
2015-05-28 20:24:47 +02:00
Steven Fackler
aebf331431 Mention UFCS sadness in instability messages 2015-05-28 10:34:40 -07:00
bors
621a10e7f3 Auto merge of #25829 - steveklabnik:ioresult_fixes, r=alexcrichton
This is now std::io::Result
2015-05-28 17:34:30 +00:00
Ms2ger
b700b37094 Return a TaggedDocsIterator from each_reexport. 2015-05-28 19:24:43 +02:00
Steve Klabnik
16a47c2d91 remove references to IoResult
This is now std::io::Result
2015-05-28 12:51:01 -04:00
bors
9c303944a7 Auto merge of #25835 - steveklabnik:gh25438, r=alexcrichton
Fixes #25438
2015-05-28 15:29:15 +00:00
Pascal Hertleif
2a63cc7715 TRPL: Fix Unescaped URL 2015-05-28 16:18:26 +02:00
bors
a5a5fcee38 Auto merge of #25834 - steveklabnik:gh25326, r=alexcrichton
Fixes #25326
2015-05-28 13:57:36 +00:00
bors
4233cbda8a Auto merge of #25849 - reinh:patch-1, r=huonw
Thanks for the awesome book!

r? @steveklabnik
2015-05-28 11:24:38 +00:00
Liigo Zhuang
d061a0f8d5 floating-point types are machine types, not machine-dependent types 2015-05-28 18:11:32 +08:00
bors
4f66d881a5 Auto merge of #25843 - shepmaster:remove-public-int-and-uint, r=huonw 2015-05-28 09:20:49 +00:00
bors
448ce12bc1 Auto merge of #25783 - nrc:save-api-2, r=@huonw
A little more work on the save-analysis API.

r? @huonw
2015-05-28 06:54:57 +00:00
Steven Fackler
f65ba38cc4 Add a test for downcasting
Ergonomics are a bit crappy right now because method resolution isn't
smart enough to drop bounds, unfortunately.
2015-05-27 23:03:04 -07:00
Rein Henrichs
23ec00751e TRPL: fix typo, borow for borrow 2015-05-27 22:35:46 -07:00
Nick Cameron
b2c8719341 save-analysis: move another couple of things to the API 2015-05-28 17:25:50 +12:00
Steven Fackler
b529a7837b Add accessors for io::Error's inner error.
error::Error itself has downcasting methods, so there's no need to
duplicate those here.
2015-05-27 21:53:54 -07:00
Steven Fackler
4458b5a9d5 Delegate io::Error::cause to inner error 2015-05-27 21:53:54 -07:00
bors
6a3d55abf0 Auto merge of #25840 - arielb1:ptr-compare-fixes, r=nrc
Fixes #25826.
2015-05-28 03:51:58 +00:00
bors
1a3cffbddf Auto merge of #25824 - alexcrichton:fix-deadlocking-test-on-windows, r=nikomatsakis
Windows tests can often deadlock if a child thread continues after the main
thread and then panics, and a `println!` executed in a child thread after the
main thread has exited is at risk of panicking.
2015-05-28 02:17:48 +00:00
Ariel Ben-Yehuda
080311d1f9 Prevent comparison and dereferencing of raw pointers in constexprs
Fixes #25826.
2015-05-28 03:22:44 +03:00
bors
f76d9bcfc2 Auto merge of #25805 - jooert:colorized_tests, r=alexcrichton
The output of individual tests can be captured now so it's safe to use
colorized output even when running tests in parallel. Closes #782.
2015-05-28 00:15:47 +00:00
Jake Goulding
a959cc435f Remove mentions of int / uint from public documentation 2015-05-27 19:26:18 -04:00
Jake Goulding
875d356245 Remove mentions of int / uint from the isize / usize docs 2015-05-27 19:16:00 -04:00
bors
f3819f063c Auto merge of #25796 - arielb1:default-assoc, r=eddyb
r? @eddyb

Fixes #19476.
2015-05-27 22:05:09 +00:00
bors
47f9e528f1 Auto merge of #25827 - Manishearth:rollup, r=Manishearth
- Successful merges: #25128, #25651, #25668, #25726, #25760, #25792, #25806, #25807
- Failed merges:
2015-05-27 19:42:48 +00:00
Manish Goregaokar
6090d15e93 Rollup merge of #25807 - rillian:manpages, r=alexcrichton
Quick update to fix two manpage issues I noticed in #25689.
2015-05-28 01:12:31 +05:30
Manish Goregaokar
aec0a4ba83 Rollup merge of #25806 - nrc:20184-msg, r=alexcrichton
Closes #20184
2015-05-28 01:12:30 +05:30
Manish Goregaokar
0e1a71c5af Rollup merge of #25792 - koobs:patch-1, r=alexcrichton
Currently, there are two conditional blocks that exist to check for "clang or gcc"

On line 866:

```
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
then
    err "either clang or gcc is required"
fi
```
and on line 1019:

```
if [ -z "$CC" -a -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
then
    err "either clang or gcc is required"
fi
```

Given the order of the clauses, this results in the "either clang or gcc is required" error from the earlier block, (even) when CC is set.

The expected behaviour is to honour user-flags, in this case CC.

Aside from removing all hand-holdy compiler checks in favour of actual compiler *feature* checks, this change removes the redundant former block in favour of the latter block, which appears designed to allow the expected behaviour.
2015-05-28 01:12:30 +05:30
Matt Brubeck
6c2b340fdc Improve docs for Vec::as_slice and as_mut_slice
Fixes #25622.
2015-05-27 12:37:29 -07:00
Manish Goregaokar
db1914ef7e Rollup merge of #25726 - nham:cell_docs, r=alexcrichton
Currently part of the description of the `into_inner` method of `UnsafeCell` seems backwards.
2015-05-28 00:35:20 +05:30