diff --git a/.buckconfig b/.buckconfig index e081ba21867f6a433e990d37cd259f31f37dfd2a..045974f7be8050235265f25af79fb08c7273831b 100644 --- a/.buckconfig +++ b/.buckconfig @@ -1,11 +1,8 @@ [repositories] -root = . +repo = . prelude = tools/buck/prelude toolchains = tools/buck/toolchains -none = none - -[repository_aliases] -config = prelude +ovr_config = tools/buck/prelude buck = none fbcode = none fbsource = none @@ -14,15 +11,7 @@ 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' -# -# Also hide some Bazel-managed directories that contain symlinks to the repo root. -ignore = \ - .git, \ - bazel-bin, \ - bazel-cxx, \ - bazel-out, \ - bazel-testlogs, \ - target +ignore = target [parser] -target_platform_detector_spec = target:root//...->prelude//platforms:default +target_platform_detector_spec = target://...->ovr_config//platforms:default diff --git a/.buckroot b/.buckroot deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 663ad47ed2bb953d2638ed402140b1d2722b623f..00109ff8b52961bb1508c2152f9b941931895bbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ name: CI on: push: pull_request: - workflow_dispatch: schedule: [cron: "40 1 * * *"] permissions: @@ -27,10 +26,10 @@ jobs: - rust: stable - rust: 1.60.0 - rust: 1.64.0 - - name: Cargo on macOS + - name: macOS rust: nightly os: macos - - name: Cargo on Windows (msvc) + - name: Windows (msvc) rust: nightly-x86_64-pc-windows-msvc os: windows flags: /EHsc @@ -46,7 +45,6 @@ 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, @@ -71,39 +69,31 @@ jobs: RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}} buck: - name: Buck2 on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}} - runs-on: ${{matrix.os}}-latest + name: Buck + runs-on: ubuntu-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 - with: - components: rust-src - - uses: dtolnay/install-buck2@latest + - uses: dtolnay/install@reindeer + - uses: dtolnay/install@buck2 - name: Install lld run: sudo apt-get install lld - if: matrix.os == 'ubuntu' - - run: buck2 run demo - - run: buck2 build ... - - run: buck2 test ... - - uses: dtolnay/install@reindeer - if: matrix.os == 'ubuntu' + - run: cargo vendor --versioned-dirs --locked + working-directory: third-party - 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 - if: matrix.os == 'ubuntu' + - run: buck2 run demo + - run: buck2 build ... + - run: buck2 run tests:test bazel: - name: Bazel on Linux + name: Bazel runs-on: ubuntu-latest if: github.event_name != 'pull_request' timeout-minutes: 45 @@ -127,9 +117,7 @@ jobs: timeout-minutes: 45 steps: - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@nightly - with: - components: clippy, rust-src + - uses: dtolnay/rust-toolchain@clippy - run: cargo clippy --workspace --tests -- -Dclippy::all clang-tidy: diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 1f9a6955d6e29992bce63dbf3654f21ed1d03b5a..09382b7919d7af0b7d60d0178072143232544d90 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -7,7 +7,6 @@ on: paths: - book/** - .github/workflows/site.yml - workflow_dispatch: jobs: deploy: diff --git a/.gitmodules b/.gitmodules index 1f0249f5c4d440119b91b44648f39bb691b239fe..208a58a9ac2325fc014adae01faa5bb1e9c98bfa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "tools/buck/prelude"] path = tools/buck/prelude - url = https://github.com/facebook/buck2-prelude + url = https://github.com/facebookincubator/buck2-prelude diff --git a/BUCK b/BUCK index 0de52bbf3495cfa025da60ada7a678253c70be03..6fcf7fa82949047722058f683148761ecefefcf9 100644 --- a/BUCK +++ b/BUCK @@ -1,14 +1,6 @@ -export_file( - name = ".clippy.toml", - visibility = ["toolchains//:rust"], -) - rust_library( name = "cxx", srcs = glob(["src/**/*.rs"]), - doc_deps = [ - ":cxx-build", - ], edition = "2018", features = [ "alloc", @@ -17,23 +9,19 @@ rust_library( visibility = ["PUBLIC"], deps = [ ":core", - ":cxxbridge-macro", + ":macro", ], ) -alias( - name = "codegen", - actual = ":cxxbridge", - visibility = ["PUBLIC"], -) - rust_binary( - name = "cxxbridge", + name = "codegen", 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", @@ -49,15 +37,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 = "cxxbridge-macro", + name = "macro", srcs = glob(["macro/src/**/*.rs"]) + ["macro/src/syntax"], - doctests = False, + crate = "cxxbridge_macro", edition = "2018", proc_macro = True, deps = [ @@ -68,13 +56,13 @@ rust_library( ) rust_library( - name = "cxx-build", + name = "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", @@ -87,7 +75,7 @@ rust_library( ) rust_library( - name = "cxx-gen", + name = "lib", srcs = glob(["gen/lib/src/**/*.rs"]) + [ "gen/lib/src/gen", "gen/lib/src/syntax", diff --git a/BUILD b/BUILD index 787994bd44ca40ae8b89d1d980996572c5bcde0e..c88eb2494309e37ec6b08e8e17fe885aa4169c74 100644 --- a/BUILD +++ b/BUILD @@ -16,17 +16,12 @@ rust_library( deps = [":core-lib"], ) -alias( - name = "codegen", - actual = ":cxxbridge", - visibility = ["//visibility:public"], -) - rust_binary( - name = "cxxbridge", + name = "codegen", 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", @@ -62,10 +57,11 @@ rust_proc_macro( ) rust_library( - name = "cxx-build", + name = "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", @@ -78,7 +74,7 @@ rust_library( ) rust_library( - name = "cxx-gen", + name = "lib", 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 3011439fe1db7a168b70cc6f6abbfbdedb1b0de4..2a7e6b478521f86a0d3bc548cbdad04c42eec2d9 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.97" + cargo_pkg_version = "1.0.91" 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 5c967a1ff10e6b412e2cca70b21aa6256af6eafc..5ed5809c3d0a304f9dfa6edc1635d49d477b5882 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxx" -version = "1.0.97" # remember to update html_root_url +version = "1.0.91" # 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.97", path = "macro" } +cxxbridge-macro = { version = "=1.0.91", path = "macro" } link-cplusplus = "1.0" [build-dependencies] cc = "1.0.49" -cxxbridge-flags = { version = "=1.0.97", path = "flags", default-features = false } +cxxbridge-flags = { version = "=1.0.91", path = "flags", default-features = false } [dev-dependencies] -cxx-build = { version = "=1.0.97", path = "gen/build" } +cxx-build = { version = "=1.0.91", 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 118c99f58e04680dfb82a714c1448520b7edc899..c6936341a16356bada4fb0e5212d0e42056ffa8c 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.97", + "Version Number": "1.0.91", "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 07975b38016eb292a8763695b95386ee6bac6e8f..7707436a1a97938e913bf9e336430f46a733b6c1 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 = "50ec4b84a7ec5370f5882d52f4a1e6b8a75de2f8dcc0a4403747b69b2c4ef5b1", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.23.0/rules_rust-v0.23.0.tar.gz"], + sha256 = "2466e5b2514772e84f9009010797b9cd4b51c1e6445bbd5b5e24848d90e6fb2e", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.18.0/rules_rust-v0.18.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.69.0"], + versions = ["1.67.0"], ) load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index 2d2502ee767db55fa5ee4f8553179960db816bb6..a8f89bfc8d5cc0db49df7eca197370fefd8daa13 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 or Buck2](build/bazel.md) + - [Bazel](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 8bc0cf66b9d6a5e54bb4a1fbf14c25de0ef199ce..6a2c82b00c2d6c1eb895414d77334ab5ef188635 100644 --- a/book/src/build/bazel.md +++ b/book/src/build/bazel.md @@ -1,5 +1,5 @@ -{{#title Bazel, Buck2 — Rust ♡ C++}} -## Bazel, Buck2, potentially other similar environments +{{#title Bazel, Buck — Rust ♡ C++}} +## Bazel, Buck, 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,14 +15,11 @@ $ 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 [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 +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 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 fe610fbdb539c49b151bf3dceadc7bc8253c7746..8b3990ce9c05e13f03af8ec900e4461ceac83972 100644 --- a/demo/BUCK +++ b/demo/BUCK @@ -21,7 +21,6 @@ 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 87ade607fac9906a62cbb15d75d0e69d87433dc7..1f38229495cc03b4ea171c8982e650b31c5fbc67 100644 --- a/flags/Cargo.toml +++ b/flags/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxxbridge-flags" -version = "1.0.97" +version = "1.0.91" 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 b682221c7ce3668ac23db9fe50925f238134686a..08c4a4d53f7e9762afbbe56a589c247f34342c37 100644 --- a/gen/build/Cargo.toml +++ b/gen/build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxx-build" -version = "1.0.97" +version = "1.0.91" 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.58", default-features = false, features = ["span-locations"] } +proc-macro2 = { version = "1.0.39", default-features = false, features = ["span-locations"] } quote = { version = "1.0", default-features = false } scratch = "1.0" -syn = { version = "2.0.1", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] } +syn = { version = "1.0.95", 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 4e29ffb29364f47d09f41244a7c579156f256d4a..3176a283e6293e24786691815edc70e44db4b11f 100644 --- a/gen/build/src/lib.rs +++ b/gen/build/src/lib.rs @@ -45,7 +45,6 @@ //! $ 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 8962c6df28d204bbf3e203bcba72a12a1db6ce46..8628dbb3aa6ff3b9d4782dad1f310ade69e66b76 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.97" + cargo_pkg_version = "1.0.92" 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 41b7dba6dd97326599a380b632545addc2ef9f11..677aa326c677f15ecc786f5cf9cda37dcdca9a4d 100644 --- a/gen/cmd/Cargo.toml +++ b/gen/cmd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxxbridge-cmd" -version = "1.0.97" +version = "1.0.91" 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.58", default-features = false, features = ["span-locations"] } +proc-macro2 = { version = "1.0.39", default-features = false, features = ["span-locations"] } quote = { version = "1.0", default-features = false } -syn = { version = "2.0.1", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] } +syn = { version = "1.0.95", 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 new file mode 100644 index 0000000000000000000000000000000000000000..8b1a393741c96c03c3712b4c80b3d2bcd06959b6 --- /dev/null +++ b/gen/cmd/src/lib.rs @@ -0,0 +1 @@ +// empty diff --git a/gen/lib/Cargo.toml b/gen/lib/Cargo.toml index d9b82c6c36bb5ccafde2daa003e61d206f565d20..01b5876f93892da3ff7e08a10a19cfe1e9608edb 100644 --- a/gen/lib/Cargo.toml +++ b/gen/lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxx-gen" -version = "0.7.97" +version = "0.7.91" 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.58", default-features = false, features = ["span-locations"] } +proc-macro2 = { version = "1.0.39", default-features = false, features = ["span-locations"] } quote = { version = "1.0", default-features = false } -syn = { version = "2.0.1", default-features = false, features = ["parsing", "printing", "clone-impls", "full"] } +syn = { version = "1.0.95", 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 79a27bd911d1eb7bd224d1882430d289a7d1b54d..bb53a7fc26bf36efdfdb96308e6a3ce98bb59d97 100644 --- a/gen/lib/src/error.rs +++ b/gen/lib/src/error.rs @@ -3,23 +3,12 @@ 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 } @@ -43,33 +32,3 @@ 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 17baa7f517c91676fa7c21a93e9788e923199888..47cfa18d680f3dc67b9ffb54cb6765b648f189c3 100644 --- a/gen/lib/src/lib.rs +++ b/gen/lib/src/lib.rs @@ -7,7 +7,6 @@ //! [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 4e4259ef9d86e599c3acd4dc8120937b8e38e415..46616fbda33844bd683bf2b9dfe0d01752c5fee4 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, Meta, Token, Visibility}; +use syn::{braced, Attribute, Ident, Item, 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 let Meta::Path(_) = attr.meta { + if attr.tokens.is_empty() { Ok(Namespace::ROOT) } else { attr.parse_args_with(Namespace::parse_bridge_attr_namespace) diff --git a/include/cxx.h b/include/cxx.h index 5d3b694cab0f9ad489bd5b77764e896eec7b2aad..907ee829f63e8bc76e5b9cdb30962e4269ab5aa5 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 / static_cast::iterator::difference_type>(this->stride); + return diff / this->stride; } template diff --git a/macro/BUILD.gn b/macro/BUILD.gn index d98f35a6d7d890c88e0c7a2d4bd247e77def8e82..6dcbd97cd3fa829f969dc387c5a3353cf93e66f8 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.97" + cargo_pkg_version = "1.0.91" 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 e855a8a64604e0612b5997885d72be12e98f8ddb..988c848be09c4c36b6314c3de39a6fc545cb399f 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cxxbridge-macro" -version = "1.0.97" +version = "1.0.91" 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.58" +proc-macro2 = "1.0.39" quote = "1.0.4" -syn = { version = "2.0.1", features = ["full"] } +syn = { version = "1.0.95", features = ["full"] } # optional dependencies: clang-ast = { version = "0.1", optional = true } diff --git a/macro/src/expand.rs b/macro/src/expand.rs index bd0a2063787c15ec304c902c2d2da5ed31def3d5..ea5af66a4235715f113296b02a698861209d39d6 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.join()); + let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); 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.join()); + let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); 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.join()); + let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); 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.join()); + let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); 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.join()); + let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); 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.join()); + let end_span = explicit_impl.map_or(key.end_span, |explicit| explicit.brace_token.span); 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.join()); + let rust_slice = Ident::new("RustSlice", ty.bracket.span); quote_spanned!(span=> ::cxx::private::#rust_slice) } _ => quote!(#ty), diff --git a/macro/src/lib.rs b/macro/src/lib.rs index d0205b32a05c98fd0cca448f4c2b119ab6b4f5e6..138e3a2990585142ba6f9588373ec0dc99f84267 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -29,6 +29,8 @@ 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 bf28442705f7ca026dce1426b2e2c39802548044..dccece44bd77e529b35bc9dee02b7cd8a525b873 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 - // discriminant. + // descriminant. return ParsedDiscriminant::Successor; } diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index 20fe888c30ab44fa877a58de0304f4b5e2a5a5cf..0000000000000000000000000000000000000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -components = ["rust-src"] diff --git a/src/cxx.cc b/src/cxx.cc index 4aac6427976d2e64b5ed076b41d864c52b01afae..4958eb08bdcddbf2acbea4ca388078b045c615b0 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(), static_cast(s.size())); + os.write(s.data(), 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(), static_cast(s.size())); + os.write(s.data(), s.size()); return os; } diff --git a/src/cxx_string.rs b/src/cxx_string.rs index d5d0af4a466717359d558ee17ce522d3c7faf699..9ecbcc64732da9755b3ba45bebd0247196acdd0f 100644 --- a/src/cxx_string.rs +++ b/src/cxx_string.rs @@ -257,25 +257,6 @@ 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 1a41936bab5c0262dab9c64dfb518779a5465a5c..77ec7cff0da169e472801a35127583d6e7e3a5fe 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.97")] +#![doc(html_root_url = "https://docs.rs/cxx/1.0.91")] #![deny( improper_ctypes, improper_ctypes_definitions, diff --git a/src/shared_ptr.rs b/src/shared_ptr.rs index 377b214f6fbea062b31bb33afaddd39d182d8294..64c866196aa60804b365e8d790ad0181f038ba4b 100644 --- a/src/shared_ptr.rs +++ b/src/shared_ptr.rs @@ -191,8 +191,8 @@ pub unsafe trait SharedPtrTarget { where Self: Sized, { - // Opaque C types do not get this method because they can never exist by - // value on the Rust side of the bridge. + // Opoaque 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 4ff700a84977c8815a32d110022c389dda1baefe..46d010e0a17470a9de116fe17b17ea13f955fe2f 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::ParseStream; -use syn::{Attribute, Error, Expr, Lit, LitStr, Meta, Path, Result, Token}; +use syn::parse::{Nothing, Parse, ParseStream, Parser as _}; +use syn::{parenthesized, token, Attribute, Error, LitStr, Path, Result, Token}; // Intended usage: // @@ -47,9 +47,8 @@ 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 { - let attr_path = attr.path(); - if attr_path.is_ident("doc") { - match parse_doc_attribute(&attr.meta) { + if attr.path.is_ident("doc") { + match parse_doc_attribute.parse2(attr.tokens.clone()) { Ok(attr) => { if let Some(doc) = &mut parser.doc { match attr { @@ -64,7 +63,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 { @@ -77,7 +76,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 { @@ -90,8 +89,8 @@ pub fn parse(cx: &mut Errors, attrs: Vec, mut parser: Parser) -> Othe break; } } - } else if attr_path.is_ident("namespace") { - match Namespace::parse_meta(&attr.meta) { + } else if attr.path.is_ident("namespace") { + match parse_namespace_attribute.parse2(attr.tokens.clone()) { Ok(attr) => { if let Some(namespace) = &mut parser.namespace { **namespace = attr; @@ -103,8 +102,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(&attr.meta) { + } else if attr.path.is_ident("cxx_name") { + match parse_cxx_name_attribute.parse2(attr.tokens.clone()) { Ok(attr) => { if let Some(cxx_name) = &mut parser.cxx_name { **cxx_name = Some(attr); @@ -116,8 +115,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(&attr.meta) { + } else if attr.path.is_ident("rust_name") { + match parse_rust_name_attribute.parse2(attr.tokens.clone()) { Ok(attr) => { if let Some(rust_name) = &mut parser.rust_name { **rust_name = Some(attr); @@ -129,8 +128,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(&attr) { + } else if attr.path.is_ident("cfg") { + match cfg::parse_attribute.parse2(attr.tokens.clone()) { Ok(cfg_expr) => { if let Some(cfg) = &mut parser.cfg { cfg.merge(cfg_expr); @@ -143,31 +142,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) = attr.meta.require_path_only() { + if let Err(err) = Nothing::parse.parse2(attr.tokens.clone()) { 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; @@ -193,26 +192,24 @@ mod kw { syn::custom_keyword!(hidden); } -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(_) => {} +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()) } - 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, Token![,])?; + let paths = input.parse_terminated::(Path::parse_mod_style)?; let mut derives = Vec::new(); for path in paths { @@ -244,42 +241,31 @@ fn parse_repr_attribute(input: ParseStream) -> Result { )) } -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()); - } - } - _ => {} - } +fn parse_namespace_attribute(input: ParseStream) -> Result { + input.parse::()?; + let namespace = input.parse::()?; + Ok(namespace) +} + +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()) } - Err(Error::new_spanned(meta, "unsupported cxx_name attribute")) } -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()); - } - } - _ => {} - } +fn parse_rust_name_attribute(input: ParseStream) -> Result { + input.parse::()?; + if input.peek(LitStr) { + let lit: LitStr = input.parse()?; + lit.parse() + } else { + input.parse() } - Err(Error::new_spanned(meta, "unsupported rust_name attribute")) } #[derive(Clone)] @@ -302,11 +288,15 @@ impl ToTokens for OtherAttrs { pound_token, style, bracket_token, - meta, + path, + tokens: attr_tokens, } = attr; pound_token.to_tokens(tokens); let _ = style; // ignore; render outer and inner attrs both as outer - bracket_token.surround(tokens, |tokens| meta.to_tokens(tokens)); + bracket_token.surround(tokens, |tokens| { + path.to_tokens(tokens); + attr_tokens.to_tokens(tokens); + }); } } } diff --git a/syntax/cfg.rs b/syntax/cfg.rs index ce6f338954a9790d8ed5583f9b0707dbe2eeb944..d486b9958c4626a1b4ccbba724634a51c1396787 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, Attribute, LitStr, Token}; +use syn::{parenthesized, token, LitStr, Token}; #[derive(Clone)] pub enum CfgExpr { @@ -25,12 +25,12 @@ impl CfgExpr { } } -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) - }) +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) } fn parse_single(input: ParseStream) -> Result { diff --git a/syntax/check.rs b/syntax/check.rs index 0770c8475366f9edd6d87707328b0632af1b7543..66883be0331d83aea7b0bf5a514e228bb12f139e 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.join()); + brace_token.set_span(strct.brace_token.span); 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.join()); + brace_token.set_span(enm.brace_token.span); quote!(#enum_token #brace_token) } diff --git a/syntax/namespace.rs b/syntax/namespace.rs index aae865ccffc74c3d8d370ed54555ac48187f4d27..07185e18779696f012e98639abca8e6c9a3d4c46 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::{Error, Parse, ParseStream, Result}; -use syn::{Expr, Ident, Lit, Meta, Token}; +use syn::parse::{Parse, ParseStream, Result}; +use syn::{Ident, 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,37 +35,6 @@ 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 c6fee5f860b8f0f560e1d5b62002280c8d00b410..1754c600632b178580b4219037f79928e2954e2b 100644 --- a/syntax/parse.rs +++ b/syntax/parse.rs @@ -489,7 +489,11 @@ 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 = extern_type_lifetimes(cx, foreign_type.generics); + let generics = Lifetimes { + lt_token: None, + lifetimes: Punctuated::new(), + gt_token: None, + }; let colon_token = None; let bounds = Vec::new(); let semi_token = foreign_type.semi_token; @@ -607,27 +611,7 @@ fn parse_extern_fn( }); continue; } - 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")); + return Err(Error::new_spanned(arg, "unsupported signature")); } FnArg::Typed(arg) => { let ident = match arg.pat.as_ref() { @@ -638,24 +622,45 @@ fn parse_extern_fn( _ => return Err(Error::new_spanned(arg, "unsupported signature")), }; let ty = parse_type(&arg.ty)?; - 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 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; + } + 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")); } } } @@ -751,45 +756,6 @@ 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() { @@ -822,10 +788,45 @@ fn extern_type_lifetimes(cx: &mut Errors, generics: Generics) -> Lifetimes { } } } - Lifetimes { + let 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()) } } @@ -927,7 +928,9 @@ fn parse_extern_type_bounded( } else { false } => {} - bound => cx.error(bound, "unsupported trait"), + bound @ TypeParamBound::Trait(_) | bound @ TypeParamBound::Lifetime(_) => { + cx.error(bound, "unsupported trait"); + } } let lookahead = input.lookahead1(); @@ -1001,7 +1004,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.join()); + span.set_span(imp.brace_token.span); return Err(Error::new_spanned(span, "expected an empty impl block")); } @@ -1148,7 +1151,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.join())), + RustType::Tuple(ty) if ty.elems.is_empty() => Ok(Type::Void(ty.paren_token.span)), _ => Err(Error::new_spanned(ty, "unsupported type")), } } @@ -1384,7 +1387,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.join(); + let fn_span = ty.paren_token.span; let ident = format_ident!("arg{}", i, span = fn_span); let colon_token = Token![:](fn_span); (ident, colon_token) @@ -1467,7 +1470,8 @@ fn parse_return_type( fn visibility_pub(vis: &Visibility, inherited: Span) -> Token![pub] { Token![pub](match vis { - Visibility::Public(vis) => vis.span, + Visibility::Public(vis) => vis.pub_token.span, + Visibility::Crate(vis) => vis.crate_token.span, Visibility::Restricted(vis) => vis.pub_token.span, Visibility::Inherited => inherited, }) diff --git a/syntax/qualified.rs b/syntax/qualified.rs index e11ffbc14d3eaa425ebb53d7b938a960da18440a..5f182fa9baad0dff8750fba88e79dc683faa5983 100644 --- a/syntax/qualified.rs +++ b/syntax/qualified.rs @@ -7,18 +7,6 @@ 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) @@ -27,7 +15,15 @@ impl QualifiedName { pub fn parse_quoted_or_unquoted(input: ParseStream) -> Result { if input.peek(LitStr) { let lit: LitStr = input.parse()?; - Self::parse_quoted(&lit) + 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) + }) + } } else { Self::parse_unquoted(input) } diff --git a/syntax/tokens.rs b/syntax/tokens.rs index 05eddc7036d2613312a2258ca18963f95b3e3696..a9f42bd43ac27f06ef6ba20324a8e6c6756af1c8 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.join()).to_tokens(tokens); + Token![->](paren_token.span).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.join()).to_tokens(tokens); + Token![->](paren_token.span).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 2a45d47dec8ec8c2722ca982754c01c036e98a52..865eebc9325fd5e91c169c149e45397f41f5161c 100644 --- a/tests/BUCK +++ b/tests/BUCK @@ -33,12 +33,11 @@ cxx_library( ":module/source", ], exported_deps = ["//:core"], - exported_headers = [ - ":bridge/header", - ":module/header", - "ffi/tests.h", - ], - preferred_linkage = "static", + exported_headers = { + "ffi/lib.rs.h": ":bridge/header", + "ffi/module.rs.h": ":module/header", + "ffi/tests.h": "ffi/tests.h", + }, ) rust_cxx_bridge( diff --git a/tests/cxx_string.rs b/tests/cxx_string.rs index 349a4e1f1cf15bce08fb3de201fc397f4ee2f8ac..67444fa56399b31c2722fa4a1199a6115c730d54 100644 --- a/tests/cxx_string.rs +++ b/tests/cxx_string.rs @@ -1,5 +1,4 @@ use cxx::{let_cxx_string, CxxString}; -use std::fmt::Write as _; #[test] fn test_async_cxx_string() { @@ -21,21 +20,3 @@ 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 a1a64b7f047a3b76dbc6c4055b65c6c96287f697..86f8cd3a5ad378e76aac53a5860ede54db44a34b 100644 --- a/tests/ffi/build.rs +++ b/tests/ffi/build.rs @@ -15,7 +15,4 @@ 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 359581aa28d877dc18d403b284be2ea74c1aa2ed..419b0f22db308f9232d8bb2d5858ccf6c82001c0 100644 --- a/tests/ui/derive_noncopy.stderr +++ b/tests/ui/derive_noncopy.stderr @@ -1,7 +1,7 @@ -error[E0204]: the trait `std::marker::Copy` cannot be implemented for this type +error[E0204]: the trait `Copy` may not be implemented for this type --> tests/ui/derive_noncopy.rs:4:12 | 4 | struct TryCopy { | ^^^^^^^ 5 | other: Other, - | ------------ this field does not implement `std::marker::Copy` + | ------------ this field does not implement `Copy` diff --git a/tests/ui/include.stderr b/tests/ui/include.stderr index b801530e1169ef15e9a62134d6f010348d8112ca..45cc5591171bf9b2b8015accbe568ee799840511 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:26 + --> tests/ui/include.rs:6:17 | 6 | include!( tests/ui/include.rs:7:23 diff --git a/tests/ui/opaque_autotraits.stderr b/tests/ui/opaque_autotraits.stderr index c8e1fbb20ab1d3709edcca2d59c2b9bcfe7fb045..c6447c558455c9ef9426d7e5c8df8594609deccc 100644 --- a/tests/ui/opaque_autotraits.stderr +++ b/tests/ui/opaque_autotraits.stderr @@ -6,11 +6,7 @@ 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` - --> src/opaque.rs - | - | pub struct Opaque { - | ^^^^^^ + = note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque` --> tests/ui/opaque_autotraits.rs:4:14 | @@ -30,11 +26,7 @@ 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` - --> src/opaque.rs - | - | pub struct Opaque { - | ^^^^^^ + = note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque` --> tests/ui/opaque_autotraits.rs:4:14 | @@ -52,18 +44,9 @@ error[E0277]: `PhantomPinned` cannot be unpinned 15 | assert_unpin::(); | ^^^^^^^^^^^ within `ffi::Opaque`, the trait `Unpin` is not implemented for `PhantomPinned` | - = 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: consider using `Box::pin` + = note: required because it appears within the type `PhantomData` + = note: required because it appears within the type `Opaque` note: required because it appears within the type `Opaque` --> tests/ui/opaque_autotraits.rs:4:14 | diff --git a/tests/ui/rust_pinned.stderr b/tests/ui/rust_pinned.stderr index ba1852b847b6725b79e74d9cdea446bb46178bd7..a0fc033822f73fc7898958259d8352a314948817 100644 --- a/tests/ui/rust_pinned.stderr +++ b/tests/ui/rust_pinned.stderr @@ -4,8 +4,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned 6 | type Pinned; | ^^^^^^ within `Pinned`, the trait `Unpin` is not implemented for `PhantomPinned` | - = note: consider using the `pin!` macro - consider using `Box::pin` if you need to access the pinned value outside of the current scope + = note: consider using `Box::pin` 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 7aa5d8ae9a2925da4372feb71be21dede5e8e2dd..3c121e54cda7976ce619bcc94df63e148dbc9285 100644 --- a/tests/ui/unique_ptr_to_opaque.stderr +++ b/tests/ui/unique_ptr_to_opaque.stderr @@ -14,8 +14,5 @@ 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 e809b61a8c5445a660e3ae073fae1d57565f1066..8851cedc194bce704d52f779958ceb7022bc40d5 100644 --- a/tests/ui/vector_autotraits.stderr +++ b/tests/ui/vector_autotraits.stderr @@ -6,27 +6,15 @@ 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` - --> src/opaque.rs - | - | pub struct Opaque { - | ^^^^^^ + = note: required because it appears within the type `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]>` - --> $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 because it appears within the type `PhantomData<[NotThreadSafe]>` + = note: required because it appears within the type `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 90285eef3144ba334e7d4ef3aaa49ddce3f85cf9..dddbab6b88884a021cacc42e9e84180189f774ea 100644 --- a/third-party/BUCK +++ b/third-party/BUCK @@ -1,44 +1,18 @@ # @generated by `reindeer buckify` -load("@prelude//rust:cargo_buildscript.bzl", "buildscript_run") -load("@prelude//rust:cargo_package.bzl", "cargo") +load("//tools/buck:buildscript.bzl", "buildscript_args") -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( +rust_library( name = "bitflags-1.3.2", - srcs = [":bitflags-1.3.2.crate"], + srcs = [ + "vendor/bitflags-1.3.2/src/example_generated.rs", + "vendor/bitflags-1.3.2/src/lib.rs", + ], crate = "bitflags", - crate_root = "bitflags-1.3.2.crate/src/lib.rs", + crate_root = "vendor/bitflags-1.3.2/src/lib.rs", edition = "2018", features = ["default"], + rustc_flags = ["--cap-lints=allow"], visibility = [], ) @@ -48,66 +22,110 @@ alias( visibility = ["PUBLIC"], ) -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( +rust_library( name = "cc-1.0.79", - srcs = [":cc-1.0.79.crate"], + 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", + ], crate = "cc", - crate_root = "cc-1.0.79.crate/src/lib.rs", + crate_root = "vendor/cc-1.0.79/src/lib.rs", edition = "2018", + rustc_flags = ["--cap-lints=allow"], visibility = [], ) alias( name = "clap", - actual = ":clap-4.3.0", + actual = ":clap-4.1.4", visibility = ["PUBLIC"], ) -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 = "clap-4.3.0.crate/src/lib.rs", - edition = "2021", - features = [ - "error-context", - "help", - "std", - "usage", +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", ], - 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", + crate = "clap", + crate_root = "vendor/clap-4.1.4/src/lib.rs", edition = "2021", features = [ "error-context", @@ -115,29 +133,23 @@ cargo.rust_library( "std", "usage", ], + rustc_flags = ["--cap-lints=allow"], visibility = [], deps = [ - ":anstyle-1.0.0", ":bitflags-1.3.2", - ":clap_lex-0.5.0", + ":clap_lex-0.3.1", ], ) -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"], +rust_library( + name = "clap_lex-0.3.1", + srcs = ["vendor/clap_lex-0.3.1/src/lib.rs"], crate = "clap_lex", - crate_root = "clap_lex-0.5.0.crate/src/lib.rs", + crate_root = "vendor/clap_lex-0.3.1/src/lib.rs", edition = "2021", + rustc_flags = ["--cap-lints=allow"], visibility = [], + deps = [":os_str_bytes-6.4.1"], ) alias( @@ -146,20 +158,21 @@ alias( visibility = ["PUBLIC"], ) -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( +rust_library( name = "codespan-reporting-0.11.1", - srcs = [":codespan-reporting-0.11.1.crate"], + 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", + ], crate = "codespan_reporting", - crate_root = "codespan-reporting-0.11.1.crate/src/lib.rs", + crate_root = "vendor/codespan-reporting-0.11.1/src/lib.rs", edition = "2018", + rustc_flags = ["--cap-lints=allow"], visibility = [], deps = [ ":termcolor-1.2.0", @@ -169,23 +182,21 @@ cargo.rust_library( alias( name = "once_cell", - actual = ":once_cell-1.17.1", + actual = ":once_cell-1.17.0", visibility = ["PUBLIC"], ) -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"], +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", + ], crate = "once_cell", - crate_root = "once_cell-1.17.1.crate/src/lib.rs", + crate_root = "vendor/once_cell-1.17.0/src/lib.rs", edition = "2021", features = [ "alloc", @@ -193,180 +204,241 @@ cargo.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.59", + actual = ":proc-macro2-1.0.51", visibility = ["PUBLIC"], ) -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"], +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", + ], crate = "proc_macro2", - crate_root = "proc-macro2-1.0.59.crate/src/lib.rs", + crate_root = "vendor/proc-macro2-1.0.51/src/lib.rs", edition = "2018", features = [ "default", "proc-macro", "span-locations", ], - rustc_flags = ["@$(location :proc-macro2-1.0.59-build-script-run[rustc_flags])"], + rustc_flags = [ + "--cap-lints=allow", + "@$(location :proc-macro2-1.0.51-build-script-build-args)", + ], visibility = [], - deps = [":unicode-ident-1.0.9"], + deps = [":unicode-ident-1.0.6"], ) -cargo.rust_binary( - name = "proc-macro2-1.0.59-build-script-build", - srcs = [":proc-macro2-1.0.59.crate"], +rust_binary( + name = "proc-macro2-1.0.51-build-script-build", + srcs = ["vendor/proc-macro2-1.0.51/build.rs"], crate = "build_script_build", - crate_root = "proc-macro2-1.0.59.crate/build.rs", + crate_root = "vendor/proc-macro2-1.0.51/build.rs", edition = "2018", features = [ "default", "proc-macro", "span-locations", ], + rustc_flags = ["--cap-lints=allow"], visibility = [], ) -buildscript_run( - name = "proc-macro2-1.0.59-build-script-run", +buildscript_args( + name = "proc-macro2-1.0.51-build-script-build-args", package_name = "proc-macro2", - buildscript_rule = ":proc-macro2-1.0.59-build-script-build", + buildscript_rule = ":proc-macro2-1.0.51-build-script-build", features = [ "default", "proc-macro", "span-locations", ], - version = "1.0.59", + outfile = "args.txt", + version = "1.0.51", ) alias( name = "quote", - actual = ":quote-1.0.28", + actual = ":quote-1.0.23", visibility = ["PUBLIC"], ) -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"], +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", + ], crate = "quote", - crate_root = "quote-1.0.28.crate/src/lib.rs", + crate_root = "vendor/quote-1.0.23/src/lib.rs", edition = "2018", features = [ "default", "proc-macro", ], - rustc_flags = ["@$(location :quote-1.0.28-build-script-run[rustc_flags])"], + rustc_flags = [ + "--cap-lints=allow", + "@$(location :quote-1.0.23-build-script-build-args)", + ], visibility = [], - deps = [":proc-macro2-1.0.59"], + deps = [":proc-macro2-1.0.51"], ) -cargo.rust_binary( - name = "quote-1.0.28-build-script-build", - srcs = [":quote-1.0.28.crate"], +rust_binary( + name = "quote-1.0.23-build-script-build", + srcs = ["vendor/quote-1.0.23/build.rs"], crate = "build_script_build", - crate_root = "quote-1.0.28.crate/build.rs", + crate_root = "vendor/quote-1.0.23/build.rs", edition = "2018", features = [ "default", "proc-macro", ], + rustc_flags = ["--cap-lints=allow"], visibility = [], ) -buildscript_run( - name = "quote-1.0.28-build-script-run", +buildscript_args( + name = "quote-1.0.23-build-script-build-args", package_name = "quote", - buildscript_rule = ":quote-1.0.28-build-script-build", + buildscript_rule = ":quote-1.0.23-build-script-build", features = [ "default", "proc-macro", ], - version = "1.0.28", + outfile = "args.txt", + version = "1.0.23", ) alias( name = "scratch", - actual = ":scratch-1.0.5", + actual = ":scratch-1.0.3", visibility = ["PUBLIC"], ) -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"], +rust_library( + name = "scratch-1.0.3", + srcs = ["vendor/scratch-1.0.3/src/lib.rs"], crate = "scratch", - crate_root = "scratch-1.0.5.crate/src/lib.rs", + crate_root = "vendor/scratch-1.0.3/src/lib.rs", edition = "2015", env = { - "OUT_DIR": "$(location :scratch-1.0.5-build-script-run[out_dir])", + "OUT_DIR": "generated", }, + 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-2.0.17", + actual = ":syn-1.0.107", visibility = ["PUBLIC"], ) -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"], +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", + ], crate = "syn", - crate_root = "syn-2.0.17.crate/src/lib.rs", - edition = "2021", + crate_root = "vendor/syn-1.0.107/src/lib.rs", + edition = "2018", features = [ "clone-impls", "default", @@ -377,165 +449,90 @@ cargo.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.59", - ":quote-1.0.28", - ":unicode-ident-1.0.9", + ":proc-macro2-1.0.51", + ":quote-1.0.23", + ":unicode-ident-1.0.6", ], ) -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"], +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"], visibility = [], ) -cargo.rust_library( +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( name = "termcolor-1.2.0", - srcs = [":termcolor-1.2.0.crate"], + srcs = ["vendor/termcolor-1.2.0/src/lib.rs"], crate = "termcolor", - crate_root = "termcolor-1.2.0.crate/src/lib.rs", + crate_root = "vendor/termcolor-1.2.0/src/lib.rs", edition = "2018", - platform = { - "windows-gnu": dict( - deps = [":winapi-util-0.1.5"], - ), - "windows-msvc": dict( - deps = [":winapi-util-0.1.5"], - ), - }, + rustc_flags = ["--cap-lints=allow"], visibility = [], ) -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"], +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", + ], crate = "unicode_ident", - crate_root = "unicode-ident-1.0.9.crate/src/lib.rs", + crate_root = "vendor/unicode-ident-1.0.6/src/lib.rs", edition = "2018", + rustc_flags = ["--cap-lints=allow"], visibility = [], ) -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( +rust_library( name = "unicode-width-0.1.10", - srcs = [":unicode-width-0.1.10.crate"], + 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", + ], crate = "unicode_width", - crate_root = "unicode-width-0.1.10.crate/src/lib.rs", + crate_root = "vendor/unicode-width-0.1.10/src/lib.rs", edition = "2015", features = ["default"], - 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"], - ), - }, + rustc_flags = ["--cap-lints=allow"], visibility = [], ) diff --git a/third-party/Cargo.lock b/third-party/Cargo.lock index 89a615916bbefc8b73e406b26023a576de2fac3a..6a6be41f84b34da06f86a629e37336a13ba1aaeb 100644 --- a/third-party/Cargo.lock +++ b/third-party/Cargo.lock @@ -2,12 +2,6 @@ # 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" @@ -22,29 +16,22 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "clap" -version = "4.3.0" +version = "4.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" +checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" 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.5.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] [[package]] name = "codespan-reporting" @@ -58,39 +45,45 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.17.0" +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 = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] [[package]] name = "scratch" -version = "1.0.5" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "syn" -version = "2.0.17" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -122,9 +115,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-width" diff --git a/third-party/Cargo.toml b/third-party/Cargo.toml index f94dba010c08dcd41e746cf08cc503f939569f46..84657de58fd0fceddb7a7e8006fa4b828f22efdb 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.58", features = ["span-locations"] } +proc-macro2 = { version = "1.0.39", features = ["span-locations"] } quote = "1.0.4" scratch = "1" -syn = { version = "2.0.1", features = ["full"] } +syn = { version = "1.0.95", features = ["full"] } diff --git a/third-party/bazel/BUILD.bazel b/third-party/bazel/BUILD.bazel index 5a3b20649fe87e82686ea7fcf8ba477f98f8ac33..244795bc497f4f5a0e7d2f448e031bcf37be333a 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.3.0//:clap", + actual = "@vendor__clap-4.1.4//:clap", tags = ["manual"], ) @@ -45,30 +45,30 @@ alias( alias( name = "once_cell", - actual = "@vendor__once_cell-1.17.1//:once_cell", + actual = "@vendor__once_cell-1.17.0//:once_cell", tags = ["manual"], ) alias( name = "proc-macro2", - actual = "@vendor__proc-macro2-1.0.59//:proc_macro2", + actual = "@vendor__proc-macro2-1.0.51//:proc_macro2", tags = ["manual"], ) alias( name = "quote", - actual = "@vendor__quote-1.0.28//:quote", + actual = "@vendor__quote-1.0.23//:quote", tags = ["manual"], ) alias( name = "scratch", - actual = "@vendor__scratch-1.0.5//:scratch", + actual = "@vendor__scratch-1.0.3//:scratch", tags = ["manual"], ) alias( name = "syn", - actual = "@vendor__syn-2.0.17//:syn", + actual = "@vendor__syn-1.0.107//:syn", tags = ["manual"], ) diff --git a/third-party/bazel/BUILD.clap-4.3.0.bazel b/third-party/bazel/BUILD.clap-4.1.4.bazel similarity index 90% rename from third-party/bazel/BUILD.clap-4.3.0.bazel rename to third-party/bazel/BUILD.clap-4.1.4.bazel index 5670d19e4391434d0a1ff9d0880dbd03dd9e0443..9386cfbbe1051303770aa410f27cb8af3bd1b729 100644 --- a/third-party/bazel/BUILD.clap-4.3.0.bazel +++ b/third-party/bazel/BUILD.clap-4.1.4.bazel @@ -43,8 +43,9 @@ rust_library( "noclippy", "norustfmt", ], - version = "4.3.0", + version = "4.1.4", deps = [ - "@vendor__clap_builder-4.3.0//:clap_builder", + "@vendor__bitflags-1.3.2//:bitflags", + "@vendor__clap_lex-0.3.1//:clap_lex", ], ) diff --git a/third-party/bazel/BUILD.clap_builder-4.3.0.bazel b/third-party/bazel/BUILD.clap_builder-4.3.0.bazel deleted file mode 100644 index 6a9fbb4292556b54415888d47f94bf633e3b244f..0000000000000000000000000000000000000000 --- a/third-party/bazel/BUILD.clap_builder-4.3.0.bazel +++ /dev/null @@ -1,52 +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//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.5.0.bazel b/third-party/bazel/BUILD.clap_lex-0.3.1.bazel similarity index 91% rename from third-party/bazel/BUILD.clap_lex-0.5.0.bazel rename to third-party/bazel/BUILD.clap_lex-0.3.1.bazel index 410f73be2490f0aae60609818219f1c8590627eb..fe85b7b63648660e2ca5c09ea640bf6f541f276d 100644 --- a/third-party/bazel/BUILD.clap_lex-0.5.0.bazel +++ b/third-party/bazel/BUILD.clap_lex-0.3.1.bazel @@ -37,5 +37,8 @@ rust_library( "noclippy", "norustfmt", ], - version = "0.5.0", + version = "0.3.1", + deps = [ + "@vendor__os_str_bytes-6.4.1//:os_str_bytes", + ], ) diff --git a/third-party/bazel/BUILD.once_cell-1.17.1.bazel b/third-party/bazel/BUILD.once_cell-1.17.0.bazel similarity index 97% rename from third-party/bazel/BUILD.once_cell-1.17.1.bazel rename to third-party/bazel/BUILD.once_cell-1.17.0.bazel index 7132498a190eb482de6b6e719b439c6b6d069571..8636f3b6bd1a0cfee95fe6c1a4136ec20bad7620 100644 --- a/third-party/bazel/BUILD.once_cell-1.17.1.bazel +++ b/third-party/bazel/BUILD.once_cell-1.17.0.bazel @@ -43,5 +43,5 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.17.1", + version = "1.17.0", ) diff --git a/third-party/bazel/BUILD.anstyle-1.0.0.bazel b/third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel similarity index 89% rename from third-party/bazel/BUILD.anstyle-1.0.0.bazel rename to third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel index 055bbd73e95d28ccfae83af30ba34eaf9ca1e5d9..2510ac1682772aab8ee36ef88dbe295b26d4a831 100644 --- a/third-party/bazel/BUILD.anstyle-1.0.0.bazel +++ b/third-party/bazel/BUILD.os_str_bytes-6.4.1.bazel @@ -15,7 +15,7 @@ package(default_visibility = ["//visibility:public"]) # ]) rust_library( - name = "anstyle", + name = "os_str_bytes", srcs = glob(["**/*.rs"]), compile_data = glob( include = ["**"], @@ -28,18 +28,17 @@ rust_library( ], ), crate_features = [ - "default", - "std", + "raw_os_str", ], crate_root = "src/lib.rs", edition = "2021", rustc_flags = ["--cap-lints=allow"], tags = [ "cargo-bazel", - "crate-name=anstyle", + "crate-name=os_str_bytes", "manual", "noclippy", "norustfmt", ], - version = "1.0.0", + version = "6.4.1", ) diff --git a/third-party/bazel/BUILD.proc-macro2-1.0.59.bazel b/third-party/bazel/BUILD.proc-macro2-1.0.51.bazel similarity index 92% rename from third-party/bazel/BUILD.proc-macro2-1.0.59.bazel rename to third-party/bazel/BUILD.proc-macro2-1.0.51.bazel index 03cccc7b2983a80a95416bcc2eab57edb349f486..0ec6426f499cb64233654ce1da6d27ebd656417b 100644 --- a/third-party/bazel/BUILD.proc-macro2-1.0.59.bazel +++ b/third-party/bazel/BUILD.proc-macro2-1.0.51.bazel @@ -43,10 +43,10 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.59", + version = "1.0.51", deps = [ - "@vendor__proc-macro2-1.0.59//:build_script_build", - "@vendor__unicode-ident-1.0.9//:unicode_ident", + "@vendor__proc-macro2-1.0.51//:build_script_build", + "@vendor__unicode-ident-1.0.6//:unicode_ident", ], ) @@ -81,7 +81,7 @@ cargo_build_script( "noclippy", "norustfmt", ], - version = "1.0.59", + version = "1.0.51", visibility = ["//visibility:private"], ) diff --git a/third-party/bazel/BUILD.quote-1.0.28.bazel b/third-party/bazel/BUILD.quote-1.0.23.bazel similarity index 92% rename from third-party/bazel/BUILD.quote-1.0.28.bazel rename to third-party/bazel/BUILD.quote-1.0.23.bazel index fde7f32d196bfdbec9280fcf6b4d3d112a9deb35..133fdc92d31332a2fe872ef3d31a60da67e60f6f 100644 --- a/third-party/bazel/BUILD.quote-1.0.28.bazel +++ b/third-party/bazel/BUILD.quote-1.0.23.bazel @@ -42,10 +42,10 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.28", + version = "1.0.23", deps = [ - "@vendor__proc-macro2-1.0.59//:proc_macro2", - "@vendor__quote-1.0.28//:build_script_build", + "@vendor__proc-macro2-1.0.51//:proc_macro2", + "@vendor__quote-1.0.23//:build_script_build", ], ) @@ -79,7 +79,7 @@ cargo_build_script( "noclippy", "norustfmt", ], - version = "1.0.28", + version = "1.0.23", visibility = ["//visibility:private"], ) diff --git a/third-party/bazel/BUILD.scratch-1.0.5.bazel b/third-party/bazel/BUILD.scratch-1.0.3.bazel similarity index 94% rename from third-party/bazel/BUILD.scratch-1.0.5.bazel rename to third-party/bazel/BUILD.scratch-1.0.3.bazel index ae28c649887030bebee0184d416fa1dd3112b7ab..56b0365cd50f0c34ba7ffc1a50a8c7b009bf7501 100644 --- a/third-party/bazel/BUILD.scratch-1.0.5.bazel +++ b/third-party/bazel/BUILD.scratch-1.0.3.bazel @@ -38,9 +38,9 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.5", + version = "1.0.3", deps = [ - "@vendor__scratch-1.0.5//:build_script_build", + "@vendor__scratch-1.0.3//:build_script_build", ], ) @@ -70,7 +70,7 @@ cargo_build_script( "noclippy", "norustfmt", ], - version = "1.0.5", + version = "1.0.3", visibility = ["//visibility:private"], ) diff --git a/third-party/bazel/BUILD.syn-2.0.17.bazel b/third-party/bazel/BUILD.syn-1.0.107.bazel similarity index 48% rename from third-party/bazel/BUILD.syn-2.0.17.bazel rename to third-party/bazel/BUILD.syn-1.0.107.bazel index 1309c5fd69996d46ce6066ae1b31e91f6413ac39..1eb43c28ce8e299fb7c1129ce873775f6cb34ee7 100644 --- a/third-party/bazel/BUILD.syn-2.0.17.bazel +++ b/third-party/bazel/BUILD.syn-1.0.107.bazel @@ -6,6 +6,7 @@ # 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"]) @@ -38,7 +39,7 @@ rust_library( "quote", ], crate_root = "src/lib.rs", - edition = "2021", + edition = "2018", rustc_flags = ["--cap-lints=allow"], tags = [ "cargo-bazel", @@ -47,10 +48,57 @@ rust_library( "noclippy", "norustfmt", ], - version = "2.0.17", + version = "1.0.107", deps = [ - "@vendor__proc-macro2-1.0.59//:proc_macro2", - "@vendor__quote-1.0.28//:quote", - "@vendor__unicode-ident-1.0.9//:unicode_ident", + "@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.unicode-ident-1.0.9.bazel b/third-party/bazel/BUILD.unicode-ident-1.0.6.bazel similarity index 97% rename from third-party/bazel/BUILD.unicode-ident-1.0.9.bazel rename to third-party/bazel/BUILD.unicode-ident-1.0.6.bazel index 9beb0b7676b1f71ed495e5217ceecfb97b3127e8..5347f03e85a21427b2c7cefd00e6e606a32e0de8 100644 --- a/third-party/bazel/BUILD.unicode-ident-1.0.9.bazel +++ b/third-party/bazel/BUILD.unicode-ident-1.0.6.bazel @@ -37,5 +37,5 @@ rust_library( "noclippy", "norustfmt", ], - version = "1.0.9", + version = "1.0.6", ) diff --git a/third-party/bazel/defs.bzl b/third-party/bazel/defs.bzl index da7fbbd49d79a00438694fd9f6c0ddb0d8a986f7..d1fa4b63f3d2fc1fcf98965a6b83f1cf1db5f81e 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 dependencies are supported for all platforms. + # Not all dependnecies 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.3.0//:clap", + "clap": "@vendor__clap-4.1.4//:clap", "codespan-reporting": "@vendor__codespan-reporting-0.11.1//:codespan_reporting", - "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", + "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", }, }, } @@ -370,16 +370,6 @@ _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", @@ -402,32 +392,22 @@ def crate_repositories(): maybe( http_archive, - name = "vendor__clap-4.3.0", - sha256 = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc", + name = "vendor__clap-4.1.4", + sha256 = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76", type = "tar.gz", - 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"), + 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"), ) maybe( http_archive, - name = "vendor__clap_builder-4.3.0", - sha256 = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990", + name = "vendor__clap_lex-0.3.1", + sha256 = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade", type = "tar.gz", - 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"), + 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"), ) maybe( @@ -442,52 +422,62 @@ def crate_repositories(): maybe( http_archive, - name = "vendor__once_cell-1.17.1", - sha256 = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3", + name = "vendor__once_cell-1.17.0", + sha256 = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66", + 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"), + ) + + maybe( + http_archive, + name = "vendor__os_str_bytes-6.4.1", + sha256 = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee", type = "tar.gz", - 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"), + 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"), ) maybe( http_archive, - name = "vendor__proc-macro2-1.0.59", - sha256 = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b", + name = "vendor__proc-macro2-1.0.51", + sha256 = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6", type = "tar.gz", - 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"), + 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"), ) maybe( http_archive, - name = "vendor__quote-1.0.28", - sha256 = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488", + name = "vendor__quote-1.0.23", + sha256 = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b", type = "tar.gz", - 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"), + 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"), ) maybe( http_archive, - name = "vendor__scratch-1.0.5", - sha256 = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1", + name = "vendor__scratch-1.0.3", + sha256 = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2", type = "tar.gz", - 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"), + 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-2.0.17", - sha256 = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388", + name = "vendor__syn-1.0.107", + sha256 = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5", type = "tar.gz", - 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"), + urls = ["https://crates.io/api/v1/crates/syn/1.0.107/download"], + strip_prefix = "syn-1.0.107", + build_file = Label("@cxx.rs//third-party/bazel:BUILD.syn-1.0.107.bazel"), ) maybe( @@ -502,12 +492,12 @@ def crate_repositories(): maybe( http_archive, - name = "vendor__unicode-ident-1.0.9", - sha256 = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0", + name = "vendor__unicode-ident-1.0.6", + sha256 = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc", type = "tar.gz", - 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"), + 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"), ) maybe( diff --git a/third-party/fixups/scratch/fixups.toml b/third-party/fixups/scratch/fixups.toml index ac9ebfb4af71d4e3c12e41a5bf5da032c24eb32c..72f4bdd0c720fe17b82810cb5c976d3698d5448c 100644 --- a/third-party/fixups/scratch/fixups.toml +++ b/third-party/fixups/scratch/fixups.toml @@ -1,2 +1,4 @@ -[[buildscript]] -[buildscript.gen_srcs] +buildscript = [] + +[env] +OUT_DIR = "generated" diff --git a/third-party/fixups/winapi/fixups.toml b/third-party/fixups/winapi/fixups.toml deleted file mode 100644 index 5e026f75e0de36f1a2eed10d3c1f1afae933efbc..0000000000000000000000000000000000000000 --- a/third-party/fixups/winapi/fixups.toml +++ /dev/null @@ -1,2 +0,0 @@ -[[buildscript]] -[buildscript.rustc_flags] diff --git a/third-party/reindeer.toml b/third-party/reindeer.toml index 0934c9c53b7b71cd0fa40326748b60660d6c1f88..eb65857c3dc6c5a5d062798f14db674594fdaa96 100644 --- a/third-party/reindeer.toml +++ b/third-party/reindeer.toml @@ -1,6 +1,13 @@ -vendor = false +precise_srcs = true +rustc_flags = ["--cap-lints=allow"] + +[cargo] +versioned_dirs = true [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 deleted file mode 100644 index adba186dbfe5cea42943999c97606c96dd5ed6f3..0000000000000000000000000000000000000000 --- a/tools/buck/.ignore +++ /dev/null @@ -1 +0,0 @@ -prelude/ diff --git a/tools/buck/buildscript.bzl b/tools/buck/buildscript.bzl new file mode 100644 index 0000000000000000000000000000000000000000..e4d5e1e4e47cf8f76f421ad9ee76b45012075f7e --- /dev/null +++ b/tools/buck/buildscript.bzl @@ -0,0 +1,17 @@ +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 1f8ef0b4df77af40e061c14e3672bd5cb0d52757..18bb245856dbd9f91b757e7ba81a1d13cfbb2bea 100644 --- a/tools/buck/rust_cxx_bridge.bzl +++ b/tools/buck/rust_cxx_bridge.bzl @@ -2,25 +2,22 @@ def rust_cxx_bridge( name: str.type, src: str.type, deps: [str.type] = []): - native.export_file( + native.genrule( name = "%s/header" % name, - src = ":%s/generated[generated.h]" % name, out = src + ".h", + cmd = "cp $(location :%s/generated)/generated.h ${OUT}" % name, ) - native.export_file( + native.genrule( 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], - outs = { - "generated.cc": ["generated.cc"], - "generated.h": ["generated.h"], - }, + out = ".", 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 6b17af4a180c6ca8d04c9bd0bc945a6003e907de..7036bc4d3e9bdc5e04de40b71e39d2ea2c5e3429 100644 --- a/tools/buck/toolchains/BUCK +++ b/tools/buck/toolchains/BUCK @@ -1,25 +1,9 @@ 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"], ) @@ -30,7 +14,6 @@ system_python_bootstrap_toolchain( system_rust_toolchain( name = "rust", - clippy_toml = "root//:.clippy.toml", default_edition = None, visibility = ["PUBLIC"], )