Rust-GCC / Rust-GCC/gccrs

Unsafe attributes not allowed

Open
#4,244 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

Summary

While all attributes made unsafe in the 2024 edition can be used without unsafe in prior editions, rustc still accepts the unsafe marking on older editions.

Reproducer

I tried this code:

#[unsafe(no_mangle)]
fn foo() {}
Does the code make use of any (1.49) nightly feature ?
  • Nightly
Godbolt link

No response

Actual behavior

An error is emitted.

Expected behavior

Compiles successfully on all editions.

GCC Version

gccrs (Compiler-Explorer-Build-gcc--binutils-2.44) 15.2.0

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 by reproducing the issue with gccrs 15.2.0 using #[unsafe(no_mangle)] fn foo() {} and compare behavior across Rust editions. Trace the edition handling for unsafe attributes, then verify that the example compiles successfully on all editions.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.