diff --git a/src/bytes.rs b/src/bytes.rs index 789fded..20af871 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 e1938ed..1a3435f 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.