Skip to content

Commit def52ee

Browse files
committed
Don't execute inventory_submit in rust analyzer
This is triggering an bug "expected integer or floating pointer number after '-'". We don't really understand the issue (perhaps related to a rustc nightly release?) but as far as we can tell it is just triggered by the transitive expansion of `inventory::submit!`. So we can just skip doing that with rust_analyzer since none of that code affects types.
1 parent 4a85aab commit def52ee

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

turbopack/crates/turbo-tasks/src/macro_helpers.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,16 @@ pub fn register_trait_methods(value: &mut ValueType) {
183183
}
184184
}
185185

186-
pub use inventory::submit as inventory_submit;
186+
/// Submit an item to the inventory.
187+
///
188+
/// This macro is a wrapper around `inventory::submit` that adds a `#[not(cfg(rust_analyzer))]`
189+
/// attribute to the item. This is to avoid warnings about unused items when using Rust Analyzer.
190+
#[macro_export]
191+
macro_rules! inventory_submit {
192+
($($item:tt),*) => {
193+
#[cfg(not(rust_analyzer))]
194+
{
195+
::inventory::submit! { $($item),* }
196+
}
197+
}
198+
}

0 commit comments

Comments
 (0)