41373 Commits

Author SHA1 Message Date
Brian Anderson a59de37e99 Fix doc tests 1.0.0 2015-05-13 20:07:33 -07:00
Steve Klabnik f0213d8ffb Merge pull request #25361 from steveklabnik/final_backport
Final backport
2015-05-13 03:01:37 -04:00
Michael Sproul 98fef7b8f2 Add a link to the error index to the main doc page.
I also capitalised "The Standard Library" and neatened a few bits of grammar.
2015-05-13 02:58:09 -04:00
Paul Quint 0975d840a7 Update BitSet docs to correct types
Update BitSet docs to correct type in one more spot

removed accidental file
2015-05-13 02:58:09 -04:00
Corey Farwell 708ad645cf Update docs to stop referencing BufReadExt 2015-05-13 02:58:09 -04:00
Tshepang Lekhonkhobe 9532106665 doc: unwrap is discouraged, so use Some 2015-05-13 02:58:09 -04:00
Ulrik Sverdrup 6a3524ea2e std: Add example for HashMap::entry() 2015-05-13 02:58:09 -04:00
Brian Anderson 86a1165f84 doc: Address feedback 2015-05-13 02:58:09 -04:00
Brian Anderson 60067f6b6d std: Update crate docs
Attempted to organize them in a way more relevant to what newbies
would be interested in hearing.
2015-05-13 02:58:09 -04:00
Brian Anderson a8c4ac922e doc: Remove mention of 30 minute intro 2015-05-13 02:58:09 -04:00
Steve Klabnik 665aed059a Backport TRPL, reference, and grammar.
Rather than port each individual change to these files, for the release,
I just waited to do it all at the end, in this commit. Since individual
comits made it to master, everyone should get proper credit in the
main tree, and AUTHORS includes those whose changes are here.
2015-05-13 02:57:13 -04:00
robertfoss 6e2106d376 Update AUTHORS.txt
Conflicts:
	AUTHORS.txt
2015-05-12 10:57:27 -07:00
Brian Anderson 7b4ef47b78 Revert accidental revert of rust-installer 2015-05-11 15:08:36 -07:00
Brian Anderson 243aece688 Fix broken doc test 2015-05-11 14:48:51 -07:00
Brian Anderson 0955dc5e06 Fix syntax error in slice.rs 2015-05-11 13:22:45 -07:00
Brian Anderson ce3331c969 Merge pull request #25313 from pnkfelix/backport-25212-to-beta
Backport #25212 to beta
2015-05-11 13:15:27 -07:00
Felix S. Klock II c25ab82dc3 address fallout in libsyntaxtest. 2015-05-11 21:34:45 +02:00
Felix S. Klock II 1a44fd12ea Fallout to compile-fail tests.
This change is worrisome to me, both because:

1. I thought the rules in RFC 599 imply that the `Box<Trait>` without `'static`
   in the first case would expand to the second case, but their behaviors
   here differ.  And,

2. The explicit handling of `'static` should mean `dropck` has no application
   here and thus we should have seen no change to the expected error messages.
   Nonetheless, the error messages changed.
2015-05-11 21:34:31 +02:00
Felix S. Klock II 10c38bdbe8 fallout to run-pass tests. 2015-05-11 21:34:18 +02:00
Felix S. Klock II e96a0442f4 Regression tests for Issue 25199 (dropck and Box<Trait + 'a>). 2015-05-11 21:34:03 +02:00
Felix S. Klock II 5044c3cb9b dropck: must assume Box<Trait + 'a> has a destructor of interest.
Implements this (previously overlooked) note from [RFC 769]:

> (Note: When encountering a D of the form `Box<Trait+'b>`, we
> conservatively assume that such a type has a Drop implementation
> parametric in 'b.)

Fix #25199.

[breaking-change]

The breakage here falls into both obvious and non-obvious cases.

The obvious case: if you were relying on the unsoundness this exposes
(namely being able to reference dead storage from a destructor, by
doing it via a boxed trait object bounded by the lifetime of the dead
storage), then this change disallows that.

The non-obvious cases: The way dropck works, it causes lifetimes to be
extended to longer extents than they covered before. I.e.  lifetimes
that are attached as trait-bounds may become longer than they were
previously.

* This includes lifetimes that are only *implicitly* attached as
  trait-bounds (due to [RFC 599]). So you may have code that was
  e.g. taking a parameter of type `&'a Box<Trait>` (which expands to
  `&'a Box<Trait+'a>`), that now may need to be assigned type `&'a
  Box<Trait+'static>` to ensure that `'a` is not inadvertantly
  inferred to a region that is actually too long.  (See earlier commit
  in this PR for an example of this.)

[RFC 769]: https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md#the-drop-check-rule

[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md
2015-05-11 21:33:09 +02:00
Alex Crichton 1d78408a81 Merge pull request #25312 from brson/beta
Bump prerelease version to .5
2015-05-11 12:32:39 -07:00
Brian Anderson 541458a203 Bump prerelease version to .5 2015-05-11 12:30:43 -07:00
Felix S. Klock II d40595251c Fallout from fixing Issue 25199.
There are two interesting kinds of breakage illustrated here:

1. `Box<Trait>` in many contexts is treated as `Box<Trait + 'static>`,
   due to [RFC 599]. However, in a type like `&'a Box<Trait>`, the
   `Box<Trait>` type will be expanded to `Box<Trait + 'a>`, again due
   to [RFC 599]. This, combined with the fix to Issue 25199, leads to
   a borrowck problem due the combination of this function signature
   (in src/libstd/net/parser.rs):

   ```rust
   fn read_or<T>(&mut self, parsers: &mut [Box<FnMut(&mut Parser) -> Option<T>>]) -> Option<T>;
   ```

   with this call site (again in src/libstd/net/parser.rs):

   ```rust
   fn read_ip_addr(&mut self) -> Option<IpAddr> {
       let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr().map(|v4| IpAddr::V4(v4));
       let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr().map(|v6| IpAddr::V6(v6));
       self.read_or(&mut [Box::new(ipv4_addr), Box::new(ipv6_addr)])
   }
   ```

   yielding borrowck errors like:

   ```
   parser.rs:265:27: 265:69 error: borrowed value does not live long enough
   parser.rs:265         self.read_or(&mut [Box::new(ipv4_addr), Box::new(ipv6_addr)])
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```

   (full log at: https://gist.github.com/pnkfelix/e2e80f1a71580f5d3103 )

   The issue here is perhaps subtle: the `parsers` argument is
   inferred to be taking a slice of boxed objects with the implicit
   lifetime bound attached to the `self` parameter to `read_or`.

   Meanwhile, the fix to Issue 25199 (added in a forth-coming commit)
   is forcing us to assume that each boxed object may have a
   destructor that could refer to state of that lifetime, and
   *therefore* that inferred lifetime is required to outlive the boxed
   object itself.

   In this case, the relevant boxed object here is not going to make
   any such references; I believe it is just an artifact of how the
   expression was built that it is not assigned type:

     `Box<FnMut(&mut Parser) -> Option<T> + 'static>`.

   (i.e., mucking with the expression is probably one way to fix this
   problem).

   But the other way to fix it, adopted here, is to change the
   `read_or` method type to force make the (presumably-intended)
   `'static` bound explicit on the boxed `FnMut` object.

   (Note: this is still just the *first* example of breakage.)

2. In `macro_rules.rs`, the `TTMacroExpander` trait defines a method
   with signature:

   ```rust
   fn expand<'cx>(&self, cx: &'cx mut ExtCtxt, ...) -> Box<MacResult+'cx>;
   ```

   taking a `&'cx mut ExtCtxt` as an argument and returning a
   `Box<MacResult'cx>`.

   The fix to Issue 25199 (added in aforementioned forth-coming
   commit) assumes that a value of type `Box<MacResult+'cx>` may, in
   its destructor, refer to a reference of lifetime `'cx`; thus the
   `'cx` lifetime is forced to outlive the returned value.

   Meanwhile, within `expand.rs`, the old code was doing:

   ```rust
   match expander.expand(fld.cx, ...).make_pat() { ... => immutable borrow of fld.cx ... }
   ```

   The problem is that the `'cx` lifetime, inferred for the
   `expander.expand` call, has now been extended so that it has to
   outlive the temporary R-value returned by `expanded.expand`.  But
   call is also reborrowing `fld.cx` *mutably*, which means that this
   reborrow must end before any immutable borrow of `fld.cx`; but
   there is one of those within the match body. (Note that the
   temporary R-values for the input expression to `match` all live as
   long as the whole `match` expression itself (see Issue #3511 and PR
   #11585).

   To address this, I moved the construction of the pat value into its
   own `let`-statement, so that the `Box<MacResult>` will only live
   for as long as the initializing expression for the `let`-statement,
   and thus allow the subsequent immutable borrow within the `match`.

[RFC 599]: https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md
2015-05-11 20:28:09 +02:00
Brian Anderson 39df5dc6b5 Merge pull request #25311 from alexcrichton/beta-backport
Backport instability comment to beta
2015-05-11 11:24:28 -07:00
Brian Anderson fd815b7a57 Merge pull request #25299 from alexcrichton/beta-backport
Backport mem::forget to beta
2015-05-11 11:22:01 -07:00
Huon Wilson 2f0dce3e78 Add a reason to the libc & rand instability.
Many many many people ask in #rust about this libraries, having an
explanatory reason will probably help a lot.
2015-05-11 11:21:59 -07:00
Brian Anderson 781c2aa620 Merge pull request #25294 from brson/relnotes-beta
Update AUTHORS.txt and RELEASES.md for 1.0 (beta)
2015-05-11 11:01:18 -07:00
Brian Anderson 14159c74f8 More authors updates 2015-05-11 11:00:28 -07:00
Steve Klabnik 79b8a6949a Merge pull request #25309 from barosl/no-more-tasks
Backport `task` -> `thread` to beta
2015-05-11 13:43:12 -04:00
Barosl Lee 59fe5e518a Fix the tests broken by replacing task with thread 2015-05-12 02:12:40 +09:00
Barosl Lee 5f15729d0c Please the make tidy 2015-05-12 02:12:37 +09:00
Barosl Lee 402442a211 Fix invalid references due to the automated string substitution 2015-05-12 02:12:27 +09:00
Barosl Lee 276b436530 Squeeze the last bits of tasks in documentation in favor of thread
An automated script was run against the `.rs` and `.md` files,
subsituting every occurrence of `task` with `thread`. In the `.rs`
files, only the texts in the comment blocks were affected.
2015-05-12 02:05:21 +09:00
Sean McArthur f245929834 collections: change bounds of SliceConcatExt implementations to use Borrow instead of AsRef
Conflicts:
	src/libcollections/slice.rs
	src/libcollections/str.rs
2015-05-10 23:19:06 -07:00
Sean McArthur 91f1e51355 collections: impl AsRef<[u8]> for String 2015-05-10 23:18:24 -07:00
Sean McArthur 5d412c6a4b core: impl AsRef<[u8]> for str 2015-05-10 23:18:21 -07:00
Alex Crichton 7b78086ba4 std: Mark mem::forget as a safe function
This commit is an implementation of [RFC 1066][rfc] where the conclusion was
that leaking a value is a safe operation in Rust code, so updating the signature
of this function follows suit.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1066-safe-mem-forget.md

Closes #25186
2015-05-10 23:16:54 -07:00
Brian Anderson 7c0fcf3b5c Update AUTHORS.txt and RELEASES.md for 1.0 2015-05-10 18:52:51 -07:00
Steve Klabnik 8421c7cfc8 Merge pull request #25276 from steveklabnik/third_doc_backport
Third doc backport
2015-05-10 15:23:49 -04:00
tynopex e88f80a4ca Update process.rs
Make whitespace consistent
2015-05-10 15:20:42 -04:00
tynopex d223e4cbbb std: Fixup docs for std::process 2015-05-10 15:20:36 -04:00
Corey Farwell 5b041fedb4 Fix punctuation placement in doc-comment 2015-05-10 15:20:25 -04:00
inrustwetrust b84f018bb4 Clarify Once::call_once memory ordering guarantees in docs 2015-05-10 15:20:07 -04:00
Steve Klabnik 7a0af01bd4 remove stability note from std::net
This is served by stability markers.
2015-05-10 15:19:56 -04:00
Chris Morgan 720f5865c0 Fix #24872, XSS in docs not found page. 2015-05-10 15:19:47 -04:00
Tshepang Lekhonkhobe 40fe325037 doc: it is 'index', not 'i' 2015-05-10 15:19:32 -04:00
Richo Healey be613a1b03 thread: right now you can't actually set those printers 2015-05-10 15:19:13 -04:00
Steve Klabnik 750da68ed5 Merge pull request #25273 from steveklabnik/second_doc_backport
Second doc backport
2015-05-10 14:35:43 -04:00
Nick Hamann 957e42a1c6 Improve libstd/net/addr.rs documentation.
This adds some missing punctuation and converts uses of "Gets" to
"Returns". This sounds better to my ear, but more importantly is
more consistent with the documentation from other files.
2015-05-10 14:33:49 -04:00