* Restore compatibility with Rust 1.74
PR #544 added support for `no_std` feature. The PR changed
`std::error::Error` to `core::error::Error`. The `core::error` trait was
stabilized in Rust 1.81, so the change bumped MSRV to 1.81. Before the
Python package built with Rust 1.66 and the `safetensors` create with
all features built with 1.74.
This commit restores compatibility with Rust 1.74 for `std` builds:
- `mixed_integer_ops` feature requires 1.66
- `half v2.4.1` requires 1.70
- `clap_lex v0.7.4` requires 1.74
I'm also adding `rust-version` to `Cargo.toml`, so cargo creates a
backwards compatible `Cargo.lock`. By default, Cargo >= 1.83 creates a
`v4` lock file, which is not compatible with Cargo < 1.78.
Signed-off-by: Christian Heimes <christian@python.org>
* Merging the test matrix.
---------
Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Nicolas Patry <patry.nicolas@protonmail.com>
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
+ toolchain: [stable]
+ include:
+ - os: ubuntu-latest
+ toolchain: "1.74"
defaults:
run:
working-directory: ./safetensors
name = "safetensors-python"
version = "0.5.3-dev.0"
edition = "2021"
+rust-version = "1.74"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "safetensors"
version = "0.5.3-dev.0"
edition = "2021"
+rust-version = "1.74"
homepage = "https://github.com/huggingface/safetensors"
repository = "https://github.com/huggingface/safetensors"
documentation = "https://docs.rs/safetensors/"
}
}
+#[cfg(not(feature = "std"))]
impl core::error::Error for SafeTensorError {}
+#[cfg(feature = "std")]
+impl std::error::Error for SafeTensorError {}
+
struct PreparedData {
n: u64,
header_bytes: Vec<u8>,