Skip to content

Commit 25f5d91

Browse files
committed
Revert "Impl get_size::GetSize (behind feature flag)"
This reverts commit 38863e8. Avoids a cyclic dependency when the build includes the `get-size/derive` feature.
1 parent ff05444 commit 25f5d91

File tree

3 files changed

+0
-94
lines changed

3 files changed

+0
-94
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ debugger_visualizer = []
2828
[dependencies]
2929
serde = { version = "1", optional = true, default-features = false }
3030
arbitrary = { version = "1", optional = true }
31-
get-size = { version = "0.1", optional = true, default-features = false }
3231

3332
[dev_dependencies]
3433
bincode = "1.0.1"

src/lib.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@
8888
//! [Rustonomicon](https://doc.rust-lang.org/1.42.0/nomicon/dropck.html#an-escape-hatch).
8989
//!
9090
//! Tracking issue: [rust-lang/rust#34761](https://github.com/rust-lang/rust/issues/34761)
91-
//!
92-
//! ### `get-size`
93-
//!
94-
//! When this optional dependency is enabled, `SmallVec` implements the `get_size::GetSize` trait.
9591
9692
#![no_std]
9793
#![cfg_attr(docsrs, feature(doc_cfg))]
@@ -145,9 +141,6 @@ use std::io;
145141
#[cfg(feature = "drain_keep_rest")]
146142
use core::mem::ManuallyDrop;
147143

148-
#[cfg(feature = "get-size")]
149-
use get_size::GetSize;
150-
151144
/// Creates a [`SmallVec`] containing the arguments.
152145
///
153146
/// `smallvec!` allows `SmallVec`s to be defined with the same syntax as array expressions.
@@ -2476,22 +2469,3 @@ impl<T> Clone for ConstNonNull<T> {
24762469
}
24772470

24782471
impl<T> Copy for ConstNonNull<T> {}
2479-
2480-
#[cfg(feature = "get-size")]
2481-
impl<A: Array> GetSize for SmallVec<A>
2482-
where
2483-
A::Item: GetSize,
2484-
{
2485-
fn get_heap_size(&self) -> usize {
2486-
let mut total = 0;
2487-
if self.spilled() {
2488-
total += self.capacity * A::Item::get_stack_size();
2489-
}
2490-
2491-
for v in self.iter() {
2492-
total += v.get_heap_size();
2493-
}
2494-
2495-
total
2496-
}
2497-
}

src/tests.rs

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,70 +1023,3 @@ fn drain_keep_rest() {
10231023

10241024
assert_eq!(a, SmallVec::<[i32; 3]>::from_slice(&[1i32, 3, 5, 6, 7, 8]));
10251025
}
1026-
1027-
#[cfg(all(feature = "get-size", target_pointer_width = "64"))]
1028-
mod get_size {
1029-
use super::*;
1030-
1031-
#[test]
1032-
fn end_to_end1() {
1033-
use ::get_size::GetSize;
1034-
1035-
let mut a: SmallVec<[i32; 2]> = smallvec![];
1036-
assert!(!a.spilled());
1037-
assert_eq!(a.len(), 0);
1038-
assert_eq!(a.get_size(), 24);
1039-
assert_eq!(a.get_heap_size(), 0);
1040-
1041-
a.push(0);
1042-
assert_eq!(a.len(), 1);
1043-
assert!(!a.spilled());
1044-
assert_eq!(a.get_size(), 24);
1045-
assert_eq!(a.get_heap_size(), 0);
1046-
1047-
a.push(1);
1048-
assert_eq!(a.len(), 2);
1049-
assert!(!a.spilled());
1050-
assert_eq!(a.get_size(), 24);
1051-
assert_eq!(a.get_heap_size(), 0);
1052-
1053-
a.push(2);
1054-
assert_eq!(a.len(), 3);
1055-
assert!(a.spilled());
1056-
assert_eq!(a.get_size(), 40);
1057-
assert_eq!(a.get_heap_size(), 16);
1058-
1059-
a.push(3);
1060-
assert_eq!(a.len(), 4);
1061-
assert!(a.spilled());
1062-
assert_eq!(a.get_size(), 40);
1063-
assert_eq!(a.get_heap_size(), 16);
1064-
1065-
a.push(4);
1066-
assert_eq!(a.len(), 5);
1067-
assert!(a.spilled());
1068-
assert_eq!(a.get_size(), 56);
1069-
assert_eq!(a.get_heap_size(), 32);
1070-
1071-
}
1072-
1073-
#[cfg(not(feature = "union"))]
1074-
#[test]
1075-
fn stack_size_no_union1() {
1076-
use ::get_size::GetSize;
1077-
1078-
assert_eq!(SmallVec::<[i32; 2]>::get_stack_size(), 24);
1079-
assert_eq!(SmallVec::<[i32; 10]>::get_stack_size(), 56);
1080-
}
1081-
1082-
#[cfg(feature="union")]
1083-
#[test]
1084-
fn stack_size_union1() {
1085-
use ::get_size::GetSize;
1086-
1087-
assert_eq!(SmallVec::<[i32; 2]>::get_stack_size(), 24);
1088-
assert_eq!(SmallVec::<[i32; 10]>::get_stack_size(), 48);
1089-
}
1090-
1091-
}
1092-

0 commit comments

Comments
 (0)