1[package]
2name = "portable-atomic"
3version = "1.6.0" #publish:version
4edition = "2018"
5rust-version = "1.34"
6license = "Apache-2.0 OR MIT"
7repository = "https://github.com/taiki-e/portable-atomic"
8keywords = ["atomic"]
9categories = ["concurrency", "embedded", "hardware-support", "no-std", "no-std::no-alloc"]
10exclude = ["/.*", "/tools", "/target-specs", "/DEVELOPMENT.md"]
11description = """
12Portable atomic types including support for 128-bit atomics, atomic float, etc.
13"""
14
15[package.metadata.docs.rs]
16# NB: sync with:
17# - env.TEST_FEATURES in .github/workflows/ci.yml.
18# - test_features list in tools/build.sh and tools/test.sh.
19features = ["float", "std", "serde", "critical-section"]
20rustdoc-args = ["--cfg", "portable_atomic_doc_cfg"]
21targets = ["x86_64-unknown-linux-gnu"]
22
23[package.metadata.cargo_check_external_types]
24# The following are external types that are allowed to be exposed in our public API.
25allowed_external_types = [
26 "serde::*",
27]
28
29[lib]
30doc-scrape-examples = false
31
32[features]
33default = ["fallback"]
34
35# (enabled by default) Enable fallback implementations.
36#
37# Disabling this allows only atomic types for which the platform natively supports atomic operations.
38fallback = []
39
40# Provide `AtomicF{32,64}`.
41#
42# See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-float
43float = []
44
45# Use `std`.
46std = []
47
48# Emit compile error if atomic CAS is not available.
49#
50# See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-require-cas
51require-cas = []
52
53# Assume the target is single core, to enable implementations based on disabling interrupts.
54# IMPORTANT: This feature is unsafe. See the documentation for the safety contract:
55# https://github.com/taiki-e/portable-atomic#optional-features-unsafe-assume-single-core
56unsafe-assume-single-core = []
57
58# The following are sub-features of the unsafe-assume-single-core feature and if enabled without
59# the unsafe-assume-single-core feature will result in a compile error.
60# There is no explicit "unsafe-" prefix because the user has already opted in to "unsafe" by
61# enabling the unsafe-assume-single-core feature, but misuse of these features is also usually
62# considered unsound.
63# See the interrupt module's readme for more: https://github.com/taiki-e/portable-atomic/blob/HEAD/src/imp/interrupt/README.md
64
65# For RISC-V targets, generate code for S mode to disable interrupts.
66s-mode = []
67# For RISC-V targets, use AMO instructions even if A-extension is disabled.
68# This feature requires Rust 1.72+.
69force-amo = []
70# For ARM targets, also disable FIQs when disabling interrupts.
71disable-fiq = []
72
73# Note: serde and critical-section are public dependencies.
74[dependencies]
75# Implements serde::{Serialize,Deserialize} for atomic types.
76#
77# See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-serde
78serde = { version = "1.0.103", optional = true, default-features = false }
79
80# Use `critical-section`.
81#
82# See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-critical-section
83critical-section = { version = "1", optional = true }
84
85[dev-dependencies]
86test-helper = { path = "tests/helper", features = ["std"] }
87
88build-context = "0.1"
89crossbeam-utils = "0.8"
90fastrand = "2"
91paste = "1"
92quickcheck = { default-features = false, git = "https://github.com/taiki-e/quickcheck.git", branch = "dev" } # https://github.com/BurntSushi/quickcheck/pull/304 + https://github.com/BurntSushi/quickcheck/pull/282 + lower MSRV
93sptr = "0.3"
94static_assertions = "1"
95
96[lints]
97workspace = true
98
99[workspace]
100members = [
101 "bench",
102 "portable-atomic-util",
103 "tests/api-test",
104 "tests/helper",
105 "tools/codegen",
106]
107
108# This table is shared by projects under https://github.com/taiki-e.
109# It is not intended for manual editing.
110[workspace.lints.rust]
111improper_ctypes = "warn"
112improper_ctypes_definitions = "warn"
113non_ascii_idents = "warn"
114rust_2018_idioms = "warn"
115single_use_lifetimes = "warn"
116unreachable_pub = "warn"
117# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV
118[workspace.lints.clippy]
119all = "warn" # Downgrade deny-by-default lints
120pedantic = "warn"
121as_ptr_cast_mut = "warn"
122default_union_representation = "warn"
123inline_asm_x86_att_syntax = "warn"
124trailing_empty_array = "warn"
125transmute_undefined_repr = "warn"
126undocumented_unsafe_blocks = "warn"
127# Suppress buggy or noisy clippy lints
128borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286
129doc_markdown = { level = "allow", priority = 1 }
130float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725
131manual_assert = { level = "allow", priority = 1 }
132manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395
133missing_errors_doc = { level = "allow", priority = 1 }
134module_name_repetitions = { level = "allow", priority = 1 }
135similar_names = { level = "allow", priority = 1 }
136single_match = { level = "allow", priority = 1 }
137single_match_else = { level = "allow", priority = 1 }
138struct_excessive_bools = { level = "allow", priority = 1 }
139too_many_arguments = { level = "allow", priority = 1 }
140too_many_lines = { level = "allow", priority = 1 }
141type_complexity = { level = "allow", priority = 1 }
142