Skip to content

Op that takes handle scope and a cppgc argument doesn't compile with #[op2(fast)] #903

Open
@nathanwhit

Description

@nathanwhit

Repro

pub struct Foo;
impl deno_core::GarbageCollected for Foo {}
#[op2(fast)]
pub fn op_repro(_scope: &mut v8::HandleScope, #[cppgc] _foo: &Foo) {}

Fails to compile with

error[E0502]: cannot borrow `*fast_api_callback_options.isolate` as mutable because it is also borrowed as immutable
   --> repro/main.rs:3:1
    |
3 | #[op2(fast)]
    | ^^^^^^^^^^^-
    | |          |
    | |          immutable borrow might be used here, when `scope` is dropped and runs the `Drop` code for type `CallbackScope`
    | mutable borrow occurs here
    | immutable borrow occurs here
    |
    = note: this error originates in the attribute macro `op2` (in Nightly builds, run with -Z macro-backtrace for more info)

If you remove the fast attr, then op2 errors with This op is fast-compatible and should be marked as (fast).

The only way to get it to compile is with the nofast attr.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopsop functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions