-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Extra space before lifetime apostrophe in macro expansion #12260
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@jhgg |
No, but we can't emit perfect code, and an extra space is harmless (it will get fixed on save/auto-format), as opposed to a missing one which causes rustfmt to fail. After that PR, the completion is no longer "invalid". |
@lnicola |
@lnicola did you mean to re open this? |
fn
s in impl
when trait
is declared by macro expansions
Yeah, and repurpose it for the space @tamaroning asked about. It might be an easy fix, we can close it if not. |
@lnicola use std::marker::PhantomData;
struct Context<'cx> {
phantom: PhantomData<&'cx ()>
}
macro_rules! trait_a {
() => {
trait A<'cx, 'a> {
fn foo(&mut self, cx: &'a Context<'cx>);
}
};
}
trait_a!();
struct S;
impl<'cx, 'a> A<'cx, 'a> for S {
// invalid completion (space is needed before Context)
fn foo(&mutself, cx: & 'aContext< 'cx>) {
}
} |
fix: Improve whitespace insertion in mbe Related: #12260 (comment)
I just checked, #12990 fixed all the issues mentioned here. So we could close it. |
I try this code:
Rust analyzer completes the code as follow:
I expected a completion like:
rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)
rust-analyzer version: 5d5bbec 2022-05-09 stable
rustc version: (eg. output of
rustc -V
)rustc 1.58.1 (db9d1b20b 2022-01-20)
relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTUP_HOME
orCARGO_HOME
)none
If this is not a complex issue, I would like to tackle with this.
The text was updated successfully, but these errors were encountered: