!14 cxx 1.0.91升级至1.0.97

Merge pull request !14 from Future/new1
This commit is contained in:
openharmony_ci 2024-04-08 15:02:32 +00:00 committed by Gitee
commit 33d722a9df
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
74 changed files with 1097 additions and 877 deletions

View File

@ -1,8 +1,11 @@
[repositories] [repositories]
repo = . root = .
prelude = tools/buck/prelude prelude = tools/buck/prelude
toolchains = tools/buck/toolchains toolchains = tools/buck/toolchains
ovr_config = tools/buck/prelude none = none
[repository_aliases]
config = prelude
buck = none buck = none
fbcode = none fbcode = none
fbsource = none fbsource = none
@ -11,7 +14,15 @@ fbsource = none
# Hide BUCK files under target/package/ from `buck build ...`. Otherwise: # Hide BUCK files under target/package/ from `buck build ...`. Otherwise:
# $ buck build ... # $ buck build ...
# //target/package/cxx-0.3.0/tests:ffi references non-existing file or directory 'target/package/cxx-0.3.0/tests/ffi/lib.rs' # //target/package/cxx-0.3.0/tests:ffi references non-existing file or directory 'target/package/cxx-0.3.0/tests/ffi/lib.rs'
ignore = target #
# Also hide some Bazel-managed directories that contain symlinks to the repo root.
ignore = \
.git, \
bazel-bin, \
bazel-cxx, \
bazel-out, \
bazel-testlogs, \
target
[parser] [parser]
target_platform_detector_spec = target://...->ovr_config//platforms:default target_platform_detector_spec = target:root//...->prelude//platforms:default

0
.buckroot Normal file
View File

View File

@ -3,6 +3,7 @@ name: CI
on: on:
push: push:
pull_request: pull_request:
workflow_dispatch:
schedule: [cron: "40 1 * * *"] schedule: [cron: "40 1 * * *"]
permissions: permissions:
@ -26,10 +27,10 @@ jobs:
- rust: stable - rust: stable
- rust: 1.60.0 - rust: 1.60.0
- rust: 1.64.0 - rust: 1.64.0
- name: macOS - name: Cargo on macOS
rust: nightly rust: nightly
os: macos os: macos
- name: Windows (msvc) - name: Cargo on Windows (msvc)
rust: nightly-x86_64-pc-windows-msvc rust: nightly-x86_64-pc-windows-msvc
os: windows os: windows
flags: /EHsc flags: /EHsc
@ -45,6 +46,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{matrix.rust}} toolchain: ${{matrix.rust}}
components: rust-src
- name: Determine test suite subset - name: Determine test suite subset
# Our Windows and macOS jobs are the longest running, so exclude the # Our Windows and macOS jobs are the longest running, so exclude the
# relatively slow compiletest from them to speed up end-to-end CI time, # relatively slow compiletest from them to speed up end-to-end CI time,
@ -69,31 +71,39 @@ jobs:
RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}} RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}}
buck: buck:
name: Buck name: Buck2 on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
runs-on: ubuntu-latest runs-on: ${{matrix.os}}-latest
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
timeout-minutes: 45 timeout-minutes: 45
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/install@reindeer with:
- uses: dtolnay/install@buck2 components: rust-src
- uses: dtolnay/install-buck2@latest
- name: Install lld - name: Install lld
run: sudo apt-get install lld run: sudo apt-get install lld
- run: cargo vendor --versioned-dirs --locked if: matrix.os == 'ubuntu'
working-directory: third-party - run: buck2 run demo
- run: buck2 build ...
- run: buck2 test ...
- uses: dtolnay/install@reindeer
if: matrix.os == 'ubuntu'
- run: reindeer buckify - run: reindeer buckify
if: matrix.os == 'ubuntu'
working-directory: third-party working-directory: third-party
- name: Check reindeer-generated BUCK file up to date - name: Check reindeer-generated BUCK file up to date
run: git diff --exit-code run: git diff --exit-code
- run: buck2 run demo if: matrix.os == 'ubuntu'
- run: buck2 build ...
- run: buck2 run tests:test
bazel: bazel:
name: Bazel name: Bazel on Linux
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
timeout-minutes: 45 timeout-minutes: 45
@ -117,7 +127,9 @@ jobs:
timeout-minutes: 45 timeout-minutes: 45
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@clippy - uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rust-src
- run: cargo clippy --workspace --tests -- -Dclippy::all - run: cargo clippy --workspace --tests -- -Dclippy::all
clang-tidy: clang-tidy:

View File

@ -7,6 +7,7 @@ on:
paths: paths:
- book/** - book/**
- .github/workflows/site.yml - .github/workflows/site.yml
workflow_dispatch:
jobs: jobs:
deploy: deploy:

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "tools/buck/prelude"] [submodule "tools/buck/prelude"]
path = tools/buck/prelude path = tools/buck/prelude
url = https://github.com/facebookincubator/buck2-prelude url = https://github.com/facebook/buck2-prelude

32
BUCK
View File

@ -1,6 +1,14 @@
export_file(
name = ".clippy.toml",
visibility = ["toolchains//:rust"],
)
rust_library( rust_library(
name = "cxx", name = "cxx",
srcs = glob(["src/**/*.rs"]), srcs = glob(["src/**/*.rs"]),
doc_deps = [
":cxx-build",
],
edition = "2018", edition = "2018",
features = [ features = [
"alloc", "alloc",
@ -9,19 +17,23 @@ rust_library(
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
deps = [ deps = [
":core", ":core",
":macro", ":cxxbridge-macro",
], ],
) )
rust_binary( alias(
name = "codegen", name = "codegen",
actual = ":cxxbridge",
visibility = ["PUBLIC"],
)
rust_binary(
name = "cxxbridge",
srcs = glob(["gen/cmd/src/**/*.rs"]) + [ srcs = glob(["gen/cmd/src/**/*.rs"]) + [
"gen/cmd/src/gen", "gen/cmd/src/gen",
"gen/cmd/src/syntax", "gen/cmd/src/syntax",
], ],
crate = "cxxbridge",
edition = "2018", edition = "2018",
visibility = ["PUBLIC"],
deps = [ deps = [
"//third-party:clap", "//third-party:clap",
"//third-party:codespan-reporting", "//third-party:codespan-reporting",
@ -37,15 +49,15 @@ cxx_library(
exported_headers = { exported_headers = {
"cxx.h": "include/cxx.h", "cxx.h": "include/cxx.h",
}, },
exported_linker_flags = ["-lstdc++"],
header_namespace = "rust", header_namespace = "rust",
preferred_linkage = "static",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( rust_library(
name = "macro", name = "cxxbridge-macro",
srcs = glob(["macro/src/**/*.rs"]) + ["macro/src/syntax"], srcs = glob(["macro/src/**/*.rs"]) + ["macro/src/syntax"],
crate = "cxxbridge_macro", doctests = False,
edition = "2018", edition = "2018",
proc_macro = True, proc_macro = True,
deps = [ deps = [
@ -56,13 +68,13 @@ rust_library(
) )
rust_library( rust_library(
name = "build", name = "cxx-build",
srcs = glob(["gen/build/src/**/*.rs"]) + [ srcs = glob(["gen/build/src/**/*.rs"]) + [
"gen/build/src/gen", "gen/build/src/gen",
"gen/build/src/syntax", "gen/build/src/syntax",
], ],
doctests = False,
edition = "2018", edition = "2018",
visibility = ["PUBLIC"],
deps = [ deps = [
"//third-party:cc", "//third-party:cc",
"//third-party:codespan-reporting", "//third-party:codespan-reporting",
@ -75,7 +87,7 @@ rust_library(
) )
rust_library( rust_library(
name = "lib", name = "cxx-gen",
srcs = glob(["gen/lib/src/**/*.rs"]) + [ srcs = glob(["gen/lib/src/**/*.rs"]) + [
"gen/lib/src/gen", "gen/lib/src/gen",
"gen/lib/src/syntax", "gen/lib/src/syntax",

14
BUILD
View File

@ -16,12 +16,17 @@ rust_library(
deps = [":core-lib"], deps = [":core-lib"],
) )
rust_binary( alias(
name = "codegen", name = "codegen",
actual = ":cxxbridge",
visibility = ["//visibility:public"],
)
rust_binary(
name = "cxxbridge",
srcs = glob(["gen/cmd/src/**/*.rs"]), srcs = glob(["gen/cmd/src/**/*.rs"]),
data = ["gen/cmd/src/gen/include/cxx.h"], data = ["gen/cmd/src/gen/include/cxx.h"],
edition = "2018", edition = "2018",
visibility = ["//visibility:public"],
deps = [ deps = [
"//third-party:clap", "//third-party:clap",
"//third-party:codespan-reporting", "//third-party:codespan-reporting",
@ -57,11 +62,10 @@ rust_proc_macro(
) )
rust_library( rust_library(
name = "build", name = "cxx-build",
srcs = glob(["gen/build/src/**/*.rs"]), srcs = glob(["gen/build/src/**/*.rs"]),
data = ["gen/build/src/gen/include/cxx.h"], data = ["gen/build/src/gen/include/cxx.h"],
edition = "2018", edition = "2018",
visibility = ["//visibility:public"],
deps = [ deps = [
"//third-party:cc", "//third-party:cc",
"//third-party:codespan-reporting", "//third-party:codespan-reporting",
@ -74,7 +78,7 @@ rust_library(
) )
rust_library( rust_library(
name = "lib", name = "cxx-gen",
srcs = glob(["gen/lib/src/**/*.rs"]), srcs = glob(["gen/lib/src/**/*.rs"]),
data = ["gen/lib/src/gen/include/cxx.h"], data = ["gen/lib/src/gen/include/cxx.h"],
edition = "2018", edition = "2018",

View File

@ -20,7 +20,7 @@ ohos_cargo_crate("lib") {
sources = [ "src/lib.rs" ] sources = [ "src/lib.rs" ]
edition = "2018" edition = "2018"
cargo_pkg_version = "1.0.91" cargo_pkg_version = "1.0.97"
cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>" cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>"
cargo_pkg_name = "cxx" cargo_pkg_name = "cxx"
cargo_pkg_description = "Safe interop between Rust and C++" cargo_pkg_description = "Safe interop between Rust and C++"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cxx" name = "cxx"
version = "1.0.91" # remember to update html_root_url version = "1.0.97" # remember to update html_root_url
authors = ["David Tolnay <dtolnay@gmail.com>"] authors = ["David Tolnay <dtolnay@gmail.com>"]
categories = ["development-tools::ffi", "api-bindings", "no-std"] categories = ["development-tools::ffi", "api-bindings", "no-std"]
description = "Safe interop between Rust and C++" description = "Safe interop between Rust and C++"
@ -23,15 +23,15 @@ alloc = []
std = ["alloc"] std = ["alloc"]
[dependencies] [dependencies]
cxxbridge-macro = { version = "=1.0.91", path = "macro" } cxxbridge-macro = { version = "=1.0.97", path = "macro" }
link-cplusplus = "1.0" link-cplusplus = "1.0"
[build-dependencies] [build-dependencies]
cc = "1.0.49" cc = "1.0.49"
cxxbridge-flags = { version = "=1.0.91", path = "flags", default-features = false } cxxbridge-flags = { version = "=1.0.97", path = "flags", default-features = false }
[dev-dependencies] [dev-dependencies]
cxx-build = { version = "=1.0.91", path = "gen/build" } cxx-build = { version = "=1.0.97", path = "gen/build" }
cxx-gen = { version = "0.7", path = "gen/lib" } cxx-gen = { version = "0.7", path = "gen/lib" }
cxx-test-suite = { version = "0", path = "tests/ffi" } cxx-test-suite = { version = "0", path = "tests/ffi" }
rustversion = "1.0" rustversion = "1.0"

View File

@ -3,7 +3,7 @@
"Name": "cxx", "Name": "cxx",
"License": "Apache License 2.0, MIT", "License": "Apache License 2.0, MIT",
"License File": "LICENSE-APACHE, LICENSE-MIT", "License File": "LICENSE-APACHE, LICENSE-MIT",
"Version Number": "1.0.91", "Version Number": "1.0.97",
"Owner": "fangting12@huawei.com", "Owner": "fangting12@huawei.com",
"Upstream URL": "https://github.com/dtolnay/cxx", "Upstream URL": "https://github.com/dtolnay/cxx",
"Description": "A Rust library that provides a safe and easy way to call C++ code from Rust." "Description": "A Rust library that provides a safe and easy way to call C++ code from Rust."

View File

@ -4,8 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive( http_archive(
name = "rules_rust", name = "rules_rust",
sha256 = "2466e5b2514772e84f9009010797b9cd4b51c1e6445bbd5b5e24848d90e6fb2e", sha256 = "50ec4b84a7ec5370f5882d52f4a1e6b8a75de2f8dcc0a4403747b69b2c4ef5b1",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.18.0/rules_rust-v0.18.0.tar.gz"], urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.23.0/rules_rust-v0.23.0.tar.gz"],
) )
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
@ -13,7 +13,7 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi
rules_rust_dependencies() rules_rust_dependencies()
rust_register_toolchains( rust_register_toolchains(
versions = ["1.67.0"], versions = ["1.69.0"],
) )
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

View File

@ -10,7 +10,7 @@
- [Multi-language build system options](building.md) - [Multi-language build system options](building.md)
- [Cargo](build/cargo.md) - [Cargo](build/cargo.md)
- [Bazel](build/bazel.md) - [Bazel or Buck2](build/bazel.md)
- [CMake](build/cmake.md) - [CMake](build/cmake.md)
- [More...](build/other.md) - [More...](build/other.md)

View File

@ -1,5 +1,5 @@
{{#title Bazel, Buck — Rust ♡ C++}} {{#title Bazel, Buck2 — Rust ♡ C++}}
## Bazel, Buck, potentially other similar environments ## Bazel, Buck2, potentially other similar environments
Starlark-based build systems with the ability to compile a code generator and Starlark-based build systems with the ability to compile a code generator and
invoke it as a `genrule` will run CXX's C++ code generator via its `cxxbridge` invoke it as a `genrule` will run CXX's C++ code generator via its `cxxbridge`
@ -15,11 +15,14 @@ $ cxxbridge src/bridge.rs --header > path/to/bridge.rs.h
$ cxxbridge src/bridge.rs > path/to/bridge.rs.cc $ cxxbridge src/bridge.rs > path/to/bridge.rs.cc
``` ```
The CXX repo maintains working Bazel `BUILD` and Buck `BUCK` targets for the The CXX repo maintains working [Bazel] `BUILD` and [Buck2] `BUCK` targets for
complete blobstore tutorial (chapter 3) for your reference, tested in CI. These the complete blobstore tutorial (chapter 3) for your reference, tested in CI.
aren't meant to be directly what you use in your codebase, but serve as an These aren't meant to be directly what you use in your codebase, but serve as an
illustration of one possible working pattern. illustration of one possible working pattern.
[Bazel]: https://bazel.build
[Buck2]: https://buck2.build
```python ```python
# tools/bazel/rust_cxx_bridge.bzl # tools/bazel/rust_cxx_bridge.bzl

View File

@ -21,6 +21,7 @@ cxx_library(
name = "blobstore-sys", name = "blobstore-sys",
srcs = ["src/blobstore.cc"], srcs = ["src/blobstore.cc"],
compiler_flags = ["-std=c++14"], compiler_flags = ["-std=c++14"],
preferred_linkage = "static",
deps = [ deps = [
":blobstore-include", ":blobstore-include",
":bridge/include", ":bridge/include",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cxxbridge-flags" name = "cxxbridge-flags"
version = "1.0.91" version = "1.0.97"
authors = ["David Tolnay <dtolnay@gmail.com>"] authors = ["David Tolnay <dtolnay@gmail.com>"]
categories = ["development-tools::ffi", "compilers"] categories = ["development-tools::ffi", "compilers"]
description = "Compiler configuration of the `cxx` crate (implementation detail)" description = "Compiler configuration of the `cxx` crate (implementation detail)"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cxx-build" name = "cxx-build"
version = "1.0.91" version = "1.0.97"
authors = ["David Tolnay <dtolnay@gmail.com>"] authors = ["David Tolnay <dtolnay@gmail.com>"]
categories = ["development-tools::build-utils", "development-tools::ffi"] categories = ["development-tools::build-utils", "development-tools::ffi"]
description = "C++ code generator for integrating `cxx` crate into a Cargo build." description = "C++ code generator for integrating `cxx` crate into a Cargo build."
@ -22,10 +22,10 @@ experimental-async-fn = []
cc = "1.0.49" cc = "1.0.49"
codespan-reporting = "0.11.1" codespan-reporting = "0.11.1"
once_cell = "1.9" once_cell = "1.9"
proc-macro2 = { version = "1.0.39", default-features = false, features = ["span-locations"] } proc-macro2 = { version = "1.0.58", default-features = false, features = ["span-locations"] }
quote = { version = "1.0", default-features = false } quote = { version = "1.0", default-features = false }
scratch = "1.0" scratch = "1.0"
syn = { version = "1.0.95", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] } syn = { version = "2.0.1", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] }
[dev-dependencies] [dev-dependencies]
cxx = { version = "1.0", path = "../.." } cxx = { version = "1.0", path = "../.." }

View File

@ -45,6 +45,7 @@
//! $ cxxbridge src/main.rs > path/to/mybridge.cc //! $ cxxbridge src/main.rs > path/to/mybridge.cc
//! ``` //! ```
#![doc(html_root_url = "https://docs.rs/cxx-build/1.0.97")]
#![allow( #![allow(
clippy::cast_sign_loss, clippy::cast_sign_loss,
clippy::default_trait_access, clippy::default_trait_access,

View File

@ -19,7 +19,7 @@ ohos_cargo_crate("cxxbridge") {
sources = [ "src/main.rs" ] sources = [ "src/main.rs" ]
edition = "2018" edition = "2018"
cargo_pkg_version = "1.0.92" cargo_pkg_version = "1.0.97"
cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>" cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>"
cargo_pkg_name = "cxxbridge-cmd" cargo_pkg_name = "cxxbridge-cmd"
cargo_pkg_description = cargo_pkg_description =

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cxxbridge-cmd" name = "cxxbridge-cmd"
version = "1.0.91" version = "1.0.97"
authors = ["David Tolnay <dtolnay@gmail.com>"] authors = ["David Tolnay <dtolnay@gmail.com>"]
categories = ["development-tools::build-utils", "development-tools::ffi"] categories = ["development-tools::build-utils", "development-tools::ffi"]
description = "C++ code generator for integrating `cxx` crate into a non-Cargo build." description = "C++ code generator for integrating `cxx` crate into a non-Cargo build."
@ -23,9 +23,9 @@ experimental-async-fn = []
[dependencies] [dependencies]
clap = { version = "4", default-features = false, features = ["error-context", "help", "std", "suggestions", "usage"] } clap = { version = "4", default-features = false, features = ["error-context", "help", "std", "suggestions", "usage"] }
codespan-reporting = "0.11" codespan-reporting = "0.11"
proc-macro2 = { version = "1.0.39", default-features = false, features = ["span-locations"] } proc-macro2 = { version = "1.0.58", default-features = false, features = ["span-locations"] }
quote = { version = "1.0", default-features = false } quote = { version = "1.0", default-features = false }
syn = { version = "1.0.95", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] } syn = { version = "2.0.1", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]

View File

@ -1 +0,0 @@
// empty

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cxx-gen" name = "cxx-gen"
version = "0.7.91" version = "0.7.97"
authors = ["Adrian Taylor <adetaylor@chromium.org>"] authors = ["Adrian Taylor <adetaylor@chromium.org>"]
categories = ["development-tools::ffi"] categories = ["development-tools::ffi"]
description = "C++ code generator for integrating `cxx` crate into higher level tools." description = "C++ code generator for integrating `cxx` crate into higher level tools."
@ -13,9 +13,9 @@ rust-version = "1.60"
[dependencies] [dependencies]
codespan-reporting = "0.11" codespan-reporting = "0.11"
proc-macro2 = { version = "1.0.39", default-features = false, features = ["span-locations"] } proc-macro2 = { version = "1.0.58", default-features = false, features = ["span-locations"] }
quote = { version = "1.0", default-features = false } quote = { version = "1.0", default-features = false }
syn = { version = "1.0.95", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] } syn = { version = "2.0.1", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] }
[lib] [lib]
doc-scrape-examples = false doc-scrape-examples = false

View File

@ -3,12 +3,23 @@
use std::error::Error as StdError; use std::error::Error as StdError;
use std::fmt::{self, Debug, Display}; use std::fmt::{self, Debug, Display};
use std::iter;
#[allow(missing_docs)] #[allow(missing_docs)]
pub struct Error { pub struct Error {
pub(crate) err: crate::gen::Error, pub(crate) err: crate::gen::Error,
} }
impl Error {
/// Returns the span of the error, if available.
pub fn span(&self) -> Option<proc_macro2::Span> {
match &self.err {
crate::gen::Error::Syn(err) => Some(err.span()),
_ => None,
}
}
}
impl From<crate::gen::Error> for Error { impl From<crate::gen::Error> for Error {
fn from(err: crate::gen::Error) -> Self { fn from(err: crate::gen::Error) -> Self {
Error { err } Error { err }
@ -32,3 +43,33 @@ impl StdError for Error {
self.err.source() self.err.source()
} }
} }
impl IntoIterator for Error {
type Item = Error;
type IntoIter = IntoIter;
fn into_iter(self) -> Self::IntoIter {
match self.err {
crate::gen::Error::Syn(err) => IntoIter::Syn(err.into_iter()),
_ => IntoIter::Other(iter::once(self)),
}
}
}
pub enum IntoIter {
Syn(<syn::Error as IntoIterator>::IntoIter),
Other(iter::Once<Error>),
}
impl Iterator for IntoIter {
type Item = Error;
fn next(&mut self) -> Option<Self::Item> {
match self {
IntoIter::Syn(iter) => iter
.next()
.map(|syn_err| Error::from(crate::gen::Error::Syn(syn_err))),
IntoIter::Other(iter) => iter.next(),
}
}
}

View File

@ -7,6 +7,7 @@
//! [dtolnay/cxx#235]: https://github.com/dtolnay/cxx/issues/235 //! [dtolnay/cxx#235]: https://github.com/dtolnay/cxx/issues/235
//! [https://github.com/google/autocxx]: https://github.com/google/autocxx //! [https://github.com/google/autocxx]: https://github.com/google/autocxx
#![doc(html_root_url = "https://docs.rs/cxx-gen/0.7.97")]
#![deny(missing_docs)] #![deny(missing_docs)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow( #![allow(

View File

@ -2,7 +2,7 @@ use crate::syntax::file::Module;
use crate::syntax::namespace::Namespace; use crate::syntax::namespace::Namespace;
use syn::parse::discouraged::Speculative; use syn::parse::discouraged::Speculative;
use syn::parse::{Error, Parse, ParseStream, Result}; use syn::parse::{Error, Parse, ParseStream, Result};
use syn::{braced, Attribute, Ident, Item, Token, Visibility}; use syn::{braced, Attribute, Ident, Item, Meta, Token, Visibility};
pub struct File { pub struct File {
pub modules: Vec<Module>, pub modules: Vec<Module>,
@ -23,7 +23,7 @@ fn parse(input: ParseStream, modules: &mut Vec<Module>) -> Result<()> {
let mut namespace = Namespace::ROOT; let mut namespace = Namespace::ROOT;
let mut attrs = input.call(Attribute::parse_outer)?; let mut attrs = input.call(Attribute::parse_outer)?;
for attr in &attrs { for attr in &attrs {
let path = &attr.path.segments; let path = &attr.path().segments;
if path.len() == 2 && path[0].ident == "cxx" && path[1].ident == "bridge" { if path.len() == 2 && path[0].ident == "cxx" && path[1].ident == "bridge" {
cxx_bridge = true; cxx_bridge = true;
namespace = parse_args(attr)?; namespace = parse_args(attr)?;
@ -64,7 +64,7 @@ fn parse(input: ParseStream, modules: &mut Vec<Module>) -> Result<()> {
} }
fn parse_args(attr: &Attribute) -> Result<Namespace> { fn parse_args(attr: &Attribute) -> Result<Namespace> {
if attr.tokens.is_empty() { if let Meta::Path(_) = attr.meta {
Ok(Namespace::ROOT) Ok(Namespace::ROOT)
} else { } else {
attr.parse_args_with(Namespace::parse_bridge_attr_namespace) attr.parse_args_with(Namespace::parse_bridge_attr_namespace)

View File

@ -659,7 +659,7 @@ typename Slice<T>::iterator::difference_type
Slice<T>::iterator::operator-(const iterator &other) const noexcept { Slice<T>::iterator::operator-(const iterator &other) const noexcept {
auto diff = std::distance(static_cast<char *>(other.pos), auto diff = std::distance(static_cast<char *>(other.pos),
static_cast<char *>(this->pos)); static_cast<char *>(this->pos));
return diff / this->stride; return diff / static_cast<typename Slice<T>::iterator::difference_type>(this->stride);
} }
template <typename T> template <typename T>

View File

@ -21,7 +21,7 @@ ohos_cargo_crate("lib") {
sources = [ "src/lib.rs" ] sources = [ "src/lib.rs" ]
edition = "2018" edition = "2018"
cargo_pkg_version = "1.0.91" cargo_pkg_version = "1.0.97"
cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>" cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>"
cargo_pkg_name = "cxxbridge-macro" cargo_pkg_name = "cxxbridge-macro"
cargo_pkg_description = "Implementation detail of the `cxx` crate." cargo_pkg_description = "Implementation detail of the `cxx` crate."

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cxxbridge-macro" name = "cxxbridge-macro"
version = "1.0.91" version = "1.0.97"
authors = ["David Tolnay <dtolnay@gmail.com>"] authors = ["David Tolnay <dtolnay@gmail.com>"]
categories = ["development-tools::ffi"] categories = ["development-tools::ffi"]
description = "Implementation detail of the `cxx` crate." description = "Implementation detail of the `cxx` crate."
@ -21,9 +21,9 @@ experimental-async-fn = []
experimental-enum-variants-from-header = ["clang-ast", "flate2", "memmap", "serde", "serde_json"] experimental-enum-variants-from-header = ["clang-ast", "flate2", "memmap", "serde", "serde_json"]
[dependencies] [dependencies]
proc-macro2 = "1.0.39" proc-macro2 = "1.0.58"
quote = "1.0.4" quote = "1.0.4"
syn = { version = "1.0.95", features = ["full"] } syn = { version = "2.0.1", features = ["full"] }
# optional dependencies: # optional dependencies:
clang-ast = { version = "0.1", optional = true } clang-ast = { version = "0.1", optional = true }

View File

@ -1264,7 +1264,7 @@ fn expand_rust_box(key: NamedImplKey, types: &Types, explicit_impl: Option<&Impl
let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve); let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve);
let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span); let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span);
let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span.join());
let unsafe_token = format_ident!("unsafe", span = begin_span); let unsafe_token = format_ident!("unsafe", span = begin_span);
let prevent_unwind_drop_label = format!("::{} as Drop>::drop", ident); let prevent_unwind_drop_label = format!("::{} as Drop>::drop", ident);
@ -1322,7 +1322,7 @@ fn expand_rust_vec(key: NamedImplKey, types: &Types, explicit_impl: Option<&Impl
let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve); let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve);
let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span); let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span);
let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span.join());
let unsafe_token = format_ident!("unsafe", span = begin_span); let unsafe_token = format_ident!("unsafe", span = begin_span);
let prevent_unwind_drop_label = format!("::{} as Drop>::drop", elem); let prevent_unwind_drop_label = format!("::{} as Drop>::drop", elem);
@ -1416,7 +1416,7 @@ fn expand_unique_ptr(
}; };
let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span); let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span);
let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span.join());
let unsafe_token = format_ident!("unsafe", span = begin_span); let unsafe_token = format_ident!("unsafe", span = begin_span);
quote_spanned! {end_span=> quote_spanned! {end_span=>
@ -1501,7 +1501,7 @@ fn expand_shared_ptr(
}; };
let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span); let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span);
let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span.join());
let unsafe_token = format_ident!("unsafe", span = begin_span); let unsafe_token = format_ident!("unsafe", span = begin_span);
quote_spanned! {end_span=> quote_spanned! {end_span=>
@ -1556,7 +1556,7 @@ fn expand_weak_ptr(key: NamedImplKey, types: &Types, explicit_impl: Option<&Impl
let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve); let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve);
let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span); let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span);
let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span.join());
let unsafe_token = format_ident!("unsafe", span = begin_span); let unsafe_token = format_ident!("unsafe", span = begin_span);
quote_spanned! {end_span=> quote_spanned! {end_span=>
@ -1629,7 +1629,7 @@ fn expand_cxx_vector(
let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve); let (impl_generics, ty_generics) = generics::split_for_impl(key, explicit_impl, resolve);
let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span); let begin_span = explicit_impl.map_or(key.begin_span, |explicit| explicit.impl_token.span);
let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span.join());
let unsafe_token = format_ident!("unsafe", span = begin_span); let unsafe_token = format_ident!("unsafe", span = begin_span);
let can_pass_element_by_value = types.is_maybe_trivial(elem); let can_pass_element_by_value = types.is_maybe_trivial(elem);
@ -1810,7 +1810,7 @@ fn expand_extern_type(ty: &Type, types: &Types, proper: bool) -> TokenStream {
} }
Type::SliceRef(ty) => { Type::SliceRef(ty) => {
let span = ty.ampersand.span; let span = ty.ampersand.span;
let rust_slice = Ident::new("RustSlice", ty.bracket.span); let rust_slice = Ident::new("RustSlice", ty.bracket.span.join());
quote_spanned!(span=> ::cxx::private::#rust_slice) quote_spanned!(span=> ::cxx::private::#rust_slice)
} }
_ => quote!(#ty), _ => quote!(#ty),

View File

@ -29,8 +29,6 @@
clippy::wrong_self_convention clippy::wrong_self_convention
)] )]
extern crate proc_macro;
mod derive; mod derive;
mod expand; mod expand;
mod generics; mod generics;

View File

@ -277,7 +277,7 @@ enum ParsedDiscriminant {
fn discriminant_value(mut clang: &[Node]) -> ParsedDiscriminant { fn discriminant_value(mut clang: &[Node]) -> ParsedDiscriminant {
if clang.is_empty() { if clang.is_empty() {
// No discriminant expression provided; use successor of previous // No discriminant expression provided; use successor of previous
// descriminant. // discriminant.
return ParsedDiscriminant::Successor; return ParsedDiscriminant::Successor;
} }

2
rust-toolchain.toml Normal file
View File

@ -0,0 +1,2 @@
[toolchain]
components = ["rust-src"]

View File

@ -285,7 +285,7 @@ String::String(unsafe_bitcopy_t, const String &bits) noexcept
: repr(bits.repr) {} : repr(bits.repr) {}
std::ostream &operator<<(std::ostream &os, const String &s) { std::ostream &operator<<(std::ostream &os, const String &s) {
os.write(s.data(), s.size()); os.write(s.data(), static_cast<std::streamsize>(s.size()));
return os; return os;
} }
@ -374,7 +374,7 @@ void Str::swap(Str &rhs) noexcept {
} }
std::ostream &operator<<(std::ostream &os, const Str &s) { std::ostream &operator<<(std::ostream &os, const Str &s) {
os.write(s.data(), s.size()); os.write(s.data(), static_cast<std::streamsize>(s.size()));
return os; return os;
} }

View File

@ -257,6 +257,25 @@ impl Hash for CxxString {
} }
} }
impl fmt::Write for Pin<&mut CxxString> {
fn write_str(&mut self, s: &str) -> fmt::Result {
self.as_mut().push_str(s);
Ok(())
}
}
#[cfg(feature = "std")]
impl std::io::Write for Pin<&mut CxxString> {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
self.as_mut().push_bytes(buf);
Ok(buf.len())
}
fn flush(&mut self) -> std::io::Result<()> {
Ok(())
}
}
#[doc(hidden)] #[doc(hidden)]
#[repr(C)] #[repr(C)]
pub struct StackString { pub struct StackString {

View File

@ -364,7 +364,7 @@
//! </table> //! </table>
#![no_std] #![no_std]
#![doc(html_root_url = "https://docs.rs/cxx/1.0.91")] #![doc(html_root_url = "https://docs.rs/cxx/1.0.97")]
#![deny( #![deny(
improper_ctypes, improper_ctypes,
improper_ctypes_definitions, improper_ctypes_definitions,

View File

@ -191,8 +191,8 @@ pub unsafe trait SharedPtrTarget {
where where
Self: Sized, Self: Sized,
{ {
// Opoaque C types do not get this method because they can never exist // Opaque C types do not get this method because they can never exist by
// by value on the Rust side of the bridge. // value on the Rust side of the bridge.
let _ = value; let _ = value;
let _ = new; let _ = new;
unreachable!() unreachable!()

View File

@ -5,8 +5,8 @@ use crate::syntax::Atom::{self, *};
use crate::syntax::{cfg, Derive, Doc, ForeignName}; use crate::syntax::{cfg, Derive, Doc, ForeignName};
use proc_macro2::{Ident, TokenStream}; use proc_macro2::{Ident, TokenStream};
use quote::ToTokens; use quote::ToTokens;
use syn::parse::{Nothing, Parse, ParseStream, Parser as _}; use syn::parse::ParseStream;
use syn::{parenthesized, token, Attribute, Error, LitStr, Path, Result, Token}; use syn::{Attribute, Error, Expr, Lit, LitStr, Meta, Path, Result, Token};
// Intended usage: // Intended usage:
// //
@ -47,8 +47,9 @@ pub struct Parser<'a> {
pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> OtherAttrs { pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> OtherAttrs {
let mut passthrough_attrs = Vec::new(); let mut passthrough_attrs = Vec::new();
for attr in attrs { for attr in attrs {
if attr.path.is_ident("doc") { let attr_path = attr.path();
match parse_doc_attribute.parse2(attr.tokens.clone()) { if attr_path.is_ident("doc") {
match parse_doc_attribute(&attr.meta) {
Ok(attr) => { Ok(attr) => {
if let Some(doc) = &mut parser.doc { if let Some(doc) = &mut parser.doc {
match attr { match attr {
@ -63,7 +64,7 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
break; break;
} }
} }
} else if attr.path.is_ident("derive") { } else if attr_path.is_ident("derive") {
match attr.parse_args_with(|attr: ParseStream| parse_derive_attribute(cx, attr)) { match attr.parse_args_with(|attr: ParseStream| parse_derive_attribute(cx, attr)) {
Ok(attr) => { Ok(attr) => {
if let Some(derives) = &mut parser.derives { if let Some(derives) = &mut parser.derives {
@ -76,7 +77,7 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
break; break;
} }
} }
} else if attr.path.is_ident("repr") { } else if attr_path.is_ident("repr") {
match attr.parse_args_with(parse_repr_attribute) { match attr.parse_args_with(parse_repr_attribute) {
Ok(attr) => { Ok(attr) => {
if let Some(repr) = &mut parser.repr { if let Some(repr) = &mut parser.repr {
@ -89,8 +90,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
break; break;
} }
} }
} else if attr.path.is_ident("namespace") { } else if attr_path.is_ident("namespace") {
match parse_namespace_attribute.parse2(attr.tokens.clone()) { match Namespace::parse_meta(&attr.meta) {
Ok(attr) => { Ok(attr) => {
if let Some(namespace) = &mut parser.namespace { if let Some(namespace) = &mut parser.namespace {
**namespace = attr; **namespace = attr;
@ -102,8 +103,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
break; break;
} }
} }
} else if attr.path.is_ident("cxx_name") { } else if attr_path.is_ident("cxx_name") {
match parse_cxx_name_attribute.parse2(attr.tokens.clone()) { match parse_cxx_name_attribute(&attr.meta) {
Ok(attr) => { Ok(attr) => {
if let Some(cxx_name) = &mut parser.cxx_name { if let Some(cxx_name) = &mut parser.cxx_name {
**cxx_name = Some(attr); **cxx_name = Some(attr);
@ -115,8 +116,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
break; break;
} }
} }
} else if attr.path.is_ident("rust_name") { } else if attr_path.is_ident("rust_name") {
match parse_rust_name_attribute.parse2(attr.tokens.clone()) { match parse_rust_name_attribute(&attr.meta) {
Ok(attr) => { Ok(attr) => {
if let Some(rust_name) = &mut parser.rust_name { if let Some(rust_name) = &mut parser.rust_name {
**rust_name = Some(attr); **rust_name = Some(attr);
@ -128,8 +129,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
break; break;
} }
} }
} else if attr.path.is_ident("cfg") { } else if attr_path.is_ident("cfg") {
match cfg::parse_attribute.parse2(attr.tokens.clone()) { match cfg::parse_attribute(&attr) {
Ok(cfg_expr) => { Ok(cfg_expr) => {
if let Some(cfg) = &mut parser.cfg { if let Some(cfg) = &mut parser.cfg {
cfg.merge(cfg_expr); cfg.merge(cfg_expr);
@ -142,31 +143,31 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
break; break;
} }
} }
} else if attr.path.is_ident("variants_from_header") } else if attr_path.is_ident("variants_from_header")
&& cfg!(feature = "experimental-enum-variants-from-header") && cfg!(feature = "experimental-enum-variants-from-header")
{ {
if let Err(err) = Nothing::parse.parse2(attr.tokens.clone()) { if let Err(err) = attr.meta.require_path_only() {
cx.push(err); cx.push(err);
} }
if let Some(variants_from_header) = &mut parser.variants_from_header { if let Some(variants_from_header) = &mut parser.variants_from_header {
**variants_from_header = Some(attr); **variants_from_header = Some(attr);
continue; continue;
} }
} else if attr.path.is_ident("allow") } else if attr_path.is_ident("allow")
|| attr.path.is_ident("warn") || attr_path.is_ident("warn")
|| attr.path.is_ident("deny") || attr_path.is_ident("deny")
|| attr.path.is_ident("forbid") || attr_path.is_ident("forbid")
|| attr.path.is_ident("deprecated") || attr_path.is_ident("deprecated")
|| attr.path.is_ident("must_use") || attr_path.is_ident("must_use")
{ {
// https://doc.rust-lang.org/reference/attributes/diagnostics.html // https://doc.rust-lang.org/reference/attributes/diagnostics.html
passthrough_attrs.push(attr); passthrough_attrs.push(attr);
continue; continue;
} else if attr.path.is_ident("serde") { } else if attr_path.is_ident("serde") {
passthrough_attrs.push(attr); passthrough_attrs.push(attr);
continue; continue;
} else if attr.path.segments.len() > 1 { } else if attr_path.segments.len() > 1 {
let tool = &attr.path.segments.first().unwrap().ident; let tool = &attr_path.segments.first().unwrap().ident;
if tool == "rustfmt" { if tool == "rustfmt" {
// Skip, rustfmt only needs to find it in the pre-expansion source file. // Skip, rustfmt only needs to find it in the pre-expansion source file.
continue; continue;
@ -192,24 +193,26 @@ mod kw {
syn::custom_keyword!(hidden); syn::custom_keyword!(hidden);
} }
fn parse_doc_attribute(input: ParseStream) -> Result<DocAttribute> { fn parse_doc_attribute(meta: &Meta) -> Result<DocAttribute> {
let lookahead = input.lookahead1(); match meta {
if lookahead.peek(Token![=]) { Meta::NameValue(meta) => {
input.parse::<Token![=]>()?; if let Expr::Lit(expr) = &meta.value {
let lit: LitStr = input.parse()?; if let Lit::Str(lit) = &expr.lit {
Ok(DocAttribute::Doc(lit)) return Ok(DocAttribute::Doc(lit.clone()));
} else if lookahead.peek(token::Paren) {
let content;
parenthesized!(content in input);
content.parse::<kw::hidden>()?;
Ok(DocAttribute::Hidden)
} else {
Err(lookahead.error())
} }
} }
}
Meta::List(meta) => {
meta.parse_args::<kw::hidden>()?;
return Ok(DocAttribute::Hidden);
}
Meta::Path(_) => {}
}
Err(Error::new_spanned(meta, "unsupported doc attribute"))
}
fn parse_derive_attribute(cx: &mut Errors, input: ParseStream) -> Result<Vec<Derive>> { fn parse_derive_attribute(cx: &mut Errors, input: ParseStream) -> Result<Vec<Derive>> {
let paths = input.parse_terminated::<Path, Token![,]>(Path::parse_mod_style)?; let paths = input.parse_terminated(Path::parse_mod_style, Token![,])?;
let mut derives = Vec::new(); let mut derives = Vec::new();
for path in paths { for path in paths {
@ -241,32 +244,43 @@ fn parse_repr_attribute(input: ParseStream) -> Result<Atom> {
)) ))
} }
fn parse_namespace_attribute(input: ParseStream) -> Result<Namespace> { fn parse_cxx_name_attribute(meta: &Meta) -> Result<ForeignName> {
input.parse::<Token![=]>()?; if let Meta::NameValue(meta) = meta {
let namespace = input.parse::<Namespace>()?; match &meta.value {
Ok(namespace) Expr::Lit(expr) => {
if let Lit::Str(lit) = &expr.lit {
return ForeignName::parse(&lit.value(), lit.span());
}
}
Expr::Path(expr) => {
if let Some(ident) = expr.path.get_ident() {
return ForeignName::parse(&ident.to_string(), ident.span());
}
}
_ => {}
}
}
Err(Error::new_spanned(meta, "unsupported cxx_name attribute"))
} }
fn parse_cxx_name_attribute(input: ParseStream) -> Result<ForeignName> { fn parse_rust_name_attribute(meta: &Meta) -> Result<Ident> {
input.parse::<Token![=]>()?; if let Meta::NameValue(meta) = meta {
if input.peek(LitStr) { match &meta.value {
let lit: LitStr = input.parse()?; Expr::Lit(expr) => {
ForeignName::parse(&lit.value(), lit.span()) if let Lit::Str(lit) = &expr.lit {
} else { return lit.parse();
let ident: Ident = input.parse()?;
ForeignName::parse(&ident.to_string(), ident.span())
} }
} }
Expr::Path(expr) => {
fn parse_rust_name_attribute(input: ParseStream) -> Result<Ident> { if let Some(ident) = expr.path.get_ident() {
input.parse::<Token![=]>()?; return Ok(ident.clone());
if input.peek(LitStr) {
let lit: LitStr = input.parse()?;
lit.parse()
} else {
input.parse()
} }
} }
_ => {}
}
}
Err(Error::new_spanned(meta, "unsupported rust_name attribute"))
}
#[derive(Clone)] #[derive(Clone)]
pub struct OtherAttrs(Vec<Attribute>); pub struct OtherAttrs(Vec<Attribute>);
@ -288,15 +302,11 @@ impl ToTokens for OtherAttrs {
pound_token, pound_token,
style, style,
bracket_token, bracket_token,
path, meta,
tokens: attr_tokens,
} = attr; } = attr;
pound_token.to_tokens(tokens); pound_token.to_tokens(tokens);
let _ = style; // ignore; render outer and inner attrs both as outer let _ = style; // ignore; render outer and inner attrs both as outer
bracket_token.surround(tokens, |tokens| { bracket_token.surround(tokens, |tokens| meta.to_tokens(tokens));
path.to_tokens(tokens);
attr_tokens.to_tokens(tokens);
});
} }
} }
} }

View File

@ -1,7 +1,7 @@
use proc_macro2::Ident; use proc_macro2::Ident;
use std::mem; use std::mem;
use syn::parse::{Error, ParseStream, Result}; use syn::parse::{Error, ParseStream, Result};
use syn::{parenthesized, token, LitStr, Token}; use syn::{parenthesized, token, Attribute, LitStr, Token};
#[derive(Clone)] #[derive(Clone)]
pub enum CfgExpr { pub enum CfgExpr {
@ -25,12 +25,12 @@ impl CfgExpr {
} }
} }
pub fn parse_attribute(input: ParseStream) -> Result<CfgExpr> { pub fn parse_attribute(attr: &Attribute) -> Result<CfgExpr> {
let content; attr.parse_args_with(|input: ParseStream| {
parenthesized!(content in input); let cfg_expr = input.call(parse_single)?;
let cfg_expr = content.call(parse_single)?; input.parse::<Option<Token![,]>>()?;
content.parse::<Option<Token![,]>>()?;
Ok(cfg_expr) Ok(cfg_expr)
})
} }
fn parse_single(input: ParseStream) -> Result<CfgExpr> { fn parse_single(input: ParseStream) -> Result<CfgExpr> {

View File

@ -664,14 +664,14 @@ fn is_opaque_cxx(cx: &mut Check, ty: &Ident) -> bool {
fn span_for_struct_error(strct: &Struct) -> TokenStream { fn span_for_struct_error(strct: &Struct) -> TokenStream {
let struct_token = strct.struct_token; let struct_token = strct.struct_token;
let mut brace_token = Group::new(Delimiter::Brace, TokenStream::new()); let mut brace_token = Group::new(Delimiter::Brace, TokenStream::new());
brace_token.set_span(strct.brace_token.span); brace_token.set_span(strct.brace_token.span.join());
quote!(#struct_token #brace_token) quote!(#struct_token #brace_token)
} }
fn span_for_enum_error(enm: &Enum) -> TokenStream { fn span_for_enum_error(enm: &Enum) -> TokenStream {
let enum_token = enm.enum_token; let enum_token = enm.enum_token;
let mut brace_token = Group::new(Delimiter::Brace, TokenStream::new()); let mut brace_token = Group::new(Delimiter::Brace, TokenStream::new());
brace_token.set_span(enm.brace_token.span); brace_token.set_span(enm.brace_token.span.join());
quote!(#enum_token #brace_token) quote!(#enum_token #brace_token)
} }

View File

@ -3,8 +3,8 @@ use quote::IdentFragment;
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use std::iter::FromIterator; use std::iter::FromIterator;
use std::slice::Iter; use std::slice::Iter;
use syn::parse::{Parse, ParseStream, Result}; use syn::parse::{Error, Parse, ParseStream, Result};
use syn::{Ident, Token}; use syn::{Expr, Ident, Lit, Meta, Token};
mod kw { mod kw {
syn::custom_keyword!(namespace); syn::custom_keyword!(namespace);
@ -24,7 +24,7 @@ impl Namespace {
self.segments.iter() self.segments.iter()
} }
pub fn parse_bridge_attr_namespace(input: ParseStream) -> Result<Namespace> { pub fn parse_bridge_attr_namespace(input: ParseStream) -> Result<Self> {
if input.is_empty() { if input.is_empty() {
return Ok(Namespace::ROOT); return Ok(Namespace::ROOT);
} }
@ -35,6 +35,37 @@ impl Namespace {
input.parse::<Option<Token![,]>>()?; input.parse::<Option<Token![,]>>()?;
Ok(namespace) Ok(namespace)
} }
pub fn parse_meta(meta: &Meta) -> Result<Self> {
if let Meta::NameValue(meta) = meta {
match &meta.value {
Expr::Lit(expr) => {
if let Lit::Str(lit) = &expr.lit {
let segments = QualifiedName::parse_quoted(lit)?.segments;
return Ok(Namespace { segments });
}
}
Expr::Path(expr)
if expr.qself.is_none()
&& expr
.path
.segments
.iter()
.all(|segment| segment.arguments.is_none()) =>
{
let segments = expr
.path
.segments
.iter()
.map(|segment| segment.ident.clone())
.collect();
return Ok(Namespace { segments });
}
_ => {}
}
}
Err(Error::new_spanned(meta, "unsupported namespace attribute"))
}
} }
impl Default for &Namespace { impl Default for &Namespace {

View File

@ -489,11 +489,7 @@ fn parse_extern_type(
let type_token = foreign_type.type_token; let type_token = foreign_type.type_token;
let visibility = visibility_pub(&foreign_type.vis, type_token.span); let visibility = visibility_pub(&foreign_type.vis, type_token.span);
let name = pair(namespace, &foreign_type.ident, cxx_name, rust_name); let name = pair(namespace, &foreign_type.ident, cxx_name, rust_name);
let generics = Lifetimes { let generics = extern_type_lifetimes(cx, foreign_type.generics);
lt_token: None,
lifetimes: Punctuated::new(),
gt_token: None,
};
let colon_token = None; let colon_token = None;
let bounds = Vec::new(); let bounds = Vec::new();
let semi_token = foreign_type.semi_token; let semi_token = foreign_type.semi_token;
@ -611,7 +607,27 @@ fn parse_extern_fn(
}); });
continue; continue;
} }
return Err(Error::new_spanned(arg, "unsupported signature")); if let Some(colon_token) = arg.colon_token {
let ty = parse_type(&arg.ty)?;
if let Type::Ref(reference) = ty {
if let Type::Ident(ident) = reference.inner {
receiver = Some(Receiver {
pinned: reference.pinned,
ampersand: reference.ampersand,
lifetime: reference.lifetime,
mutable: reference.mutable,
var: Token![self](ident.rust.span()),
colon_token,
ty: ident,
shorthand: false,
pin_tokens: reference.pin_tokens,
mutability: reference.mutability,
});
continue;
}
}
}
return Err(Error::new_spanned(arg, "unsupported method receiver"));
} }
FnArg::Typed(arg) => { FnArg::Typed(arg) => {
let ident = match arg.pat.as_ref() { let ident = match arg.pat.as_ref() {
@ -622,7 +638,6 @@ fn parse_extern_fn(
_ => return Err(Error::new_spanned(arg, "unsupported signature")), _ => return Err(Error::new_spanned(arg, "unsupported signature")),
}; };
let ty = parse_type(&arg.ty)?; let ty = parse_type(&arg.ty)?;
if ident != "self" {
let cfg = CfgExpr::Unconditional; let cfg = CfgExpr::Unconditional;
let doc = Doc::new(); let doc = Doc::new();
let attrs = OtherAttrs::none(); let attrs = OtherAttrs::none();
@ -641,26 +656,6 @@ fn parse_extern_fn(
if let Some(comma) = comma { if let Some(comma) = comma {
args.push_punct(*comma); args.push_punct(*comma);
} }
continue;
}
if let Type::Ref(reference) = ty {
if let Type::Ident(ident) = reference.inner {
receiver = Some(Receiver {
pinned: reference.pinned,
ampersand: reference.ampersand,
lifetime: reference.lifetime,
mutable: reference.mutable,
var: Token![self](ident.rust.span()),
colon_token: arg.colon_token,
ty: ident,
shorthand: false,
pin_tokens: reference.pin_tokens,
mutability: reference.mutability,
});
continue;
}
}
return Err(Error::new_spanned(arg, "unsupported method receiver"));
} }
} }
} }
@ -756,6 +751,45 @@ fn parse_extern_verbatim_type(
let type_token: Token![type] = input.parse()?; let type_token: Token![type] = input.parse()?;
let ident: Ident = input.parse()?; let ident: Ident = input.parse()?;
let generics: Generics = input.parse()?; let generics: Generics = input.parse()?;
let lifetimes = extern_type_lifetimes(cx, generics);
let lookahead = input.lookahead1();
if lookahead.peek(Token![=]) {
// type Alias = crate::path::to::Type;
parse_type_alias(
cx,
unparsed_attrs,
visibility,
type_token,
ident,
lifetimes,
input,
lang,
extern_block_cfg,
namespace,
attrs,
)
} else if lookahead.peek(Token![:]) {
// type Opaque: Bound2 + Bound2;
parse_extern_type_bounded(
cx,
unparsed_attrs,
visibility,
type_token,
ident,
lifetimes,
input,
lang,
trusted,
extern_block_cfg,
namespace,
attrs,
)
} else {
Err(lookahead.error())
}
}
fn extern_type_lifetimes(cx: &mut Errors, generics: Generics) -> Lifetimes {
let mut lifetimes = Punctuated::new(); let mut lifetimes = Punctuated::new();
let mut has_unsupported_generic_param = false; let mut has_unsupported_generic_param = false;
for pair in generics.params.into_pairs() { for pair in generics.params.into_pairs() {
@ -788,45 +822,10 @@ fn parse_extern_verbatim_type(
} }
} }
} }
let lifetimes = Lifetimes { Lifetimes {
lt_token: generics.lt_token, lt_token: generics.lt_token,
lifetimes, lifetimes,
gt_token: generics.gt_token, gt_token: generics.gt_token,
};
let lookahead = input.lookahead1();
if lookahead.peek(Token![=]) {
// type Alias = crate::path::to::Type;
parse_type_alias(
cx,
unparsed_attrs,
visibility,
type_token,
ident,
lifetimes,
input,
lang,
extern_block_cfg,
namespace,
attrs,
)
} else if lookahead.peek(Token![:]) || lookahead.peek(Token![;]) {
// type Opaque: Bound2 + Bound2;
parse_extern_type_bounded(
cx,
unparsed_attrs,
visibility,
type_token,
ident,
lifetimes,
input,
lang,
trusted,
extern_block_cfg,
namespace,
attrs,
)
} else {
Err(lookahead.error())
} }
} }
@ -928,9 +927,7 @@ fn parse_extern_type_bounded(
} else { } else {
false false
} => {} } => {}
bound @ TypeParamBound::Trait(_) | bound @ TypeParamBound::Lifetime(_) => { bound => cx.error(bound, "unsupported trait"),
cx.error(bound, "unsupported trait");
}
} }
let lookahead = input.lookahead1(); let lookahead = input.lookahead1();
@ -1004,7 +1001,7 @@ fn parse_impl(cx: &mut Errors, imp: ItemImpl) -> Result<Api> {
if !imp.items.is_empty() { if !imp.items.is_empty() {
let mut span = Group::new(Delimiter::Brace, TokenStream::new()); let mut span = Group::new(Delimiter::Brace, TokenStream::new());
span.set_span(imp.brace_token.span); span.set_span(imp.brace_token.span.join());
return Err(Error::new_spanned(span, "expected an empty impl block")); return Err(Error::new_spanned(span, "expected an empty impl block"));
} }
@ -1151,7 +1148,7 @@ fn parse_type(ty: &RustType) -> Result<Type> {
RustType::Path(ty) => parse_type_path(ty), RustType::Path(ty) => parse_type_path(ty),
RustType::Array(ty) => parse_type_array(ty), RustType::Array(ty) => parse_type_array(ty),
RustType::BareFn(ty) => parse_type_fn(ty), RustType::BareFn(ty) => parse_type_fn(ty),
RustType::Tuple(ty) if ty.elems.is_empty() => Ok(Type::Void(ty.paren_token.span)), RustType::Tuple(ty) if ty.elems.is_empty() => Ok(Type::Void(ty.paren_token.span.join())),
_ => Err(Error::new_spanned(ty, "unsupported type")), _ => Err(Error::new_spanned(ty, "unsupported type")),
} }
} }
@ -1387,7 +1384,7 @@ fn parse_type_fn(ty: &TypeBareFn) -> Result<Type> {
let (ident, colon_token) = match &arg.name { let (ident, colon_token) = match &arg.name {
Some((ident, colon_token)) => (ident.clone(), *colon_token), Some((ident, colon_token)) => (ident.clone(), *colon_token),
None => { None => {
let fn_span = ty.paren_token.span; let fn_span = ty.paren_token.span.join();
let ident = format_ident!("arg{}", i, span = fn_span); let ident = format_ident!("arg{}", i, span = fn_span);
let colon_token = Token![:](fn_span); let colon_token = Token![:](fn_span);
(ident, colon_token) (ident, colon_token)
@ -1470,8 +1467,7 @@ fn parse_return_type(
fn visibility_pub(vis: &Visibility, inherited: Span) -> Token![pub] { fn visibility_pub(vis: &Visibility, inherited: Span) -> Token![pub] {
Token![pub](match vis { Token![pub](match vis {
Visibility::Public(vis) => vis.pub_token.span, Visibility::Public(vis) => vis.span,
Visibility::Crate(vis) => vis.crate_token.span,
Visibility::Restricted(vis) => vis.pub_token.span, Visibility::Restricted(vis) => vis.pub_token.span,
Visibility::Inherited => inherited, Visibility::Inherited => inherited,
}) })

View File

@ -7,14 +7,7 @@ pub struct QualifiedName {
} }
impl QualifiedName { impl QualifiedName {
pub fn parse_unquoted(input: ParseStream) -> Result<Self> { pub fn parse_quoted(lit: &LitStr) -> Result<Self> {
let allow_raw = true;
parse_unquoted(input, allow_raw)
}
pub fn parse_quoted_or_unquoted(input: ParseStream) -> Result<Self> {
if input.peek(LitStr) {
let lit: LitStr = input.parse()?;
if lit.value().is_empty() { if lit.value().is_empty() {
let segments = Vec::new(); let segments = Vec::new();
Ok(QualifiedName { segments }) Ok(QualifiedName { segments })
@ -24,6 +17,17 @@ impl QualifiedName {
parse_unquoted(input, allow_raw) parse_unquoted(input, allow_raw)
}) })
} }
}
pub fn parse_unquoted(input: ParseStream) -> Result<Self> {
let allow_raw = true;
parse_unquoted(input, allow_raw)
}
pub fn parse_quoted_or_unquoted(input: ParseStream) -> Result<Self> {
if input.peek(LitStr) {
let lit: LitStr = input.parse()?;
Self::parse_quoted(&lit)
} else { } else {
Self::parse_unquoted(input) Self::parse_unquoted(input)
} }

View File

@ -270,7 +270,7 @@ impl ToTokens for Signature {
args.to_tokens(tokens); args.to_tokens(tokens);
}); });
if let Some(ret) = ret { if let Some(ret) = ret {
Token![->](paren_token.span).to_tokens(tokens); Token![->](paren_token.span.join()).to_tokens(tokens);
if let Some((result, langle, rangle)) = throws_tokens { if let Some((result, langle, rangle)) = throws_tokens {
result.to_tokens(tokens); result.to_tokens(tokens);
langle.to_tokens(tokens); langle.to_tokens(tokens);
@ -280,7 +280,7 @@ impl ToTokens for Signature {
ret.to_tokens(tokens); ret.to_tokens(tokens);
} }
} else if let Some((result, langle, rangle)) = throws_tokens { } else if let Some((result, langle, rangle)) = throws_tokens {
Token![->](paren_token.span).to_tokens(tokens); Token![->](paren_token.span.join()).to_tokens(tokens);
result.to_tokens(tokens); result.to_tokens(tokens);
langle.to_tokens(tokens); langle.to_tokens(tokens);
token::Paren(langle.span).surround(tokens, |_| ()); token::Paren(langle.span).surround(tokens, |_| ());

View File

@ -33,11 +33,12 @@ cxx_library(
":module/source", ":module/source",
], ],
exported_deps = ["//:core"], exported_deps = ["//:core"],
exported_headers = { exported_headers = [
"ffi/lib.rs.h": ":bridge/header", ":bridge/header",
"ffi/module.rs.h": ":module/header", ":module/header",
"ffi/tests.h": "ffi/tests.h", "ffi/tests.h",
}, ],
preferred_linkage = "static",
) )
rust_cxx_bridge( rust_cxx_bridge(

View File

@ -1,4 +1,5 @@
use cxx::{let_cxx_string, CxxString}; use cxx::{let_cxx_string, CxxString};
use std::fmt::Write as _;
#[test] #[test]
fn test_async_cxx_string() { fn test_async_cxx_string() {
@ -20,3 +21,21 @@ fn test_debug() {
assert_eq!(format!("{:?}", s), r#""x\"y'z""#); assert_eq!(format!("{:?}", s), r#""x\"y'z""#);
} }
#[test]
fn test_fmt_write() {
let_cxx_string!(s = "");
let name = "world";
write!(s, "Hello, {name}!").unwrap();
assert_eq!(s.to_str(), Ok("Hello, world!"));
}
#[test]
fn test_io_write() {
let_cxx_string!(s = "");
let mut reader: &[u8] = b"Hello, world!";
std::io::copy(&mut reader, &mut s).unwrap();
assert_eq!(s.to_str(), Ok("Hello, world!"));
}

View File

@ -15,4 +15,7 @@ fn main() {
build.define("CXX_TEST_INSTANTIATIONS", None); build.define("CXX_TEST_INSTANTIATIONS", None);
} }
build.compile("cxx-test-suite"); build.compile("cxx-test-suite");
println!("cargo:rerun-if-changed=tests.cc");
println!("cargo:rerun-if-changed=tests.h");
} }

View File

@ -1,7 +1,7 @@
error[E0204]: the trait `Copy` may not be implemented for this type error[E0204]: the trait `std::marker::Copy` cannot be implemented for this type
--> tests/ui/derive_noncopy.rs:4:12 --> tests/ui/derive_noncopy.rs:4:12
| |
4 | struct TryCopy { 4 | struct TryCopy {
| ^^^^^^^ | ^^^^^^^
5 | other: Other, 5 | other: Other,
| ------------ this field does not implement `Copy` | ------------ this field does not implement `std::marker::Copy`

View File

@ -11,10 +11,10 @@ error: unexpected token
| ^^^^ | ^^^^
error: expected `>` error: expected `>`
--> tests/ui/include.rs:6:17 --> tests/ui/include.rs:6:26
| |
6 | include!(<path/to); 6 | include!(<path/to);
| ^^^^^^^^^^ | ^
error: unexpected token in include path error: unexpected token in include path
--> tests/ui/include.rs:7:23 --> tests/ui/include.rs:7:23

View File

@ -6,7 +6,11 @@ error[E0277]: `*const cxx::void` cannot be sent between threads safely
| |
= help: within `ffi::Opaque`, the trait `Send` is not implemented for `*const cxx::void` = help: within `ffi::Opaque`, the trait `Send` is not implemented for `*const cxx::void`
= note: required because it appears within the type `[*const void; 0]` = note: required because it appears within the type `[*const void; 0]`
= note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque`
--> src/opaque.rs
|
| pub struct Opaque {
| ^^^^^^
note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque`
--> tests/ui/opaque_autotraits.rs:4:14 --> tests/ui/opaque_autotraits.rs:4:14
| |
@ -26,7 +30,11 @@ error[E0277]: `*const cxx::void` cannot be shared between threads safely
| |
= help: within `ffi::Opaque`, the trait `Sync` is not implemented for `*const cxx::void` = help: within `ffi::Opaque`, the trait `Sync` is not implemented for `*const cxx::void`
= note: required because it appears within the type `[*const void; 0]` = note: required because it appears within the type `[*const void; 0]`
= note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque`
--> src/opaque.rs
|
| pub struct Opaque {
| ^^^^^^
note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque`
--> tests/ui/opaque_autotraits.rs:4:14 --> tests/ui/opaque_autotraits.rs:4:14
| |
@ -44,9 +52,18 @@ error[E0277]: `PhantomPinned` cannot be unpinned
15 | assert_unpin::<ffi::Opaque>(); 15 | assert_unpin::<ffi::Opaque>();
| ^^^^^^^^^^^ within `ffi::Opaque`, the trait `Unpin` is not implemented for `PhantomPinned` | ^^^^^^^^^^^ within `ffi::Opaque`, the trait `Unpin` is not implemented for `PhantomPinned`
| |
= note: consider using `Box::pin` = note: consider using the `pin!` macro
= note: required because it appears within the type `PhantomData<PhantomPinned>` consider using `Box::pin` if you need to access the pinned value outside of the current scope
= note: required because it appears within the type `Opaque` note: required because it appears within the type `PhantomData<PhantomPinned>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `Opaque`
--> src/opaque.rs
|
| pub struct Opaque {
| ^^^^^^
note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque`
--> tests/ui/opaque_autotraits.rs:4:14 --> tests/ui/opaque_autotraits.rs:4:14
| |

View File

@ -4,7 +4,8 @@ error[E0277]: `PhantomPinned` cannot be unpinned
6 | type Pinned; 6 | type Pinned;
| ^^^^^^ within `Pinned`, the trait `Unpin` is not implemented for `PhantomPinned` | ^^^^^^ within `Pinned`, the trait `Unpin` is not implemented for `PhantomPinned`
| |
= note: consider using `Box::pin` = note: consider using the `pin!` macro
consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required because it appears within the type `Pinned` note: required because it appears within the type `Pinned`
--> tests/ui/rust_pinned.rs:10:12 --> tests/ui/rust_pinned.rs:10:12
| |

View File

@ -14,5 +14,8 @@ note: expected this to be `Trivial`
note: required by a bound in `UniquePtr::<T>::new` note: required by a bound in `UniquePtr::<T>::new`
--> src/unique_ptr.rs --> src/unique_ptr.rs
| |
| pub fn new(value: T) -> Self
| --- required by a bound in this associated function
| where
| T: ExternType<Kind = Trivial>, | T: ExternType<Kind = Trivial>,
| ^^^^^^^^^^^^^^ required by this bound in `UniquePtr::<T>::new` | ^^^^^^^^^^^^^^ required by this bound in `UniquePtr::<T>::new`

View File

@ -6,15 +6,27 @@ error[E0277]: `*const cxx::void` cannot be sent between threads safely
| |
= help: within `CxxVector<NotThreadSafe>`, the trait `Send` is not implemented for `*const cxx::void` = help: within `CxxVector<NotThreadSafe>`, the trait `Send` is not implemented for `*const cxx::void`
= note: required because it appears within the type `[*const void; 0]` = note: required because it appears within the type `[*const void; 0]`
= note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque`
--> src/opaque.rs
|
| pub struct Opaque {
| ^^^^^^
note: required because it appears within the type `NotThreadSafe` note: required because it appears within the type `NotThreadSafe`
--> tests/ui/vector_autotraits.rs:7:14 --> tests/ui/vector_autotraits.rs:7:14
| |
7 | type NotThreadSafe; 7 | type NotThreadSafe;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
= note: required because it appears within the type `[NotThreadSafe]` = note: required because it appears within the type `[NotThreadSafe]`
= note: required because it appears within the type `PhantomData<[NotThreadSafe]>` note: required because it appears within the type `PhantomData<[NotThreadSafe]>`
= note: required because it appears within the type `CxxVector<NotThreadSafe>` --> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `CxxVector<NotThreadSafe>`
--> src/cxx_vector.rs
|
| pub struct CxxVector<T> {
| ^^^^^^^^^
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> tests/ui/vector_autotraits.rs:16:19 --> tests/ui/vector_autotraits.rs:16:19
| |

695
third-party/BUCK generated vendored
View File

@ -1,18 +1,44 @@
# @generated by `reindeer buckify` # @generated by `reindeer buckify`
load("//tools/buck:buildscript.bzl", "buildscript_args") load("@prelude//rust:cargo_buildscript.bzl", "buildscript_run")
load("@prelude//rust:cargo_package.bzl", "cargo")
rust_library( http_archive(
name = "bitflags-1.3.2", name = "anstyle-1.0.0.crate",
srcs = [ sha256 = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d",
"vendor/bitflags-1.3.2/src/example_generated.rs", strip_prefix = "anstyle-1.0.0",
"vendor/bitflags-1.3.2/src/lib.rs", urls = ["https://crates.io/api/v1/crates/anstyle/1.0.0/download"],
visibility = [],
)
cargo.rust_library(
name = "anstyle-1.0.0",
srcs = [":anstyle-1.0.0.crate"],
crate = "anstyle",
crate_root = "anstyle-1.0.0.crate/src/lib.rs",
edition = "2021",
features = [
"default",
"std",
], ],
visibility = [],
)
http_archive(
name = "bitflags-1.3.2.crate",
sha256 = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a",
strip_prefix = "bitflags-1.3.2",
urls = ["https://crates.io/api/v1/crates/bitflags/1.3.2/download"],
visibility = [],
)
cargo.rust_library(
name = "bitflags-1.3.2",
srcs = [":bitflags-1.3.2.crate"],
crate = "bitflags", crate = "bitflags",
crate_root = "vendor/bitflags-1.3.2/src/lib.rs", crate_root = "bitflags-1.3.2.crate/src/lib.rs",
edition = "2018", edition = "2018",
features = ["default"], features = ["default"],
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
@ -22,110 +48,66 @@ alias(
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "cc-1.0.79.crate",
sha256 = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f",
strip_prefix = "cc-1.0.79",
urls = ["https://crates.io/api/v1/crates/cc/1.0.79/download"],
visibility = [],
)
cargo.rust_library(
name = "cc-1.0.79", name = "cc-1.0.79",
srcs = [ srcs = [":cc-1.0.79.crate"],
"vendor/cc-1.0.79/src/com.rs",
"vendor/cc-1.0.79/src/lib.rs",
"vendor/cc-1.0.79/src/registry.rs",
"vendor/cc-1.0.79/src/setup_config.rs",
"vendor/cc-1.0.79/src/vs_instances.rs",
"vendor/cc-1.0.79/src/winapi.rs",
"vendor/cc-1.0.79/src/windows_registry.rs",
],
crate = "cc", crate = "cc",
crate_root = "vendor/cc-1.0.79/src/lib.rs", crate_root = "cc-1.0.79.crate/src/lib.rs",
edition = "2018", edition = "2018",
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
alias( alias(
name = "clap", name = "clap",
actual = ":clap-4.1.4", actual = ":clap-4.3.0",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "clap-4.1.4", name = "clap-4.3.0.crate",
srcs = [ sha256 = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc",
"vendor/clap-4.1.4/examples/demo.md", strip_prefix = "clap-4.3.0",
"vendor/clap-4.1.4/examples/demo.rs", urls = ["https://crates.io/api/v1/crates/clap/4.3.0/download"],
"vendor/clap-4.1.4/src/_cookbook/cargo_example.rs", visibility = [],
"vendor/clap-4.1.4/src/_cookbook/cargo_example_derive.rs", )
"vendor/clap-4.1.4/src/_cookbook/escaped_positional.rs",
"vendor/clap-4.1.4/src/_cookbook/escaped_positional_derive.rs", cargo.rust_library(
"vendor/clap-4.1.4/src/_cookbook/find.rs", name = "clap-4.3.0",
"vendor/clap-4.1.4/src/_cookbook/git.rs", srcs = [":clap-4.3.0.crate"],
"vendor/clap-4.1.4/src/_cookbook/git_derive.rs",
"vendor/clap-4.1.4/src/_cookbook/mod.rs",
"vendor/clap-4.1.4/src/_cookbook/multicall_busybox.rs",
"vendor/clap-4.1.4/src/_cookbook/multicall_hostname.rs",
"vendor/clap-4.1.4/src/_cookbook/pacman.rs",
"vendor/clap-4.1.4/src/_cookbook/repl.rs",
"vendor/clap-4.1.4/src/_cookbook/typed_derive.rs",
"vendor/clap-4.1.4/src/_derive/_tutorial.rs",
"vendor/clap-4.1.4/src/_derive/mod.rs",
"vendor/clap-4.1.4/src/_faq.rs",
"vendor/clap-4.1.4/src/_features.rs",
"vendor/clap-4.1.4/src/_tutorial.rs",
"vendor/clap-4.1.4/src/builder/action.rs",
"vendor/clap-4.1.4/src/builder/app_settings.rs",
"vendor/clap-4.1.4/src/builder/arg.rs",
"vendor/clap-4.1.4/src/builder/arg_group.rs",
"vendor/clap-4.1.4/src/builder/arg_predicate.rs",
"vendor/clap-4.1.4/src/builder/arg_settings.rs",
"vendor/clap-4.1.4/src/builder/command.rs",
"vendor/clap-4.1.4/src/builder/debug_asserts.rs",
"vendor/clap-4.1.4/src/builder/mod.rs",
"vendor/clap-4.1.4/src/builder/os_str.rs",
"vendor/clap-4.1.4/src/builder/possible_value.rs",
"vendor/clap-4.1.4/src/builder/range.rs",
"vendor/clap-4.1.4/src/builder/resettable.rs",
"vendor/clap-4.1.4/src/builder/str.rs",
"vendor/clap-4.1.4/src/builder/styled_str.rs",
"vendor/clap-4.1.4/src/builder/tests.rs",
"vendor/clap-4.1.4/src/builder/value_hint.rs",
"vendor/clap-4.1.4/src/builder/value_parser.rs",
"vendor/clap-4.1.4/src/derive.rs",
"vendor/clap-4.1.4/src/error/context.rs",
"vendor/clap-4.1.4/src/error/format.rs",
"vendor/clap-4.1.4/src/error/kind.rs",
"vendor/clap-4.1.4/src/error/mod.rs",
"vendor/clap-4.1.4/src/lib.rs",
"vendor/clap-4.1.4/src/macros.rs",
"vendor/clap-4.1.4/src/mkeymap.rs",
"vendor/clap-4.1.4/src/output/fmt.rs",
"vendor/clap-4.1.4/src/output/help.rs",
"vendor/clap-4.1.4/src/output/help_template.rs",
"vendor/clap-4.1.4/src/output/mod.rs",
"vendor/clap-4.1.4/src/output/textwrap/core.rs",
"vendor/clap-4.1.4/src/output/textwrap/mod.rs",
"vendor/clap-4.1.4/src/output/textwrap/word_separators.rs",
"vendor/clap-4.1.4/src/output/textwrap/wrap_algorithms.rs",
"vendor/clap-4.1.4/src/output/usage.rs",
"vendor/clap-4.1.4/src/parser/arg_matcher.rs",
"vendor/clap-4.1.4/src/parser/error.rs",
"vendor/clap-4.1.4/src/parser/features/mod.rs",
"vendor/clap-4.1.4/src/parser/features/suggestions.rs",
"vendor/clap-4.1.4/src/parser/matches/any_value.rs",
"vendor/clap-4.1.4/src/parser/matches/arg_matches.rs",
"vendor/clap-4.1.4/src/parser/matches/matched_arg.rs",
"vendor/clap-4.1.4/src/parser/matches/mod.rs",
"vendor/clap-4.1.4/src/parser/matches/value_source.rs",
"vendor/clap-4.1.4/src/parser/mod.rs",
"vendor/clap-4.1.4/src/parser/parser.rs",
"vendor/clap-4.1.4/src/parser/validator.rs",
"vendor/clap-4.1.4/src/util/color.rs",
"vendor/clap-4.1.4/src/util/flat_map.rs",
"vendor/clap-4.1.4/src/util/flat_set.rs",
"vendor/clap-4.1.4/src/util/graph.rs",
"vendor/clap-4.1.4/src/util/id.rs",
"vendor/clap-4.1.4/src/util/mod.rs",
"vendor/clap-4.1.4/src/util/str_to_bool.rs",
],
crate = "clap", crate = "clap",
crate_root = "vendor/clap-4.1.4/src/lib.rs", crate_root = "clap-4.3.0.crate/src/lib.rs",
edition = "2021",
features = [
"error-context",
"help",
"std",
"usage",
],
visibility = [],
deps = [":clap_builder-4.3.0"],
)
http_archive(
name = "clap_builder-4.3.0.crate",
sha256 = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990",
strip_prefix = "clap_builder-4.3.0",
urls = ["https://crates.io/api/v1/crates/clap_builder/4.3.0/download"],
visibility = [],
)
cargo.rust_library(
name = "clap_builder-4.3.0",
srcs = [":clap_builder-4.3.0.crate"],
crate = "clap_builder",
crate_root = "clap_builder-4.3.0.crate/src/lib.rs",
edition = "2021", edition = "2021",
features = [ features = [
"error-context", "error-context",
@ -133,23 +115,29 @@ rust_library(
"std", "std",
"usage", "usage",
], ],
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
deps = [ deps = [
":anstyle-1.0.0",
":bitflags-1.3.2", ":bitflags-1.3.2",
":clap_lex-0.3.1", ":clap_lex-0.5.0",
], ],
) )
rust_library( http_archive(
name = "clap_lex-0.3.1", name = "clap_lex-0.5.0.crate",
srcs = ["vendor/clap_lex-0.3.1/src/lib.rs"], sha256 = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b",
crate = "clap_lex", strip_prefix = "clap_lex-0.5.0",
crate_root = "vendor/clap_lex-0.3.1/src/lib.rs", urls = ["https://crates.io/api/v1/crates/clap_lex/0.5.0/download"],
edition = "2021", visibility = [],
rustc_flags = ["--cap-lints=allow"], )
cargo.rust_library(
name = "clap_lex-0.5.0",
srcs = [":clap_lex-0.5.0.crate"],
crate = "clap_lex",
crate_root = "clap_lex-0.5.0.crate/src/lib.rs",
edition = "2021",
visibility = [], visibility = [],
deps = [":os_str_bytes-6.4.1"],
) )
alias( alias(
@ -158,21 +146,20 @@ alias(
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "codespan-reporting-0.11.1.crate",
sha256 = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e",
strip_prefix = "codespan-reporting-0.11.1",
urls = ["https://crates.io/api/v1/crates/codespan-reporting/0.11.1/download"],
visibility = [],
)
cargo.rust_library(
name = "codespan-reporting-0.11.1", name = "codespan-reporting-0.11.1",
srcs = [ srcs = [":codespan-reporting-0.11.1.crate"],
"vendor/codespan-reporting-0.11.1/src/diagnostic.rs",
"vendor/codespan-reporting-0.11.1/src/files.rs",
"vendor/codespan-reporting-0.11.1/src/lib.rs",
"vendor/codespan-reporting-0.11.1/src/term.rs",
"vendor/codespan-reporting-0.11.1/src/term/config.rs",
"vendor/codespan-reporting-0.11.1/src/term/renderer.rs",
"vendor/codespan-reporting-0.11.1/src/term/views.rs",
],
crate = "codespan_reporting", crate = "codespan_reporting",
crate_root = "vendor/codespan-reporting-0.11.1/src/lib.rs", crate_root = "codespan-reporting-0.11.1.crate/src/lib.rs",
edition = "2018", edition = "2018",
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
deps = [ deps = [
":termcolor-1.2.0", ":termcolor-1.2.0",
@ -182,21 +169,23 @@ rust_library(
alias( alias(
name = "once_cell", name = "once_cell",
actual = ":once_cell-1.17.0", actual = ":once_cell-1.17.1",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "once_cell-1.17.0", name = "once_cell-1.17.1.crate",
srcs = [ sha256 = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3",
"vendor/once_cell-1.17.0/src/imp_cs.rs", strip_prefix = "once_cell-1.17.1",
"vendor/once_cell-1.17.0/src/imp_pl.rs", urls = ["https://crates.io/api/v1/crates/once_cell/1.17.1/download"],
"vendor/once_cell-1.17.0/src/imp_std.rs", visibility = [],
"vendor/once_cell-1.17.0/src/lib.rs", )
"vendor/once_cell-1.17.0/src/race.rs",
], cargo.rust_library(
name = "once_cell-1.17.1",
srcs = [":once_cell-1.17.1.crate"],
crate = "once_cell", crate = "once_cell",
crate_root = "vendor/once_cell-1.17.0/src/lib.rs", crate_root = "once_cell-1.17.1.crate/src/lib.rs",
edition = "2021", edition = "2021",
features = [ features = [
"alloc", "alloc",
@ -204,241 +193,180 @@ rust_library(
"race", "race",
"std", "std",
], ],
rustc_flags = ["--cap-lints=allow"],
visibility = [],
)
rust_library(
name = "os_str_bytes-6.4.1",
srcs = [
"vendor/os_str_bytes-6.4.1/src/common/mod.rs",
"vendor/os_str_bytes-6.4.1/src/common/raw.rs",
"vendor/os_str_bytes-6.4.1/src/iter.rs",
"vendor/os_str_bytes-6.4.1/src/lib.rs",
"vendor/os_str_bytes-6.4.1/src/pattern.rs",
"vendor/os_str_bytes-6.4.1/src/raw_str.rs",
"vendor/os_str_bytes-6.4.1/src/util.rs",
"vendor/os_str_bytes-6.4.1/src/wasm/mod.rs",
"vendor/os_str_bytes-6.4.1/src/wasm/raw.rs",
"vendor/os_str_bytes-6.4.1/src/windows/mod.rs",
"vendor/os_str_bytes-6.4.1/src/windows/raw.rs",
"vendor/os_str_bytes-6.4.1/src/windows/wtf8/code_points.rs",
"vendor/os_str_bytes-6.4.1/src/windows/wtf8/convert.rs",
"vendor/os_str_bytes-6.4.1/src/windows/wtf8/mod.rs",
"vendor/os_str_bytes-6.4.1/src/windows/wtf8/string.rs",
],
crate = "os_str_bytes",
crate_root = "vendor/os_str_bytes-6.4.1/src/lib.rs",
edition = "2021",
features = ["raw_os_str"],
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
alias( alias(
name = "proc-macro2", name = "proc-macro2",
actual = ":proc-macro2-1.0.51", actual = ":proc-macro2-1.0.59",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "proc-macro2-1.0.51", name = "proc-macro2-1.0.59.crate",
srcs = [ sha256 = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b",
"vendor/proc-macro2-1.0.51/src/detection.rs", strip_prefix = "proc-macro2-1.0.59",
"vendor/proc-macro2-1.0.51/src/fallback.rs", urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.59/download"],
"vendor/proc-macro2-1.0.51/src/lib.rs", visibility = [],
"vendor/proc-macro2-1.0.51/src/location.rs", )
"vendor/proc-macro2-1.0.51/src/marker.rs",
"vendor/proc-macro2-1.0.51/src/parse.rs", cargo.rust_library(
"vendor/proc-macro2-1.0.51/src/rcvec.rs", name = "proc-macro2-1.0.59",
"vendor/proc-macro2-1.0.51/src/wrapper.rs", srcs = [":proc-macro2-1.0.59.crate"],
],
crate = "proc_macro2", crate = "proc_macro2",
crate_root = "vendor/proc-macro2-1.0.51/src/lib.rs", crate_root = "proc-macro2-1.0.59.crate/src/lib.rs",
edition = "2018", edition = "2018",
features = [ features = [
"default", "default",
"proc-macro", "proc-macro",
"span-locations", "span-locations",
], ],
rustc_flags = [ rustc_flags = ["@$(location :proc-macro2-1.0.59-build-script-run[rustc_flags])"],
"--cap-lints=allow",
"@$(location :proc-macro2-1.0.51-build-script-build-args)",
],
visibility = [], visibility = [],
deps = [":unicode-ident-1.0.6"], deps = [":unicode-ident-1.0.9"],
) )
rust_binary( cargo.rust_binary(
name = "proc-macro2-1.0.51-build-script-build", name = "proc-macro2-1.0.59-build-script-build",
srcs = ["vendor/proc-macro2-1.0.51/build.rs"], srcs = [":proc-macro2-1.0.59.crate"],
crate = "build_script_build", crate = "build_script_build",
crate_root = "vendor/proc-macro2-1.0.51/build.rs", crate_root = "proc-macro2-1.0.59.crate/build.rs",
edition = "2018", edition = "2018",
features = [ features = [
"default", "default",
"proc-macro", "proc-macro",
"span-locations", "span-locations",
], ],
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
buildscript_args( buildscript_run(
name = "proc-macro2-1.0.51-build-script-build-args", name = "proc-macro2-1.0.59-build-script-run",
package_name = "proc-macro2", package_name = "proc-macro2",
buildscript_rule = ":proc-macro2-1.0.51-build-script-build", buildscript_rule = ":proc-macro2-1.0.59-build-script-build",
features = [ features = [
"default", "default",
"proc-macro", "proc-macro",
"span-locations", "span-locations",
], ],
outfile = "args.txt", version = "1.0.59",
version = "1.0.51",
) )
alias( alias(
name = "quote", name = "quote",
actual = ":quote-1.0.23", actual = ":quote-1.0.28",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "quote-1.0.23", name = "quote-1.0.28.crate",
srcs = [ sha256 = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488",
"vendor/quote-1.0.23/src/ext.rs", strip_prefix = "quote-1.0.28",
"vendor/quote-1.0.23/src/format.rs", urls = ["https://crates.io/api/v1/crates/quote/1.0.28/download"],
"vendor/quote-1.0.23/src/ident_fragment.rs", visibility = [],
"vendor/quote-1.0.23/src/lib.rs", )
"vendor/quote-1.0.23/src/runtime.rs",
"vendor/quote-1.0.23/src/spanned.rs", cargo.rust_library(
"vendor/quote-1.0.23/src/to_tokens.rs", name = "quote-1.0.28",
], srcs = [":quote-1.0.28.crate"],
crate = "quote", crate = "quote",
crate_root = "vendor/quote-1.0.23/src/lib.rs", crate_root = "quote-1.0.28.crate/src/lib.rs",
edition = "2018", edition = "2018",
features = [ features = [
"default", "default",
"proc-macro", "proc-macro",
], ],
rustc_flags = [ rustc_flags = ["@$(location :quote-1.0.28-build-script-run[rustc_flags])"],
"--cap-lints=allow",
"@$(location :quote-1.0.23-build-script-build-args)",
],
visibility = [], visibility = [],
deps = [":proc-macro2-1.0.51"], deps = [":proc-macro2-1.0.59"],
) )
rust_binary( cargo.rust_binary(
name = "quote-1.0.23-build-script-build", name = "quote-1.0.28-build-script-build",
srcs = ["vendor/quote-1.0.23/build.rs"], srcs = [":quote-1.0.28.crate"],
crate = "build_script_build", crate = "build_script_build",
crate_root = "vendor/quote-1.0.23/build.rs", crate_root = "quote-1.0.28.crate/build.rs",
edition = "2018", edition = "2018",
features = [ features = [
"default", "default",
"proc-macro", "proc-macro",
], ],
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
buildscript_args( buildscript_run(
name = "quote-1.0.23-build-script-build-args", name = "quote-1.0.28-build-script-run",
package_name = "quote", package_name = "quote",
buildscript_rule = ":quote-1.0.23-build-script-build", buildscript_rule = ":quote-1.0.28-build-script-build",
features = [ features = [
"default", "default",
"proc-macro", "proc-macro",
], ],
outfile = "args.txt", version = "1.0.28",
version = "1.0.23",
) )
alias( alias(
name = "scratch", name = "scratch",
actual = ":scratch-1.0.3", actual = ":scratch-1.0.5",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "scratch-1.0.3", name = "scratch-1.0.5.crate",
srcs = ["vendor/scratch-1.0.3/src/lib.rs"], sha256 = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1",
strip_prefix = "scratch-1.0.5",
urls = ["https://crates.io/api/v1/crates/scratch/1.0.5/download"],
visibility = [],
)
cargo.rust_library(
name = "scratch-1.0.5",
srcs = [":scratch-1.0.5.crate"],
crate = "scratch", crate = "scratch",
crate_root = "vendor/scratch-1.0.3/src/lib.rs", crate_root = "scratch-1.0.5.crate/src/lib.rs",
edition = "2015", edition = "2015",
env = { env = {
"OUT_DIR": "generated", "OUT_DIR": "$(location :scratch-1.0.5-build-script-run[out_dir])",
}, },
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
cargo.rust_binary(
name = "scratch-1.0.5-build-script-build",
srcs = [":scratch-1.0.5.crate"],
crate = "build_script_build",
crate_root = "scratch-1.0.5.crate/build.rs",
edition = "2015",
visibility = [],
)
buildscript_run(
name = "scratch-1.0.5-build-script-run",
package_name = "scratch",
buildscript_rule = ":scratch-1.0.5-build-script-build",
version = "1.0.5",
)
alias( alias(
name = "syn", name = "syn",
actual = ":syn-1.0.107", actual = ":syn-2.0.17",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
rust_library( http_archive(
name = "syn-1.0.107", name = "syn-2.0.17.crate",
srcs = [ sha256 = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388",
"vendor/syn-1.0.107/src/attr.rs", strip_prefix = "syn-2.0.17",
"vendor/syn-1.0.107/src/await.rs", urls = ["https://crates.io/api/v1/crates/syn/2.0.17/download"],
"vendor/syn-1.0.107/src/bigint.rs", visibility = [],
"vendor/syn-1.0.107/src/buffer.rs", )
"vendor/syn-1.0.107/src/custom_keyword.rs",
"vendor/syn-1.0.107/src/custom_punctuation.rs", cargo.rust_library(
"vendor/syn-1.0.107/src/data.rs", name = "syn-2.0.17",
"vendor/syn-1.0.107/src/derive.rs", srcs = [":syn-2.0.17.crate"],
"vendor/syn-1.0.107/src/discouraged.rs",
"vendor/syn-1.0.107/src/drops.rs",
"vendor/syn-1.0.107/src/error.rs",
"vendor/syn-1.0.107/src/export.rs",
"vendor/syn-1.0.107/src/expr.rs",
"vendor/syn-1.0.107/src/ext.rs",
"vendor/syn-1.0.107/src/file.rs",
"vendor/syn-1.0.107/src/gen/clone.rs",
"vendor/syn-1.0.107/src/gen/debug.rs",
"vendor/syn-1.0.107/src/gen/eq.rs",
"vendor/syn-1.0.107/src/gen/fold.rs",
"vendor/syn-1.0.107/src/gen/hash.rs",
"vendor/syn-1.0.107/src/gen/visit.rs",
"vendor/syn-1.0.107/src/gen/visit_mut.rs",
"vendor/syn-1.0.107/src/gen_helper.rs",
"vendor/syn-1.0.107/src/generics.rs",
"vendor/syn-1.0.107/src/group.rs",
"vendor/syn-1.0.107/src/ident.rs",
"vendor/syn-1.0.107/src/item.rs",
"vendor/syn-1.0.107/src/lib.rs",
"vendor/syn-1.0.107/src/lifetime.rs",
"vendor/syn-1.0.107/src/lit.rs",
"vendor/syn-1.0.107/src/lookahead.rs",
"vendor/syn-1.0.107/src/mac.rs",
"vendor/syn-1.0.107/src/macros.rs",
"vendor/syn-1.0.107/src/op.rs",
"vendor/syn-1.0.107/src/parse.rs",
"vendor/syn-1.0.107/src/parse_macro_input.rs",
"vendor/syn-1.0.107/src/parse_quote.rs",
"vendor/syn-1.0.107/src/pat.rs",
"vendor/syn-1.0.107/src/path.rs",
"vendor/syn-1.0.107/src/print.rs",
"vendor/syn-1.0.107/src/punctuated.rs",
"vendor/syn-1.0.107/src/reserved.rs",
"vendor/syn-1.0.107/src/sealed.rs",
"vendor/syn-1.0.107/src/span.rs",
"vendor/syn-1.0.107/src/spanned.rs",
"vendor/syn-1.0.107/src/stmt.rs",
"vendor/syn-1.0.107/src/thread.rs",
"vendor/syn-1.0.107/src/token.rs",
"vendor/syn-1.0.107/src/tt.rs",
"vendor/syn-1.0.107/src/ty.rs",
"vendor/syn-1.0.107/src/verbatim.rs",
"vendor/syn-1.0.107/src/whitespace.rs",
],
crate = "syn", crate = "syn",
crate_root = "vendor/syn-1.0.107/src/lib.rs", crate_root = "syn-2.0.17.crate/src/lib.rs",
edition = "2018", edition = "2021",
features = [ features = [
"clone-impls", "clone-impls",
"default", "default",
@ -449,90 +377,165 @@ rust_library(
"proc-macro", "proc-macro",
"quote", "quote",
], ],
rustc_flags = [
"--cap-lints=allow",
"@$(location :syn-1.0.107-build-script-build-args)",
],
visibility = [], visibility = [],
deps = [ deps = [
":proc-macro2-1.0.51", ":proc-macro2-1.0.59",
":quote-1.0.23", ":quote-1.0.28",
":unicode-ident-1.0.6", ":unicode-ident-1.0.9",
], ],
) )
rust_binary( http_archive(
name = "syn-1.0.107-build-script-build", name = "termcolor-1.2.0.crate",
srcs = ["vendor/syn-1.0.107/build.rs"], sha256 = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6",
crate = "build_script_build", strip_prefix = "termcolor-1.2.0",
crate_root = "vendor/syn-1.0.107/build.rs", urls = ["https://crates.io/api/v1/crates/termcolor/1.2.0/download"],
edition = "2018",
features = [
"clone-impls",
"default",
"derive",
"full",
"parsing",
"printing",
"proc-macro",
"quote",
],
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
buildscript_args( cargo.rust_library(
name = "syn-1.0.107-build-script-build-args",
package_name = "syn",
buildscript_rule = ":syn-1.0.107-build-script-build",
features = [
"clone-impls",
"default",
"derive",
"full",
"parsing",
"printing",
"proc-macro",
"quote",
],
outfile = "args.txt",
version = "1.0.107",
)
rust_library(
name = "termcolor-1.2.0", name = "termcolor-1.2.0",
srcs = ["vendor/termcolor-1.2.0/src/lib.rs"], srcs = [":termcolor-1.2.0.crate"],
crate = "termcolor", crate = "termcolor",
crate_root = "vendor/termcolor-1.2.0/src/lib.rs", crate_root = "termcolor-1.2.0.crate/src/lib.rs",
edition = "2018", edition = "2018",
rustc_flags = ["--cap-lints=allow"], platform = {
"windows-gnu": dict(
deps = [":winapi-util-0.1.5"],
),
"windows-msvc": dict(
deps = [":winapi-util-0.1.5"],
),
},
visibility = [], visibility = [],
) )
rust_library( http_archive(
name = "unicode-ident-1.0.6", name = "unicode-ident-1.0.9.crate",
srcs = [ sha256 = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0",
"vendor/unicode-ident-1.0.6/src/lib.rs", strip_prefix = "unicode-ident-1.0.9",
"vendor/unicode-ident-1.0.6/src/tables.rs", urls = ["https://crates.io/api/v1/crates/unicode-ident/1.0.9/download"],
], visibility = [],
)
cargo.rust_library(
name = "unicode-ident-1.0.9",
srcs = [":unicode-ident-1.0.9.crate"],
crate = "unicode_ident", crate = "unicode_ident",
crate_root = "vendor/unicode-ident-1.0.6/src/lib.rs", crate_root = "unicode-ident-1.0.9.crate/src/lib.rs",
edition = "2018", edition = "2018",
rustc_flags = ["--cap-lints=allow"],
visibility = [], visibility = [],
) )
rust_library( http_archive(
name = "unicode-width-0.1.10.crate",
sha256 = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b",
strip_prefix = "unicode-width-0.1.10",
urls = ["https://crates.io/api/v1/crates/unicode-width/0.1.10/download"],
visibility = [],
)
cargo.rust_library(
name = "unicode-width-0.1.10", name = "unicode-width-0.1.10",
srcs = [ srcs = [":unicode-width-0.1.10.crate"],
"vendor/unicode-width-0.1.10/src/lib.rs",
"vendor/unicode-width-0.1.10/src/tables.rs",
"vendor/unicode-width-0.1.10/src/tests.rs",
],
crate = "unicode_width", crate = "unicode_width",
crate_root = "vendor/unicode-width-0.1.10/src/lib.rs", crate_root = "unicode-width-0.1.10.crate/src/lib.rs",
edition = "2015", edition = "2015",
features = ["default"], features = ["default"],
rustc_flags = ["--cap-lints=allow"], visibility = [],
)
http_archive(
name = "winapi-0.3.9.crate",
sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419",
strip_prefix = "winapi-0.3.9",
urls = ["https://crates.io/api/v1/crates/winapi/0.3.9/download"],
visibility = [],
)
cargo.rust_library(
name = "winapi-0.3.9",
srcs = [":winapi-0.3.9.crate"],
crate = "winapi",
crate_root = "winapi-0.3.9.crate/src/lib.rs",
edition = "2015",
features = [
"consoleapi",
"errhandlingapi",
"fileapi",
"minwindef",
"processenv",
"std",
"winbase",
"wincon",
"winerror",
"winnt",
],
rustc_flags = ["@$(location :winapi-0.3.9-build-script-run[rustc_flags])"],
visibility = [],
)
cargo.rust_binary(
name = "winapi-0.3.9-build-script-build",
srcs = [":winapi-0.3.9.crate"],
crate = "build_script_build",
crate_root = "winapi-0.3.9.crate/build.rs",
edition = "2015",
features = [
"consoleapi",
"errhandlingapi",
"fileapi",
"minwindef",
"processenv",
"std",
"winbase",
"wincon",
"winerror",
"winnt",
],
visibility = [],
)
buildscript_run(
name = "winapi-0.3.9-build-script-run",
package_name = "winapi",
buildscript_rule = ":winapi-0.3.9-build-script-build",
features = [
"consoleapi",
"errhandlingapi",
"fileapi",
"minwindef",
"processenv",
"std",
"winbase",
"wincon",
"winerror",
"winnt",
],
version = "0.3.9",
)
http_archive(
name = "winapi-util-0.1.5.crate",
sha256 = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178",
strip_prefix = "winapi-util-0.1.5",
urls = ["https://crates.io/api/v1/crates/winapi-util/0.1.5/download"],
visibility = [],
)
cargo.rust_library(
name = "winapi-util-0.1.5",
srcs = [":winapi-util-0.1.5.crate"],
crate = "winapi_util",
crate_root = "winapi-util-0.1.5.crate/src/lib.rs",
edition = "2018",
platform = {
"windows-gnu": dict(
deps = [":winapi-0.3.9"],
),
"windows-msvc": dict(
deps = [":winapi-0.3.9"],
),
},
visibility = [], visibility = [],
) )

57
third-party/Cargo.lock generated vendored
View File

@ -2,6 +2,12 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "anstyle"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -16,22 +22,29 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.1.4" version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc"
dependencies = [ dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990"
dependencies = [
"anstyle",
"bitflags", "bitflags",
"clap_lex", "clap_lex",
] ]
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.3.1" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
dependencies = [
"os_str_bytes",
]
[[package]] [[package]]
name = "codespan-reporting" name = "codespan-reporting"
@ -45,45 +58,39 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.17.0" version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.51" version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.23" version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]] [[package]]
name = "scratch" name = "scratch"
version = "1.0.3" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.107" version = "2.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -115,9 +122,9 @@ dependencies = [
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.6" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"

View File

@ -12,7 +12,7 @@ cc = "1.0.49"
clap = { version = "4", default-features = false, features = ["error-context", "help", "std", "usage"] } clap = { version = "4", default-features = false, features = ["error-context", "help", "std", "usage"] }
codespan-reporting = "0.11.1" codespan-reporting = "0.11.1"
once_cell = "1.9" once_cell = "1.9"
proc-macro2 = { version = "1.0.39", features = ["span-locations"] } proc-macro2 = { version = "1.0.58", features = ["span-locations"] }
quote = "1.0.4" quote = "1.0.4"
scratch = "1" scratch = "1"
syn = { version = "1.0.95", features = ["full"] } syn = { version = "2.0.1", features = ["full"] }

View File

@ -15,7 +15,7 @@ package(default_visibility = ["//visibility:public"])
# ]) # ])
rust_library( rust_library(
name = "os_str_bytes", name = "anstyle",
srcs = glob(["**/*.rs"]), srcs = glob(["**/*.rs"]),
compile_data = glob( compile_data = glob(
include = ["**"], include = ["**"],
@ -28,17 +28,18 @@ rust_library(
], ],
), ),
crate_features = [ crate_features = [
"raw_os_str", "default",
"std",
], ],
crate_root = "src/lib.rs", crate_root = "src/lib.rs",
edition = "2021", edition = "2021",
rustc_flags = ["--cap-lints=allow"], rustc_flags = ["--cap-lints=allow"],
tags = [ tags = [
"cargo-bazel", "cargo-bazel",
"crate-name=os_str_bytes", "crate-name=anstyle",
"manual", "manual",
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "6.4.1", version = "1.0.0",
) )

12
third-party/bazel/BUILD.bazel generated vendored
View File

@ -33,7 +33,7 @@ alias(
alias( alias(
name = "clap", name = "clap",
actual = "@vendor__clap-4.1.4//:clap", actual = "@vendor__clap-4.3.0//:clap",
tags = ["manual"], tags = ["manual"],
) )
@ -45,30 +45,30 @@ alias(
alias( alias(
name = "once_cell", name = "once_cell",
actual = "@vendor__once_cell-1.17.0//:once_cell", actual = "@vendor__once_cell-1.17.1//:once_cell",
tags = ["manual"], tags = ["manual"],
) )
alias( alias(
name = "proc-macro2", name = "proc-macro2",
actual = "@vendor__proc-macro2-1.0.51//:proc_macro2", actual = "@vendor__proc-macro2-1.0.59//:proc_macro2",
tags = ["manual"], tags = ["manual"],
) )
alias( alias(
name = "quote", name = "quote",
actual = "@vendor__quote-1.0.23//:quote", actual = "@vendor__quote-1.0.28//:quote",
tags = ["manual"], tags = ["manual"],
) )
alias( alias(
name = "scratch", name = "scratch",
actual = "@vendor__scratch-1.0.3//:scratch", actual = "@vendor__scratch-1.0.5//:scratch",
tags = ["manual"], tags = ["manual"],
) )
alias( alias(
name = "syn", name = "syn",
actual = "@vendor__syn-1.0.107//:syn", actual = "@vendor__syn-2.0.17//:syn",
tags = ["manual"], tags = ["manual"],
) )

View File

@ -43,9 +43,8 @@ rust_library(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "4.1.4", version = "4.3.0",
deps = [ deps = [
"@vendor__bitflags-1.3.2//:bitflags", "@vendor__clap_builder-4.3.0//:clap_builder",
"@vendor__clap_lex-0.3.1//:clap_lex",
], ],
) )

52
third-party/bazel/BUILD.clap_builder-4.3.0.bazel generated vendored Normal file
View File

@ -0,0 +1,52 @@
###############################################################################
# @generated
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
# regenerate this file, run the following:
#
# bazel run @//third-party:vendor
###############################################################################
load("@rules_rust//rust:defs.bzl", "rust_library")
package(default_visibility = ["//visibility:public"])
# licenses([
# "TODO", # MIT OR Apache-2.0
# ])
rust_library(
name = "clap_builder",
srcs = glob(["**/*.rs"]),
compile_data = glob(
include = ["**"],
exclude = [
"**/* *",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
),
crate_features = [
"error-context",
"help",
"std",
"usage",
],
crate_root = "src/lib.rs",
edition = "2021",
rustc_flags = ["--cap-lints=allow"],
tags = [
"cargo-bazel",
"crate-name=clap_builder",
"manual",
"noclippy",
"norustfmt",
],
version = "4.3.0",
deps = [
"@vendor__anstyle-1.0.0//:anstyle",
"@vendor__bitflags-1.3.2//:bitflags",
"@vendor__clap_lex-0.5.0//:clap_lex",
],
)

View File

@ -37,8 +37,5 @@ rust_library(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "0.3.1", version = "0.5.0",
deps = [
"@vendor__os_str_bytes-6.4.1//:os_str_bytes",
],
) )

View File

@ -43,5 +43,5 @@ rust_library(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.17.0", version = "1.17.1",
) )

View File

@ -43,10 +43,10 @@ rust_library(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.0.51", version = "1.0.59",
deps = [ deps = [
"@vendor__proc-macro2-1.0.51//:build_script_build", "@vendor__proc-macro2-1.0.59//:build_script_build",
"@vendor__unicode-ident-1.0.6//:unicode_ident", "@vendor__unicode-ident-1.0.9//:unicode_ident",
], ],
) )
@ -81,7 +81,7 @@ cargo_build_script(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.0.51", version = "1.0.59",
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
) )

View File

@ -42,10 +42,10 @@ rust_library(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.0.23", version = "1.0.28",
deps = [ deps = [
"@vendor__proc-macro2-1.0.51//:proc_macro2", "@vendor__proc-macro2-1.0.59//:proc_macro2",
"@vendor__quote-1.0.23//:build_script_build", "@vendor__quote-1.0.28//:build_script_build",
], ],
) )
@ -79,7 +79,7 @@ cargo_build_script(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.0.23", version = "1.0.28",
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
) )

View File

@ -38,9 +38,9 @@ rust_library(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.0.3", version = "1.0.5",
deps = [ deps = [
"@vendor__scratch-1.0.3//:build_script_build", "@vendor__scratch-1.0.5//:build_script_build",
], ],
) )
@ -70,7 +70,7 @@ cargo_build_script(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.0.3", version = "1.0.5",
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
) )

View File

@ -1,104 +0,0 @@
###############################################################################
# @generated
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
# regenerate this file, run the following:
#
# bazel run @//third-party:vendor
###############################################################################
load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
load("@rules_rust//rust:defs.bzl", "rust_library")
package(default_visibility = ["//visibility:public"])
# licenses([
# "TODO", # MIT OR Apache-2.0
# ])
rust_library(
name = "syn",
srcs = glob(["**/*.rs"]),
compile_data = glob(
include = ["**"],
exclude = [
"**/* *",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
),
crate_features = [
"clone-impls",
"default",
"derive",
"full",
"parsing",
"printing",
"proc-macro",
"quote",
],
crate_root = "src/lib.rs",
edition = "2018",
rustc_flags = ["--cap-lints=allow"],
tags = [
"cargo-bazel",
"crate-name=syn",
"manual",
"noclippy",
"norustfmt",
],
version = "1.0.107",
deps = [
"@vendor__proc-macro2-1.0.51//:proc_macro2",
"@vendor__quote-1.0.23//:quote",
"@vendor__syn-1.0.107//:build_script_build",
"@vendor__unicode-ident-1.0.6//:unicode_ident",
],
)
cargo_build_script(
name = "syn_build_script",
srcs = glob(["**/*.rs"]),
crate_features = [
"clone-impls",
"default",
"derive",
"full",
"parsing",
"printing",
"proc-macro",
"quote",
],
crate_name = "build_script_build",
crate_root = "build.rs",
data = glob(
include = ["**"],
exclude = [
"**/* *",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
),
edition = "2018",
rustc_flags = [
"--cap-lints=allow",
],
tags = [
"cargo-bazel",
"crate-name=syn",
"manual",
"noclippy",
"norustfmt",
],
version = "1.0.107",
visibility = ["//visibility:private"],
)
alias(
name = "build_script_build",
actual = "syn_build_script",
tags = ["manual"],
)

56
third-party/bazel/BUILD.syn-2.0.17.bazel generated vendored Normal file
View File

@ -0,0 +1,56 @@
###############################################################################
# @generated
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
# regenerate this file, run the following:
#
# bazel run @//third-party:vendor
###############################################################################
load("@rules_rust//rust:defs.bzl", "rust_library")
package(default_visibility = ["//visibility:public"])
# licenses([
# "TODO", # MIT OR Apache-2.0
# ])
rust_library(
name = "syn",
srcs = glob(["**/*.rs"]),
compile_data = glob(
include = ["**"],
exclude = [
"**/* *",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
),
crate_features = [
"clone-impls",
"default",
"derive",
"full",
"parsing",
"printing",
"proc-macro",
"quote",
],
crate_root = "src/lib.rs",
edition = "2021",
rustc_flags = ["--cap-lints=allow"],
tags = [
"cargo-bazel",
"crate-name=syn",
"manual",
"noclippy",
"norustfmt",
],
version = "2.0.17",
deps = [
"@vendor__proc-macro2-1.0.59//:proc_macro2",
"@vendor__quote-1.0.28//:quote",
"@vendor__unicode-ident-1.0.9//:unicode_ident",
],
)

View File

@ -37,5 +37,5 @@ rust_library(
"noclippy", "noclippy",
"norustfmt", "norustfmt",
], ],
version = "1.0.6", version = "1.0.9",
) )

124
third-party/bazel/defs.bzl generated vendored
View File

@ -37,7 +37,7 @@ def _flatten_dependency_maps(all_dependency_maps):
# name of the workspace this file is defined in. # name of the workspace this file is defined in.
"workspace_member_package": { "workspace_member_package": {
# Not all dependnecies are supported for all platforms. # Not all dependencies are supported for all platforms.
# the condition key is the condition required to be true # the condition key is the condition required to be true
# on the host platform. # on the host platform.
"condition": { "condition": {
@ -292,13 +292,13 @@ _NORMAL_DEPENDENCIES = {
"third-party": { "third-party": {
_COMMON_CONDITION: { _COMMON_CONDITION: {
"cc": "@vendor__cc-1.0.79//:cc", "cc": "@vendor__cc-1.0.79//:cc",
"clap": "@vendor__clap-4.1.4//:clap", "clap": "@vendor__clap-4.3.0//:clap",
"codespan-reporting": "@vendor__codespan-reporting-0.11.1//:codespan_reporting", "codespan-reporting": "@vendor__codespan-reporting-0.11.1//:codespan_reporting",
"once_cell": "@vendor__once_cell-1.17.0//:once_cell", "once_cell": "@vendor__once_cell-1.17.1//:once_cell",
"proc-macro2": "@vendor__proc-macro2-1.0.51//:proc_macro2", "proc-macro2": "@vendor__proc-macro2-1.0.59//:proc_macro2",
"quote": "@vendor__quote-1.0.23//:quote", "quote": "@vendor__quote-1.0.28//:quote",
"scratch": "@vendor__scratch-1.0.3//:scratch", "scratch": "@vendor__scratch-1.0.5//:scratch",
"syn": "@vendor__syn-1.0.107//:syn", "syn": "@vendor__syn-2.0.17//:syn",
}, },
}, },
} }
@ -370,6 +370,16 @@ _CONDITIONS = {
def crate_repositories(): def crate_repositories():
"""A macro for defining repositories for all generated crates""" """A macro for defining repositories for all generated crates"""
maybe(
http_archive,
name = "vendor__anstyle-1.0.0",
sha256 = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d",
type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/anstyle/1.0.0/download"],
strip_prefix = "anstyle-1.0.0",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.anstyle-1.0.0.bazel"),
)
maybe( maybe(
http_archive, http_archive,
name = "vendor__bitflags-1.3.2", name = "vendor__bitflags-1.3.2",
@ -392,22 +402,32 @@ def crate_repositories():
maybe( maybe(
http_archive, http_archive,
name = "vendor__clap-4.1.4", name = "vendor__clap-4.3.0",
sha256 = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76", sha256 = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/clap/4.1.4/download"], urls = ["https://crates.io/api/v1/crates/clap/4.3.0/download"],
strip_prefix = "clap-4.1.4", strip_prefix = "clap-4.3.0",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap-4.1.4.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap-4.3.0.bazel"),
) )
maybe( maybe(
http_archive, http_archive,
name = "vendor__clap_lex-0.3.1", name = "vendor__clap_builder-4.3.0",
sha256 = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade", sha256 = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/clap_lex/0.3.1/download"], urls = ["https://crates.io/api/v1/crates/clap_builder/4.3.0/download"],
strip_prefix = "clap_lex-0.3.1", strip_prefix = "clap_builder-4.3.0",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap_lex-0.3.1.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap_builder-4.3.0.bazel"),
)
maybe(
http_archive,
name = "vendor__clap_lex-0.5.0",
sha256 = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b",
type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/clap_lex/0.5.0/download"],
strip_prefix = "clap_lex-0.5.0",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap_lex-0.5.0.bazel"),
) )
maybe( maybe(
@ -422,62 +442,52 @@ def crate_repositories():
maybe( maybe(
http_archive, http_archive,
name = "vendor__once_cell-1.17.0", name = "vendor__once_cell-1.17.1",
sha256 = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66", sha256 = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/once_cell/1.17.0/download"], urls = ["https://crates.io/api/v1/crates/once_cell/1.17.1/download"],
strip_prefix = "once_cell-1.17.0", strip_prefix = "once_cell-1.17.1",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.once_cell-1.17.0.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.once_cell-1.17.1.bazel"),
) )
maybe( maybe(
http_archive, http_archive,
name = "vendor__os_str_bytes-6.4.1", name = "vendor__proc-macro2-1.0.59",
sha256 = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee", sha256 = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/os_str_bytes/6.4.1/download"], urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.59/download"],
strip_prefix = "os_str_bytes-6.4.1", strip_prefix = "proc-macro2-1.0.59",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.os_str_bytes-6.4.1.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.proc-macro2-1.0.59.bazel"),
) )
maybe( maybe(
http_archive, http_archive,
name = "vendor__proc-macro2-1.0.51", name = "vendor__quote-1.0.28",
sha256 = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6", sha256 = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.51/download"], urls = ["https://crates.io/api/v1/crates/quote/1.0.28/download"],
strip_prefix = "proc-macro2-1.0.51", strip_prefix = "quote-1.0.28",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.proc-macro2-1.0.51.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.quote-1.0.28.bazel"),
) )
maybe( maybe(
http_archive, http_archive,
name = "vendor__quote-1.0.23", name = "vendor__scratch-1.0.5",
sha256 = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b", sha256 = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/quote/1.0.23/download"], urls = ["https://crates.io/api/v1/crates/scratch/1.0.5/download"],
strip_prefix = "quote-1.0.23", strip_prefix = "scratch-1.0.5",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.quote-1.0.23.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.scratch-1.0.5.bazel"),
) )
maybe( maybe(
http_archive, http_archive,
name = "vendor__scratch-1.0.3", name = "vendor__syn-2.0.17",
sha256 = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2", sha256 = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/scratch/1.0.3/download"], urls = ["https://crates.io/api/v1/crates/syn/2.0.17/download"],
strip_prefix = "scratch-1.0.3", strip_prefix = "syn-2.0.17",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.scratch-1.0.3.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.syn-2.0.17.bazel"),
)
maybe(
http_archive,
name = "vendor__syn-1.0.107",
sha256 = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5",
type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/syn/1.0.107/download"],
strip_prefix = "syn-1.0.107",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.syn-1.0.107.bazel"),
) )
maybe( maybe(
@ -492,12 +502,12 @@ def crate_repositories():
maybe( maybe(
http_archive, http_archive,
name = "vendor__unicode-ident-1.0.6", name = "vendor__unicode-ident-1.0.9",
sha256 = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc", sha256 = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0",
type = "tar.gz", type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/unicode-ident/1.0.6/download"], urls = ["https://crates.io/api/v1/crates/unicode-ident/1.0.9/download"],
strip_prefix = "unicode-ident-1.0.6", strip_prefix = "unicode-ident-1.0.9",
build_file = Label("@cxx.rs//third-party/bazel:BUILD.unicode-ident-1.0.6.bazel"), build_file = Label("@cxx.rs//third-party/bazel:BUILD.unicode-ident-1.0.9.bazel"),
) )
maybe( maybe(

View File

@ -1,4 +1,2 @@
buildscript = [] [[buildscript]]
[buildscript.gen_srcs]
[env]
OUT_DIR = "generated"

2
third-party/fixups/winapi/fixups.toml vendored Normal file
View File

@ -0,0 +1,2 @@
[[buildscript]]
[buildscript.rustc_flags]

View File

@ -1,13 +1,6 @@
precise_srcs = true vendor = false
rustc_flags = ["--cap-lints=allow"]
[cargo]
versioned_dirs = true
[buck] [buck]
generated_file_header = """ generated_file_header = """
# \u0040generated by `reindeer buckify` # \u0040generated by `reindeer buckify`
""" """
buckfile_imports = """
load("//tools/buck:buildscript.bzl", "buildscript_args")
"""

1
tools/buck/.ignore Normal file
View File

@ -0,0 +1 @@
prelude/

View File

@ -1,17 +0,0 @@
def buildscript_args(
name: str.type,
package_name: str.type,
buildscript_rule: str.type,
outfile: str.type,
version: str.type,
cfgs: [str.type] = [],
features: [str.type] = []):
_ = package_name
_ = version
_ = cfgs
_ = features
native.genrule(
name = name,
out = outfile,
cmd = "env RUSTC=rustc TARGET= $(exe %s) | sed -n s/^cargo:rustc-cfg=/--cfg=/p > ${OUT}" % buildscript_rule,
)

View File

@ -2,22 +2,25 @@ def rust_cxx_bridge(
name: str.type, name: str.type,
src: str.type, src: str.type,
deps: [str.type] = []): deps: [str.type] = []):
native.genrule( native.export_file(
name = "%s/header" % name, name = "%s/header" % name,
src = ":%s/generated[generated.h]" % name,
out = src + ".h", out = src + ".h",
cmd = "cp $(location :%s/generated)/generated.h ${OUT}" % name,
) )
native.genrule( native.export_file(
name = "%s/source" % name, name = "%s/source" % name,
src = ":%s/generated[generated.cc]" % name,
out = src + ".cc", out = src + ".cc",
cmd = "cp $(location :%s/generated)/generated.cc ${OUT}" % name,
) )
native.genrule( native.genrule(
name = "%s/generated" % name, name = "%s/generated" % name,
srcs = [src], srcs = [src],
out = ".", outs = {
"generated.cc": ["generated.cc"],
"generated.h": ["generated.h"],
},
cmd = "$(exe //:codegen) ${SRCS} -o ${OUT}/generated.h -o ${OUT}/generated.cc", cmd = "$(exe //:codegen) ${SRCS} -o ${OUT}/generated.h -o ${OUT}/generated.cc",
type = "cxxbridge", type = "cxxbridge",
) )

View File

@ -1,9 +1,25 @@
load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain") load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain")
load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain")
load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain") load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain")
load("@prelude//toolchains:rust.bzl", "system_rust_toolchain") load("@prelude//toolchains:rust.bzl", "system_rust_toolchain")
system_cxx_toolchain( system_cxx_toolchain(
name = "cxx", name = "cxx",
cxx_flags = select({
"config//os:linux": ["-std=c++17"],
"config//os:macos": ["-std=c++17"],
"config//os:windows": [],
}),
link_flags = select({
"config//os:linux": ["-lstdc++"],
"config//os:macos": ["-lc++"],
"config//os:windows": [],
}),
visibility = ["PUBLIC"],
)
system_genrule_toolchain(
name = "genrule",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )
@ -14,6 +30,7 @@ system_python_bootstrap_toolchain(
system_rust_toolchain( system_rust_toolchain(
name = "rust", name = "rust",
clippy_toml = "root//:.clippy.toml",
default_edition = None, default_edition = None,
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
) )