blob: 8c4a541a5d26377f9e6cd8a3b768edb22f706e44 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/components.gni")
import("//build/rust/rustc_library.gni")
# TODO(https://fxbug.dev/323626438): Remove the cstr crate when all use cases for the cstr!()
# can be supported directly by C-string literals.
#
# In general, C-string literals should be preferred over using the cstr!() macro. There are
# however some cases where C-string literals are known not to be sufficient:
#
# - inside of a token tree parsed by the syn crate: https://github.com/dtolnay/syn/issues/1502
# - creating a C-string literal from an identifier inside of a macro implementation,
# i.e., stringify!() does not have a C-string literal equivalent.
#
cstr_full_deps_allowlist = [
"//src/connectivity/network/netstack-proxy:*",
"//src/connectivity/wlan/lib/mlme/rust:*",
"//src/lib/cstr:*",
"//src/lib/pty:*",
"//src/lib/trace/rust/bench:*",
"//src/storage/fxfs/trace:*",
]
rustc_library("cstr") {
visibility = cstr_full_deps_allowlist
with_unit_tests = true
edition = "2021"
deps = [ "//third_party/rust_crates:static_assertions" ]
sources = [ "src/lib.rs" ]
}
fuchsia_unittest_package("cstr-test") {
deps = [ ":cstr_test" ]
test_specs = {
environments = [ emu_env ]
}
}
group("tests") {
testonly = true
deps = [ ":cstr-test" ]
}