Document unwinding ABI extern "C"
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- documentation
Research direction
Start with the Rust Reference entry for the extern "C" ABI and trace the documentation history from the referenced commit. Review issue #48251 and the linked LLVM discussion to establish the intended platform-dependent unwinding behavior. Done means the reference clearly documents the behavior or records the unresolved decision.
Written by the indexing model from the issue text.
Description
The current documentation of the extern "C" ABI in the reference says:
extern "C" -- This is the same as extern fn foo(); whatever the default your C compiler supports.
When it comes to whether C functions can unwind, the C compiler defaults on most platforms is that these cannot unwind. An exception is MSVC, where AFAICT all functions can always unwind (e.g. even C++ noexcept functions are allowed to be unwound by specific exceptions like, e.g., the one thrown by longjmp).
If this is actually the intended behavior we probably should not emit nounwind for extern "C" functions on Windows. That would have fixed https://github.com/rust-lang/rust/issues/48251 in a different way since that would have allowed longjmps from C into Rust. In the LLVM issue different strategies to allowing nounwind there but fixing things at the LLVM level are being discussed: https://bugs.llvm.org/show_bug.cgi?id=36508.
So as written, whether extern "C" functions can unwind is platform dependent. Is this the intended behavior ? If so, we should clarify this. The earliest I can trace this documentation is https://github.com/rust-lang-nursery/reference/commit/3461ff1feb4956f168c74c9a906af2c61410b080
cc @Centril @nagisa @eddyb
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-lang/reference
-
A-const-eval A-undefined-behavior
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
A-resolve
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
A-coercions
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
All issues in rust-lang/reference
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100