Skip to content

Structural Search and Replace (SSR): replacement referred unknown placeholder #12914

@Logarithmus

Description

@Logarithmus

rust-analyzer version: 2022-07-25
rustc version: 1.62.1

Code:

use std::ops::Add;
use typenum::{Sum, consts::*};

// <$l as Add<$r>>::Output ==>> typenum::Sum<$l, $r>

pub type Num = <P1 as Add<P2>>::Output;

fn main() {
    println!("Hello, world!");
}

Steps to reproduce:

  1. cargo new sample_text && cd sample_text && cargo add typenum
  2. Open text editor with LSP
  3. Paste this code snippet to src/main.rs
  4. Run code action for commented line with an SSR request

Expected behavior:

Replace

pub type Num = <P1 as Add<P2>>::Output;

with

pub type Num = Sum<P1, P2>;

Observed behavior:

Internal error: replacement referred unknown placeholder $l

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ssrstructural search & replaceC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions