Mark Arc function get_mut and method make_unique unsafe
This is a temporary mitigation for issue #24880 which points out that
these functions are racy in a particular situation where weak pointers
exist.
To mitigate this, mark the functions unsafe until this can be fixed or
another decision is made.
The `HashMap` and `HashSet` iterators use `RawTable::first_bucket_raw` which is generic and will get inlined cross-crate.
However, `first_bucket_raw` calls `calculate_offsets` and the call doesn't get inlined, despite being a simple function.
This missing `#[inline]` results in `hash_table::calculate_offsets` showing up at the top of a callgrind profile with 3 million calls (for the testcase in #25916).
The `HashMap` and `HashSet` iterators use `RawTable::first_bucket_raw` which is generic and will get inlined cross-crate.
However, `first_bucket_raw` calls `calculate_offsets` and the call doesn't get inlined, despite being a simple function.
This missing `#[inline]` results in `hash_table::calculate_offsets` showing up at the top of a callgrind profile with 3 million calls (for the testcase in #25916).
Previous:
```
--disable-llvm-version-check don't don't check if the LLVM version is supported, build anyway
```
New:
```
--disable-llvm-version-check don't check if the LLVM version is supported, build anyway
```
The doc indicates that you can replace 'before' with 'after' showing the use of try!. The two examples should be equivalent, but they are not.
In the File::create we were inducing a panic before in case of error, not propagating. It is important for newbies (like myself) to understand that try! propagates failures, while unwrap can induce a panic.
The other alternative is to make the 'before' File::create also manually handle Err like the other calls. Either way it would be consistent.
This is a temporary mitigation for issue #24880 which points out that
these functions are racy in a particular situation where weak pointers
exist.
To mitigate this, mark the functions unsafe until this can be fixed or
another decision is made.
This is a breaking change to unstable API, because the new version
requires an `unsafe` block. Review carefully if weak pointers may race
for any uses of this API and consider abandoning it.
[breaking-change]
GDB and LLDB pretty printers have some common functionality
and also access some common information, such as the layout of
standard library types. So far, this information has been
duplicated in the two pretty printing python modules. This
commit introduces a common module used by both debuggers.
As mentioned in #25893 the copy trait is not very well explained for beginners. There is no clear mention that all primitive types implement the copy trait and there are not a lot of examples.
With this change I try to make it more visible and understandable for new users.
I myself have struggled with this, see [my question on stackoverflow](http://stackoverflow.com/questions/30540419/why-are-booleans-copyable-even-though-the-documentation-doesnt-indicate-that). And I want to make it more transparent for others.
I filed issue #25893 but I thought that I could give it a shot myself to relieve some of the work from the devs :)
If it is not well written or there are some changes to be made before it can be merged, let me know.
Cheers,
Mathieu
The E0397 explanation, as I've written it, isn't really an explanation, but I'm not sure what to put here. I will happily take suggestions.
Partially addresses https://github.com/rust-lang/rust/issues/25851
This adds an example from mem::swap, and provides some suggested uses of this
function.
This is my attempt to summarize the answers to a question I asked on reddit http://www.reddit.com/r/rust/comments/37jcul/what_is_forget_for/ and add the answers to the documentation so that no one else has to google or ask the question again.
This commit implements a number of standard traits for the standard library's
process I/O handles. The `FromRaw{Fd,Handle}` traits are now implemented for the
`Stdio` type and the `AsRaw{Fd,Handle}` traits are now implemented for the
`Child{Stdout,Stdin,Stderr}` types.
The stability markers for these implementations mention that they are stable for
1.1 as I will nominate this commit for cherry-picking to beta.
This takes the cases from InvalidInput where a data format error
was encountered. This is different from the documented semantics
of InvalidInput, which more likely indicate a programming error.
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.
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