From 50172919a61e7f845a3307eba9ec42fbb78effa4 Mon Sep 17 00:00:00 2001 From: David Richey Date: Mon, 27 Jan 2025 22:16:45 -0600 Subject: [PATCH] Fix scip inherent impl overflow --- crates/rust-analyzer/src/cli/scip.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/rust-analyzer/src/cli/scip.rs b/crates/rust-analyzer/src/cli/scip.rs index dc0f722aae..22bf0075ad 100644 --- a/crates/rust-analyzer/src/cli/scip.rs +++ b/crates/rust-analyzer/src/cli/scip.rs @@ -444,14 +444,14 @@ impl SymbolGenerator { MonikerResult::Moniker(moniker) => TokenSymbols { symbol: scip::symbol::format_symbol(moniker_to_symbol(moniker)), enclosing_symbol: None, - is_inherent_impl: moniker - .identifier - .description - .get(moniker.identifier.description.len() - 2) - .is_some_and(|descriptor| { + is_inherent_impl: match &moniker.identifier.description[..] { + // inherent impls are represented as impl#[SelfType] + [.., descriptor, _] => { descriptor.desc == MonikerDescriptorKind::Type && descriptor.name == "impl" - }), + } + _ => false, + }, }, MonikerResult::Local { enclosing_moniker } => { let local_symbol = scip::types::Symbol::new_local(local_count);