rust-lang / rust-lang/rust

Unsafe usage problem in 1.88 (code is compiling with Version ="2021" and failing with Version = "2024"

Open
#144,839 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics S-needs-repro T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
unsafe(plugin_interface! {
   extern trait ExamplePlugin {
        /// Ask the plugin to do a thing
        fn do_a_thing();
        /// Say hello to a person
        fn say_hello(to: *const c_char) -> bool;
        /// Here's a function
        fn trigger_function(a_func: extern "C" fn(u32, u32));
    }
})
Current output
Compiling sxarc_host v0.7.0 (C:\DEV\sxarc\exec\sxarc_host)
error: expected item, found keyword `unsafe`
 --> exec\sxarc_host\src\lib.rs:4:1
  |
4 | unsafe(plugin_interface! {
  | ^^^^^^ expected item
  |
  = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>

error: could not compile `sxarc_host` (lib) due to 1 previous error
Desired output
edition = "2021" it is compiling

edition = "2024" is throwing the above error
Rationale and extra context

Original Code is from : https://github.com/lilopkins/dynamic-plugins-rs/tree/main

Was changing the project structure and actualizing all crate versions to the latest one.

Other cases

Rust Version
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-pc-windows-msvc
release: 1.88.0
LLVM version: 20.1.5
Anything else?

Was only changing the Project Structure to (see picture) and updating all cartes / Versions to the newest one.

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked dynamic-plugins-rs project and reproduce the shown plugin_interface! example using rustc 1.88.0 under editions 2021 and 2024. Compare the compiler diagnostics and determine whether this is an edition-related compiler regression or an issue in the example; done means the cause and a reproducible resolution are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.