godot-rust / gdnative

Rust bindings for Godot 3
https://godot-rust.github.io
MIT License
3.61k stars 210 forks source link

GDNativeCallbacks is not unsafe to implement, but the deprecated macros think it is #1076

Open chitoyuu opened 4 months ago

chitoyuu commented 4 months ago

From Discord:


Compiling b v0.1.0 (C:\Users\Sloth\Documents\elem\b)
warning: use of deprecated macro `godot_init`: use the #[gdnative::init::callbacks] attribute macro instead
  --> src\lib.rs:23:1
   |
23 | godot_init!(init);
   | ^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

error[E0199]: implementing the trait `GDNativeCallbacks` is not unsafe
  --> src\lib.rs:23:1
   |
23 | godot_init!(init);
   | ^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `godot_init` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove `unsafe` from this trait implementation
  --> C:\Users\Sloth\.cargo\git\checkouts\godot-rust-1005fa777d499fc2\639aae7\gdnative-core\src\init\macros.rs:16:13

16 -             unsafe impl $crate::init::GDNativeCallbacks for GDNativeCallbacksImpl {
16 +             impl $crate::init::GDNativeCallbacks for GDNativeCallbacksImpl {
   |

For more information about this error, try `rustc --explain E0199`.
warning: `b` (lib) generated 1 warning
error: could not compile `b` (lib) due to previous error; 1 warning emitted
``