Files
regalloc2/Cargo.toml
Amanieu d'Antras 2bd03256b3 Make regalloc2 #![no_std] (#119)
* Make regalloc2 `#![no_std]`

This crate doesn't require any features from the standard library, so it
can be made `no_std` to allow it to be used in environments that can't
use the Rust standard library.

This PR mainly performs the following mechanical changes:
- `std::collections` is replaced with `alloc::collections`.
- `std::*` is replaced with `core::*`.
- `Vec`, `vec!`, `format!` and `ToString` are imported when needed since
  they are no longer in the prelude.
- `HashSet` and `HashMap` are taken from the `hashbrown` crate, which is
  the same implementation that the standard library uses.
- `FxHashSet` and `FxHashMap` are typedefs in `lib.rs` that are based on
  the `hashbrown` types.

The only functional change is that `RegAllocError` no longer implements
the `Error` trait since that is not available in `core`.

Dependencies were adjusted to not require `std` and this is tested in CI
by building against the `thumbv6m-none-eabi` target that doesn't have
`std`.

* Add the Error trait impl back under a "std" feature
2023-03-09 11:25:59 -08:00

52 lines
1.4 KiB
TOML

[package]
name = "regalloc2"
version = "0.6.1"
authors = [
"Chris Fallin <chris@cfallin.org>",
"Mozilla SpiderMonkey Developers",
]
edition = "2018"
license = "Apache-2.0 WITH LLVM-exception"
description = "Backtracking register allocator inspired from IonMonkey"
repository = "https://github.com/bytecodealliance/regalloc2"
[dependencies]
log = { version = "0.4.8", default-features = false }
smallvec = { version = "1.6.1", features = ["union"] }
rustc-hash = { version = "1.1.0", default-features = false }
slice-group-by = { version = "0.3.0", default-features = false }
hashbrown = "0.13.2"
# Optional serde support, enabled by feature below.
serde = { version = "1.0.136", features = [
"derive",
"alloc",
], default-features = false, optional = true }
# The below are only needed for fuzzing.
libfuzzer-sys = { version = "0.4.2", optional = true }
# When testing regalloc2 by itself, enable debug assertions and overflow checks
[profile.release]
debug = true
debug-assertions = true
overflow-checks = true
[features]
default = ["std"]
# Enables std-specific features such as the Error trait for RegAllocError.
std = []
# Enables generation of DefAlloc edits for the checker.
checker = []
# Enables detailed logging which can be somewhat expensive.
trace-log = []
# Exposes the internal API for fuzzing.
fuzzing = ["libfuzzer-sys", "checker", "trace-log"]
# Enables serde for exposed types.
enable-serde = ["serde"]