Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7cb74ed
Remove memoization leftovers
Dec 8, 2020
de1cd4b
Extra assertions in eval_body_using_ecx to disallow queries for
Dec 9, 2020
c6f2d49
fix issue #78496
wecing Dec 10, 2020
78c0680
update comments
wecing Dec 10, 2020
3812f70
fix test case issue ref
wecing Dec 10, 2020
b6f7eef
Remove unnecessary check and fix local_def_id parameter
Dec 10, 2020
a03feaa
add missing constraints
Dec 11, 2020
ed80815
Move binder for dyn to each list item
jackh726 Dec 11, 2020
0f30b7d
fix panic if converting ZST Vec to VecDeque
Stupremee Dec 13, 2020
d75618e
replace assert! with assert_eq!
Stupremee Dec 13, 2020
94fd1d3
BTreeMap: more expressive local variables in merge
ssomers Nov 23, 2020
09d528e
fix typo
Stupremee Dec 13, 2020
6c7835e
BTreeSet: simplify implementation of pop_first/pop_last
ssomers Nov 20, 2020
357565d
expand-yaml-anchors: Make the output directory separator-insensitive
JohnTitor Dec 14, 2020
01c2520
Add explanation for skip_binder in relate
jackh726 Dec 14, 2020
777ca99
Optimization for bool's PartialOrd impl
ChayimFriedman2 Dec 14, 2020
a72b739
Remove unused `TyEncoder::tcx` required method
LeSeulArtichaut Dec 14, 2020
0e0ae47
Add a new lint to rustdoc for invalid codeblocks
poliorcetics Dec 15, 2020
243f469
Rollup merge of #79816 - poliorcetics:rustdoc-fail-on-deny, r=jyn514
Dylan-DPC Dec 16, 2020
ed1f0b5
Rollup merge of #79840 - dvtkrlbs:issue-79667, r=oli-obk
Dylan-DPC Dec 16, 2020
864d804
Rollup merge of #79882 - wecing:master, r=oli-obk
Dylan-DPC Dec 16, 2020
a674cb3
Rollup merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
Dylan-DPC Dec 16, 2020
642ba23
Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic,…
Dylan-DPC Dec 16, 2020
2c6edd9
Rollup merge of #80006 - ssomers:btree_cleanup_6, r=Mark-Simulacrum
Dylan-DPC Dec 16, 2020
ee524d1
Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
Dylan-DPC Dec 16, 2020
0cda9cd
Rollup merge of #80026 - JohnTitor:separator-insensitive, r=Mark-Simu…
Dylan-DPC Dec 16, 2020
c6f081a
Rollup merge of #80035 - ChayimFriedman2:patch-1, r=nagisa
Dylan-DPC Dec 16, 2020
3fbb93b
Rollup merge of #80039 - LeSeulArtichaut:rm-tyencoder-tcx, r=matthewj…
Dylan-DPC Dec 16, 2020
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: 6 additions & 2 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2793,8 +2793,12 @@ impl<T> From<Vec<T>> for VecDeque<T> {
let len = other.len();

// We need to extend the buf if it's not a power of two, too small
// or doesn't have at least one free space
if !buf.capacity().is_power_of_two()
// or doesn't have at least one free space.
// We check if `T` is a ZST in the first condition,
// because `usize::MAX` (the capacity returned by `capacity()` for ZST)
// is not a power of two and thus it'll always try
// to reserve more memory which will panic for ZST (rust-lang/rust#78532)
if (!buf.capacity().is_power_of_two() && mem::size_of::<T>() != 0)
|| (buf.capacity() < (MINIMUM_CAPACITY + 1))
|| (buf.capacity() == len)
{
Expand Down
7 changes: 7 additions & 0 deletions library/alloc/tests/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1728,3 +1728,10 @@ fn test_zero_sized_push() {
}
}
}

#[test]
fn test_from_zero_sized_vec() {
let v = vec![(); 100];
let queue = VecDeque::from(v);
assert_eq!(queue.len(), 100);
}