diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e7ac0684..408220f5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -4,7 +4,7 @@ on: pull_request: jobs: - build: + build-stable: runs-on: ${{ matrix.os }} strategy: matrix: @@ -59,3 +59,28 @@ jobs: # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos # working-directory: ./safetensors # fail_ci_if_error: true + + build-msrv: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./safetensors + env: + MSRV: "1.74" + + steps: + - uses: actions/checkout@v3 + + - name: Install Rust ${{ env.MSRV }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.MSRV }} + override: true + + - uses: Swatinem/rust-cache@v2 + + - name: Build + run: cargo build --all-targets --verbose + + - name: Run Tests + run: cargo test --verbose diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index a1dadeed..de7692bc 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -2,6 +2,7 @@ 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] diff --git a/safetensors/Cargo.toml b/safetensors/Cargo.toml index 037104a3..dd303d65 100644 --- a/safetensors/Cargo.toml +++ b/safetensors/Cargo.toml @@ -2,6 +2,7 @@ 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/" diff --git a/safetensors/src/tensor.rs b/safetensors/src/tensor.rs index bee71782..42d59e04 100644 --- a/safetensors/src/tensor.rs +++ b/safetensors/src/tensor.rs @@ -64,8 +64,12 @@ impl core::fmt::Display for SafeTensorError { } } +#[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,