diff --git a/.github/composite/godot/action.yml b/.github/composite/godot/action.yml index dc36c4cbb..601d26232 100644 --- a/.github/composite/godot/action.yml +++ b/.github/composite/godot/action.yml @@ -20,14 +20,14 @@ inputs: runs: using: "composite" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Rust uses: ./.github/composite/rust with: rust: ${{ inputs.rust_toolchain }} - name: "Check cache for installed Godot version" id: "cache-godot" - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ runner.temp }}/godot_bin key: godot-${{ runner.os }}-v${{ inputs.godot_ver }} diff --git a/.github/composite/llvm/action.yml b/.github/composite/llvm/action.yml index 79ba1268d..bc21cfeb0 100644 --- a/.github/composite/llvm/action.yml +++ b/.github/composite/llvm/action.yml @@ -14,7 +14,7 @@ runs: id: cache-llvm # Note: conditionals not yet supported; see https://github.com/actions/runner/issues/834 # if: ${{ inputs.llvm == 'true' }} - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ runner.temp }}/llvm key: llvm-10.0 diff --git a/.github/external-config/public-docs-token.txt b/.github/external-config/public-docs-token.txt index 71ba0f652..4f1ea35ab 100644 --- a/.github/external-config/public-docs-token.txt +++ b/.github/external-config/public-docs-token.txt @@ -1 +1 @@ -MTFBQUZNN0NBMHVoSTJTeUk2OEptdl9Ea1pzdTlEbWZtUHRTdldzVnJDT0dibnA2Z2FZNk9OaHoxeEdObnpMMGx6UTVVRTJNM0Ezdjk3RXJjTAo= \ No newline at end of file +MTFBQUZNN0NBMGZzSGFaOVJFSmRtdV9IYnJXVEFZVEoxNDJ3N3VPTG1UY3UyTnlQM1h2RXNoMjZTMmNtdEhLa2hOQlFOVllWTVlhSTE1bk1JUwo= \ No newline at end of file diff --git a/.github/workflows/full-ci.yml b/.github/workflows/full-ci.yml index a2a06838e..e4a491393 100644 --- a/.github/workflows/full-ci.yml +++ b/.github/workflows/full-ci.yml @@ -28,9 +28,9 @@ env: # Local variables # Note: using variables is limited at the moment, see https://github.com/actions/runner/issues/480 GDRUST_FEATURES: "gdnative/async,gdnative/serde,gdnative_bindings_generator/debug" - CARGO_DENY_VERSION: "0.11.4" - CARGO_DINGHY_VERSION: "0.6.4" - CARGO_MACHETE_VERSION: "0.3" + CARGO_DENY_VERSION: "0.14.20" + CARGO_DINGHY_VERSION: "0.6.8" + CARGO_MACHETE_VERSION: "0.6.2" on: merge_group: @@ -43,7 +43,7 @@ jobs: rustfmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust with: @@ -64,7 +64,7 @@ jobs: - toolchain: nightly postfix: ' (nightly)' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust with: @@ -77,7 +77,7 @@ jobs: runs-on: ubuntu-latest needs: rustfmt steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Deny # Note: manually downloading is ~30s faster than https://github.com/EmbarkStudios/cargo-deny-action @@ -127,22 +127,17 @@ jobs: - rust: { toolchain: 'nightly' } testflags: '-- --skip ui_tests' - os: { id: ubuntu-latest, name: linux } - rust: { toolchain: '1.67', postfix: ' (msrv 1.67)' } + rust: { toolchain: '1.70', postfix: ' (msrv 1.70)' } testflags: '-- --skip ui_tests' - os: { id: ubuntu-latest, name: linux } rust: { toolchain: 'stable', postfix: ' (minimal-deps)', special: 'minimal-deps' } testflags: '-- --skip ui_tests' runs-on: ${{ matrix.os.id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install nightly Rust (minimal-deps only)" - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: false # use selected toolchain for remainder of this step - components: cargo if: ${{ matrix.rust.special == 'minimal-deps' }} + run: rustup toolchain install nightly --profile minimal --component cargo - name: "Install minimal dependency versions from Cargo" run: cargo +nightly update -Z minimal-versions if: ${{ matrix.rust.special == 'minimal-deps' }} @@ -174,7 +169,7 @@ jobs: name: linux runs-on: ${{ matrix.os.id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust with: @@ -193,7 +188,7 @@ jobs: # rust: [stable] runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust #with: @@ -225,7 +220,7 @@ jobs: # rust: [stable] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust #with: @@ -295,16 +290,16 @@ jobs: godot: "3.5.1-stable" postfix: ' (nightly, inventory)' build_args: '--features inventory' - - rust: '1.67' + - rust: '1.70' godot: "3.5.1-stable" - postfix: ' (msrv 1.67)' - - rust: '1.67' + postfix: ' (msrv 1.70)' + - rust: '1.70' godot: "3.5.1-stable" - postfix: ' (msrv 1.67, ptrcall)' + postfix: ' (msrv 1.70, ptrcall)' build_args: '--features ptrcall' - - rust: '1.67' + - rust: '1.70' godot: "3.5.1-stable" - postfix: ' (msrv 1.67, inventory)' + postfix: ' (msrv 1.70, inventory)' build_args: '--features inventory' # Test with oldest supported engine version @@ -318,7 +313,7 @@ jobs: build_args: '--features custom-godot,ptrcall' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Run Godot integration test" uses: ./.github/composite/godot with: diff --git a/.github/workflows/minimal-ci.yml b/.github/workflows/minimal-ci.yml index 02bc86638..5c6ff340b 100644 --- a/.github/workflows/minimal-ci.yml +++ b/.github/workflows/minimal-ci.yml @@ -32,7 +32,7 @@ jobs: rustfmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust with: @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest continue-on-error: ${{ matrix.rust == 'nightly' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust with: @@ -57,7 +57,7 @@ jobs: check-todo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install ripgrep" run: | cd /tmp @@ -70,7 +70,7 @@ jobs: unit-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install Rust" uses: ./.github/composite/rust - name: "Compile tests" @@ -81,7 +81,7 @@ jobs: integration-test-godot: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Run Godot integration test" uses: ./.github/composite/godot with: diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index f39b75734..d9336277d 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -30,7 +30,7 @@ jobs: validation: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # sed: https://unix.stackexchange.com/a/589584 - name: "Interpret tag version" @@ -73,12 +73,11 @@ jobs: runs-on: ubuntu-latest needs: validation steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - uses: actions/checkout@v4 + - name: "Install Rust toolchain" + run: | + rustup toolchain install stable --profile minimal + rustup default stable - name: "Compile tests" run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run - name: "Test" @@ -88,13 +87,11 @@ jobs: runs-on: ubuntu-latest needs: validation steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: clippy + - uses: actions/checkout@v4 + - name: "Install Rust toolchain" + run: | + rustup toolchain install stable --profile minimal --component clippy + rustup default stable - name: "Check clippy" run: cargo clippy --workspace --features ${GDRUST_FEATURES} -- -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented @@ -102,13 +99,11 @@ jobs: runs-on: ubuntu-latest needs: validation steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt + - uses: actions/checkout@v4 + - name: "Install Rust toolchain" + run: | + rustup toolchain install stable --profile minimal --component rustfmt + rustup default stable - name: "Check rustfmt" run: cargo fmt --all -- --check @@ -119,7 +114,7 @@ jobs: steps: # Note: we cannot dry-run the publishing, since crates depend on each other, and dry-run will fail if they aren't yet on crates.io. # Sleep to leave crates.io and docs.rs some time to index the dependencies, before releasing dependents. - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Execute crates.io publishing" env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index f45f906d9..6c015e233 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -23,7 +23,7 @@ jobs: steps: # Checkout is always needed, for the notify step - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 # This is just a sanity check to make sure that the follow-up docs generation doesn't break. # So we use the Rust version provided by the GitHub runners, which hopefully is >= MSRV. diff --git a/README.md b/README.md index b97f890ee..f9815fa64 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ If you are looking to contribute, but are not sure if what you want to do falls ## Toolchain compatibility -`gdnative` currently has a minimum supported Rust version (MSRV) of **1.67**. We use the Rust 2021 Edition. +`gdnative` currently has a minimum supported Rust version (MSRV) of **1.70**. We use the Rust 2021 Edition. > **Warning**: **Linux users: Be aware of the source of your Godot binary!** Binary distributions of Godot using a container-based format may ship versions of dependencies that may not be compatible with GDNative libraries built directly from your base system. Examples of such formats include **Flatpak**, **Snap**, and **AppImage**. > diff --git a/bindings-generator/Cargo.toml b/bindings-generator/Cargo.toml index cef8096ac..6ea0d182d 100644 --- a/bindings-generator/Cargo.toml +++ b/bindings-generator/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" version = "0.11.3" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [features] debug = [] @@ -23,6 +23,6 @@ proc-macro2 = "1" quote = "1" regex = { version = "1.5.5", default-features = false, features = ["std", "unicode-perl"] } # for security: https://blog.rust-lang.org/2022/03/08/cve-2022-24713.html roxmltree = "0.19" -syn = { version = "1", features = ["full", "extra-traits", "visit"] } +syn = { version = "1.0.84", features = ["full", "extra-traits", "visit"] } unindent = "0.2.0" which = { optional = true, version = "5" } diff --git a/bindings-generator/src/methods.rs b/bindings-generator/src/methods.rs index 3312ff4dd..d900a0762 100644 --- a/bindings-generator/src/methods.rs +++ b/bindings-generator/src/methods.rs @@ -224,6 +224,7 @@ pub fn generate_method_table(api: &Api, class: &GodotClass) -> TokenStream { #(#impl_methods),* }; + #[allow(static_mut_refs)] &mut TABLE } diff --git a/examples/builder-export/Cargo.toml b/examples/builder-export/Cargo.toml index 3a30e20e9..428bc10f5 100644 --- a/examples/builder-export/Cargo.toml +++ b/examples/builder-export/Cargo.toml @@ -3,7 +3,7 @@ name = "builder-export" version = "0.1.0" authors = ["The godot-rust developers"] edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" publish = false diff --git a/examples/dodge-the-creeps/Cargo.toml b/examples/dodge-the-creeps/Cargo.toml index d91f283c0..a4e3ee3ea 100644 --- a/examples/dodge-the-creeps/Cargo.toml +++ b/examples/dodge-the-creeps/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["The godot-rust developers"] publish = false edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" [lib] diff --git a/examples/godot_tps_controller_port/Cargo.toml b/examples/godot_tps_controller_port/Cargo.toml index 671895c81..8987e33a1 100644 --- a/examples/godot_tps_controller_port/Cargo.toml +++ b/examples/godot_tps_controller_port/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" authors = ["The godot-rust developers"] publish = false -rust-version = "1.67" +rust-version = "1.70" license = "MIT" [dependencies] diff --git a/examples/hello-world/Cargo.toml b/examples/hello-world/Cargo.toml index 6489249eb..5d4cacaf5 100644 --- a/examples/hello-world/Cargo.toml +++ b/examples/hello-world/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["The godot-rust developers"] publish = false edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" [lib] diff --git a/examples/native-plugin/Cargo.toml b/examples/native-plugin/Cargo.toml index 87d2781a4..fa337aea6 100644 --- a/examples/native-plugin/Cargo.toml +++ b/examples/native-plugin/Cargo.toml @@ -3,7 +3,7 @@ name = "native-plugin" version = "0.1.0" authors = ["The godot-rust developers"] edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" publish = false diff --git a/examples/property-export/Cargo.toml b/examples/property-export/Cargo.toml index c49347f7a..838b79618 100644 --- a/examples/property-export/Cargo.toml +++ b/examples/property-export/Cargo.toml @@ -3,7 +3,7 @@ name = "property-export" version = "0.1.0" authors = ["The godot-rust developers"] edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" publish = false diff --git a/examples/resource/Cargo.toml b/examples/resource/Cargo.toml index ada21fd31..a6bb20e91 100644 --- a/examples/resource/Cargo.toml +++ b/examples/resource/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["The godot-rust developers"] publish = false edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" [lib] diff --git a/examples/rpc/Cargo.toml b/examples/rpc/Cargo.toml index 58751e03b..2b56bd186 100644 --- a/examples/rpc/Cargo.toml +++ b/examples/rpc/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["The godot-rust developers"] publish = false edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" [lib] diff --git a/examples/scene-create/Cargo.toml b/examples/scene-create/Cargo.toml index 3f58cea10..a68072c7a 100644 --- a/examples/scene-create/Cargo.toml +++ b/examples/scene-create/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["The godot-rust developers"] publish = false edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" [lib] diff --git a/examples/signals/Cargo.toml b/examples/signals/Cargo.toml index 49a8f4e67..1c38fbd48 100644 --- a/examples/signals/Cargo.toml +++ b/examples/signals/Cargo.toml @@ -3,7 +3,7 @@ name = "signals" version = "0.1.0" authors = ["The godot-rust developers"] edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" publish = false diff --git a/examples/spinning-cube/Cargo.toml b/examples/spinning-cube/Cargo.toml index 98d044aa3..fc97939d8 100644 --- a/examples/spinning-cube/Cargo.toml +++ b/examples/spinning-cube/Cargo.toml @@ -3,7 +3,7 @@ name = "spinning-cube" version = "0.1.0" authors = ["The godot-rust developers"] edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" publish = false diff --git a/gdnative-async/Cargo.toml b/gdnative-async/Cargo.toml index 807bd425d..7488c1226 100644 --- a/gdnative-async/Cargo.toml +++ b/gdnative-async/Cargo.toml @@ -9,7 +9,7 @@ version = "0.11.3" license = "MIT" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [features] diff --git a/gdnative-bindings/Cargo.toml b/gdnative-bindings/Cargo.toml index b939443a3..2a351546f 100644 --- a/gdnative-bindings/Cargo.toml +++ b/gdnative-bindings/Cargo.toml @@ -9,7 +9,7 @@ version = "0.11.3" license = "MIT" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [features] default = ["one-class-one-file"] diff --git a/gdnative-core/Cargo.toml b/gdnative-core/Cargo.toml index 709cf654e..5783354e0 100644 --- a/gdnative-core/Cargo.toml +++ b/gdnative-core/Cargo.toml @@ -9,7 +9,7 @@ version = "0.11.3" license = "MIT" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [features] default = [] diff --git a/gdnative-core/src/core_types/geom/rect2.rs b/gdnative-core/src/core_types/geom/rect2.rs index 4b06c5af2..09df995b0 100644 --- a/gdnative-core/src/core_types/geom/rect2.rs +++ b/gdnative-core/src/core_types/geom/rect2.rs @@ -261,7 +261,7 @@ impl Rect2 { /// Error indicating that an `i64` cannot be converted to a [`Margin`]. #[derive(Debug)] -pub struct MarginError(i64); +pub struct MarginError(pub i64); /// Provides compatibility with Godot's [`Margin` enum][margin] through the [`TryFrom`] trait. /// diff --git a/gdnative-core/src/core_types/string.rs b/gdnative-core/src/core_types/string.rs index 355576ee4..57e7e4ad4 100644 --- a/gdnative-core/src/core_types/string.rs +++ b/gdnative-core/src/core_types/string.rs @@ -410,6 +410,7 @@ impl TryFrom for char { 1 => std::char::from_u32(c.0 as u32).ok_or(GodotCharError::IncompleteSequence), 4 => std::char::from_u32(c.0 as u32).ok_or(GodotCharError::InvalidCodePoint), 2 => { + #[allow(clippy::unnecessary_cast)] // type wchar_t may be platform-dependent let mut iter = std::char::decode_utf16(std::iter::once(c.0 as u16)); let c = iter .next() diff --git a/gdnative-core/src/object/mod.rs b/gdnative-core/src/object/mod.rs index 2c1a92336..6219839a8 100644 --- a/gdnative-core/src/object/mod.rs +++ b/gdnative-core/src/object/mod.rs @@ -355,7 +355,7 @@ impl Ref { // Classes with NUL-bytes in their names can not exist let class_name = CString::new(class_name).ok()?; let ctor = (get_api().godot_get_class_constructor)(class_name.as_ptr())?; - let ptr = NonNull::new(ctor() as *mut sys::godot_object)?; + let ptr = NonNull::new(ctor().cast::())?; ::impl_from_maybe_ref_counted(ptr) } } diff --git a/gdnative-core/src/private.rs b/gdnative-core/src/private.rs index b711c4686..69b92b7f1 100644 --- a/gdnative-core/src/private.rs +++ b/gdnative-core/src/private.rs @@ -281,6 +281,7 @@ macro_rules! make_method_table { $($methods: std::ptr::null_mut(),)* }; + #[allow(static_mut_refs)] &mut TABLE } diff --git a/gdnative-derive/Cargo.toml b/gdnative-derive/Cargo.toml index 8297418cf..9bef0d5a2 100644 --- a/gdnative-derive/Cargo.toml +++ b/gdnative-derive/Cargo.toml @@ -9,13 +9,13 @@ version = "0.11.3" license = "MIT" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [lib] proc-macro = true [dependencies] -syn = { version = "1", features = ["full", "extra-traits", "visit"] } +syn = { version = "1.0.84", features = ["full", "extra-traits", "visit"] } quote = "1" proc-macro2 = "1" proc-macro-crate = "2" diff --git a/gdnative-derive/src/methods.rs b/gdnative-derive/src/methods.rs index 5364ae1c1..d12d55dde 100644 --- a/gdnative-derive/src/methods.rs +++ b/gdnative-derive/src/methods.rs @@ -5,7 +5,6 @@ use syn::{ use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::{quote, ToTokens}; -use std::boxed::Box; use crate::syntax::rpc_mode::RpcMode; use crate::utils::find_non_concrete; diff --git a/gdnative-derive/src/variant/attr/field.rs b/gdnative-derive/src/variant/attr/field.rs index b1686021c..74e2e59ab 100644 --- a/gdnative-derive/src/variant/attr/field.rs +++ b/gdnative-derive/src/variant/attr/field.rs @@ -1,5 +1,3 @@ -use std::iter::FromIterator; - use proc_macro2::Span; use syn::spanned::Spanned; diff --git a/gdnative-derive/src/variant/attr/item.rs b/gdnative-derive/src/variant/attr/item.rs index d63e791be..5e7d68605 100644 --- a/gdnative-derive/src/variant/attr/item.rs +++ b/gdnative-derive/src/variant/attr/item.rs @@ -1,5 +1,3 @@ -use std::iter::FromIterator; - use proc_macro2::Span; use syn::spanned::Spanned; diff --git a/gdnative-sys/Cargo.toml b/gdnative-sys/Cargo.toml index 5b132d393..77d4e514a 100644 --- a/gdnative-sys/Cargo.toml +++ b/gdnative-sys/Cargo.toml @@ -10,7 +10,7 @@ build = "build.rs" license = "MIT" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [dependencies] libc = "0.2" diff --git a/gdnative-sys/build.rs b/gdnative-sys/build.rs index a4840f3fa..3ae08bb6a 100644 --- a/gdnative-sys/build.rs +++ b/gdnative-sys/build.rs @@ -254,7 +254,6 @@ mod header_binding { mod api_wrapper { use proc_macro2::{Ident, TokenStream}; use quote::{format_ident, quote, ToTokens}; - use std::convert::AsRef; use std::fs::File; use std::io::Write as _; use std::path; @@ -392,44 +391,44 @@ mod api_wrapper { } } - // Used to convert [String, String] in JSON into the Argument struct. - impl Deserialize for Argument { - fn begin(out: &mut Option) -> &mut dyn de::Visitor { - impl de::Visitor for Place { - fn seq(&mut self) -> miniserde::Result> { - Ok(Box::new(ArgumentBuilder { - out: &mut self.out, - tuple: (None, None), - })) - } - } + impl de::Visitor for Place { + fn seq(&mut self) -> miniserde::Result> { + Ok(Box::new(ArgumentBuilder { + out: &mut self.out, + tuple: (None, None), + })) + } + } - struct ArgumentBuilder<'a> { - out: &'a mut Option, - tuple: (Option, Option), - } + struct ArgumentBuilder<'a> { + out: &'a mut Option, + tuple: (Option, Option), + } - impl<'a> de::Seq for ArgumentBuilder<'a> { - fn element(&mut self) -> miniserde::Result<&mut dyn de::Visitor> { - if self.tuple.0.is_none() { - Ok(Deserialize::begin(&mut self.tuple.0)) - } else if self.tuple.1.is_none() { - Ok(Deserialize::begin(&mut self.tuple.1)) - } else { - Err(miniserde::Error) - } - } + impl<'a> de::Seq for ArgumentBuilder<'a> { + fn element(&mut self) -> miniserde::Result<&mut dyn de::Visitor> { + if self.tuple.0.is_none() { + Ok(Deserialize::begin(&mut self.tuple.0)) + } else if self.tuple.1.is_none() { + Ok(Deserialize::begin(&mut self.tuple.1)) + } else { + Err(miniserde::Error) + } + } - fn finish(&mut self) -> miniserde::Result<()> { - if let (Some(a), Some(b)) = (self.tuple.0.take(), self.tuple.1.take()) { - *self.out = Some(Argument { type_: a, name: b }); - Ok(()) - } else { - Err(miniserde::Error) - } - } + fn finish(&mut self) -> miniserde::Result<()> { + if let (Some(a), Some(b)) = (self.tuple.0.take(), self.tuple.1.take()) { + *self.out = Some(Argument { type_: a, name: b }); + Ok(()) + } else { + Err(miniserde::Error) } + } + } + // Used to convert [String, String] in JSON into the Argument struct. + impl Deserialize for Argument { + fn begin(out: &mut Option) -> &mut dyn de::Visitor { Place::new(out) } } diff --git a/gdnative/Cargo.toml b/gdnative/Cargo.toml index eda9cdff3..348b84712 100644 --- a/gdnative/Cargo.toml +++ b/gdnative/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" workspace = ".." readme = "../README.md" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [features] # Public diff --git a/impl/proc-macros/Cargo.toml b/impl/proc-macros/Cargo.toml index fa4758818..307095d0f 100644 --- a/impl/proc-macros/Cargo.toml +++ b/impl/proc-macros/Cargo.toml @@ -8,12 +8,12 @@ version = "0.11.3" license = "MIT" workspace = "../.." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [lib] proc-macro = true [dependencies] -syn = { version = "1", features = ["full", "extra-traits", "visit", "visit-mut"] } +syn = { version = "1.0.84", features = ["full", "extra-traits", "visit", "visit-mut"] } quote = "1" proc-macro2 = "1" diff --git a/impl/proc-macros/src/doc.rs b/impl/proc-macros/src/doc.rs deleted file mode 100644 index e1ac3853e..000000000 --- a/impl/proc-macros/src/doc.rs +++ /dev/null @@ -1,26 +0,0 @@ -use syn::visit_mut::VisitMut; -use syn::{Attribute, ItemFn, ItemImpl}; - -struct IncludeDocs<'a> { - docs: &'a [&'a str], - deprecated: Option<&'a str>, -} - -impl<'a> IncludeDocs<'a> { - fn include_docs(&self, attrs: &mut Vec) { - attrs.extend(self.docs.iter().map(|s| parse_quote!(#[doc=#s]))); - if let Some(s) = self.deprecated { - attrs.push(parse_quote!(#[deprecated=#s])); - } - } -} - -impl<'a> VisitMut for IncludeDocs<'a> { - fn visit_item_fn_mut(&mut self, i: &mut ItemFn) { - self.include_docs(&mut i.attrs) - } - - fn visit_item_impl_mut(&mut self, i: &mut ItemImpl) { - self.include_docs(&mut i.attrs) - } -} diff --git a/impl/proc-macros/src/lib.rs b/impl/proc-macros/src/lib.rs index 056d3c1b9..773be1af7 100644 --- a/impl/proc-macros/src/lib.rs +++ b/impl/proc-macros/src/lib.rs @@ -9,7 +9,6 @@ use proc_macro::TokenStream; use syn::AttributeArgs; mod cfg_ex; -mod doc; mod pool_array_element; #[proc_macro] diff --git a/test/Cargo.toml b/test/Cargo.toml index b0901031b..4c11546db 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -3,7 +3,7 @@ name = "gdnative-test" version = "0.1.0" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" license = "MIT" publish = false @@ -26,6 +26,5 @@ ron = "0.8" serde = "1" serde_json = "1" bincode = "1" -serde_yaml = "0.9" rmp-serde = "1" futures = "0.3" diff --git a/test/src/test_serde.rs b/test/src/test_serde.rs index 50366c97e..af653ee6d 100644 --- a/test/src/test_serde.rs +++ b/test/src/test_serde.rs @@ -16,7 +16,6 @@ pub(crate) fn run_tests() -> bool { status &= test_ron(); status &= test_json(); - status &= test_yaml(); status &= test_msgpack(); status &= test_bincode(); @@ -164,20 +163,6 @@ crate::godot_itest! { test_json { assert_eq!(foo, result); }} -crate::godot_itest! { test_yaml { - let foo = Foo::new(); - - let yaml_str = serde_yaml::to_string(&foo).expect("Foo to YAML"); - let result = serde_yaml::from_str::(&yaml_str).expect("Foo from YAML"); - assert_eq!(foo, result); - - let yaml_str = - serde_yaml::to_string(&foo.to_variant().dispatch()).expect("Dispatch to YAML"); - let disp = serde_yaml::from_str::(&yaml_str).expect("Dispatch from YAML"); - let result = Foo::from_variant(&Variant::from(&disp)).expect("Foo from Dispatch from YAML"); - assert_eq!(foo, result); -}} - crate::godot_itest! { test_msgpack { let foo = Foo::new();