Specialize Vec::from_elem to use calloc
Fixes#38723. This specializes the implementation for `u8` only, but it could be extended to other zeroable types if desired.
I haven't tested this extensively, but I did verify that it gives the expected performance boost for large `vec![0; n]` allocations with both alloc_system and jemalloc, on Linux. (I have not tested or even built the Windows code.)
[rustbuild] Side-step HashMap iteration to preserve command-line step order.
The new `HashMap` was introduced by #41227 and it accidentally randomized step order.
r? @alexcrichton
Part of #29368.
* added missing links
* updated method summaries to use 3rd person style
* added missing periods in `Component`'s variant summaries
* use standard iterator boilerplate in `Components`' and `Iter`'s docs
* added example to `Iter::as_path`, adapted from `Components::as_path`'s
example
* consolidated examples for `Path::file_name`
* some other small fixes
rustc: provide adt_sized_constraint as an on-demand query.
By using `queries::adt_sized_constraint::try_get`, we can detect cycles without a separate stack.
r? @nikomatsakis
add 'mir' to rustc help menu and man doc
add 'mir' to '--emit' flag list for 'rustc'.
This is added because 'rustc' can now generate MIR (referencing to
"Teach rustc --emit=mir #39891").
Do not desugar if-let-else to match arm guards
Fixes#41272
Changed the desugaring code
**Before**
```rust
match <sub_expr> {
<pat> => <body>,
[_ if <else_opt_if_cond> => <else_opt_if_body>,]
_ => [<else_opt> | ()]
}
```
**After**
```rust
match <sub_expr> {
<pat> => <body>,
_ => [<else_opt> | ()]
}
```
With this fix, it doesn't cause E0301
Various improvements in std::collections docs
The meat of this PR are:
* changes to (almost all?) iterator struct docs in std::collections such that they use the standard iterator boilerplate and state where they are created
* a bunch of added links (at least as much as possible given std::collections mostly being a facade and whatnot 😅)
* an example for `Bound`
* changed phrasing for some summary sentences to be less redundant as well as more consistant with others in the module
There also are various other fixes, e.g. removing parens from method names in the module docs, changing some imperatives to 3rd person, etc.
r? @steveklabnik
Improve std::hash docs
Fixes#29357.
For details on what exactly I've done, see the commit descriptions.
There are some things I'm not sure about, but would like to address before merging this so the issue can be closed; any feedback on these points would really be appriciated:
* [x] ~I didn't touch the module level docs at all. On the one hand, I think they could use a short overview over the module; on the other hand, the module really isn't that big and I don't know if I could really do anything beyond just duplicating the type's summaries...~
* [x] ~I feel like the module-level examples are quite long-winded and not to the point, but I couldn't really think of anything better. Any ideas?~
* [x] ~Should `Hasher` get an example for implementing it? There is one in the module documentation, but it only "implements" it via `unimplemented!` and I'm not sure what the value of that is.~
* [x] ~Should `Hasher`'s `write_{int}` methods get examples?~
If there's anything else you'd like to see in std::hash's docs, please let me know!
r? @rust-lang/docs
I've added some explicit tests that negative impls are allowed to
overlap, and also to make sure that the feature doesn't interfere with
specialization. I've not added an explicit test for positive overlapping
with negative, as that's already tested elsewhere.