mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? In #83074 we changed how turbo task objects were registered to use the `inventory` crate. This PR adds a new `inventory_submit!` macro that wraps the existing `inventory::submit` function with a `#[cfg(not(rust_analyzer))]` attribute to prevent Rust Analyzer choking on the generated code. See example error  Because the inventory code does not affect any API surfaces this is safe and if anything should improve rust-analyzer performance
15 lines
354 B
Rust
15 lines
354 B
Rust
#![allow(dead_code)]
|
|
#![allow(unexpected_cfgs)]
|
|
|
|
use anyhow::Result;
|
|
use turbo_tasks::{ResolvedVc, Vc};
|
|
|
|
#[turbo_tasks::function(operation)]
|
|
async fn multiply(value: Vc<i32>, coefficient: ResolvedVc<i32>) -> Result<Vc<i32>> {
|
|
let value = *value.await?;
|
|
let coefficient = *coefficient.await?;
|
|
Ok(Vc::cell(value * coefficient))
|
|
}
|
|
|
|
fn main() {}
|