From a4319cc66ca0573fad737c64cb1e187a09caf165 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Mon, 1 Apr 2024 17:12:46 +0200 Subject: [PATCH 1/9] Update CI to work again --- .github/external-config/public-docs-token.txt | 2 +- bindings-generator/src/methods.rs | 1 + gdnative-core/src/core_types/geom/rect2.rs | 2 +- gdnative-core/src/private.rs | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) 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/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/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/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 } From 54677d39bcdfa8881b5957c6337f34cfe30c673e Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 6 Apr 2024 20:49:37 +0200 Subject: [PATCH 2/9] Apply clippy suggestion (prevents ICE) ICE was fixed in the meantime, this addresses the problem until next stable release. --- gdnative-core/src/object/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) } } From f4241c579ef685490195b269cb781a539b5499c8 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 6 Apr 2024 20:59:29 +0200 Subject: [PATCH 3/9] Bump MSRV from 1.67 to 1.70 --- .github/workflows/full-ci.yml | 14 +++++++------- README.md | 2 +- bindings-generator/Cargo.toml | 2 +- examples/builder-export/Cargo.toml | 2 +- examples/dodge-the-creeps/Cargo.toml | 2 +- examples/godot_tps_controller_port/Cargo.toml | 2 +- examples/hello-world/Cargo.toml | 2 +- examples/native-plugin/Cargo.toml | 2 +- examples/property-export/Cargo.toml | 2 +- examples/resource/Cargo.toml | 2 +- examples/rpc/Cargo.toml | 2 +- examples/scene-create/Cargo.toml | 2 +- examples/signals/Cargo.toml | 2 +- examples/spinning-cube/Cargo.toml | 2 +- gdnative-async/Cargo.toml | 2 +- gdnative-bindings/Cargo.toml | 2 +- gdnative-core/Cargo.toml | 2 +- gdnative-derive/Cargo.toml | 2 +- gdnative-sys/Cargo.toml | 2 +- gdnative/Cargo.toml | 2 +- impl/proc-macros/Cargo.toml | 2 +- test/Cargo.toml | 2 +- 22 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/full-ci.yml b/.github/workflows/full-ci.yml index a2a06838e..23380850d 100644 --- a/.github/workflows/full-ci.yml +++ b/.github/workflows/full-ci.yml @@ -127,7 +127,7 @@ 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' } @@ -295,16 +295,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 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..671e45f22 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 = [] 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-derive/Cargo.toml b/gdnative-derive/Cargo.toml index 8297418cf..4a09f6d87 100644 --- a/gdnative-derive/Cargo.toml +++ b/gdnative-derive/Cargo.toml @@ -9,7 +9,7 @@ version = "0.11.3" license = "MIT" workspace = ".." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [lib] proc-macro = true 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/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..2c0970601 100644 --- a/impl/proc-macros/Cargo.toml +++ b/impl/proc-macros/Cargo.toml @@ -8,7 +8,7 @@ version = "0.11.3" license = "MIT" workspace = "../.." edition = "2021" -rust-version = "1.67" +rust-version = "1.70" [lib] proc-macro = true diff --git a/test/Cargo.toml b/test/Cargo.toml index b0901031b..e81124598 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 From 2d66b46057a81951940e2e8705123cc308f85de1 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 6 Apr 2024 21:01:16 +0200 Subject: [PATCH 4/9] Update cargo-dinghy, cargo-deny, cargo-machete --- .github/workflows/full-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/full-ci.yml b/.github/workflows/full-ci.yml index 23380850d..31836210f 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: From 6f4dde27ffd3e88529a909b9710e827ee0d16a41 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 6 Apr 2024 21:02:21 +0200 Subject: [PATCH 5/9] Update actions/checkout, actions/cache --- .github/composite/godot/action.yml | 4 ++-- .github/composite/llvm/action.yml | 2 +- .github/workflows/full-ci.yml | 16 ++++++++-------- .github/workflows/minimal-ci.yml | 10 +++++----- .github/workflows/release-version.yml | 10 +++++----- .github/workflows/update-docs.yml | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) 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/workflows/full-ci.yml b/.github/workflows/full-ci.yml index 31836210f..39c4a8b51 100644 --- a/.github/workflows/full-ci.yml +++ b/.github/workflows/full-ci.yml @@ -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 @@ -134,7 +134,7 @@ jobs: 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: @@ -174,7 +174,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 +193,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 +225,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: @@ -318,7 +318,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..a530fd920 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,7 +73,7 @@ jobs: runs-on: ubuntu-latest needs: validation steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -88,7 +88,7 @@ jobs: runs-on: ubuntu-latest needs: validation steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -102,7 +102,7 @@ jobs: runs-on: ubuntu-latest needs: validation steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -119,7 +119,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. From 62e45e3ebb6943619e3118053e4c85b35f3128a1 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 6 Apr 2024 21:07:37 +0200 Subject: [PATCH 6/9] Replace obsolete actions-rs toolchain --- .github/workflows/full-ci.yml | 7 +------ .github/workflows/release-version.yml | 29 +++++++++++---------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/full-ci.yml b/.github/workflows/full-ci.yml index 39c4a8b51..e4a491393 100644 --- a/.github/workflows/full-ci.yml +++ b/.github/workflows/full-ci.yml @@ -136,13 +136,8 @@ jobs: steps: - 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' }} diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index a530fd920..d9336277d 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -74,11 +74,10 @@ jobs: needs: validation steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - 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" @@ -89,12 +88,10 @@ jobs: needs: validation steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: clippy + - 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 @@ -103,12 +100,10 @@ jobs: needs: validation steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt + - name: "Install Rust toolchain" + run: | + rustup toolchain install stable --profile minimal --component rustfmt + rustup default stable - name: "Check rustfmt" run: cargo fmt --all -- --check From b2c20b3b270386b662e3f65e5bb7b357ed30c8c0 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 6 Apr 2024 21:13:17 +0200 Subject: [PATCH 7/9] Address clippy lints (some of which nightly) Remove dead code (IncludeDocs) --- gdnative-core/src/core_types/string.rs | 1 + gdnative-derive/src/methods.rs | 1 - gdnative-derive/src/variant/attr/field.rs | 2 - gdnative-derive/src/variant/attr/item.rs | 2 - gdnative-sys/build.rs | 67 +++++++++++------------ impl/proc-macros/src/doc.rs | 26 --------- impl/proc-macros/src/lib.rs | 1 - 7 files changed, 34 insertions(+), 66 deletions(-) delete mode 100644 impl/proc-macros/src/doc.rs 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-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/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/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] From 5c2c819a1e48ce66f5c0f4013b7ba63e476ed7e5 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Mon, 1 Apr 2024 17:21:08 +0200 Subject: [PATCH 8/9] Remove serde_yaml from tests (no longer maintained) --- test/Cargo.toml | 1 - test/src/test_serde.rs | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/test/Cargo.toml b/test/Cargo.toml index e81124598..4c11546db 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -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(); From 8516ff0289110e9ac983b4428ac739f2a2ec0405 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sat, 6 Apr 2024 21:42:55 +0200 Subject: [PATCH 9/9] Change syn minimal version to 1.0.84 The macro parse_quote_spanned!() has been introduced there. --- bindings-generator/Cargo.toml | 2 +- gdnative-derive/Cargo.toml | 2 +- impl/proc-macros/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings-generator/Cargo.toml b/bindings-generator/Cargo.toml index 671e45f22..6ea0d182d 100644 --- a/bindings-generator/Cargo.toml +++ b/bindings-generator/Cargo.toml @@ -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/gdnative-derive/Cargo.toml b/gdnative-derive/Cargo.toml index 4a09f6d87..9bef0d5a2 100644 --- a/gdnative-derive/Cargo.toml +++ b/gdnative-derive/Cargo.toml @@ -15,7 +15,7 @@ rust-version = "1.70" 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/impl/proc-macros/Cargo.toml b/impl/proc-macros/Cargo.toml index 2c0970601..307095d0f 100644 --- a/impl/proc-macros/Cargo.toml +++ b/impl/proc-macros/Cargo.toml @@ -14,6 +14,6 @@ rust-version = "1.70" 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"