Skip to content

Rollup of 15 pull requests #67670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Dec 28, 2019
Merged
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3c56a65
reuse `capacity` variable in slice::repeat
king6cong Dec 24, 2019
ac31c71
Update libc to 0.2.66
oxalica Dec 24, 2019
43cb37e
Use issue = "none" instead of "0" in intrinsics
LunaBorowska Dec 25, 2019
415ecc8
Add Scalar::to_(u|i)16 methods
pvdrz Dec 25, 2019
dfcc44d
rewrite scalar to integer methods
pvdrz Dec 25, 2019
b8ccc0f
Remove `compiler_builtins_lib` documentation
kraai Dec 25, 2019
5d19d4d
Use the correct type for static qualifs
matthewjasper Dec 25, 2019
21e636f
Remove redundant link texts
kraai Dec 26, 2019
2f43313
Convert collapsed to shortcut reference links
kraai Dec 26, 2019
be9a3c6
Update .mailmap
pvdrz Dec 26, 2019
9c0f3f7
Document safety of Path casting
Mark-Simulacrum Dec 26, 2019
2c796ee
Use NonNull in slice::Iter and slice::IterMut.
Kixunil Dec 24, 2019
749295c
Add regression test for old NLL ICE
rossmacarthur Dec 27, 2019
1c572a2
Stabilize the `matches!` macro
SimonSapin Dec 27, 2019
aa5983d
Fix my entry in the mailmap
Manishearth Dec 27, 2019
1ec81ab
Fix Nika's entry in the mailmap
Manishearth Dec 27, 2019
e518e38
Fix whitequark's entry in the mailmap
Manishearth Dec 27, 2019
f35517e
core: add IntoFuture trait and support for await
seanmonstar Dec 26, 2019
b1b005b
Rollup merge of #65244 - seanmonstar:into-future, r=seanmonstar
oli-obk Dec 27, 2019
a076464
Rollup merge of #67576 - king6cong:slice_repeat, r=Dylan-DPC
oli-obk Dec 27, 2019
4b91966
Rollup merge of #67588 - Kixunil:nonnull-slice-iter, r=rkruppe
oli-obk Dec 27, 2019
31fd966
Rollup merge of #67594 - oxalica:update-libc, r=Dylan-DPC
oli-obk Dec 27, 2019
4cf4fc6
Rollup merge of #67602 - xfix:use-issue-none-instead-of-0-in-intrinsi…
oli-obk Dec 27, 2019
e9af9db
Rollup merge of #67604 - christianpoveda:scalar_to_(u|i)64, r=RalfJung
oli-obk Dec 27, 2019
98de504
Rollup merge of #67617 - kraai:remove-compiler_builtins_lib-docs, r=D…
oli-obk Dec 27, 2019
b88ce0e
Rollup merge of #67621 - matthewjasper:correct-static-type, r=oli-obk
oli-obk Dec 27, 2019
b371e0f
Rollup merge of #67629 - kraai:remove-redundant-link-texts, r=stevekl…
oli-obk Dec 27, 2019
48efc1e
Rollup merge of #67632 - kraai:remove-collapsed-reference-links, r=st…
oli-obk Dec 27, 2019
47d5acf
Rollup merge of #67633 - christianpoveda:patch-1, r=Mark-Simulacrum
oli-obk Dec 27, 2019
9525e8e
Rollup merge of #67635 - Mark-Simulacrum:path-doc-unsafe, r=dtolnay
oli-obk Dec 27, 2019
9eb45e3
Rollup merge of #67654 - rossmacarthur:fix-51770-add-regression-test,…
oli-obk Dec 27, 2019
335c887
Rollup merge of #67659 - SimonSapin:matches, r=rkruppe
oli-obk Dec 27, 2019
65bbcf0
Rollup merge of #67664 - Manishearth:mailmapfixes, r=Mark-Simulacrum
oli-obk Dec 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ impl<T> [T] {
// and `rem` is the remaining part of `n`.

// Using `Vec` to access `set_len()`.
let mut buf = Vec::with_capacity(self.len().checked_mul(n).expect("capacity overflow"));
let capacity = self.len().checked_mul(n).expect("capacity overflow");
let mut buf = Vec::with_capacity(capacity);

// `2^expn` repetition is done by doubling `buf` `expn`-times.
buf.extend(self);
Expand All @@ -476,7 +477,7 @@ impl<T> [T] {

// `rem` (`= n - 2^expn`) repetition is done by copying
// first `rem` repetitions from `buf` itself.
let rem_len = self.len() * n - buf.len(); // `self.len() * rem`
let rem_len = capacity - buf.len(); // `self.len() * rem`
if rem_len > 0 {
// `buf.extend(buf[0 .. rem_len])`:
unsafe {
Expand All @@ -487,8 +488,7 @@ impl<T> [T] {
rem_len,
);
// `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`).
let buf_cap = buf.capacity();
buf.set_len(buf_cap);
buf.set_len(capacity);
}
}
buf
Expand Down