summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2015-05-13Fix doc tests 1.0.0Brian Anderson-3/+3
2015-05-13Add a link to the error index to the main doc page.Michael Sproul-4/+9
I also capitalised "The Standard Library" and neatened a few bits of grammar.
2015-05-13Update BitSet docs to correct typesPaul Quint-3/+3
Update BitSet docs to correct type in one more spot removed accidental file
2015-05-13Update docs to stop referencing `BufReadExt`Corey Farwell-2/+2
2015-05-13doc: unwrap is discouraged, so use SomeTshepang Lekhonkhobe-35/+35
2015-05-13std: Add example for HashMap::entry()Ulrik Sverdrup-0/+18
2015-05-13doc: Address feedbackBrian Anderson-10/+11
2015-05-13std: Update crate docsBrian Anderson-53/+49
Attempted to organize them in a way more relevant to what newbies would be interested in hearing.
2015-05-13doc: Remove mention of 30 minute introBrian Anderson-9/+8
2015-05-13Backport TRPL, reference, and grammar.Steve Klabnik-2110/+6688
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-11Revert accidental revert of rust-installerBrian Anderson-0/+0
2015-05-11Fix broken doc testBrian Anderson-0/+2
2015-05-11Fix syntax error in slice.rsBrian Anderson-3/+0
2015-05-11address fallout in libsyntaxtest.Felix S. Klock II-1/+5
2015-05-11Fallout to compile-fail tests.Felix S. Klock II-1/+13
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-11fallout to run-pass tests.Felix S. Klock II-3/+3
2015-05-11Regression tests for Issue 25199 (dropck and `Box<Trait + 'a>`).Felix S. Klock II-0/+214
2015-05-11dropck: must assume `Box<Trait + 'a>` has a destructor of interest.Felix S. Klock II-94/+141
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-11Fallout from fixing Issue 25199.Felix S. Klock II-4/+5
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-11Add a reason to the libc & rand instability.Huon Wilson-2/+4
Many many many people ask in #rust about this libraries, having an explanatory reason will probably help a lot.
2015-05-11Merge pull request #25299 from alexcrichton/beta-backportBrian Anderson-26/+76
Backport mem::forget to beta
2015-05-12Fix the tests broken by replacing `task` with `thread`Barosl Lee-1/+1
2015-05-12Please the `make tidy`Barosl Lee-1/+2
2015-05-12Fix invalid references due to the automated string substitutionBarosl Lee-2/+2
2015-05-12Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-199/+199
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-10collections: change bounds of SliceConcatExt implementations to use Borrow ↵Sean McArthur-12/+10
instead of AsRef Conflicts: src/libcollections/slice.rs src/libcollections/str.rs
2015-05-10collections: impl AsRef<[u8]> for StringSean McArthur-0/+8
2015-05-10core: impl AsRef<[u8]> for strSean McArthur-0/+9
2015-05-10std: Mark `mem::forget` as a safe functionAlex Crichton-14/+49
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-10Merge pull request #25276 from steveklabnik/third_doc_backportSteve Klabnik-23/+30
Third doc backport
2015-05-10Update process.rstynopex-8/+8
Make whitespace consistent
2015-05-10std: Fixup docs for std::processtynopex-13/+16
2015-05-10Fix punctuation placement in doc-commentCorey Farwell-1/+1
2015-05-10Clarify Once::call_once memory ordering guarantees in docsinrustwetrust-1/+5
2015-05-10remove stability note from std::netSteve Klabnik-4/+1
This is served by stability markers.
2015-05-10Fix #24872, XSS in docs not found page.Chris Morgan-1/+5
2015-05-10doc: it is 'index', not 'i'Tshepang Lekhonkhobe-1/+1
2015-05-10thread: right now you can't actually set those printersRicho Healey-2/+1
2015-05-10Improve libstd/net/addr.rs documentation.Nick Hamann-9/+9
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-10Add some missing punctuation in the libstd/net/tcp.rs docs.Nick Hamann-1/+1
2015-05-10Add some missing punctuation in the libstd/net/ip.rs docs.Nick Hamann-19/+19
2015-05-10Improve libstd/net/udp.rs documentation.Nick Hamann-10/+10
This adds some missing punctuation, adds a missing word, and corrects a bug in the description of `send_to`, which actually returns the number of bytes written on success. Fixes #24925.
2015-05-10Make From::from example more idiomatic / simplerCorey Farwell-3/+1
2015-05-10Indicate function call is code-like in doc-commentCorey Farwell-2/+2
2015-05-10IMO better borrow_mut() documentation on RefCellgareins-1/+1
Previous borrow() is enough to make borrow_mut() panic, no need to have borrow_mut() twice. [This](http://is.gd/woKKAW)
2015-05-10collections: Improve example for as_string and as_vecUlrik Sverdrup-4/+21
2015-05-10Utilize `while let` instead of `loop` with `break` in doc-commentCorey Farwell-5/+1
2015-05-10Explain how to create a Stdin or StdoutMatt Brubeck-0/+4
2015-05-10Separate code into two code blocksNick Hamann-3/+4
2015-05-10Address some nitsNick Hamann-2/+2