{"record":{"id":"fd21d4d0e6cb9e0c","repo":"zed-industries/zed","slug":"gpui-bench-does-not-support-async-benchmark-fu","errorCode":null,"errorMessage":"#[gpui::bench] does not support async benchmark functions yet","messagePattern":"#\\[gpui::bench\\] does not support async benchmark functions yet","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/gpui_macros/src/bench.rs","lineNumber":64,"sourceCode":"        if let Err(error) = parser.parse(args) {\n            return error_to_stream(error);\n        }\n    }\n\n    // The frame budget math lives in `BenchReport` so `bench_context` is the\n    // single source of truth; `default()` supplies the default frame rate.\n    let report_expr = match fps {\n        Some(fps) => quote! { gpui::BenchReport::with_fps(#fps) },\n        None => quote! { gpui::BenchReport::default() },\n    };\n\n    let mut inner_fn = match syn::parse::<ItemFn>(function) {\n        Ok(function) => function,\n        Err(error) => return error_to_stream(error),\n    };\n\n    if let Some(asyncness) = &inner_fn.sig.asyncness {\n        return error_to_stream(syn::Error::new(\n            asyncness.span(),\n            \"#[gpui::bench] does not support async benchmark functions yet\",\n        ));\n    }\n\n    let outer_fn_name = inner_fn.sig.ident.clone();\n    let inner_fn_name = format_ident!(\"__gpui_bench_{}\", outer_fn_name);\n    inner_fn.sig.ident = inner_fn_name.clone();\n\n    let benchmark = if let Some(inputs) = inputs {\n        let input_name = match input_name {\n            Some(input_name) => quote! { #input_name },\n            None => quote! { stringify!(#outer_fn_name) },\n        };\n        let group_name = match group_name {\n            Some(group_name) => quote! { #group_name },\n            None => quote! { stringify!(#outer_fn_name) },\n        };","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_macros/src/bench.rs#L46-L82","documentation":"Compile-time rejection: the #[gpui::bench] macro was applied to an async fn, which the benchmark harness does not support. The attribute cannot generate a synchronous Criterion benchmark for an async function.","triggerScenarios":"Thrown at crates/gpui_macros/src/bench.rs:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the benchmark function synchronous","If async setup is needed, drive it manually (e.g. via a runtime handle) inside the sync benchmark body"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}