Closed
Description
rust-analyzer version: rust-analyzer version: 0.3.1463-standalone
rustc version: rustc 1.68.2 (9eb3afe9e 2023-03-27
RA parameterHints/chainingHints
cannot work properly in functions with proc_macro
annotations, but typeHints
seem to work normally
Example
Proc macro
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn test_attr(_args: TokenStream, input: TokenStream) -> TokenStream {
let funtion: syn::ItemFn = match syn::parse(input) {
Ok(function) => function,
Err(err) => return err.to_compile_error().into(),
};
quote::quote! {
#funtion
}
.into()
}
Test
#[cfg(test)]
mod tests {
use test_ra::test_attr;
fn add(a: i32, b: i32) -> i32 {
a + b
}
#[test_attr]
fn test() {
// parameterHints/chainingHints not works, but typeHints works well?
let _a = add(5, 6);
let _b: Vec<_> = [1, 2, 3]
.iter()
.map(|item| item)
.map(|item| item)
.map(|item| item)
.collect();
}
fn test1() {
let _a = add(5, 6);
let _b: Vec<_> = [1, 2, 3]
.iter()
.map(|item| item)
.map(|item| item)
.map(|item| item)
.collect();
}
}