Closed
Description
rust-analyzer version: 94fa8a653 2022-05-12 nightly
rustc version: rustc 1.62.0-nightly (de1bc0008 2022-04-21)
relevant settings: Rustup on Ubuntu 22.04, with VS Code 1.67.1
In VSCode, I typed in the following code:
macro_rules! noop {
($($item: item)*) => {
$($item)*
}
}
noop! {
trait Foo {
fn foo(&mut self, bar: i64, baz: &mut u32) -> Result<(), u32>;
}
}
struct Test;
impl Foo for Test {
f // my cursor is right here, and the autocomplete "fn foo(..)" option appears
}
When I press "enter" to autocomplete the method, the following is generated:
impl Foo for Test {
fn foo(&mutself, bar:i64, baz: &mutu32) ->Result<(),u32> {
}
}
Note the lack of space between &mut
and self
, as well as &mut
and u32
. This leads to a compile error when I try to compile or even rustfmt
this code. Removing the trait from the macro prevents this from happening.