Skip to content

Commit

Permalink
add no_std to alloc contexts
Browse files Browse the repository at this point in the history
commit 69c25f0 made it so libm
no longer included in std features and is moved to an explicit
no_std feature, however this broke the build and is confusing for
no_std docs. no_std docs force using "alloc", relatedly everywhere
we use "alloc" we should also use "no_std".
  • Loading branch information
rexmas committed Oct 17, 2024
1 parent 772e647 commit 70e067a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: cd proptest && cargo build --lib --no-default-features --features std
- name: Build rng no-default-features
if: ${{ matrix.build == 'nightly' }}
run: cd proptest && cargo build --no-default-features --features "alloc unstable hardware-rng"
run: cd proptest && cargo build --no-default-features --features "no_std alloc unstable hardware-rng"
- name: Run persistence tests
if: ${{ matrix.build == 'nightly' }}
run: cd proptest/test-persistence-location && ./run-tests.sh
Expand Down
2 changes: 1 addition & 1 deletion book/src/proptest/no-std.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default-features = false
# alloc: Use the `alloc` crate directly. Proptest has a hard requirement on
# memory allocation, so either this or `std` is needed.
# unstable: Enable use of nightly-only compiler features.
features = ["alloc", "unstable"]
features = ["no_std", "alloc", "unstable"]
```

Some APIs are not available in the `no_std` build. This includes functionality
Expand Down
2 changes: 1 addition & 1 deletion prerelease-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -eux
cd proptest
cargo clean
cargo +nightly build --target thumbv7em-none-eabihf \
--no-default-features --features 'alloc unstable'
--no-default-features --features 'no_std alloc unstable'
cargo clean
cargo +nightly build --target wasm32-unknown-emscripten \
--no-default-features --features std
Expand Down
5 changes: 2 additions & 3 deletions proptest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ attr-macro = ["proptest-macro"]
unstable = []

# Enables the use of standard-library dependent features
std = ["rand/std", "lazy_static",
"regex-syntax", "num-traits/std"]
std = ["rand/std", "lazy_static", "regex-syntax", "num-traits/std"]

# std or libm required for mul_add.
no_std = ["num-traits/libm"]
Expand All @@ -57,7 +56,7 @@ timeout = ["fork", "rusty-fork/timeout"]
# need it excluded, however.
atomic64bit = []

bit-set = [ "dep:bit-set", "dep:bit-vec" ]
bit-set = ["dep:bit-set", "dep:bit-vec"]

[dependencies]
bitflags = "2"
Expand Down
2 changes: 1 addition & 1 deletion proptest/gen-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -eux
if test "$1" = "nostd"; then
crate=proptest-nostd
cargo='cargo +nightly'
cargoflags='--no-default-features --features=alloc,unstable'
cargoflags='--no-default-features --features=no_std,alloc,unstable'
else
crate=proptest
cargo=cargo
Expand Down

0 comments on commit 70e067a

Please sign in to comment.