From f3816f86d252cf5eac4acc76eb4b2c3a4080b108 Mon Sep 17 00:00:00 2001 From: Mat Sadler Date: Mon, 18 Sep 2023 16:48:27 -0700 Subject: [PATCH] fix compile error in bytes feature --- CHANGELOG.md | 7 ++++++- Cargo.toml | 2 +- src/r_string.rs | 2 +- tests/bytes.rs | 5 ++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df23c4c7..fd567c84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ ### Security +## [0.6.2] - 2023-09-18 +### Fixed +- Compliation error in `bytes` feature. + ## [0.6.1] - 2023-08-20 ### Changed - Support `rb-sys`' `stable-api` feature. @@ -439,7 +443,8 @@ - Pre-built bindings for Ruby 2.6 - 3.1 on common platforms, build-time generated bindings otherwise. -[Unreleased]: https://github.com/matsadler/magnus/compare/0.6.1...HEAD +[Unreleased]: https://github.com/matsadler/magnus/compare/0.6.2...HEAD +[0.6.2]: https://github.com/matsadler/magnus/compare/0.6.1...0.6.2 [0.6.1]: https://github.com/matsadler/magnus/compare/0.6.0...0.6.1 [0.5.5]: https://github.com/matsadler/magnus/compare/0.5.4...0.5.5 [0.6.0]: https://github.com/matsadler/magnus/compare/0.5.3...0.6.0 diff --git a/Cargo.toml b/Cargo.toml index 82c874aa..f0e97427 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ rb-sys = { version = "0.9.81", default-features = false, features = ["bindgen-rb seq-macro = "0.3" [dev-dependencies] -magnus = { path = ".", features = ["embed", "rb-sys"] } +magnus = { path = ".", features = ["embed", "rb-sys", "bytes"] } rb-sys = { version = "0.9", default-features = false, features = ["stable-api-compiled-fallback"] } [build-dependencies] diff --git a/src/r_string.rs b/src/r_string.rs index cca751fd..6dfdc64c 100644 --- a/src/r_string.rs +++ b/src/r_string.rs @@ -1743,7 +1743,7 @@ unsafe impl IntoValueFromNative for &str {} impl IntoValue for bytes::Bytes { #[inline] fn into_value_with(self, handle: &Ruby) -> Value { - handle.str_from_slice(self.as_ref()).into() + handle.str_from_slice(self.as_ref()).into_value_with(handle) } } diff --git a/tests/bytes.rs b/tests/bytes.rs index 3eb962ae..df097541 100644 --- a/tests/bytes.rs +++ b/tests/bytes.rs @@ -1,10 +1,9 @@ #[test] -#[cfg(feature = "bytes")] fn it_converts_to_bytes() { - use magnus::{eval, RString}; + use magnus::RString; let ruby = unsafe { magnus::embed::init() }; - let s: RString = unsafe { ruby.eval("[0,0,0].pack('c*')").unwrap() }; + let s: RString = ruby.eval("[0,0,0].pack('c*')").unwrap(); assert_eq!(bytes::Bytes::from_static(&[0, 0, 0]), s.to_bytes()); }