Skip to content

"Cannot pass a mutable reference" error when returning an enum from an unconstrained function #7558

Open
@jfecher

Description

Aim

fn main() {
    let x = unsafe { foo() };
}

fn foo() -> Enum {
    Enum::A
}

enum Enum { A }

Expected Behavior

The program to either work or issue an error explaining that enums cannot cross the constrained <-> unconstrained boundary.

Bug

error: Cannot pass a mutable reference from a unconstrained runtime to an constrained runtime
  ┌─ src/main.nr:6:22
  │
6 │     let x = unsafe { foo() };
  │                      -----
  │

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

  • Status

    📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions