2

Avoid overflow in `VecDeque::with_capacity_in()`. by hkratz · Pull Request #9001...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/90010
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

hkratz commented 10 days ago

The overflow only happens if alloc is compiled with overflow checks enabled and the passed capacity is greater or equal 2^(usize::BITS-1). The overflow shadows the expected "capacity overflow" panic leading to a test failure if overflow checks are enabled for std in the CI.

Unblocks CI: Enable overflow checks for test (non-dist) builds #89776.

For some reason the overflow is only observable with optimization turned off, but that is a separate issue.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK