Skip to content

Commit 1eb9f5e

Browse files
committed
Fix scip inherent impl overflow
1 parent d60afec commit 1eb9f5e

File tree

1 file changed

+6
-6
lines changed
  • src/tools/rust-analyzer/crates/rust-analyzer/src/cli

1 file changed

+6
-6
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,14 @@ impl SymbolGenerator {
444444
MonikerResult::Moniker(moniker) => TokenSymbols {
445445
symbol: scip::symbol::format_symbol(moniker_to_symbol(moniker)),
446446
enclosing_symbol: None,
447-
is_inherent_impl: moniker
448-
.identifier
449-
.description
450-
.get(moniker.identifier.description.len() - 2)
451-
.is_some_and(|descriptor| {
447+
is_inherent_impl: match &moniker.identifier.description[..] {
448+
// inherent impls are represented as impl#[SelfType]
449+
[.., descriptor, _] => {
452450
descriptor.desc == MonikerDescriptorKind::Type
453451
&& descriptor.name == "impl"
454-
}),
452+
}
453+
_ => false,
454+
},
455455
},
456456
MonikerResult::Local { enclosing_moniker } => {
457457
let local_symbol = scip::types::Symbol::new_local(local_count);

0 commit comments

Comments
 (0)