Files
Luke SandbergandGitHub 38c4caf22a [turbopack] Don't execute inventory_submit in rust analyzer (#83447)
### 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

![image.png](https://app.graphite.dev/user-attachments/assets/2fe87f23-8717-4615-a86d-94c1b19ae099.png)

Because the inventory code does not affect any API surfaces this is safe and if anything should improve rust-analyzer performance
2025-09-04 13:31:50 -07:00

20 lines
566 B
Rust

#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![allow(unexpected_cfgs)]
use turbo_tasks::{ResolvedVc, Vc};
#[turbo_tasks::value(transparent)]
struct IntegersVec(Vec<ResolvedVc<u32>>);
#[turbo_tasks::function(invalid_argument)]
fn return_contains_resolved_vc() -> Vc<IntegersVec> {
Vc::cell(Vec::new())
}
fn main() {
// the macro should be error-tolerant and this function should still be created
// despite the earlier compilation error, so this line should not also error
let _ = return_contains_resolved_vc();
}