From e3fdb814be068e30171941063e356d642b9ed2a0 Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Thu, 29 Jul 2021 15:53:41 +1000 Subject: [PATCH 1/2] Add documentation about smartstring being arch-dependent --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index ace4e3b..ec58799 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,19 @@ when not inlined it's pointer compatible with `String`, meaning that you can saf if it had never been a `SmartString`. (But please don't do that, there's an `Into` implementation that's much safer.) +## Supported architectures +`smartstring` currently doesn't build on 32-bit big endian architectures like `powerpc`, so its use +in any crates that intend to run on those architectures should ideally be gated behind a +[platform specific dependency](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies) +in your `Cargo.toml`, like so: +```toml +[target.'cfg(not(all(target_endian = "big", target_pointer_width = "32")))'.dependencies] +smartstring = "0.2" +``` + +This will ensure that `cargo` does not try to build `smartstring` on these unsupported +architectures, which will otherwise [always fail](https://github.com/bodil/smartstring/blob/v0.2.9/src/config.rs#L91-L93). + ## Caveat The way `smartstring` gets by without a discriminant is dependent on the memory layout of the From 38718f0444ecad0c63494c221a47569f81d97ef7 Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Thu, 29 Jul 2021 15:56:42 +1000 Subject: [PATCH 2/2] change "build" to "run" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec58799..1776193 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ if it had never been a `SmartString`. (But please don't do that, there's an `Int implementation that's much safer.) ## Supported architectures -`smartstring` currently doesn't build on 32-bit big endian architectures like `powerpc`, so its use +`smartstring` currently doesn't run on 32-bit big endian architectures like `powerpc`, so its use in any crates that intend to run on those architectures should ideally be gated behind a [platform specific dependency](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies) in your `Cargo.toml`, like so: