rust-lang / rust-lang/rust-analyzer
Structural Search and Replace (SSR): replacement referred unknown placeholder
Open
Nobody has claimed this yet.
A-ssr
C-bug
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
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:
cargo new sample_text && cd sample_text && cargo add typenum- Open text editor with LSP
- Paste this code snippet to
src/main.rs - 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the structural search and replace request on the commented line using the provided sample project. Trace how the replacement referring to $l and $r is interpreted, then verify that the request produces pub type Num = Sum<P1, P2>; instead of the unknown-placeholder error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100