From b110613bee0b08686885b28ca3f3008c2ca0c511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=9C=AA=E6=9D=A5?= Date: Tue, 2 Apr 2024 19:59:25 +0800 Subject: [PATCH] =?UTF-8?q?cxx=201.0.91=E5=8D=87=E7=BA=A7=E8=87=B31.0.97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 徐未来 --- .buckconfig | 19 +- .buckroot | 0 .github/workflows/ci.yml | 38 +- .github/workflows/site.yml | 1 + .gitmodules | 2 +- BUCK | 32 +- BUILD | 14 +- BUILD.gn | 2 +- Cargo.toml | 8 +- README.OpenSource | 2 +- WORKSPACE | 6 +- book/src/SUMMARY.md | 2 +- book/src/build/bazel.md | 13 +- demo/BUCK | 1 + flags/Cargo.toml | 2 +- gen/build/Cargo.toml | 6 +- gen/build/src/lib.rs | 1 + gen/cmd/BUILD.gn | 2 +- gen/cmd/Cargo.toml | 6 +- gen/cmd/src/lib.rs | 1 - gen/lib/Cargo.toml | 6 +- gen/lib/src/error.rs | 41 ++ gen/lib/src/lib.rs | 1 + gen/src/file.rs | 6 +- include/cxx.h | 2 +- macro/BUILD.gn | 2 +- macro/Cargo.toml | 6 +- macro/src/expand.rs | 14 +- macro/src/lib.rs | 2 - macro/src/load.rs | 2 +- rust-toolchain.toml | 2 + src/cxx.cc | 4 +- src/cxx_string.rs | 19 + src/lib.rs | 2 +- src/shared_ptr.rs | 4 +- syntax/attrs.rs | 144 ++-- syntax/cfg.rs | 14 +- syntax/check.rs | 4 +- syntax/namespace.rs | 37 +- syntax/parse.rs | 172 +++-- syntax/qualified.rs | 22 +- syntax/tokens.rs | 4 +- tests/BUCK | 11 +- tests/cxx_string.rs | 19 + tests/ffi/build.rs | 3 + tests/ui/derive_noncopy.stderr | 4 +- tests/ui/include.stderr | 4 +- tests/ui/opaque_autotraits.stderr | 27 +- tests/ui/rust_pinned.stderr | 3 +- tests/ui/unique_ptr_to_opaque.stderr | 3 + tests/ui/vector_autotraits.stderr | 18 +- third-party/BUCK | 695 +++++++++--------- third-party/Cargo.lock | 57 +- third-party/Cargo.toml | 4 +- ...-6.4.1.bazel => BUILD.anstyle-1.0.0.bazel} | 9 +- third-party/bazel/BUILD.bazel | 12 +- ...lap-4.1.4.bazel => BUILD.clap-4.3.0.bazel} | 5 +- .../bazel/BUILD.clap_builder-4.3.0.bazel | 52 ++ ...0.3.1.bazel => BUILD.clap_lex-0.5.0.bazel} | 5 +- ...7.0.bazel => BUILD.once_cell-1.17.1.bazel} | 2 +- ...1.bazel => BUILD.proc-macro2-1.0.59.bazel} | 8 +- ...-1.0.23.bazel => BUILD.quote-1.0.28.bazel} | 8 +- ...-1.0.3.bazel => BUILD.scratch-1.0.5.bazel} | 6 +- third-party/bazel/BUILD.syn-1.0.107.bazel | 104 --- third-party/bazel/BUILD.syn-2.0.17.bazel | 56 ++ ....bazel => BUILD.unicode-ident-1.0.9.bazel} | 2 +- third-party/bazel/defs.bzl | 124 ++-- third-party/fixups/scratch/fixups.toml | 6 +- third-party/fixups/winapi/fixups.toml | 2 + third-party/reindeer.toml | 9 +- tools/buck/.ignore | 1 + tools/buck/buildscript.bzl | 17 - tools/buck/rust_cxx_bridge.bzl | 13 +- tools/buck/toolchains/BUCK | 17 + 74 files changed, 1097 insertions(+), 877 deletions(-) create mode 100644 .buckroot delete mode 100644 gen/cmd/src/lib.rs create mode 100644 rust-toolchain.toml rename third-party/bazel/{BUILD.os_str_bytes-6.4.1.bazel => BUILD.anstyle-1.0.0.bazel} (89%) rename third-party/bazel/{BUILD.clap-4.1.4.bazel => BUILD.clap-4.3.0.bazel} (90%) create mode 100644 third-party/bazel/BUILD.clap_builder-4.3.0.bazel rename third-party/bazel/{BUILD.clap_lex-0.3.1.bazel => BUILD.clap_lex-0.5.0.bazel} (91%) rename third-party/bazel/{BUILD.once_cell-1.17.0.bazel => BUILD.once_cell-1.17.1.bazel} (97%) rename third-party/bazel/{BUILD.proc-macro2-1.0.51.bazel => BUILD.proc-macro2-1.0.59.bazel} (92%) rename third-party/bazel/{BUILD.quote-1.0.23.bazel => BUILD.quote-1.0.28.bazel} (92%) rename third-party/bazel/{BUILD.scratch-1.0.3.bazel => BUILD.scratch-1.0.5.bazel} (94%) delete mode 100644 third-party/bazel/BUILD.syn-1.0.107.bazel create mode 100644 third-party/bazel/BUILD.syn-2.0.17.bazel rename third-party/bazel/{BUILD.unicode-ident-1.0.6.bazel => BUILD.unicode-ident-1.0.9.bazel} (97%) create mode 100644 third-party/fixups/winapi/fixups.toml create mode 100644 tools/buck/.ignore delete mode 100644 tools/buck/buildscript.bzl diff --git a/.buckconfig b/.buckconfig index 045974f7..e081ba21 100644 --- a/.buckconfig +++ b/.buckconfig @@ -1,8 +1,11 @@ [repositories] -repo = . +root = . prelude = tools/buck/prelude toolchains = tools/buck/toolchains -ovr_config = tools/buck/prelude +none = none + +[repository_aliases] +config = prelude buck = none fbcode = none fbsource = none @@ -11,7 +14,15 @@ fbsource = none # Hide BUCK files under target/package/ from `buck build ...`. Otherwise: # $ 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' -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] -target_platform_detector_spec = target://...->ovr_config//platforms:default +target_platform_detector_spec = target:root//...->prelude//platforms:default diff --git a/.buckroot b/.buckroot new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00109ff8..663ad47e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ name: CI on: push: pull_request: + workflow_dispatch: schedule: [cron: "40 1 * * *"] permissions: @@ -26,10 +27,10 @@ jobs: - rust: stable - rust: 1.60.0 - rust: 1.64.0 - - name: macOS + - name: Cargo on macOS rust: nightly os: macos - - name: Windows (msvc) + - name: Cargo on Windows (msvc) rust: nightly-x86_64-pc-windows-msvc os: windows flags: /EHsc @@ -45,6 +46,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust}} + components: rust-src - name: Determine test suite subset # 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, @@ -69,31 +71,39 @@ jobs: RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}} buck: - name: Buck - runs-on: ubuntu-latest + name: Buck2 on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}} + runs-on: ${{matrix.os}}-latest if: github.event_name != 'pull_request' + strategy: + fail-fast: false + matrix: + os: [ubuntu, macos, windows] timeout-minutes: 45 steps: - uses: actions/checkout@v3 with: submodules: true - uses: dtolnay/rust-toolchain@stable - - uses: dtolnay/install@reindeer - - uses: dtolnay/install@buck2 + with: + components: rust-src + - uses: dtolnay/install-buck2@latest - name: Install lld run: sudo apt-get install lld - - run: cargo vendor --versioned-dirs --locked - working-directory: third-party + if: matrix.os == 'ubuntu' + - run: buck2 run demo + - run: buck2 build ... + - run: buck2 test ... + - uses: dtolnay/install@reindeer + if: matrix.os == 'ubuntu' - run: reindeer buckify + if: matrix.os == 'ubuntu' working-directory: third-party - name: Check reindeer-generated BUCK file up to date run: git diff --exit-code - - run: buck2 run demo - - run: buck2 build ... - - run: buck2 run tests:test + if: matrix.os == 'ubuntu' bazel: - name: Bazel + name: Bazel on Linux runs-on: ubuntu-latest if: github.event_name != 'pull_request' timeout-minutes: 45 @@ -117,7 +127,9 @@ jobs: timeout-minutes: 45 steps: - 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 clang-tidy: diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 09382b79..1f9a6955 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -7,6 +7,7 @@ on: paths: - book/** - .github/workflows/site.yml + workflow_dispatch: jobs: deploy: diff --git a/.gitmodules b/.gitmodules index 208a58a9..1f0249f5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "tools/buck/prelude"] path = tools/buck/prelude - url = https://github.com/facebookincubator/buck2-prelude + url = https://github.com/facebook/buck2-prelude diff --git a/BUCK b/BUCK index 6fcf7fa8..0de52bbf 100644 --- a/BUCK +++ b/BUCK @@ -1,6 +1,14 @@ +export_file( + name = ".clippy.toml", + visibility = ["toolchains//:rust"], +) + rust_library( name = "cxx", srcs = glob(["src/**/*.rs"]), + doc_deps = [ + ":cxx-build", + ], edition = "2018", features = [ "alloc", @@ -9,19 +17,23 @@ rust_library( visibility = ["PUBLIC"], deps = [ ":core", - ":macro", + ":cxxbridge-macro", ], ) -rust_binary( +alias( name = "codegen", + actual = ":cxxbridge", + visibility = ["PUBLIC"], +) + +rust_binary( + name = "cxxbridge", srcs = glob(["gen/cmd/src/**/*.rs"]) + [ "gen/cmd/src/gen", "gen/cmd/src/syntax", ], - crate = "cxxbridge", edition = "2018", - visibility = ["PUBLIC"], deps = [ "//third-party:clap", "//third-party:codespan-reporting", @@ -37,15 +49,15 @@ cxx_library( exported_headers = { "cxx.h": "include/cxx.h", }, - exported_linker_flags = ["-lstdc++"], header_namespace = "rust", + preferred_linkage = "static", visibility = ["PUBLIC"], ) rust_library( - name = "macro", + name = "cxxbridge-macro", srcs = glob(["macro/src/**/*.rs"]) + ["macro/src/syntax"], - crate = "cxxbridge_macro", + doctests = False, edition = "2018", proc_macro = True, deps = [ @@ -56,13 +68,13 @@ rust_library( ) rust_library( - name = "build", + name = "cxx-build", srcs = glob(["gen/build/src/**/*.rs"]) + [ "gen/build/src/gen", "gen/build/src/syntax", ], + doctests = False, edition = "2018", - visibility = ["PUBLIC"], deps = [ "//third-party:cc", "//third-party:codespan-reporting", @@ -75,7 +87,7 @@ rust_library( ) rust_library( - name = "lib", + name = "cxx-gen", srcs = glob(["gen/lib/src/**/*.rs"]) + [ "gen/lib/src/gen", "gen/lib/src/syntax", diff --git a/BUILD b/BUILD index c88eb249..787994bd 100644 --- a/BUILD +++ b/BUILD @@ -16,12 +16,17 @@ rust_library( deps = [":core-lib"], ) -rust_binary( +alias( name = "codegen", + actual = ":cxxbridge", + visibility = ["//visibility:public"], +) + +rust_binary( + name = "cxxbridge", srcs = glob(["gen/cmd/src/**/*.rs"]), data = ["gen/cmd/src/gen/include/cxx.h"], edition = "2018", - visibility = ["//visibility:public"], deps = [ "//third-party:clap", "//third-party:codespan-reporting", @@ -57,11 +62,10 @@ rust_proc_macro( ) rust_library( - name = "build", + name = "cxx-build", srcs = glob(["gen/build/src/**/*.rs"]), data = ["gen/build/src/gen/include/cxx.h"], edition = "2018", - visibility = ["//visibility:public"], deps = [ "//third-party:cc", "//third-party:codespan-reporting", @@ -74,7 +78,7 @@ rust_library( ) rust_library( - name = "lib", + name = "cxx-gen", srcs = glob(["gen/lib/src/**/*.rs"]), data = ["gen/lib/src/gen/include/cxx.h"], edition = "2018", diff --git a/BUILD.gn b/BUILD.gn index 2a7e6b47..3011439f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -20,7 +20,7 @@ ohos_cargo_crate("lib") { sources = [ "src/lib.rs" ] edition = "2018" - cargo_pkg_version = "1.0.91" + cargo_pkg_version = "1.0.97" cargo_pkg_authors = "David Tolnay " cargo_pkg_name = "cxx" cargo_pkg_description = "Safe interop between Rust and C++" diff --git a/Cargo.toml b/Cargo.toml index 5ed5809c..5c967a1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] 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 "] categories = ["development-tools::ffi", "api-bindings", "no-std"] description = "Safe interop between Rust and C++" @@ -23,15 +23,15 @@ alloc = [] std = ["alloc"] [dependencies] -cxxbridge-macro = { version = "=1.0.91", path = "macro" } +cxxbridge-macro = { version = "=1.0.97", path = "macro" } link-cplusplus = "1.0" [build-dependencies] 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] -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-test-suite = { version = "0", path = "tests/ffi" } rustversion = "1.0" diff --git a/README.OpenSource b/README.OpenSource index c6936341..118c99f5 100644 --- a/README.OpenSource +++ b/README.OpenSource @@ -3,7 +3,7 @@ "Name": "cxx", "License": "Apache License 2.0, MIT", "License File": "LICENSE-APACHE, LICENSE-MIT", - "Version Number": "1.0.91", + "Version Number": "1.0.97", "Owner": "fangting12@huawei.com", "Upstream URL": "https://github.com/dtolnay/cxx", "Description": "A Rust library that provides a safe and easy way to call C++ code from Rust." diff --git a/WORKSPACE b/WORKSPACE index 7707436a..07975b38 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,8 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_rust", - sha256 = "2466e5b2514772e84f9009010797b9cd4b51c1e6445bbd5b5e24848d90e6fb2e", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.18.0/rules_rust-v0.18.0.tar.gz"], + sha256 = "50ec4b84a7ec5370f5882d52f4a1e6b8a75de2f8dcc0a4403747b69b2c4ef5b1", + 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") @@ -13,7 +13,7 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi rules_rust_dependencies() rust_register_toolchains( - versions = ["1.67.0"], + versions = ["1.69.0"], ) load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index a8f89bfc..2d2502ee 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -10,7 +10,7 @@ - [Multi-language build system options](building.md) - [Cargo](build/cargo.md) - - [Bazel](build/bazel.md) + - [Bazel or Buck2](build/bazel.md) - [CMake](build/cmake.md) - [More...](build/other.md) diff --git a/book/src/build/bazel.md b/book/src/build/bazel.md index 6a2c82b0..8bc0cf66 100644 --- a/book/src/build/bazel.md +++ b/book/src/build/bazel.md @@ -1,5 +1,5 @@ -{{#title Bazel, Buck — Rust ♡ C++}} -## Bazel, Buck, potentially other similar environments +{{#title Bazel, Buck2 — Rust ♡ C++}} +## Bazel, Buck2, potentially other similar environments 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` @@ -15,11 +15,14 @@ $ cxxbridge src/bridge.rs --header > path/to/bridge.rs.h $ cxxbridge src/bridge.rs > path/to/bridge.rs.cc ``` -The CXX repo maintains working Bazel `BUILD` and Buck `BUCK` targets for the -complete blobstore tutorial (chapter 3) for your reference, tested in CI. These -aren't meant to be directly what you use in your codebase, but serve as an +The CXX repo maintains working [Bazel] `BUILD` and [Buck2] `BUCK` targets for +the complete blobstore tutorial (chapter 3) for your reference, tested in CI. +These aren't meant to be directly what you use in your codebase, but serve as an illustration of one possible working pattern. +[Bazel]: https://bazel.build +[Buck2]: https://buck2.build + ```python # tools/bazel/rust_cxx_bridge.bzl diff --git a/demo/BUCK b/demo/BUCK index 8b3990ce..fe610fbd 100644 --- a/demo/BUCK +++ b/demo/BUCK @@ -21,6 +21,7 @@ cxx_library( name = "blobstore-sys", srcs = ["src/blobstore.cc"], compiler_flags = ["-std=c++14"], + preferred_linkage = "static", deps = [ ":blobstore-include", ":bridge/include", diff --git a/flags/Cargo.toml b/flags/Cargo.toml index 1f382294..87ade607 100644 --- a/flags/Cargo.toml +++ b/flags/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxxbridge-flags" -version = "1.0.91" +version = "1.0.97" authors = ["David Tolnay "] categories = ["development-tools::ffi", "compilers"] description = "Compiler configuration of the `cxx` crate (implementation detail)" diff --git a/gen/build/Cargo.toml b/gen/build/Cargo.toml index 08c4a4d5..b682221c 100644 --- a/gen/build/Cargo.toml +++ b/gen/build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxx-build" -version = "1.0.91" +version = "1.0.97" authors = ["David Tolnay "] categories = ["development-tools::build-utils", "development-tools::ffi"] description = "C++ code generator for integrating `cxx` crate into a Cargo build." @@ -22,10 +22,10 @@ experimental-async-fn = [] cc = "1.0.49" codespan-reporting = "0.11.1" 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 } 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] cxx = { version = "1.0", path = "../.." } diff --git a/gen/build/src/lib.rs b/gen/build/src/lib.rs index 3176a283..4e29ffb2 100644 --- a/gen/build/src/lib.rs +++ b/gen/build/src/lib.rs @@ -45,6 +45,7 @@ //! $ cxxbridge src/main.rs > path/to/mybridge.cc //! ``` +#![doc(html_root_url = "https://docs.rs/cxx-build/1.0.97")] #![allow( clippy::cast_sign_loss, clippy::default_trait_access, diff --git a/gen/cmd/BUILD.gn b/gen/cmd/BUILD.gn index 8628dbb3..8962c6df 100644 --- a/gen/cmd/BUILD.gn +++ b/gen/cmd/BUILD.gn @@ -19,7 +19,7 @@ ohos_cargo_crate("cxxbridge") { sources = [ "src/main.rs" ] edition = "2018" - cargo_pkg_version = "1.0.92" + cargo_pkg_version = "1.0.97" cargo_pkg_authors = "David Tolnay " cargo_pkg_name = "cxxbridge-cmd" cargo_pkg_description = diff --git a/gen/cmd/Cargo.toml b/gen/cmd/Cargo.toml index 677aa326..41b7dba6 100644 --- a/gen/cmd/Cargo.toml +++ b/gen/cmd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxxbridge-cmd" -version = "1.0.91" +version = "1.0.97" authors = ["David Tolnay "] categories = ["development-tools::build-utils", "development-tools::ffi"] description = "C++ code generator for integrating `cxx` crate into a non-Cargo build." @@ -23,9 +23,9 @@ experimental-async-fn = [] [dependencies] clap = { version = "4", default-features = false, features = ["error-context", "help", "std", "suggestions", "usage"] } 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 } -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] targets = ["x86_64-unknown-linux-gnu"] diff --git a/gen/cmd/src/lib.rs b/gen/cmd/src/lib.rs deleted file mode 100644 index 8b1a3937..00000000 --- a/gen/cmd/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -// empty diff --git a/gen/lib/Cargo.toml b/gen/lib/Cargo.toml index 01b5876f..d9b82c6c 100644 --- a/gen/lib/Cargo.toml +++ b/gen/lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxx-gen" -version = "0.7.91" +version = "0.7.97" authors = ["Adrian Taylor "] categories = ["development-tools::ffi"] description = "C++ code generator for integrating `cxx` crate into higher level tools." @@ -13,9 +13,9 @@ rust-version = "1.60" [dependencies] 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 } -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] doc-scrape-examples = false diff --git a/gen/lib/src/error.rs b/gen/lib/src/error.rs index bb53a7fc..79a27bd9 100644 --- a/gen/lib/src/error.rs +++ b/gen/lib/src/error.rs @@ -3,12 +3,23 @@ use std::error::Error as StdError; use std::fmt::{self, Debug, Display}; +use std::iter; #[allow(missing_docs)] pub struct Error { pub(crate) err: crate::gen::Error, } +impl Error { + /// Returns the span of the error, if available. + pub fn span(&self) -> Option { + match &self.err { + crate::gen::Error::Syn(err) => Some(err.span()), + _ => None, + } + } +} + impl From for Error { fn from(err: crate::gen::Error) -> Self { Error { err } @@ -32,3 +43,33 @@ impl StdError for Error { 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(::IntoIter), + Other(iter::Once), +} + +impl Iterator for IntoIter { + type Item = Error; + + fn next(&mut self) -> Option { + match self { + IntoIter::Syn(iter) => iter + .next() + .map(|syn_err| Error::from(crate::gen::Error::Syn(syn_err))), + IntoIter::Other(iter) => iter.next(), + } + } +} diff --git a/gen/lib/src/lib.rs b/gen/lib/src/lib.rs index 47cfa18d..17baa7f5 100644 --- a/gen/lib/src/lib.rs +++ b/gen/lib/src/lib.rs @@ -7,6 +7,7 @@ //! [dtolnay/cxx#235]: https://github.com/dtolnay/cxx/issues/235 //! [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)] #![allow(dead_code)] #![allow( diff --git a/gen/src/file.rs b/gen/src/file.rs index 46616fbd..4e4259ef 100644 --- a/gen/src/file.rs +++ b/gen/src/file.rs @@ -2,7 +2,7 @@ use crate::syntax::file::Module; use crate::syntax::namespace::Namespace; use syn::parse::discouraged::Speculative; 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 modules: Vec, @@ -23,7 +23,7 @@ fn parse(input: ParseStream, modules: &mut Vec) -> Result<()> { let mut namespace = Namespace::ROOT; let mut attrs = input.call(Attribute::parse_outer)?; 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" { cxx_bridge = true; namespace = parse_args(attr)?; @@ -64,7 +64,7 @@ fn parse(input: ParseStream, modules: &mut Vec) -> Result<()> { } fn parse_args(attr: &Attribute) -> Result { - if attr.tokens.is_empty() { + if let Meta::Path(_) = attr.meta { Ok(Namespace::ROOT) } else { attr.parse_args_with(Namespace::parse_bridge_attr_namespace) diff --git a/include/cxx.h b/include/cxx.h index 907ee829..5d3b694c 100644 --- a/include/cxx.h +++ b/include/cxx.h @@ -659,7 +659,7 @@ typename Slice::iterator::difference_type Slice::iterator::operator-(const iterator &other) const noexcept { auto diff = std::distance(static_cast(other.pos), static_cast(this->pos)); - return diff / this->stride; + return diff / static_cast::iterator::difference_type>(this->stride); } template diff --git a/macro/BUILD.gn b/macro/BUILD.gn index 6dcbd97c..d98f35a6 100644 --- a/macro/BUILD.gn +++ b/macro/BUILD.gn @@ -21,7 +21,7 @@ ohos_cargo_crate("lib") { sources = [ "src/lib.rs" ] edition = "2018" - cargo_pkg_version = "1.0.91" + cargo_pkg_version = "1.0.97" cargo_pkg_authors = "David Tolnay " cargo_pkg_name = "cxxbridge-macro" cargo_pkg_description = "Implementation detail of the `cxx` crate." diff --git a/macro/Cargo.toml b/macro/Cargo.toml index 988c848b..e855a8a6 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxxbridge-macro" -version = "1.0.91" +version = "1.0.97" authors = ["David Tolnay "] categories = ["development-tools::ffi"] 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"] [dependencies] -proc-macro2 = "1.0.39" +proc-macro2 = "1.0.58" quote = "1.0.4" -syn = { version = "1.0.95", features = ["full"] } +syn = { version = "2.0.1", features = ["full"] } # optional dependencies: clang-ast = { version = "0.1", optional = true } diff --git a/macro/src/expand.rs b/macro/src/expand.rs index ea5af66a..bd0a2063 100644 --- a/macro/src/expand.rs +++ b/macro/src/expand.rs @@ -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 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 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 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 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 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); 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 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); 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 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); 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 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 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) => { 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!(#ty), diff --git a/macro/src/lib.rs b/macro/src/lib.rs index 138e3a29..d0205b32 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -29,8 +29,6 @@ clippy::wrong_self_convention )] -extern crate proc_macro; - mod derive; mod expand; mod generics; diff --git a/macro/src/load.rs b/macro/src/load.rs index dccece44..bf284427 100644 --- a/macro/src/load.rs +++ b/macro/src/load.rs @@ -277,7 +277,7 @@ enum ParsedDiscriminant { fn discriminant_value(mut clang: &[Node]) -> ParsedDiscriminant { if clang.is_empty() { // No discriminant expression provided; use successor of previous - // descriminant. + // discriminant. return ParsedDiscriminant::Successor; } diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..20fe888c --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +components = ["rust-src"] diff --git a/src/cxx.cc b/src/cxx.cc index 4958eb08..4aac6427 100644 --- a/src/cxx.cc +++ b/src/cxx.cc @@ -285,7 +285,7 @@ String::String(unsafe_bitcopy_t, const String &bits) noexcept : repr(bits.repr) {} std::ostream &operator<<(std::ostream &os, const String &s) { - os.write(s.data(), s.size()); + os.write(s.data(), static_cast(s.size())); return os; } @@ -374,7 +374,7 @@ void Str::swap(Str &rhs) noexcept { } std::ostream &operator<<(std::ostream &os, const Str &s) { - os.write(s.data(), s.size()); + os.write(s.data(), static_cast(s.size())); return os; } diff --git a/src/cxx_string.rs b/src/cxx_string.rs index 9ecbcc64..d5d0af4a 100644 --- a/src/cxx_string.rs +++ b/src/cxx_string.rs @@ -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 { + self.as_mut().push_bytes(buf); + Ok(buf.len()) + } + + fn flush(&mut self) -> std::io::Result<()> { + Ok(()) + } +} + #[doc(hidden)] #[repr(C)] pub struct StackString { diff --git a/src/lib.rs b/src/lib.rs index 77ec7cff..1a41936b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -364,7 +364,7 @@ //! #![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( improper_ctypes, improper_ctypes_definitions, diff --git a/src/shared_ptr.rs b/src/shared_ptr.rs index 64c86619..377b214f 100644 --- a/src/shared_ptr.rs +++ b/src/shared_ptr.rs @@ -191,8 +191,8 @@ pub unsafe trait SharedPtrTarget { where Self: Sized, { - // Opoaque C types do not get this method because they can never exist - // by value on the Rust side of the bridge. + // Opaque C types do not get this method because they can never exist by + // value on the Rust side of the bridge. let _ = value; let _ = new; unreachable!() diff --git a/syntax/attrs.rs b/syntax/attrs.rs index 46d010e0..4ff700a8 100644 --- a/syntax/attrs.rs +++ b/syntax/attrs.rs @@ -5,8 +5,8 @@ use crate::syntax::Atom::{self, *}; use crate::syntax::{cfg, Derive, Doc, ForeignName}; use proc_macro2::{Ident, TokenStream}; use quote::ToTokens; -use syn::parse::{Nothing, Parse, ParseStream, Parser as _}; -use syn::{parenthesized, token, Attribute, Error, LitStr, Path, Result, Token}; +use syn::parse::ParseStream; +use syn::{Attribute, Error, Expr, Lit, LitStr, Meta, Path, Result, Token}; // Intended usage: // @@ -47,8 +47,9 @@ pub struct Parser<'a> { pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> OtherAttrs { let mut passthrough_attrs = Vec::new(); for attr in attrs { - if attr.path.is_ident("doc") { - match parse_doc_attribute.parse2(attr.tokens.clone()) { + let attr_path = attr.path(); + if attr_path.is_ident("doc") { + match parse_doc_attribute(&attr.meta) { Ok(attr) => { if let Some(doc) = &mut parser.doc { match attr { @@ -63,7 +64,7 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe 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)) { Ok(attr) => { if let Some(derives) = &mut parser.derives { @@ -76,7 +77,7 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe break; } } - } else if attr.path.is_ident("repr") { + } else if attr_path.is_ident("repr") { match attr.parse_args_with(parse_repr_attribute) { Ok(attr) => { if let Some(repr) = &mut parser.repr { @@ -89,8 +90,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe break; } } - } else if attr.path.is_ident("namespace") { - match parse_namespace_attribute.parse2(attr.tokens.clone()) { + } else if attr_path.is_ident("namespace") { + match Namespace::parse_meta(&attr.meta) { Ok(attr) => { if let Some(namespace) = &mut parser.namespace { **namespace = attr; @@ -102,8 +103,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe break; } } - } else if attr.path.is_ident("cxx_name") { - match parse_cxx_name_attribute.parse2(attr.tokens.clone()) { + } else if attr_path.is_ident("cxx_name") { + match parse_cxx_name_attribute(&attr.meta) { Ok(attr) => { if let Some(cxx_name) = &mut parser.cxx_name { **cxx_name = Some(attr); @@ -115,8 +116,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe break; } } - } else if attr.path.is_ident("rust_name") { - match parse_rust_name_attribute.parse2(attr.tokens.clone()) { + } else if attr_path.is_ident("rust_name") { + match parse_rust_name_attribute(&attr.meta) { Ok(attr) => { if let Some(rust_name) = &mut parser.rust_name { **rust_name = Some(attr); @@ -128,8 +129,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe break; } } - } else if attr.path.is_ident("cfg") { - match cfg::parse_attribute.parse2(attr.tokens.clone()) { + } else if attr_path.is_ident("cfg") { + match cfg::parse_attribute(&attr) { Ok(cfg_expr) => { if let Some(cfg) = &mut parser.cfg { cfg.merge(cfg_expr); @@ -142,31 +143,31 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe 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") { - if let Err(err) = Nothing::parse.parse2(attr.tokens.clone()) { + if let Err(err) = attr.meta.require_path_only() { cx.push(err); } if let Some(variants_from_header) = &mut parser.variants_from_header { **variants_from_header = Some(attr); continue; } - } else if attr.path.is_ident("allow") - || attr.path.is_ident("warn") - || attr.path.is_ident("deny") - || attr.path.is_ident("forbid") - || attr.path.is_ident("deprecated") - || attr.path.is_ident("must_use") + } else if attr_path.is_ident("allow") + || attr_path.is_ident("warn") + || attr_path.is_ident("deny") + || attr_path.is_ident("forbid") + || attr_path.is_ident("deprecated") + || attr_path.is_ident("must_use") { // https://doc.rust-lang.org/reference/attributes/diagnostics.html passthrough_attrs.push(attr); continue; - } else if attr.path.is_ident("serde") { + } else if attr_path.is_ident("serde") { passthrough_attrs.push(attr); continue; - } else if attr.path.segments.len() > 1 { - let tool = &attr.path.segments.first().unwrap().ident; + } else if attr_path.segments.len() > 1 { + let tool = &attr_path.segments.first().unwrap().ident; if tool == "rustfmt" { // Skip, rustfmt only needs to find it in the pre-expansion source file. continue; @@ -192,24 +193,26 @@ mod kw { syn::custom_keyword!(hidden); } -fn parse_doc_attribute(input: ParseStream) -> Result { - let lookahead = input.lookahead1(); - if lookahead.peek(Token![=]) { - input.parse::()?; - let lit: LitStr = input.parse()?; - Ok(DocAttribute::Doc(lit)) - } else if lookahead.peek(token::Paren) { - let content; - parenthesized!(content in input); - content.parse::()?; - Ok(DocAttribute::Hidden) - } else { - Err(lookahead.error()) +fn parse_doc_attribute(meta: &Meta) -> Result { + match meta { + Meta::NameValue(meta) => { + if let Expr::Lit(expr) = &meta.value { + if let Lit::Str(lit) = &expr.lit { + return Ok(DocAttribute::Doc(lit.clone())); + } + } + } + Meta::List(meta) => { + meta.parse_args::()?; + return Ok(DocAttribute::Hidden); + } + Meta::Path(_) => {} } + Err(Error::new_spanned(meta, "unsupported doc attribute")) } fn parse_derive_attribute(cx: &mut Errors, input: ParseStream) -> Result> { - let paths = input.parse_terminated::(Path::parse_mod_style)?; + let paths = input.parse_terminated(Path::parse_mod_style, Token![,])?; let mut derives = Vec::new(); for path in paths { @@ -241,31 +244,42 @@ fn parse_repr_attribute(input: ParseStream) -> Result { )) } -fn parse_namespace_attribute(input: ParseStream) -> Result { - input.parse::()?; - let namespace = input.parse::()?; - Ok(namespace) +fn parse_cxx_name_attribute(meta: &Meta) -> Result { + if let Meta::NameValue(meta) = meta { + match &meta.value { + 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 { - input.parse::()?; - if input.peek(LitStr) { - let lit: LitStr = input.parse()?; - ForeignName::parse(&lit.value(), lit.span()) - } else { - let ident: Ident = input.parse()?; - ForeignName::parse(&ident.to_string(), ident.span()) - } -} - -fn parse_rust_name_attribute(input: ParseStream) -> Result { - input.parse::()?; - if input.peek(LitStr) { - let lit: LitStr = input.parse()?; - lit.parse() - } else { - input.parse() +fn parse_rust_name_attribute(meta: &Meta) -> Result { + if let Meta::NameValue(meta) = meta { + match &meta.value { + Expr::Lit(expr) => { + if let Lit::Str(lit) = &expr.lit { + return lit.parse(); + } + } + Expr::Path(expr) => { + if let Some(ident) = expr.path.get_ident() { + return Ok(ident.clone()); + } + } + _ => {} + } } + Err(Error::new_spanned(meta, "unsupported rust_name attribute")) } #[derive(Clone)] @@ -288,15 +302,11 @@ impl ToTokens for OtherAttrs { pound_token, style, bracket_token, - path, - tokens: attr_tokens, + meta, } = attr; pound_token.to_tokens(tokens); let _ = style; // ignore; render outer and inner attrs both as outer - bracket_token.surround(tokens, |tokens| { - path.to_tokens(tokens); - attr_tokens.to_tokens(tokens); - }); + bracket_token.surround(tokens, |tokens| meta.to_tokens(tokens)); } } } diff --git a/syntax/cfg.rs b/syntax/cfg.rs index d486b995..ce6f3389 100644 --- a/syntax/cfg.rs +++ b/syntax/cfg.rs @@ -1,7 +1,7 @@ use proc_macro2::Ident; use std::mem; use syn::parse::{Error, ParseStream, Result}; -use syn::{parenthesized, token, LitStr, Token}; +use syn::{parenthesized, token, Attribute, LitStr, Token}; #[derive(Clone)] pub enum CfgExpr { @@ -25,12 +25,12 @@ impl CfgExpr { } } -pub fn parse_attribute(input: ParseStream) -> Result { - let content; - parenthesized!(content in input); - let cfg_expr = content.call(parse_single)?; - content.parse::>()?; - Ok(cfg_expr) +pub fn parse_attribute(attr: &Attribute) -> Result { + attr.parse_args_with(|input: ParseStream| { + let cfg_expr = input.call(parse_single)?; + input.parse::>()?; + Ok(cfg_expr) + }) } fn parse_single(input: ParseStream) -> Result { diff --git a/syntax/check.rs b/syntax/check.rs index 66883be0..0770c847 100644 --- a/syntax/check.rs +++ b/syntax/check.rs @@ -664,14 +664,14 @@ fn is_opaque_cxx(cx: &mut Check, ty: &Ident) -> bool { fn span_for_struct_error(strct: &Struct) -> TokenStream { let struct_token = strct.struct_token; 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) } fn span_for_enum_error(enm: &Enum) -> TokenStream { let enum_token = enm.enum_token; 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) } diff --git a/syntax/namespace.rs b/syntax/namespace.rs index 07185e18..aae865cc 100644 --- a/syntax/namespace.rs +++ b/syntax/namespace.rs @@ -3,8 +3,8 @@ use quote::IdentFragment; use std::fmt::{self, Display}; use std::iter::FromIterator; use std::slice::Iter; -use syn::parse::{Parse, ParseStream, Result}; -use syn::{Ident, Token}; +use syn::parse::{Error, Parse, ParseStream, Result}; +use syn::{Expr, Ident, Lit, Meta, Token}; mod kw { syn::custom_keyword!(namespace); @@ -24,7 +24,7 @@ impl Namespace { self.segments.iter() } - pub fn parse_bridge_attr_namespace(input: ParseStream) -> Result { + pub fn parse_bridge_attr_namespace(input: ParseStream) -> Result { if input.is_empty() { return Ok(Namespace::ROOT); } @@ -35,6 +35,37 @@ impl Namespace { input.parse::>()?; Ok(namespace) } + + pub fn parse_meta(meta: &Meta) -> Result { + 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 { diff --git a/syntax/parse.rs b/syntax/parse.rs index 1754c600..c6fee5f8 100644 --- a/syntax/parse.rs +++ b/syntax/parse.rs @@ -489,11 +489,7 @@ fn parse_extern_type( let type_token = foreign_type.type_token; let visibility = visibility_pub(&foreign_type.vis, type_token.span); let name = pair(namespace, &foreign_type.ident, cxx_name, rust_name); - let generics = Lifetimes { - lt_token: None, - lifetimes: Punctuated::new(), - gt_token: None, - }; + let generics = extern_type_lifetimes(cx, foreign_type.generics); let colon_token = None; let bounds = Vec::new(); let semi_token = foreign_type.semi_token; @@ -611,7 +607,27 @@ fn parse_extern_fn( }); 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) => { let ident = match arg.pat.as_ref() { @@ -622,45 +638,24 @@ fn parse_extern_fn( _ => return Err(Error::new_spanned(arg, "unsupported signature")), }; let ty = parse_type(&arg.ty)?; - if ident != "self" { - let cfg = CfgExpr::Unconditional; - let doc = Doc::new(); - let attrs = OtherAttrs::none(); - let visibility = Token![pub](ident.span()); - let name = pair(Namespace::default(), &ident, None, None); - let colon_token = arg.colon_token; - args.push_value(Var { - cfg, - doc, - attrs, - visibility, - name, - colon_token, - ty, - }); - if let Some(comma) = comma { - args.push_punct(*comma); - } - continue; + let cfg = CfgExpr::Unconditional; + let doc = Doc::new(); + let attrs = OtherAttrs::none(); + let visibility = Token![pub](ident.span()); + let name = pair(Namespace::default(), &ident, None, None); + let colon_token = arg.colon_token; + args.push_value(Var { + cfg, + doc, + attrs, + visibility, + name, + colon_token, + ty, + }); + if let Some(comma) = comma { + args.push_punct(*comma); } - 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 ident: Ident = 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 has_unsupported_generic_param = false; 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, lifetimes, 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 { false } => {} - bound @ TypeParamBound::Trait(_) | bound @ TypeParamBound::Lifetime(_) => { - cx.error(bound, "unsupported trait"); - } + bound => cx.error(bound, "unsupported trait"), } let lookahead = input.lookahead1(); @@ -1004,7 +1001,7 @@ fn parse_impl(cx: &mut Errors, imp: ItemImpl) -> Result { if !imp.items.is_empty() { 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")); } @@ -1151,7 +1148,7 @@ fn parse_type(ty: &RustType) -> Result { RustType::Path(ty) => parse_type_path(ty), RustType::Array(ty) => parse_type_array(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")), } } @@ -1387,7 +1384,7 @@ fn parse_type_fn(ty: &TypeBareFn) -> Result { let (ident, colon_token) = match &arg.name { Some((ident, colon_token)) => (ident.clone(), *colon_token), 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 colon_token = Token![:](fn_span); (ident, colon_token) @@ -1470,8 +1467,7 @@ fn parse_return_type( fn visibility_pub(vis: &Visibility, inherited: Span) -> Token![pub] { Token![pub](match vis { - Visibility::Public(vis) => vis.pub_token.span, - Visibility::Crate(vis) => vis.crate_token.span, + Visibility::Public(vis) => vis.span, Visibility::Restricted(vis) => vis.pub_token.span, Visibility::Inherited => inherited, }) diff --git a/syntax/qualified.rs b/syntax/qualified.rs index 5f182fa9..e11ffbc1 100644 --- a/syntax/qualified.rs +++ b/syntax/qualified.rs @@ -7,6 +7,18 @@ pub struct QualifiedName { } impl QualifiedName { + pub fn parse_quoted(lit: &LitStr) -> Result { + if lit.value().is_empty() { + let segments = Vec::new(); + Ok(QualifiedName { segments }) + } else { + lit.parse_with(|input: ParseStream| { + let allow_raw = false; + parse_unquoted(input, allow_raw) + }) + } + } + pub fn parse_unquoted(input: ParseStream) -> Result { let allow_raw = true; parse_unquoted(input, allow_raw) @@ -15,15 +27,7 @@ impl QualifiedName { pub fn parse_quoted_or_unquoted(input: ParseStream) -> Result { if input.peek(LitStr) { let lit: LitStr = input.parse()?; - if lit.value().is_empty() { - let segments = Vec::new(); - Ok(QualifiedName { segments }) - } else { - lit.parse_with(|input: ParseStream| { - let allow_raw = false; - parse_unquoted(input, allow_raw) - }) - } + Self::parse_quoted(&lit) } else { Self::parse_unquoted(input) } diff --git a/syntax/tokens.rs b/syntax/tokens.rs index a9f42bd4..05eddc70 100644 --- a/syntax/tokens.rs +++ b/syntax/tokens.rs @@ -270,7 +270,7 @@ impl ToTokens for Signature { args.to_tokens(tokens); }); 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 { result.to_tokens(tokens); langle.to_tokens(tokens); @@ -280,7 +280,7 @@ impl ToTokens for Signature { ret.to_tokens(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); langle.to_tokens(tokens); token::Paren(langle.span).surround(tokens, |_| ()); diff --git a/tests/BUCK b/tests/BUCK index 865eebc9..2a45d47d 100644 --- a/tests/BUCK +++ b/tests/BUCK @@ -33,11 +33,12 @@ cxx_library( ":module/source", ], exported_deps = ["//:core"], - exported_headers = { - "ffi/lib.rs.h": ":bridge/header", - "ffi/module.rs.h": ":module/header", - "ffi/tests.h": "ffi/tests.h", - }, + exported_headers = [ + ":bridge/header", + ":module/header", + "ffi/tests.h", + ], + preferred_linkage = "static", ) rust_cxx_bridge( diff --git a/tests/cxx_string.rs b/tests/cxx_string.rs index 67444fa5..349a4e1f 100644 --- a/tests/cxx_string.rs +++ b/tests/cxx_string.rs @@ -1,4 +1,5 @@ use cxx::{let_cxx_string, CxxString}; +use std::fmt::Write as _; #[test] fn test_async_cxx_string() { @@ -20,3 +21,21 @@ fn test_debug() { 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!")); +} diff --git a/tests/ffi/build.rs b/tests/ffi/build.rs index 86f8cd3a..a1a64b7f 100644 --- a/tests/ffi/build.rs +++ b/tests/ffi/build.rs @@ -15,4 +15,7 @@ fn main() { build.define("CXX_TEST_INSTANTIATIONS", None); } build.compile("cxx-test-suite"); + + println!("cargo:rerun-if-changed=tests.cc"); + println!("cargo:rerun-if-changed=tests.h"); } diff --git a/tests/ui/derive_noncopy.stderr b/tests/ui/derive_noncopy.stderr index 419b0f22..359581aa 100644 --- a/tests/ui/derive_noncopy.stderr +++ b/tests/ui/derive_noncopy.stderr @@ -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 | 4 | struct TryCopy { | ^^^^^^^ 5 | other: Other, - | ------------ this field does not implement `Copy` + | ------------ this field does not implement `std::marker::Copy` diff --git a/tests/ui/include.stderr b/tests/ui/include.stderr index 45cc5591..b801530e 100644 --- a/tests/ui/include.stderr +++ b/tests/ui/include.stderr @@ -11,10 +11,10 @@ error: unexpected token | ^^^^ error: expected `>` - --> tests/ui/include.rs:6:17 + --> tests/ui/include.rs:6:26 | 6 | include!( tests/ui/include.rs:7:23 diff --git a/tests/ui/opaque_autotraits.stderr b/tests/ui/opaque_autotraits.stderr index c6447c55..c8e1fbb2 100644 --- a/tests/ui/opaque_autotraits.stderr +++ b/tests/ui/opaque_autotraits.stderr @@ -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` = 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` --> 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` = 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` --> tests/ui/opaque_autotraits.rs:4:14 | @@ -44,9 +52,18 @@ error[E0277]: `PhantomPinned` cannot be unpinned 15 | assert_unpin::(); | ^^^^^^^^^^^ within `ffi::Opaque`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using `Box::pin` - = note: required because it appears within the type `PhantomData` - = note: required because it appears within the type `Opaque` + = 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 `PhantomData` + --> $RUST/core/src/marker.rs + | + | pub struct PhantomData; + | ^^^^^^^^^^^ +note: required because it appears within the type `Opaque` + --> src/opaque.rs + | + | pub struct Opaque { + | ^^^^^^ note: required because it appears within the type `Opaque` --> tests/ui/opaque_autotraits.rs:4:14 | diff --git a/tests/ui/rust_pinned.stderr b/tests/ui/rust_pinned.stderr index a0fc0338..ba1852b8 100644 --- a/tests/ui/rust_pinned.stderr +++ b/tests/ui/rust_pinned.stderr @@ -4,7 +4,8 @@ error[E0277]: `PhantomPinned` cannot be unpinned 6 | type Pinned; | ^^^^^^ 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` --> tests/ui/rust_pinned.rs:10:12 | diff --git a/tests/ui/unique_ptr_to_opaque.stderr b/tests/ui/unique_ptr_to_opaque.stderr index 3c121e54..7aa5d8ae 100644 --- a/tests/ui/unique_ptr_to_opaque.stderr +++ b/tests/ui/unique_ptr_to_opaque.stderr @@ -14,5 +14,8 @@ note: expected this to be `Trivial` note: required by a bound in `UniquePtr::::new` --> src/unique_ptr.rs | + | pub fn new(value: T) -> Self + | --- required by a bound in this associated function + | where | T: ExternType, | ^^^^^^^^^^^^^^ required by this bound in `UniquePtr::::new` diff --git a/tests/ui/vector_autotraits.stderr b/tests/ui/vector_autotraits.stderr index 8851cedc..e809b61a 100644 --- a/tests/ui/vector_autotraits.stderr +++ b/tests/ui/vector_autotraits.stderr @@ -6,15 +6,27 @@ error[E0277]: `*const cxx::void` cannot be sent between threads safely | = help: within `CxxVector`, 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 `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` --> tests/ui/vector_autotraits.rs:7:14 | 7 | 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 `CxxVector` +note: required because it appears within the type `PhantomData<[NotThreadSafe]>` + --> $RUST/core/src/marker.rs + | + | pub struct PhantomData; + | ^^^^^^^^^^^ +note: required because it appears within the type `CxxVector` + --> src/cxx_vector.rs + | + | pub struct CxxVector { + | ^^^^^^^^^ note: required by a bound in `assert_send` --> tests/ui/vector_autotraits.rs:16:19 | diff --git a/third-party/BUCK b/third-party/BUCK index dddbab6b..90285eef 100644 --- a/third-party/BUCK +++ b/third-party/BUCK @@ -1,18 +1,44 @@ # @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( - name = "bitflags-1.3.2", - srcs = [ - "vendor/bitflags-1.3.2/src/example_generated.rs", - "vendor/bitflags-1.3.2/src/lib.rs", +http_archive( + name = "anstyle-1.0.0.crate", + sha256 = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d", + strip_prefix = "anstyle-1.0.0", + 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_root = "vendor/bitflags-1.3.2/src/lib.rs", + crate_root = "bitflags-1.3.2.crate/src/lib.rs", edition = "2018", features = ["default"], - rustc_flags = ["--cap-lints=allow"], visibility = [], ) @@ -22,110 +48,66 @@ alias( 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", - srcs = [ - "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", - ], + srcs = [":cc-1.0.79.crate"], crate = "cc", - crate_root = "vendor/cc-1.0.79/src/lib.rs", + crate_root = "cc-1.0.79.crate/src/lib.rs", edition = "2018", - rustc_flags = ["--cap-lints=allow"], visibility = [], ) alias( name = "clap", - actual = ":clap-4.1.4", + actual = ":clap-4.3.0", visibility = ["PUBLIC"], ) -rust_library( - name = "clap-4.1.4", - srcs = [ - "vendor/clap-4.1.4/examples/demo.md", - "vendor/clap-4.1.4/examples/demo.rs", - "vendor/clap-4.1.4/src/_cookbook/cargo_example.rs", - "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", - "vendor/clap-4.1.4/src/_cookbook/find.rs", - "vendor/clap-4.1.4/src/_cookbook/git.rs", - "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", - ], +http_archive( + name = "clap-4.3.0.crate", + sha256 = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc", + strip_prefix = "clap-4.3.0", + urls = ["https://crates.io/api/v1/crates/clap/4.3.0/download"], + visibility = [], +) + +cargo.rust_library( + name = "clap-4.3.0", + srcs = [":clap-4.3.0.crate"], 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", features = [ "error-context", @@ -133,23 +115,29 @@ rust_library( "std", "usage", ], - rustc_flags = ["--cap-lints=allow"], visibility = [], deps = [ + ":anstyle-1.0.0", ":bitflags-1.3.2", - ":clap_lex-0.3.1", + ":clap_lex-0.5.0", ], ) -rust_library( - name = "clap_lex-0.3.1", - srcs = ["vendor/clap_lex-0.3.1/src/lib.rs"], - crate = "clap_lex", - crate_root = "vendor/clap_lex-0.3.1/src/lib.rs", - edition = "2021", - rustc_flags = ["--cap-lints=allow"], +http_archive( + name = "clap_lex-0.5.0.crate", + sha256 = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b", + strip_prefix = "clap_lex-0.5.0", + urls = ["https://crates.io/api/v1/crates/clap_lex/0.5.0/download"], + visibility = [], +) + +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 = [], - deps = [":os_str_bytes-6.4.1"], ) alias( @@ -158,21 +146,20 @@ alias( 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", - srcs = [ - "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", - ], + srcs = [":codespan-reporting-0.11.1.crate"], 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", - rustc_flags = ["--cap-lints=allow"], visibility = [], deps = [ ":termcolor-1.2.0", @@ -182,21 +169,23 @@ rust_library( alias( name = "once_cell", - actual = ":once_cell-1.17.0", + actual = ":once_cell-1.17.1", visibility = ["PUBLIC"], ) -rust_library( - name = "once_cell-1.17.0", - srcs = [ - "vendor/once_cell-1.17.0/src/imp_cs.rs", - "vendor/once_cell-1.17.0/src/imp_pl.rs", - "vendor/once_cell-1.17.0/src/imp_std.rs", - "vendor/once_cell-1.17.0/src/lib.rs", - "vendor/once_cell-1.17.0/src/race.rs", - ], +http_archive( + name = "once_cell-1.17.1.crate", + sha256 = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3", + strip_prefix = "once_cell-1.17.1", + urls = ["https://crates.io/api/v1/crates/once_cell/1.17.1/download"], + visibility = [], +) + +cargo.rust_library( + name = "once_cell-1.17.1", + srcs = [":once_cell-1.17.1.crate"], 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", features = [ "alloc", @@ -204,241 +193,180 @@ rust_library( "race", "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 = [], ) alias( name = "proc-macro2", - actual = ":proc-macro2-1.0.51", + actual = ":proc-macro2-1.0.59", visibility = ["PUBLIC"], ) -rust_library( - name = "proc-macro2-1.0.51", - srcs = [ - "vendor/proc-macro2-1.0.51/src/detection.rs", - "vendor/proc-macro2-1.0.51/src/fallback.rs", - "vendor/proc-macro2-1.0.51/src/lib.rs", - "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", - "vendor/proc-macro2-1.0.51/src/rcvec.rs", - "vendor/proc-macro2-1.0.51/src/wrapper.rs", - ], +http_archive( + name = "proc-macro2-1.0.59.crate", + sha256 = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b", + strip_prefix = "proc-macro2-1.0.59", + urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.59/download"], + visibility = [], +) + +cargo.rust_library( + name = "proc-macro2-1.0.59", + srcs = [":proc-macro2-1.0.59.crate"], 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", features = [ "default", "proc-macro", "span-locations", ], - rustc_flags = [ - "--cap-lints=allow", - "@$(location :proc-macro2-1.0.51-build-script-build-args)", - ], + rustc_flags = ["@$(location :proc-macro2-1.0.59-build-script-run[rustc_flags])"], visibility = [], - deps = [":unicode-ident-1.0.6"], + deps = [":unicode-ident-1.0.9"], ) -rust_binary( - name = "proc-macro2-1.0.51-build-script-build", - srcs = ["vendor/proc-macro2-1.0.51/build.rs"], +cargo.rust_binary( + name = "proc-macro2-1.0.59-build-script-build", + srcs = [":proc-macro2-1.0.59.crate"], 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", features = [ "default", "proc-macro", "span-locations", ], - rustc_flags = ["--cap-lints=allow"], visibility = [], ) -buildscript_args( - name = "proc-macro2-1.0.51-build-script-build-args", +buildscript_run( + name = "proc-macro2-1.0.59-build-script-run", 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 = [ "default", "proc-macro", "span-locations", ], - outfile = "args.txt", - version = "1.0.51", + version = "1.0.59", ) alias( name = "quote", - actual = ":quote-1.0.23", + actual = ":quote-1.0.28", visibility = ["PUBLIC"], ) -rust_library( - name = "quote-1.0.23", - srcs = [ - "vendor/quote-1.0.23/src/ext.rs", - "vendor/quote-1.0.23/src/format.rs", - "vendor/quote-1.0.23/src/ident_fragment.rs", - "vendor/quote-1.0.23/src/lib.rs", - "vendor/quote-1.0.23/src/runtime.rs", - "vendor/quote-1.0.23/src/spanned.rs", - "vendor/quote-1.0.23/src/to_tokens.rs", - ], +http_archive( + name = "quote-1.0.28.crate", + sha256 = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488", + strip_prefix = "quote-1.0.28", + urls = ["https://crates.io/api/v1/crates/quote/1.0.28/download"], + visibility = [], +) + +cargo.rust_library( + name = "quote-1.0.28", + srcs = [":quote-1.0.28.crate"], crate = "quote", - crate_root = "vendor/quote-1.0.23/src/lib.rs", + crate_root = "quote-1.0.28.crate/src/lib.rs", edition = "2018", features = [ "default", "proc-macro", ], - rustc_flags = [ - "--cap-lints=allow", - "@$(location :quote-1.0.23-build-script-build-args)", - ], + rustc_flags = ["@$(location :quote-1.0.28-build-script-run[rustc_flags])"], visibility = [], - deps = [":proc-macro2-1.0.51"], + deps = [":proc-macro2-1.0.59"], ) -rust_binary( - name = "quote-1.0.23-build-script-build", - srcs = ["vendor/quote-1.0.23/build.rs"], +cargo.rust_binary( + name = "quote-1.0.28-build-script-build", + srcs = [":quote-1.0.28.crate"], crate = "build_script_build", - crate_root = "vendor/quote-1.0.23/build.rs", + crate_root = "quote-1.0.28.crate/build.rs", edition = "2018", features = [ "default", "proc-macro", ], - rustc_flags = ["--cap-lints=allow"], visibility = [], ) -buildscript_args( - name = "quote-1.0.23-build-script-build-args", +buildscript_run( + name = "quote-1.0.28-build-script-run", package_name = "quote", - buildscript_rule = ":quote-1.0.23-build-script-build", + buildscript_rule = ":quote-1.0.28-build-script-build", features = [ "default", "proc-macro", ], - outfile = "args.txt", - version = "1.0.23", + version = "1.0.28", ) alias( name = "scratch", - actual = ":scratch-1.0.3", + actual = ":scratch-1.0.5", visibility = ["PUBLIC"], ) -rust_library( - name = "scratch-1.0.3", - srcs = ["vendor/scratch-1.0.3/src/lib.rs"], +http_archive( + name = "scratch-1.0.5.crate", + 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_root = "vendor/scratch-1.0.3/src/lib.rs", + crate_root = "scratch-1.0.5.crate/src/lib.rs", edition = "2015", env = { - "OUT_DIR": "generated", + "OUT_DIR": "$(location :scratch-1.0.5-build-script-run[out_dir])", }, - rustc_flags = ["--cap-lints=allow"], 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( name = "syn", - actual = ":syn-1.0.107", + actual = ":syn-2.0.17", visibility = ["PUBLIC"], ) -rust_library( - name = "syn-1.0.107", - srcs = [ - "vendor/syn-1.0.107/src/attr.rs", - "vendor/syn-1.0.107/src/await.rs", - "vendor/syn-1.0.107/src/bigint.rs", - "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", - "vendor/syn-1.0.107/src/data.rs", - "vendor/syn-1.0.107/src/derive.rs", - "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", - ], +http_archive( + name = "syn-2.0.17.crate", + sha256 = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388", + strip_prefix = "syn-2.0.17", + urls = ["https://crates.io/api/v1/crates/syn/2.0.17/download"], + visibility = [], +) + +cargo.rust_library( + name = "syn-2.0.17", + srcs = [":syn-2.0.17.crate"], crate = "syn", - crate_root = "vendor/syn-1.0.107/src/lib.rs", - edition = "2018", + crate_root = "syn-2.0.17.crate/src/lib.rs", + edition = "2021", features = [ "clone-impls", "default", @@ -449,90 +377,165 @@ rust_library( "proc-macro", "quote", ], - rustc_flags = [ - "--cap-lints=allow", - "@$(location :syn-1.0.107-build-script-build-args)", - ], visibility = [], deps = [ - ":proc-macro2-1.0.51", - ":quote-1.0.23", - ":unicode-ident-1.0.6", + ":proc-macro2-1.0.59", + ":quote-1.0.28", + ":unicode-ident-1.0.9", ], ) -rust_binary( - name = "syn-1.0.107-build-script-build", - srcs = ["vendor/syn-1.0.107/build.rs"], - crate = "build_script_build", - crate_root = "vendor/syn-1.0.107/build.rs", - edition = "2018", - features = [ - "clone-impls", - "default", - "derive", - "full", - "parsing", - "printing", - "proc-macro", - "quote", - ], - rustc_flags = ["--cap-lints=allow"], +http_archive( + name = "termcolor-1.2.0.crate", + sha256 = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6", + strip_prefix = "termcolor-1.2.0", + urls = ["https://crates.io/api/v1/crates/termcolor/1.2.0/download"], visibility = [], ) -buildscript_args( - 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( +cargo.rust_library( name = "termcolor-1.2.0", - srcs = ["vendor/termcolor-1.2.0/src/lib.rs"], + srcs = [":termcolor-1.2.0.crate"], crate = "termcolor", - crate_root = "vendor/termcolor-1.2.0/src/lib.rs", + crate_root = "termcolor-1.2.0.crate/src/lib.rs", 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 = [], ) -rust_library( - name = "unicode-ident-1.0.6", - srcs = [ - "vendor/unicode-ident-1.0.6/src/lib.rs", - "vendor/unicode-ident-1.0.6/src/tables.rs", - ], +http_archive( + name = "unicode-ident-1.0.9.crate", + sha256 = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0", + strip_prefix = "unicode-ident-1.0.9", + 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_root = "vendor/unicode-ident-1.0.6/src/lib.rs", + crate_root = "unicode-ident-1.0.9.crate/src/lib.rs", edition = "2018", - rustc_flags = ["--cap-lints=allow"], 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", - srcs = [ - "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", - ], + srcs = [":unicode-width-0.1.10.crate"], 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", 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 = [], ) diff --git a/third-party/Cargo.lock b/third-party/Cargo.lock index 6a6be41f..89a61591 100644 --- a/third-party/Cargo.lock +++ b/third-party/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + [[package]] name = "bitflags" version = "1.3.2" @@ -16,22 +22,29 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "clap" -version = "4.1.4" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" 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", "clap_lex", ] [[package]] name = "clap_lex" -version = "0.3.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" -dependencies = [ - "os_str_bytes", -] +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "codespan-reporting" @@ -45,45 +58,39 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" - -[[package]] -name = "os_str_bytes" -version = "6.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] [[package]] name = "scratch" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "syn" -version = "1.0.107" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388" dependencies = [ "proc-macro2", "quote", @@ -115,9 +122,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-width" diff --git a/third-party/Cargo.toml b/third-party/Cargo.toml index 84657de5..f94dba01 100644 --- a/third-party/Cargo.toml +++ b/third-party/Cargo.toml @@ -12,7 +12,7 @@ cc = "1.0.49" clap = { version = "4", default-features = false, features = ["error-context", "help", "std", "usage"] } codespan-reporting = "0.11.1" 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" scratch = "1" -syn = { version = "1.0.95", features = ["full"] } +syn = { version = "2.0.1", features = ["full"] } diff --git a/third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel b/third-party/bazel/BUILD.anstyle-1.0.0.bazel similarity index 89% rename from third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel rename to third-party/bazel/BUILD.anstyle-1.0.0.bazel index 2510ac16..055bbd73 100644 --- a/third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel +++ b/third-party/bazel/BUILD.anstyle-1.0.0.bazel @@ -15,7 +15,7 @@ package(default_visibility = ["//visibility:public"]) # ]) rust_library( - name = "os_str_bytes", + name = "anstyle", srcs = glob(["**/*.rs"]), compile_data = glob( include = ["**"], @@ -28,17 +28,18 @@ rust_library( ], ), crate_features = [ - "raw_os_str", + "default", + "std", ], crate_root = "src/lib.rs", edition = "2021", rustc_flags = ["--cap-lints=allow"], tags = [ "cargo-bazel", - "crate-name=os_str_bytes", + "crate-name=anstyle", "manual", "noclippy", "norustfmt", ], - version = "6.4.1", + version = "1.0.0", ) diff --git a/third-party/bazel/BUILD.bazel b/third-party/bazel/BUILD.bazel index 244795bc..5a3b2064 100644 --- a/third-party/bazel/BUILD.bazel +++ b/third-party/bazel/BUILD.bazel @@ -33,7 +33,7 @@ alias( alias( name = "clap", - actual = "@vendor__clap-4.1.4//:clap", + actual = "@vendor__clap-4.3.0//:clap", tags = ["manual"], ) @@ -45,30 +45,30 @@ alias( alias( name = "once_cell", - actual = "@vendor__once_cell-1.17.0//:once_cell", + actual = "@vendor__once_cell-1.17.1//:once_cell", tags = ["manual"], ) alias( name = "proc-macro2", - actual = "@vendor__proc-macro2-1.0.51//:proc_macro2", + actual = "@vendor__proc-macro2-1.0.59//:proc_macro2", tags = ["manual"], ) alias( name = "quote", - actual = "@vendor__quote-1.0.23//:quote", + actual = "@vendor__quote-1.0.28//:quote", tags = ["manual"], ) alias( name = "scratch", - actual = "@vendor__scratch-1.0.3//:scratch", + actual = "@vendor__scratch-1.0.5//:scratch", tags = ["manual"], ) alias( name = "syn", - actual = "@vendor__syn-1.0.107//:syn", + actual = "@vendor__syn-2.0.17//:syn", tags = ["manual"], ) diff --git a/third-party/bazel/BUILD.clap-4.1.4.bazel b/third-party/bazel/BUILD.clap-4.3.0.bazel similarity index 90% rename from third-party/bazel/BUILD.clap-4.1.4.bazel rename to third-party/bazel/BUILD.clap-4.3.0.bazel index 9386cfbb..5670d19e 100644 --- a/third-party/bazel/BUILD.clap-4.1.4.bazel +++ b/third-party/bazel/BUILD.clap-4.3.0.bazel @@ -43,9 +43,8 @@ rust_library( "noclippy", "norustfmt", ], - version = "4.1.4", + version = "4.3.0", deps = [ - "@vendor__bitflags-1.3.2//:bitflags", - "@vendor__clap_lex-0.3.1//:clap_lex", + "@vendor__clap_builder-4.3.0//:clap_builder", ], ) diff --git a/third-party/bazel/BUILD.clap_builder-4.3.0.bazel b/third-party/bazel/BUILD.clap_builder-4.3.0.bazel new file mode 100644 index 00000000..6a9fbb42 --- /dev/null +++ b/third-party/bazel/BUILD.clap_builder-4.3.0.bazel @@ -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", + ], +) diff --git a/third-party/bazel/BUILD.clap_lex-0.3.1.bazel b/third-party/bazel/BUILD.clap_lex-0.5.0.bazel similarity index 91% rename from third-party/bazel/BUILD.clap_lex-0.3.1.bazel rename to third-party/bazel/BUILD.clap_lex-0.5.0.bazel index fe85b7b6..410f73be 100644 --- a/third-party/bazel/BUILD.clap_lex-0.3.1.bazel +++ b/third-party/bazel/BUILD.clap_lex-0.5.0.bazel @@ -37,8 +37,5 @@ rust_library( "noclippy", "norustfmt", ], - version = "0.3.1", - deps = [ - "@vendor__os_str_bytes-6.4.1//:os_str_bytes", - ], + version = "0.5.0", ) diff --git a/third-party/bazel/BUILD.once_cell-1.17.0.bazel b/third-party/bazel/BUILD.once_cell-1.17.1.bazel similarity index 97% rename from third-party/bazel/BUILD.once_cell-1.17.0.bazel rename to third-party/bazel/BUILD.once_cell-1.17.1.bazel index 8636f3b6..7132498a 100644 --- a/third-party/bazel/BUILD.once_cell-1.17.0.bazel +++ b/third-party/bazel/BUILD.once_cell-1.17.1.bazel @@ -43,5 +43,5 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.17.0", + version = "1.17.1", ) diff --git a/third-party/bazel/BUILD.proc-macro2-1.0.51.bazel b/third-party/bazel/BUILD.proc-macro2-1.0.59.bazel similarity index 92% rename from third-party/bazel/BUILD.proc-macro2-1.0.51.bazel rename to third-party/bazel/BUILD.proc-macro2-1.0.59.bazel index 0ec6426f..03cccc7b 100644 --- a/third-party/bazel/BUILD.proc-macro2-1.0.51.bazel +++ b/third-party/bazel/BUILD.proc-macro2-1.0.59.bazel @@ -43,10 +43,10 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.51", + version = "1.0.59", deps = [ - "@vendor__proc-macro2-1.0.51//:build_script_build", - "@vendor__unicode-ident-1.0.6//:unicode_ident", + "@vendor__proc-macro2-1.0.59//:build_script_build", + "@vendor__unicode-ident-1.0.9//:unicode_ident", ], ) @@ -81,7 +81,7 @@ cargo_build_script( "noclippy", "norustfmt", ], - version = "1.0.51", + version = "1.0.59", visibility = ["//visibility:private"], ) diff --git a/third-party/bazel/BUILD.quote-1.0.23.bazel b/third-party/bazel/BUILD.quote-1.0.28.bazel similarity index 92% rename from third-party/bazel/BUILD.quote-1.0.23.bazel rename to third-party/bazel/BUILD.quote-1.0.28.bazel index 133fdc92..fde7f32d 100644 --- a/third-party/bazel/BUILD.quote-1.0.23.bazel +++ b/third-party/bazel/BUILD.quote-1.0.28.bazel @@ -42,10 +42,10 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.23", + version = "1.0.28", deps = [ - "@vendor__proc-macro2-1.0.51//:proc_macro2", - "@vendor__quote-1.0.23//:build_script_build", + "@vendor__proc-macro2-1.0.59//:proc_macro2", + "@vendor__quote-1.0.28//:build_script_build", ], ) @@ -79,7 +79,7 @@ cargo_build_script( "noclippy", "norustfmt", ], - version = "1.0.23", + version = "1.0.28", visibility = ["//visibility:private"], ) diff --git a/third-party/bazel/BUILD.scratch-1.0.3.bazel b/third-party/bazel/BUILD.scratch-1.0.5.bazel similarity index 94% rename from third-party/bazel/BUILD.scratch-1.0.3.bazel rename to third-party/bazel/BUILD.scratch-1.0.5.bazel index 56b0365c..ae28c649 100644 --- a/third-party/bazel/BUILD.scratch-1.0.3.bazel +++ b/third-party/bazel/BUILD.scratch-1.0.5.bazel @@ -38,9 +38,9 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.3", + version = "1.0.5", 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", "norustfmt", ], - version = "1.0.3", + version = "1.0.5", visibility = ["//visibility:private"], ) diff --git a/third-party/bazel/BUILD.syn-1.0.107.bazel b/third-party/bazel/BUILD.syn-1.0.107.bazel deleted file mode 100644 index 1eb43c28..00000000 --- a/third-party/bazel/BUILD.syn-1.0.107.bazel +++ /dev/null @@ -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"], -) diff --git a/third-party/bazel/BUILD.syn-2.0.17.bazel b/third-party/bazel/BUILD.syn-2.0.17.bazel new file mode 100644 index 00000000..1309c5fd --- /dev/null +++ b/third-party/bazel/BUILD.syn-2.0.17.bazel @@ -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", + ], +) diff --git a/third-party/bazel/BUILD.unicode-ident-1.0.6.bazel b/third-party/bazel/BUILD.unicode-ident-1.0.9.bazel similarity index 97% rename from third-party/bazel/BUILD.unicode-ident-1.0.6.bazel rename to third-party/bazel/BUILD.unicode-ident-1.0.9.bazel index 5347f03e..9beb0b76 100644 --- a/third-party/bazel/BUILD.unicode-ident-1.0.6.bazel +++ b/third-party/bazel/BUILD.unicode-ident-1.0.9.bazel @@ -37,5 +37,5 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.6", + version = "1.0.9", ) diff --git a/third-party/bazel/defs.bzl b/third-party/bazel/defs.bzl index d1fa4b63..da7fbbd4 100644 --- a/third-party/bazel/defs.bzl +++ b/third-party/bazel/defs.bzl @@ -37,7 +37,7 @@ def _flatten_dependency_maps(all_dependency_maps): # name of the workspace this file is defined in. "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 # on the host platform. "condition": { @@ -292,13 +292,13 @@ _NORMAL_DEPENDENCIES = { "third-party": { _COMMON_CONDITION: { "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", - "once_cell": "@vendor__once_cell-1.17.0//:once_cell", - "proc-macro2": "@vendor__proc-macro2-1.0.51//:proc_macro2", - "quote": "@vendor__quote-1.0.23//:quote", - "scratch": "@vendor__scratch-1.0.3//:scratch", - "syn": "@vendor__syn-1.0.107//:syn", + "once_cell": "@vendor__once_cell-1.17.1//:once_cell", + "proc-macro2": "@vendor__proc-macro2-1.0.59//:proc_macro2", + "quote": "@vendor__quote-1.0.28//:quote", + "scratch": "@vendor__scratch-1.0.5//:scratch", + "syn": "@vendor__syn-2.0.17//:syn", }, }, } @@ -370,6 +370,16 @@ _CONDITIONS = { def crate_repositories(): """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( http_archive, name = "vendor__bitflags-1.3.2", @@ -392,22 +402,32 @@ def crate_repositories(): maybe( http_archive, - name = "vendor__clap-4.1.4", - sha256 = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76", + name = "vendor__clap-4.3.0", + sha256 = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/clap/4.1.4/download"], - strip_prefix = "clap-4.1.4", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap-4.1.4.bazel"), + urls = ["https://crates.io/api/v1/crates/clap/4.3.0/download"], + strip_prefix = "clap-4.3.0", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap-4.3.0.bazel"), ) maybe( http_archive, - name = "vendor__clap_lex-0.3.1", - sha256 = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade", + name = "vendor__clap_builder-4.3.0", + sha256 = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/clap_lex/0.3.1/download"], - strip_prefix = "clap_lex-0.3.1", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.clap_lex-0.3.1.bazel"), + urls = ["https://crates.io/api/v1/crates/clap_builder/4.3.0/download"], + strip_prefix = "clap_builder-4.3.0", + 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( @@ -422,62 +442,52 @@ def crate_repositories(): maybe( http_archive, - name = "vendor__once_cell-1.17.0", - sha256 = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66", + name = "vendor__once_cell-1.17.1", + sha256 = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/once_cell/1.17.0/download"], - strip_prefix = "once_cell-1.17.0", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.once_cell-1.17.0.bazel"), + urls = ["https://crates.io/api/v1/crates/once_cell/1.17.1/download"], + strip_prefix = "once_cell-1.17.1", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.once_cell-1.17.1.bazel"), ) maybe( http_archive, - name = "vendor__os_str_bytes-6.4.1", - sha256 = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee", + name = "vendor__proc-macro2-1.0.59", + sha256 = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/os_str_bytes/6.4.1/download"], - strip_prefix = "os_str_bytes-6.4.1", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.os_str_bytes-6.4.1.bazel"), + urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.59/download"], + strip_prefix = "proc-macro2-1.0.59", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.proc-macro2-1.0.59.bazel"), ) maybe( http_archive, - name = "vendor__proc-macro2-1.0.51", - sha256 = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6", + name = "vendor__quote-1.0.28", + sha256 = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/proc-macro2/1.0.51/download"], - strip_prefix = "proc-macro2-1.0.51", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.proc-macro2-1.0.51.bazel"), + urls = ["https://crates.io/api/v1/crates/quote/1.0.28/download"], + strip_prefix = "quote-1.0.28", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.quote-1.0.28.bazel"), ) maybe( http_archive, - name = "vendor__quote-1.0.23", - sha256 = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b", + name = "vendor__scratch-1.0.5", + sha256 = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/quote/1.0.23/download"], - strip_prefix = "quote-1.0.23", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.quote-1.0.23.bazel"), + urls = ["https://crates.io/api/v1/crates/scratch/1.0.5/download"], + strip_prefix = "scratch-1.0.5", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.scratch-1.0.5.bazel"), ) maybe( http_archive, - name = "vendor__scratch-1.0.3", - sha256 = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2", + name = "vendor__syn-2.0.17", + sha256 = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/scratch/1.0.3/download"], - strip_prefix = "scratch-1.0.3", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.scratch-1.0.3.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"), + urls = ["https://crates.io/api/v1/crates/syn/2.0.17/download"], + strip_prefix = "syn-2.0.17", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.syn-2.0.17.bazel"), ) maybe( @@ -492,12 +502,12 @@ def crate_repositories(): maybe( http_archive, - name = "vendor__unicode-ident-1.0.6", - sha256 = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc", + name = "vendor__unicode-ident-1.0.9", + sha256 = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0", type = "tar.gz", - urls = ["https://crates.io/api/v1/crates/unicode-ident/1.0.6/download"], - strip_prefix = "unicode-ident-1.0.6", - build_file = Label("@cxx.rs//third-party/bazel:BUILD.unicode-ident-1.0.6.bazel"), + urls = ["https://crates.io/api/v1/crates/unicode-ident/1.0.9/download"], + strip_prefix = "unicode-ident-1.0.9", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.unicode-ident-1.0.9.bazel"), ) maybe( diff --git a/third-party/fixups/scratch/fixups.toml b/third-party/fixups/scratch/fixups.toml index 72f4bdd0..ac9ebfb4 100644 --- a/third-party/fixups/scratch/fixups.toml +++ b/third-party/fixups/scratch/fixups.toml @@ -1,4 +1,2 @@ -buildscript = [] - -[env] -OUT_DIR = "generated" +[[buildscript]] +[buildscript.gen_srcs] diff --git a/third-party/fixups/winapi/fixups.toml b/third-party/fixups/winapi/fixups.toml new file mode 100644 index 00000000..5e026f75 --- /dev/null +++ b/third-party/fixups/winapi/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/third-party/reindeer.toml b/third-party/reindeer.toml index eb65857c..0934c9c5 100644 --- a/third-party/reindeer.toml +++ b/third-party/reindeer.toml @@ -1,13 +1,6 @@ -precise_srcs = true -rustc_flags = ["--cap-lints=allow"] - -[cargo] -versioned_dirs = true +vendor = false [buck] generated_file_header = """ # \u0040generated by `reindeer buckify` """ -buckfile_imports = """ -load("//tools/buck:buildscript.bzl", "buildscript_args") -""" diff --git a/tools/buck/.ignore b/tools/buck/.ignore new file mode 100644 index 00000000..adba186d --- /dev/null +++ b/tools/buck/.ignore @@ -0,0 +1 @@ +prelude/ diff --git a/tools/buck/buildscript.bzl b/tools/buck/buildscript.bzl deleted file mode 100644 index e4d5e1e4..00000000 --- a/tools/buck/buildscript.bzl +++ /dev/null @@ -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, - ) diff --git a/tools/buck/rust_cxx_bridge.bzl b/tools/buck/rust_cxx_bridge.bzl index 18bb2458..1f8ef0b4 100644 --- a/tools/buck/rust_cxx_bridge.bzl +++ b/tools/buck/rust_cxx_bridge.bzl @@ -2,22 +2,25 @@ def rust_cxx_bridge( name: str.type, src: str.type, deps: [str.type] = []): - native.genrule( + native.export_file( name = "%s/header" % name, + src = ":%s/generated[generated.h]" % name, out = src + ".h", - cmd = "cp $(location :%s/generated)/generated.h ${OUT}" % name, ) - native.genrule( + native.export_file( name = "%s/source" % name, + src = ":%s/generated[generated.cc]" % name, out = src + ".cc", - cmd = "cp $(location :%s/generated)/generated.cc ${OUT}" % name, ) native.genrule( name = "%s/generated" % name, srcs = [src], - out = ".", + outs = { + "generated.cc": ["generated.cc"], + "generated.h": ["generated.h"], + }, cmd = "$(exe //:codegen) ${SRCS} -o ${OUT}/generated.h -o ${OUT}/generated.cc", type = "cxxbridge", ) diff --git a/tools/buck/toolchains/BUCK b/tools/buck/toolchains/BUCK index 7036bc4d..6b17af4a 100644 --- a/tools/buck/toolchains/BUCK +++ b/tools/buck/toolchains/BUCK @@ -1,9 +1,25 @@ 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:rust.bzl", "system_rust_toolchain") system_cxx_toolchain( 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"], ) @@ -14,6 +30,7 @@ system_python_bootstrap_toolchain( system_rust_toolchain( name = "rust", + clippy_toml = "root//:.clippy.toml", default_edition = None, visibility = ["PUBLIC"], )