rust-lang / rust-lang/rfcs

'unsafe' keyword should expect Expression instead '{}'

Open
#3,431 20 comments 50 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-lang
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

unsafe keyword is only valid this way: unsafe { unsafe_function() }
but it cloud be more better if unsafe cloud be written this way: unsafe unsafe_function()

  • it can make unsafe more readable, to be honest i needed this a lot of times, unsafe tends to be messy in inline code.
  • it doesn't breaks previous code, since it cloud take brackets as an expression, it makes the lang less restrictive.
  • this makes unsafe code look less scary or weird, but that is just my opinion so don't rely in this argument.

unsafe {} -> unsafe *expression*

Contributor guide

No contributing guide indexed for this repository

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 reviewing the issue proposal and the repository's RFC process; no implementation file, test, or entry point is named. A complete contribution would define the syntax and parsing implications of accepting an expression after unsafe, preserve the existing block form, and document how the proposal should be evaluated.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.