-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: bugCategory: bug
Description
rust-analyzer version: rust-analyzer 0.4.2595-standalone
rustc version: rustc 1.91.0-nightly (040a98af7 2025-08-20)
editor or extension: VIM9.1
code snippet to reproduce:
struct Foo<T>($0T);
Output assists:
╭Choose action─────────────────────╮
│1. Change visibility to pub(crate)│
│2. Add `#[derive]` │
│3. Generate impl for `Foo` │
│4. Generate trait impl for `Foo` │
│5. Generate `new` │
╰──────────────────────────────────╯
Generate `Deref` not exist
Output assists (rust-analyzer 1.91.0-nightly (040a98a 2025-08-20):
╭Choose action─────────────────────╮
│1. Change visibility to pub(crate)│
│2. Generate `Deref` impl using `T`│
│3. Add `#[derive]` │
│4. Generate impl for `Foo` │
│5. Generate trait impl for `Foo` │
│6. Generate `new` │
╰──────────────────────────────────╯
This problem from crates/ide-assists/src/handlers/generate_deref.rs
line 172:
if strukt_type.impls_trait(sema.db, deref_trait, &[]) {
if strukt_type.impls_trait(sema.db, deref_mut_trait, &[]) {
Some(DerefType::DerefMut)
} else {
Some(DerefType::Deref)
}
} else {
None
}
For has generic parameter type, impls_trait
seems to have unexpectedly returned true
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug