Commit Graph

43547 Commits

Author SHA1 Message Date
Tim Ringenbach
8746b1ac6f Improve mem::forget documentation
This adds an example from mem::swap, and provides some suggested uses of this
function.

Change wording on comment on forget line to be more specific as to why we
need to call forget.

This breaks the examples up into three pieces. The last piece isn't
compiling for some reason.
2015-05-29 13:29:42 -05:00
Nick Howell
81a413bb01 trpl: eight sections, not seven 2015-05-29 14:29:35 -04:00
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
Steve Klabnik
5e941877fe Add syntax for multiple lifetimes
Fixes #25417
2015-05-29 12:52:02 -04:00
Steve Klabnik
b218470b4d Make note about $ more prominent.
Fixes #25554
2015-05-29 12:20:32 -04:00
Niko Matsakis
808b411244 New tests for cross-crate usages of const fn and so forth 2015-05-29 11:52:59 -04:00
Steven Fackler
494901a8b4 Fix windows recvfrom definition 2015-05-29 08:32:22 -07:00
Steven Fackler
39abcef0a7 Skip timeout upper bound check on windows 2015-05-29 08:32:22 -07: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
Tshepang Lekhonkhobe
deb4948395 remove the last mention of IoResult 2015-05-29 10:58:39 +02: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
Steven Fackler
69a0e1af95 Implement RFC 1047 - socket timeouts
Closes #25619
2015-05-28 20:03:20 -07:00
Nick Hamann
fdf3ce76cf Change E0015 and E0378 explanations to link to text of RFC 911, not rfc PR. 2015-05-28 21:12:46 -05:00
Nick Hamann
364035497c Revise E0015 according to feedback. 2015-05-28 21:02:13 -05: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
Nick Hamann
7e78e708fb Convert mutable statics error to have error code and add explanation.
Also changes 'owned pointers' => 'boxes' in the error message.
2015-05-28 19:28:07 -05:00
Alex Crichton
2627ae32f2 rustc: Fixup verbatim UNC paths as well on Windows
The compiler already has special support for fixing up verbatim paths with disks
on Windows to something that can be correctly passed down to gcc, and this
commit adds support for verbatim UNC paths as well.

Closes #25505
2015-05-28 16:49:42 -07:00
Nils Liberg
adac861db2 Fix link to newtypes page 2015-05-29 01:02:24 +02:00
Nils Liberg
d0744ba3e7 Fix mistake: "to to" -> "to" 2015-05-29 01:02:24 +02:00
David Campbell
31a007af19 remove extra space from "over" code as well 2015-05-29 01:02:24 +02:00
David Campbell
4d90b4d9b8 Update let.md -- follow whitespace style guideline
"Idiomatic code should not use extra whitespace in the middle of a line to provide alignment."
2015-05-29 01:02:24 +02:00
Corey Farwell
06706510cb Make adjancent code examples more similar 2015-05-29 01:02:24 +02:00
David Campbell
19cb2a7707 add newline before list in functions-and-methods
The current version of hoedown treats lists interrupting paragraphs in the Markdown.pl style rather than CommonMark, so a newline is needed for the list to be rendered properly.
2015-05-29 01:02:24 +02: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
Nick Hamann
eb15030dc1 Add error explanations for E0040, E0087, E0378, E0379, E0394. 2015-05-28 17:54:19 -05:00
Nick Hamann
f6074406db Update E0015 explanation, fix E0053. 2015-05-28 17:54:13 -05:00
Mathieu David
15aeea5477 Corrected typo
"workd" corrected to "world"
2015-05-29 00:43:39 +02: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
Mathieu David
15ab481322 removed lonely closing parenthesis
There was no opening parenthesis for this closing parenthesis...
2015-05-28 23:47:27 +02: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
Alex Crichton
1b5f9cb1f1 std: Add an option to disable ELF based TLS
This commit adds a ./configure option called `--disable-elf-tls` which disables
ELF based TLS (that which is communicated to LLVM) on platforms which already
support it. OSX 10.6 does not support this form of TLS, and some users of Rust
need to target 10.6 and are unable to do so due to the usage of TLS. The
standard library will continue to use ELF based TLS on OSX by default (as the
officially supported platform is 10.7+), but this adds an option to compile the
standard library in a way that is compatible with 10.6.
2015-05-28 10:14:42 -07: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