rust-lang / rust-lang/rfcs

Stabilize `intrinsics::abort` in `core`

Open
#2,512 36 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

View all comments

I would like to see intrinsics::abort stabilized in some form as it's useful in some cases to have
panicking behavior (and alloc_error) = abort (minimizes code size and the abort exception / signal
can be handled elsewhere or in a upper abstraction layer).

As intrinsics::abort lowers to a trap instruction on most architectures (*) I propose we add a
safe wrapper around it in core::arch::$ARCH for the architectures where it does.

(*) On most but not on all. For example, On MSP430 it lowers to a call to the abort function
which results in a linker error unless that symbol is defined somewhere in the dependency graph.

(Related: There's std::process::abort which claims to be a safe wrapper around intrinsics::abort
but if you at its implementation it is, in fact, not just a wrapper around intrinsics::abort but
something completely different.)

@rust-lang/libs what would be needed to move this forward? An full RFC, or just a PR + FCP?

cc @Amanieu @glandium

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 proposal for stabilizing intrinsics::abort, including the suggested core::arch::$ARCH wrappers and the distinction from std::process::abort. The issue does not identify files or tests; work is not ready to begin until the required RFC or PR-plus-FCP path and supported architectures are decided.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.