Skip to content

Extra space before lifetime apostrophe in macro expansion #12260

Closed
@tamaroning

Description

@tamaroning

I try this code:

use std::marker::PhantomData;

struct Context<'cx> {
    phantom: PhantomData<&'cx ()>
}

macro_rules! trait_a {
    () => {
        trait A<'cx> {
            fn foo(&mut self, cx: &Context<'cx>);
        }       
    };
}

trait_a!();

struct S;

impl<'cx> A<'cx> for S {
    // Cursor is here
}

Rust analyzer completes the code as follow:

    fn foo(&mutself, cx: &Context< 'cx>) {
        
    }

I expected a completion like:

    fn foo(&mut self, cx: &Context<'cx>) {
        
    }

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 or CARGO_HOME)
none

If this is not a complex issue, I would like to tackle with this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macromacro expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions