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
43 lines
751 B
Rust
43 lines
751 B
Rust
#![feature(arbitrary_self_types)]
|
|
#![feature(arbitrary_self_types_pointers)]
|
|
#![allow(unexpected_cfgs)]
|
|
|
|
use turbo_tasks::Vc;
|
|
|
|
#[turbo_tasks::value_trait]
|
|
trait MyTrait {
|
|
fn item(&self) -> bool;
|
|
|
|
#[turbo_tasks::function]
|
|
fn item2(&self) -> Vc<bool>;
|
|
|
|
#[turbo_tasks::function]
|
|
fn item3(&self) -> Vc<bool>;
|
|
}
|
|
|
|
#[turbo_tasks::value]
|
|
struct MyStruct;
|
|
|
|
#[turbo_tasks::value_impl]
|
|
impl MyTrait for MyStruct {
|
|
fn item(&self) -> bool {
|
|
true
|
|
}
|
|
|
|
#[turbo_tasks::function]
|
|
fn item2(&self) -> Vc<bool> {
|
|
Vc::cell(true)
|
|
}
|
|
|
|
#[turbo_tasks::function]
|
|
fn item3(&self) -> Vc<bool> {
|
|
Vc::cell(true)
|
|
}
|
|
}
|
|
|
|
fn expects_my_trait(_x: impl MyTrait) {}
|
|
|
|
fn main() {
|
|
expects_my_trait(MyStruct {});
|
|
}
|