| 1 |
# Copyright 2018 The Fuchsia Authors |
| 2 |
# |
| 3 |
# Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 |
| 4 |
# <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT |
| 5 |
# license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. |
| 6 |
# This file may not be copied, modified, or distributed except according to |
| 7 |
# those terms. |
| 8 |
|
| 9 |
# Put both crates in a single workspace so that `trybuild` compiler errors have |
| 10 |
# paths that are stable regardless of the path to the repository root. This |
| 11 |
# avoids issues like: |
| 12 |
# https://github.com/dtolnay/trybuild/issues/207#issuecomment-131227.594 |
| 13 |
[workspace] |
| 14 |
|
| 15 |
[package] |
| 16 |
edition = "2021" |
| 17 |
name = "zerocopy" |
| 18 |
version = "0.8.36" |
| 19 |
authors = [ |
| 20 |
"Joshua Liebow-Feeser <[email protected]>", |
| 21 |
"Jack Wrenn <[email protected]>", |
| 22 |
] |
| 23 |
description = "Zerocopy makes zero-cost memory manipulation effortless. We write \"unsafe\" so you don't have to." |
| 24 |
categories = [ |
| 25 |
"embedded", |
| 26 |
"encoding", |
| 27 |
"no-std::no-alloc", |
| 28 |
"parsing", |
| 29 |
"rust-patterns", |
| 30 |
] |
| 31 |
keywords = ["cast", "convert", "transmute", "transmutation", "type-punning"] |
| 32 |
license = "BSD-2-Clause OR Apache-2.0 OR MIT" |
| 33 |
repository = "https://github.com/google/zerocopy" |
| 34 |
rust-version = "1.56.0" |
| 35 |
|
| 36 |
exclude = [".*"] |
| 37 |
|
| 38 |
[package.metadata.build-rs] |
| 39 |
# These key/value pairs are parsed by `build.rs`. Each entry names a `--cfg` |
| 40 |
# which will be emitted if zerocopy is built with a toolchain version *lower* |
| 41 |
# than the specified version. In the emitted `--cfg`, dashes are replaced by |
| 42 |
# underscores. |
| 43 |
# |
| 44 |
# Each name is suffixed with the version it corresponds to. This is a convention |
| 45 |
# used in the codebase to make it less likely for us to make mistakes when |
| 46 |
# writing `doc_cfg` attributes. |
| 47 |
# |
| 48 |
# It may seem odd to name cfgs `no-zerocopy-foo` and emit these cfgs on |
| 49 |
# toolchains lower than that target toolchain. We do this because it is |
| 50 |
# friendlier to users who compile zerocopy by directly invoking rustc or by |
| 51 |
# invoking rustc from a build system other than Cargo. If such a user provides |
| 52 |
# no `--cfg` arguments, then, assuming they are on a sufficiently recent |
| 53 |
# toolchain, everything will "just work" without requiring extra configuration. |
| 54 |
# See [1] for an example of a user upgrading from a version of zerocopy which |
| 55 |
# did things in the inverse way. See #2259 for more context. |
| 56 |
# |
| 57 |
# [1] https://fuchsia-review.googlesource.com/c/fuchsia/+/1433139/1/third_party/rust_crates/Cargo.toml |
| 58 |
|
| 59 |
|
| 60 |
# From 1.89.0, Rust supports x86 AVX-12 SIMD types (previously gated by the |
| 61 |
# `stdarch_x86_avx512` feature). |
| 62 |
no-zerocopy-simd-x86-avx12-1-89-0 = "1.89.0" |
| 63 |
|
| 64 |
# From 1.81.0, Rust supports the `core::error::Error` trait. |
| 65 |
no-zerocopy-core-error-1-81-0 = "1.81.0" |
| 66 |
|
| 67 |
# From 1.78.0, Rust supports the `#[diagnostic::on_unimplemented]` attribute. |
| 68 |
no-zerocopy-diagnostic-on-unimplemented-1-78-0 = "1.78.0" |
| 69 |
|
| 70 |
# From 1.61.0, Rust supports generic types with trait bounds in `const fn`. |
| 71 |
no-zerocopy-generic-bounds-in-const-fn-1-61-0 = "1.61.0" |
| 72 |
|
| 73 |
# From 1.60.0, Rust supports `cfg(target_has_atomics)`, which allows us to |
| 74 |
# detect whether a target supports particular sets of atomics. |
| 75 |
no-zerocopy-target-has-atomics-1-60-0 = "1.60.0" |
| 76 |
|
| 77 |
# When the "simd" feature is enabled, include SIMD types from the |
| 78 |
# `core::arch::aarch64` module, which was stabilized in 1.59.0. On earlier Rust |
| 79 |
# versions, these types require the "simd-nightly" feature. |
| 80 |
no-zerocopy-aarch64-simd-1-59-0 = "1.59.0" |
| 81 |
|
| 82 |
# Permit panicking in `const fn`s and calling `Vec::try_reserve`. |
| 83 |
no-zerocopy-panic-in-const-and-vec-try-reserve-1-57-0 = "1.57.0" |
| 84 |
|
| 85 |
[package.metadata.ci] |
| 86 |
# The versions of the stable and nightly compiler toolchains to use in CI. |
| 87 |
pinned-stable = "1.93.0" |
| 88 |
pinned-nightly = "nightly-2026-01-25" |
| 89 |
|
| 90 |
[package.metadata.docs.rs] |
| 91 |
all-features = true |
| 92 |
rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"] |
| 93 |
|
| 94 |
[package.metadata.playground] |
| 95 |
features = ["__internal_use_only_features_that_work_on_stable"] |
| 96 |
|
| 97 |
[features] |
| 98 |
alloc = [] |
| 99 |
derive = ["zerocopy-derive"] |
| 100 |
simd = [] |
| 101 |
simd-nightly = ["simd"] |
| 102 |
float-nightly = [] |
| 103 |
std = ["alloc"] |
| 104 |
# This feature depends on all other features that work on the stable compiler. |
| 105 |
# We make no stability guarantees about this feature; it may be modified or |
| 106 |
# removed at any time. |
| 107 |
__internal_use_only_features_that_work_on_stable = [ |
| 108 |
"alloc", |
| 109 |
"derive", |
| 110 |
"simd", |
| 111 |
"std", |
| 112 |
] |
| 113 |
|
| 114 |
[dependencies] |
| 115 |
zerocopy-derive = { version = "=0.8.36", path = "zerocopy-derive", optional = true } |
| 116 |
|
| 117 |
# The "associated proc macro pattern" ensures that the versions of zerocopy and |
| 118 |
# zerocopy-derive remain equal, even if the 'derive' feature isn't used. |
| 119 |
# See: https://github.com/matklad/macro-dep-test |
| 120 |
[target.'cfg(any())'.dependencies] |
| 121 |
zerocopy-derive = { version = "=0.8.36", path = "zerocopy-derive" } |
| 122 |
|
| 123 |
[dev-dependencies] |
| 124 |
# FIXME(#381) Remove this dependency once we have our own layout gadgets. |
| 125 |
elain = "0.3.0" |
| 126 |
itertools = "0.11" |
| 127 |
rand = { version = "0.8.5", default-features = false, features = ["small_rng"] } |
| 128 |
rustversion = "1.0" |
| 129 |
static_assertions = "1.1" |
| 130 |
testutil = { path = "testutil" } |
| 131 |
# Pinned to a specific version so that the version used for local development |
| 132 |
# and the version used in CI are guaranteed to be the same. Future versions |
| 133 |
# sometimes change the output format slightly, so a version mismatch can cause |
| 134 |
# CI test failures. |
| 135 |
trybuild = { version = "=1.0.89", features = ["diff"] } |
| 136 |
# In tests, unlike in production, zerocopy-derive is not optional |
| 137 |
zerocopy-derive = { version = "=0.8.36", path = "zerocopy-derive" } |