diff options
| author | bors <bors@rust-lang.org> | 2020-05-30 07:56:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-30 07:56:05 +0000 |
| commit | 91fb72a8a9f53de2bcc5638c1358fcb552dba8ce (patch) | |
| tree | 6bd52d61abaa0eab87137167ee3d8e8556670858 /src/librustc_data_structures/thin_vec.rs | |
| parent | 0e9e4083100aa3ebf09b8f1ace0348cb37475eb9 (diff) | |
| parent | 025058f2aa5bcc890d1db8cc71ff63f690b8df0f (diff) | |
Auto merge of #72768 - JohnTitor:rollup-6kwokh6, r=JohnTitor
Rollup of 10 pull requests
Successful merges:
- #72033 (Update RELEASES.md for 1.44.0)
- #72162 (Add Extend::{extend_one,extend_reserve})
- #72419 (Miri read_discriminant: return a scalar instead of raw underlying bytes)
- #72621 (Don't bail out of trait selection when predicate references an error)
- #72677 (Fix diagnostics for `@ ..` binding pattern in tuples and tuple structs)
- #72710 (Add test to make sure -Wunused-crate-dependencies works with tests)
- #72724 (Revert recursive `TokenKind::Interpolated` expansion for now)
- #72741 (Remove unused mut from long-linker-command-lines test)
- #72750 (Remove remaining calls to `as_local_node_id`)
- #72752 (remove mk_bool)
Failed merges:
r? @ghost
Diffstat (limited to 'src/librustc_data_structures/thin_vec.rs')
| -rw-r--r-- | src/librustc_data_structures/thin_vec.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/librustc_data_structures/thin_vec.rs b/src/librustc_data_structures/thin_vec.rs index 2befc0aa504..43002178eb9 100644 --- a/src/librustc_data_structures/thin_vec.rs +++ b/src/librustc_data_structures/thin_vec.rs @@ -53,6 +53,20 @@ impl<T> Extend<T> for ThinVec<T> { ThinVec(None) => *self = iter.into_iter().collect::<Vec<_>>().into(), } } + + fn extend_one(&mut self, item: T) { + match *self { + ThinVec(Some(ref mut vec)) => vec.push(item), + ThinVec(None) => *self = vec![item].into(), + } + } + + fn extend_reserve(&mut self, additional: usize) { + match *self { + ThinVec(Some(ref mut vec)) => vec.reserve(additional), + ThinVec(None) => *self = Vec::with_capacity(additional).into(), + } + } } impl<T: HashStable<CTX>, CTX> HashStable<CTX> for ThinVec<T> { |
