diff options
| author | The8472 <git@infinite-source.de> | 2021-05-15 20:41:15 +0200 |
|---|---|---|
| committer | The8472 <git@infinite-source.de> | 2021-05-19 01:41:12 +0200 |
| commit | a44a059c3b65b5ce9c996db0995eb574e46fa314 (patch) | |
| tree | 2d91d7dadf367e962d73a012eec6a71b3530882a /library/alloc | |
| parent | 60a900ee10c70ea90927c1192ec6683f26f496de (diff) | |
| download | rust-a44a059c3b65b5ce9c996db0995eb574e46fa314.tar.gz rust-a44a059c3b65b5ce9c996db0995eb574e46fa314.zip | |
add regression test
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/tests/vec.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs index aa606cd2315..6c71cf924d2 100644 --- a/library/alloc/tests/vec.rs +++ b/library/alloc/tests/vec.rs @@ -1094,6 +1094,18 @@ fn test_from_iter_specialization_panic_during_drop_leaks() { } } +// regression test for issue #85322. Peekable previously implemented InPlaceIterable, +// but due to an interaction with IntoIter's current Clone implementation it failed to uphold +// the contract. +#[test] +fn test_collect_after_iterator_clone() { + let v = vec![0; 5]; + let mut i = v.into_iter().peekable(); + i.peek(); + let v = i.clone().collect::<Vec<_>>(); + assert!(v.len() <= v.capacity()); +} + #[test] fn test_cow_from() { let borrowed: &[_] = &["borrowed", "(slice)"]; |
