Skip to content

Naked functions do not require unsafety #32489

@nagisa

Description

@nagisa
Member

RFC states that naked functions must either not contain any “safe” blocks or be unsafe themselves. Currently, code like

#![feature(asm, naked_functions)]

#[naked]
extern "win64" fn naked(x: u32) -> u32 {
    x + 1
}

is accepted.

Activity

nagisa

nagisa commented on Mar 25, 2016

@nagisa
MemberAuthor
added
A-nakedArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzS
on Jun 2, 2016
steveklabnik

steveklabnik commented on Dec 25, 2019

@steveklabnik
Member

Triage: still reproduces today

added
requires-nightlyThis issue requires a nightly compiler in some way.
T-langRelevant to the language team
on Dec 25, 2019
npmccallum

npmccallum commented on Aug 4, 2021

@npmccallum
Contributor

@nagisa @steveklabnik I propose we reject this bug in light of the Constrained Naked RFC. There is nothing which prevents a naked function from being safe.

added 3 commits that reference this issue on Jan 22, 2022
86b4a3e
7d624e1
a8f64c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-nakedArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSC-bugCategory: This is a bug.I-needs-decisionIssue: In need of a decision.T-langRelevant to the language teamrequires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @steveklabnik@npmccallum@nagisa@jonas-schievink@Mark-Simulacrum

      Issue actions

        Naked functions do not require unsafety · Issue #32489 · rust-lang/rust