Skip to content

Latest commit

 

History

History
executable file
·
130 lines (118 loc) · 10.6 KB

2019-09-26.md

File metadata and controls

executable file
·
130 lines (118 loc) · 10.6 KB

T-Lang Meeting: 2019.09.26

Shepherded items

Triage

Main topic: RFC 2753

extern “C unwind” notes

  • Target case
    • unwinding over FFI integration
  • Example use cases
    • Rust panics, traverses native frames w/o destructors, panic caught in a Rust frame
  • Main design question at hand
    • extern “C unwind”
      • using “the native” unwinding mechanism, as defined by the target specification
        • DWARF on linux, SEH on msvc
    • extern “C panic”
      • using “the Rust” unwinding mechanism, which may or may not be equal to the target specification
      • any use case for this apart from “it’s easiest”?
        • only one is Rust loading other Rust code, but that’s really
  • What exactly are we guaranteeing at this point?

  • Possible future situations worth considering
    • What if a new unwinding mechanism should arise, where C++ compilers have not yet transitioned, or offer optional support, but we want to adopt it
      • We could change our default target uses, if we think we can get away with it
        • Equivalent to e.g. adopting newer instruction sets
      • Issue a new target that supports this mechanism and people can opt in
        • “rust unwind == native unwind” remains true all the time
        • “rust unwind == native unwind” not true, in which case on older target we require shims
  • Interactions not addressed in RFC 2753
    • If native code raises an exception, and it traverses Rust stack frames, do destructors run?
    • If native code raises an exception, and it traverses Rust stack frames, do destructors run?
    • If native code raises an exception, does catch_panic intercept it?
    • If Rust code raises a panic, and it traverses native frames, what happens?
      • If there are destructors, do they run?
  • Key question perhaps
    • Are the points above “undefined behavior” or “implementation defined”?
      • Today, it is definitely UB because of the nounwind attribute and attempts to insert the abort shim
      • Not clear what the real difference is. Perhaps it is that rustc would have to define (and potentially stabilize) that behavior.
      • Perhaps the difference is that we are avoiding LLVM UB — we won’t miscompile the code.
      • Analogy: Rust ABI
    • Idea:
      • spell out the kind of changes that we anticipate and which could happen
  • Key desiderata and/or concerns
    • We shouldn’t constrain our future behavior, for example to adapt to changes in C and C++.
      • e.g., the proposal to alter our behavior to match new C++ proposals
  • Concern:
    • Drop order between structs and enums
      • Difference: Behavior of exceptions that cross stack frames is pretty inconsistent across platforms
      • But we can expect that people will start to want better behavior
      • And it’s true that our freedom has been restricted by stabilizing the behavior
      • How would someone define on this?
  • Proposal: WG, try to actually settle some of this behavior
    • define “scope” of the effort, perhaps in terms of use cases?
      • example: not stabilizing the Rust ABI, nor proposing to alter Rust’s panic mechanism
      • but yes thinking about what it would mean if it did change
    • get input from folks from UCG
  • Consensus of meeting:
    • RFC should clarify questions that it intentionally does not answer and leaves for future work
    • Centralize rationale, clarify what “impl defined behavior” means, etc, complete “TODO” items
    • Spin out a WG with BatmanAOD and/or acfoltzer as “lang team shepherd” / Niko as liason
    • We are comfortable landing a syntactic change that doesn’t (yet) enable stable code that has fully defined behavior, as long as we have a plan to finish up the remaining pieces rather than leaving to “accidentally stable” behavior
      • extern “C unwind” — would we stabilize this behavior even before all pieces are in place?
        • centril: would like to see centralized rationale etc written out
        • adam/acfolzer: have laid out thoughts on thread, will try to move to RFC