Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
94d73d4
Refactor `parse_prefix` on Windows
CDirkx Nov 3, 2020
ea14607
make MIR graphviz generation use gsgdt
vn-ki Oct 26, 2020
5b049e1
write to a String instead to reduce churn
vn-ki Oct 26, 2020
a4e94ec
update gsgdt
vn-ki Oct 27, 2020
86a7831
formatting
vn-ki Nov 9, 2020
51ecb96
add different color for cleanup nodes in dark mode
vn-ki Nov 12, 2020
6fe31e7
fix clippy test
vn-ki Dec 5, 2020
7cb74ed
Remove memoization leftovers
Dec 8, 2020
de1cd4b
Extra assertions in eval_body_using_ecx to disallow queries for
Dec 9, 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
1b74a82
Always run intrinsics lowering pass
tmiasko Dec 15, 2020
8c51cf0
Rollup merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk
Dylan-DPC Dec 15, 2020
c42967b
Rollup merge of #78833 - CDirkx:parse_prefix, r=dtolnay
Dylan-DPC Dec 15, 2020
13c85b3
Rollup merge of #79840 - dvtkrlbs:issue-79667, r=oli-obk
Dylan-DPC Dec 15, 2020
b3e09ce
Rollup merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
Dylan-DPC Dec 15, 2020
1489095
Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic,…
Dylan-DPC Dec 15, 2020
ca1010e
Rollup merge of #80006 - ssomers:btree_cleanup_6, r=Mark-Simulacrum
Dylan-DPC Dec 15, 2020
125f19c
Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
Dylan-DPC Dec 15, 2020
da1e5eb
Rollup merge of #80026 - JohnTitor:separator-insensitive, r=Mark-Simu…
Dylan-DPC Dec 15, 2020
185936b
Rollup merge of #80035 - ChayimFriedman2:patch-1, r=nagisa
Dylan-DPC Dec 15, 2020
7a08349
Rollup merge of #80040 - tmiasko:always-lower-intrinsics, r=nagisa
Dylan-DPC Dec 15, 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);
}