diff --git a/src/bytes.rs b/src/bytes.rs index 789fdedaa655cf1c825f18a9984319261b221a1b..20af87167204fbd0d071e940d91abf0c53aade13 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -1890,8 +1890,8 @@ impl Inner { #[inline] fn is_shared(&mut self) -> bool { match self.kind() { - KIND_INLINE | KIND_ARC => true, - _ => false, + KIND_VEC => false, + _ => true, } } diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs index e1938ed9c4330f3048976be2efe18534d6697bf3..1a3435f2ef13b03bdeec544e5d8ffdf43c4a69ac 100644 --- a/tests/test_bytes.rs +++ b/tests/test_bytes.rs @@ -363,6 +363,15 @@ fn extend() { assert_eq!(*bytes, LONG[..]); } +#[test] +fn from_static() { + let mut a = Bytes::from_static(b"ab"); + let b = a.split_off(1); + + assert_eq!(a, b"a"[..]); + assert_eq!(b, b"b"[..]); +} + #[test] // Only run these tests on little endian systems. CI uses qemu for testing // little endian... and qemu doesn't really support threading all that well.