Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nathanwhit opened this issue Sep 9, 2024 · 0 comments
Labels
bug Something isn't working ops op functionality

Comments

@nathanwhit
Copy link
Member

nathanwhit commented Sep 9, 2024

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.

@nathanwhit nathanwhit changed the title Op that takes handle scope and a cppgc argument doesn't compile with #[op2(fast)] Op that takes handle scope and a cppgc argument doesn't compile with #[op2(fast)] Sep 9, 2024
@littledivy littledivy added bug Something isn't working ops op functionality labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ops op functionality
Projects
None yet
Development

No branches or pull requests

2 participants