Skip to content

Future incompatible: Trailing semicolon in macro used in expression position #1674

Description

@CenTdemeern1

The godot_warn, godot_error, and godot_script_error macros contain a semicolon at the end of their bodies which will become a hard error in a future release of Rust when using the macros as an expression:

warning: trailing semicolon in macro used in expression position
   --> /Users/centdemeern1/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/godot-core-0.5.4/src/global/print.rs:336:86
    |
334 | macro_rules! godot_error {
    | ------------------------ in this expansion of `godot_error!`
335 |     ($fmt:literal $(, $args:expr_2021)* $(,)?) => {
336 |         $crate::inner_godot_msg!($crate::global::PrintLevel::Error; $fmt $(, $args)*);
    |                                                                                      ^
    |
   ::: src/pathfinding/datatypes/gridmap.rs:18:30
    |
 18 |             .inspect_err(|e| godot_error!("Invalid type: got {e}"))
    |                              ------------------------------------- in this macro invocation
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
    = note: `#[warn(semicolon_in_expressions_from_non_local_macros)]` (part of `#[warn(future_incompatible)]`) on by default

Repro:

_ = godot_warn!("");

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: coreCore componentsmaintenanceInternal change, not user-facing, developer QoL. Refactors, dep updates, etc.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions