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]
16edition = "2021"
17name = "zerocopy"
18version = "0.8.17"
19authors = ["Joshua Liebow-Feeser <joshlf@google.com>"]
20description = "Zerocopy makes zero-cost memory manipulation effortless. We write \"unsafe\" so you don't have to."
21categories = ["embedded", "encoding", "no-std::no-alloc", "parsing", "rust-patterns"]
22keywords = ["cast", "convert", "transmute", "transmutation", "type-punning"]
23license = "BSD-2-Clause OR Apache-2.0 OR MIT"
24repository = "https://github.com/google/zerocopy"
25rust-version = "1.56.0"
26
27exclude = [".*"]
28
29[package.metadata.build-rs]
30# These key/value pairs are parsed by `build.rs`. Each entry names a `--cfg`
31# which will be emitted if zerocopy is built with a toolchain version at least
32# as high as the specified version. In the emitted `--cfg`, dashes are replaced
33# by underscores.
34#
35# Each name is suffixed with the version it corresponds to. This is a convention
36# used in the codebase to make it less likely for us to make mistakes when
37# writing `doc_cfg` attributes.
38
39# From 1.81.0, Rust supports the `core::error::Error` trait.
40zerocopy-core-error-1-81-0 = "1.81.0"
41
42# From 1.78.0, Rust supports the `#[diagnostic::on_unimplemented]` attribute.
43zerocopy-diagnostic-on-unimplemented-1-78-0 = "1.78.0"
44
45# From 1.61.0, Rust supports generic types with trait bounds in `const fn`.
46zerocopy-generic-bounds-in-const-fn-1-61-0 = "1.61.0"
47
48# From 1.60.0, Rust supports `cfg(target_has_atomics)`, which allows us to
49# detect whether a target supports particular sets of atomics.
50zerocopy-target-has-atomics-1-60-0 = "1.60.0"
51
52# When the "simd" feature is enabled, include SIMD types from the
53# `core::arch::aarch64` module, which was stabilized in 1.59.0. On earlier Rust
54# versions, these types require the "simd-nightly" feature.
55zerocopy-aarch64-simd-1-59-0 = "1.59.0"
56
57# Permit panicking in `const fn`s and calling `Vec::try_reserve`.
58zerocopy-panic-in-const-and-vec-try-reserve-1-57-0 = "1.57.0"
59
60[package.metadata.ci]
61# The versions of the stable and nightly compiler toolchains to use in CI.
62pinned-stable = "1.84.1"
63pinned-nightly = "nightly-2024-11-06"
64
65[package.metadata.docs.rs]
66all-features = true
67rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"]
68
69[package.metadata.playground]
70features = ["__internal_use_only_features_that_work_on_stable"]
71
72[features]
73alloc = []
74derive = ["zerocopy-derive"]
75simd = []
76simd-nightly = ["simd"]
77float-nightly = []
78std = ["alloc"]
79# This feature depends on all other features that work on the stable compiler.
80# We make no stability guarantees about this feature; it may be modified or
81# removed at any time.
82__internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd", "std"]
83
84[dependencies]
85zerocopy-derive = { version = "=0.8.17", path = "zerocopy-derive", optional = true }
86
87# The "associated proc macro pattern" ensures that the versions of zerocopy and
88# zerocopy-derive remain equal, even if the 'derive' feature isn't used.
89# See: https://github.com/matklad/macro-dep-test
90[target.'cfg(any())'.dependencies]
91zerocopy-derive = { version = "=0.8.17", path = "zerocopy-derive" }
92
93[dev-dependencies]
94itertools = "0.11"
95rand = { version = "0.8.5", default-features = false, features = ["small_rng"] }
96rustversion = "1.0"
97static_assertions = "1.1"
98testutil = { path = "testutil" }
99# Pinned to a specific version so that the version used for local development
100# and the version used in CI are guaranteed to be the same. Future versions
101# sometimes change the output format slightly, so a version mismatch can cause
102# CI test failures.
103trybuild = { version = "=1.0.89", features = ["diff"] }
104# In tests, unlike in production, zerocopy-derive is not optional
105zerocopy-derive = { version = "=0.8.17", path = "zerocopy-derive" }
106# TODO(#381) Remove this dependency once we have our own layout gadgets.
107elain = "0.3.0"
108