Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue for #[ffi_returns_twice] #58314

Closed
gnzlbg opened this issue Feb 8, 2019 · 7 comments
Closed

Tracking issue for #[ffi_returns_twice] #58314

gnzlbg opened this issue Feb 8, 2019 · 7 comments
Labels
A-FFI Area: Foreign function interface (FFI) B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 8, 2019

I'll update with the PR and RFC links when those are ready.

PR: #58315
RFC: rust-lang/rfcs#2633

@jonas-schievink jonas-schievink added B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Feb 9, 2019
@jonas-schievink
Copy link
Contributor

Implemented in #58315

@gnzlbg gnzlbg changed the title Tracking issue for #[returns_twice] Tracking issue for #[ffi_returns_twice] Feb 9, 2019
@Centril Centril added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Feb 11, 2019
bors added a commit to rust-lang/libc that referenced this issue Nov 18, 2019
Deprecate vfork

The compiler may generate incorrect code for `vfork` and `setjmp` because they are missing the `#[returns_twice]` attribute which is currently unstable ([tracking issue](rust-lang/rust#58314)). Since `vfork` is impossible to use safely, I propose deprecating it until `#[returns_twice]` is stable.
@JohnTitor
Copy link
Member

Could we stabilize this feature now? I'm not sure if this is unstable because it's newly added or there's a blocker but it'd be great if we could de-deprecate vfork on the libc :) cc @Amanieu

@Amanieu
Copy link
Member

Amanieu commented Oct 15, 2020

I am very hesitant to do so since it would stabilize a horrible hack that C uses for two functions: vfork and setjmp. In particular:

  • This basically works by disabling a bunch of optimizations in LLVM, but it would likely require additional work in rustc for MIR optimizations.
  • Functions that return twice are a hack, you can't even implement such functions in C: they must be written in assembly.
  • If you really want to use vfork then you should use a C or asm wrapper that hides the "returns twice" hack and provides a safe callback interface that allows you to run a function in the child process.

@JohnTitor
Copy link
Member

Ah, fair enough! I just thought this was missed from stabilizing eyes since rust-lang/libc#1574's OP says "I propose deprecating it until #[returns_twice] is stable". With the above comment, I'm fine to leave this feature as-is, thanks for clarifying!

@jonas-schievink jonas-schievink added the A-FFI Area: Foreign function interface (FFI) label Feb 25, 2021
@joshtriplett
Copy link
Member

Closing because rust-lang/rfcs#2633 was closed. (The ffi-unwind project is looking at this.)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 6, 2024
…, r=compiler-errors

Remove `ffi_returns_twice` feature

The [tracking issue](rust-lang#58314) and [RFC](rust-lang/rfcs#2633) have been closed for a couple of years.

There is also an attribute gate in R-A which should be removed if this lands.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 6, 2024
…, r=compiler-errors

Remove `ffi_returns_twice` feature

The [tracking issue](rust-lang#58314) and [RFC](rust-lang/rfcs#2633) have been closed for a couple of years.

There is also an attribute gate in R-A which should be removed if this lands.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 6, 2024
…, r=compiler-errors

Remove `ffi_returns_twice` feature

The [tracking issue](rust-lang#58314) and [RFC](rust-lang/rfcs#2633) have been closed for a couple of years.

There is also an attribute gate in R-A which should be removed if this lands.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 7, 2024
Rollup merge of rust-lang#120502 - clubby789:remove-ffi-returns-twice, r=compiler-errors

Remove `ffi_returns_twice` feature

The [tracking issue](rust-lang#58314) and [RFC](rust-lang/rfcs#2633) have been closed for a couple of years.

There is also an attribute gate in R-A which should be removed if this lands.
GuillaumeGomez pushed a commit to GuillaumeGomez/rustc_codegen_gcc that referenced this issue Feb 15, 2024
…ler-errors

Remove `ffi_returns_twice` feature

The [tracking issue](rust-lang/rust#58314) and [RFC](rust-lang/rfcs#2633) have been closed for a couple of years.

There is also an attribute gate in R-A which should be removed if this lands.
@VorpalBlade
Copy link

Whatever became of this? Since FFI-unwind was mentioned, C-unwind now exists and is stable, so is it time to revisit this?

@Amanieu
Copy link
Member

Amanieu commented Oct 23, 2024

This is completely unrelated to unwinding. It's about the weird ABI used by functions like vfork and setjmp which do not want to support in Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-FFI Area: Foreign function interface (FFI) B-unstable Blocker: Implemented in the nightly compiler and unstable. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants