Skip to content

Tracking issue: missing features of Rust for idiomatic refactoring of Hafnium #69

@efenniht

Description

@efenniht

(제목이 너무 거창하군요 😱)

  • Move forwarding, a.k.a. NRVO (Do move forwarding on MIR rust-lang/rust#32966)
    이게 불완전하게 작동해서 스택이 터지고 (Stack-consuming ArrayVec #50), drop 도 값 대신 &mut 을 받습니다.
  • Overhaul drop
    • Drop은 이미 너무 많은 문제를 가지고 있습니다.
      • 인자를 받을 수 없습니다.
      • 복구 가능한 실패(returning Result)를 할 수 없습니다.
      • 그렇다고 내부에서 panic을 하면 큰일납니다. 1
      • field의 drop 순서를 정하기 위해서는 ManuallyDrop 같은 걸 넣어야 합니다.
      • invariant가 깨진 상태를 의도적으로 만들어야 합니다.
    • 따라서 custom drop and/or linear type 이 필요합니다.
      • 문제 중 첫 2개를 해결할 수 있습니다.
    • 또한, drop by value and/or Destruct trait 이 필요합니다.
      • 나머지 문제 3개를 해결할 수 있습니다.
      • drop by value가 되려면 move forwarding도 잘 되어야 합니다.
      • 특히나 drop_in_place 과 같은 기능이 유지되어야 하므로, pinned value을 인자로 줄 수 있는 call by value가 가능해야 합니다. 말은 했는데 이게 가능한건지는 잘 모르겠습니다.

Footnotes

  1. Hafnium은 panic할 때 unwinding을 하지 않으므로 이 문제는 크게 관련이 없습니다. 하지만 유닛 테스트를 할 때는 panic strategy가 unwind라서 에러 메세지가 잘 나오지 않는 사소한 문제가 있습니다.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions