Skip to content

The Machine ™ #275

Closed
Closed
@oli-obk

Description

@oli-obk

Things that need to be moved to the machine before the merger

  • array length computation via Rvalue::Len
  • heap allocations via Rvalue::NullaryOp(NullOp::Box, _)
  • memory::Kind has Rust (heap), C (malloc heap) and Env (env var emulation) allocations
    • We could add a generic Machine variant to Kind, which every Machine can override
  • branching (TerminatorKind::SwitchInt) isn't allowed in CTFE in Rust right now

Things I'm not sure about

There's a lot of stuff that moving to The Machine will make the code much more complex, even though many of these things are basically trivial additions to const eval that imo Rust should have, but couldn't have had with HIR-based const eval.

  • Function pointers and calling them only const fn is already a guarantee
  • Some casts which aren't supported by CTFE in Rust right now
  • Unsizing
  • Local variables
  • Destructuring
  • Rvalue::Discriminant
  • unions
  • enum creation
  • References and dereferencing
  • closures and calling them
  • unsafe code handcrafting a vtable by moving a pointer to a const fn into the appropriate vtable fields and then calling the method via a fat pointer pointing to the field.

Some of these things are really hard to untangle from miri without making the code quite riddiculous.

Please check boxes on the things that need to be done in the "I'm not sure"-list and discuss the rest below.

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