◐ Shell
clean mode source ↗

no_std for wtf8, sre_engine, compiler-core, literal by youknowone · Pull Request #7051 · RustPython/RustPython

🧩 Analysis chain

🏁 Script executed:

fd 'Cargo.toml' crates/wtf8 --exec cat {}

Repository: RustPython/RustPython

Length of output: 458


🏁 Script executed:

grep -A 50 '\[workspace\.dependencies\]' Cargo.toml | head -100

Repository: RustPython/RustPython

Length of output: 2625


🏁 Script executed:

# Check the actual lib.rs to see import usage and configuration
head -100 crates/wtf8/src/lib.rs

Repository: RustPython/RustPython

Length of output: 3814


🏁 Script executed:

# Check how itertools and bstr are used in the code
rg -n "itertools::" crates/wtf8/src/ -A 2

Repository: RustPython/RustPython

Length of output: 211


🏁 Script executed:

# Search for actual usage of Either, Itertools, ByteSlice, ByteVec
rg "Either|Itertools|ByteSlice|ByteVec" crates/wtf8/src/ --max-count=20

Repository: RustPython/RustPython

Length of output: 364


🏁 Script executed:

# Check for any cargo features or configuration related to no_std in wtf8
rg "feature\|no_std" crates/wtf8/ -B 2 -A 2

Repository: RustPython/RustPython

Length of output: 47


🏁 Script executed:

# Check if there are any tests or CI configuration that builds with no_std
fd 'Cargo.toml|\.rs' crates/wtf8 --exec grep -l "no_std\|no-std" {}

Repository: RustPython/RustPython

Length of output: 87


🏁 Script executed:

# Let's check if bstr crate documentation or source indicates no_std requirements
# First, let me see if there's a Cargo.lock or any evidence of successful builds
git log --oneline crates/wtf8/Cargo.toml | head -5

Repository: RustPython/RustPython

Length of output: 122


🏁 Script executed:

# Check the commit that added no_std support to see what pattern was used
git show 2c5ece945 --stat | head -30

Repository: RustPython/RustPython

Length of output: 1737


🏁 Script executed:

# Check if wtf8 was included in that commit and see what changes were made
git show 2c5ece945 -- crates/wtf8/ | head -200

Repository: RustPython/RustPython

Length of output: 6676


🏁 Script executed:

# Check if there's any .cargo/config.toml configuration related to building crates
cat .cargo/config.toml | head -50

Repository: RustPython/RustPython

Length of output: 343


🏁 Script executed:

# Check if there are any actual usages of ascii and memchr
rg "ascii::|memchr::" crates/wtf8/src/ -A 2

Repository: RustPython/RustPython

Length of output: 1327


🏁 Script executed:

# Check if any of the dependencies have been explicitly configured for no_std elsewhere
# Let's search for how other no_std crates in the workspace handle dependencies
rg "default-features.*false" Cargo.toml | head -20

Repository: RustPython/RustPython

Length of output: 576


🏁 Script executed:

# Check if there are any tests or build configurations that verify no_std compilation
rg "no.std|no-std" . --type toml | head -20

Repository: RustPython/RustPython

Length of output: 47


🏁 Script executed:

# Let me verify if these specific dependency versions support no_std out of the box
# by checking their documentation or configuration patterns used elsewhere in the repo
python3 << 'EOF'
# Check if other crates in the workspace use similar dependencies
import subprocess
import re

# Search for patterns of how dependencies are configured in Cargo.toml files
result = subprocess.run(['rg', 'ascii|bstr|itertools|memchr', '--type', 'toml', '-B2', '-A2'], 
                       capture_output=True, text=True)
print(result.stdout)
EOF

Repository: RustPython/RustPython

Length of output: 47


🌐 Web query:

itertools 0.14.0 no_std alloc feature requirements

💡 Result:

For itertools = 0.14.0, std is enabled by default (default = ["use_std"]). The crate’s features are: use_std (which implies use_alloc) and use_alloc alone. [1][2]

no_std + alloc (no std)

Use default-features = false and enable use_alloc:

[dependencies]
itertools = { version = "0.14.0", default-features = false, features = ["use_alloc"] }

This avoids use_std (and thus avoids enabling either/use_std) while allowing the parts of itertools that rely on alloc. [1][2]

no_std without alloc (core-only)

Disable default features and don’t enable use_alloc:

[dependencies]
itertools = { version = "0.14.0", default-features = false }

(You can only use the subset of itertools that doesn’t require allocation.) [1][2]

Note: In a #![no_std] binary, alloc-using code also requires that your target provides the alloc crate and that you have a global allocator available at link/runtime. [1]

Sources: [1] Cargo.toml for itertools 0.14.0 on docs.rs, [2] docs.rs feature flags page.


itertools requires explicit no_std configuration — add default-features = false, features = ["use_alloc"] to the workspace dependency.

The crate uses #![no_std] with itertools::Either and itertools::Itertools, but itertools 0.14.0 defaults to use_std. Update the workspace dependency in Cargo.toml:

The other dependencies (ascii, bstr, memchr) support no_std with their default configurations.