Skip to content

Commit

Permalink
properly import alloc::vec in no-std+alloc. Fixes #107
Browse files Browse the repository at this point in the history
  • Loading branch information
starkat99 committed Apr 6, 2024
1 parent 41cb0f4 commit 2841ec4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- run:
name: cargo test no_std
command: cargo -v test --no-default-features -- --nocapture
- run:
name: cargo test no_std+alloc
command: cargo -v test --no-default-features --features alloc -- --nocapture

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Missing macro import causing build failure on `no_std` + `alloc` feature set. Fixes [#107].

## [2.4.0] - 2024-02-25 <a name="2.4.0"></a>
### Added
Expand Down Expand Up @@ -324,6 +326,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[#93]: https://github.com/starkat99/half-rs/issues/54
[#100]: https://github.com/starkat99/half-rs/issues/100
[#103]: https://github.com/starkat99/half-rs/issues/103
[#107]: https://github.com/starkat99/half-rs/issues/107

[@tspiteri]: https://github.com/tspiteri
[@PSeitz]: https://github.com/PSeitz
Expand Down
22 changes: 21 additions & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ args = [

# Build & Test with no features enabled
[tasks.post-ci-flow]
run_task = [{ name = ["check-docs", "build-no-std", "test-no-std"] }]
run_task = [
{ name = [
"check-docs",
"build-no-std",
"test-no-std",
"build-no-std-alloc",
"test-no-std-alloc",
] },
]

[tasks.build-no-std]
description = "Build without any features"
Expand All @@ -56,3 +64,15 @@ description = "Run tests without any features"
category = "Test"
env = { CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--no-default-features" }
run_task = "test"

[tasks.build-no-std-alloc]
description = "Build without any features except alloc"
category = "Build"
env = { CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--no-default-features --features alloc" }
run_task = "build"

[tasks.test-no-std-alloc]
description = "Run tests without any features except alloc"
category = "Test"
env = { CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--no-default-features --features alloc" }
run_task = "test"
2 changes: 1 addition & 1 deletion src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use crate::{bf16, binary16::arch, f16};
#[cfg(feature = "alloc")]
#[allow(unused_imports)]
use alloc::vec::Vec;
use alloc::{vec, vec::Vec};
use core::slice;

/// Extensions to `[f16]` and `[bf16]` slices to support conversion and reinterpret operations.
Expand Down
2 changes: 1 addition & 1 deletion src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use super::{bf16, f16, slice::HalfFloatSliceExt};
#[cfg(feature = "alloc")]
#[allow(unused_imports)]
use alloc::vec::Vec;
use alloc::{vec, vec::Vec};
use core::mem;

/// Extensions to [`Vec<f16>`] and [`Vec<bf16>`] to support reinterpret operations.
Expand Down

0 comments on commit 2841ec4

Please sign in to comment.