"Generate method" assist adds the code to the current impl even if this is a trait implementation.
I believe this is related to #21684 fixing #21550
rust-analyzer version: rust-analyzer 1.95.0 (5980761 2026-04-14)
rustc version: rustc 1.95.0 (59807616e 2026-04-14)
code snippet to reproduce:
trait Foo {
fn foo();
}
struct Bar;
impl Bar {
fn func1() {}
// (3)
}
impl Foo for Bar {
fn foo(&self) {
self.func2(); // (1)
}
// (2)
}
Using the "Generate func2 method" assist at (1) adds the func2 method skeleton at (2) in the trait implementation block whereas I would expect it to default to (3) in the Bar struct block implementation.
cc @akashchakrabortymsc-cmd
"Generate method" assist adds the code to the current impl even if this is a trait implementation.
I believe this is related to #21684 fixing #21550
rust-analyzer version:
rust-analyzer 1.95.0 (5980761 2026-04-14)rustc version:
rustc 1.95.0 (59807616e 2026-04-14)code snippet to reproduce:
Using the "Generate
func2method" assist at(1)adds thefunc2method skeleton at(2)in the trait implementation block whereas I would expect it to default to(3)in theBarstruct block implementation.cc @akashchakrabortymsc-cmd