make source_text take non mutable reference of self

This commit is contained in:
bit-aloo 2025-12-27 09:43:01 +05:30
parent 8ae38dc333
commit 38f1cccef2
No known key found for this signature in database
3 changed files with 3 additions and 3 deletions

View file

@ -175,7 +175,7 @@ struct ProcMacroClientHandle {
}
impl proc_macro_srv::ProcMacroClientInterface for ProcMacroClientHandle {
fn source_text(&mut self, file_id: u32, start: u32, end: u32) -> Option<String> {
fn source_text(&self, file_id: u32, start: u32, end: u32) -> Option<String> {
self.subreq_tx.send(bidirectional::SubRequest::SourceText { file_id, start, end }).ok()?;
match self.subresp_rx.recv().ok()? {

View file

@ -94,7 +94,7 @@ impl<'env> ProcMacroSrv<'env> {
pub type ProcMacroClientHandle = Box<dyn ProcMacroClientInterface + Send>;
pub trait ProcMacroClientInterface {
fn source_text(&mut self, file_id: u32, start: u32, end: u32) -> Option<String>;
fn source_text(&self, file_id: u32, start: u32, end: u32) -> Option<String>;
}
const EXPANDER_STACK_SIZE: usize = 8 * 1024 * 1024;

View file

@ -156,7 +156,7 @@ impl server::Span for RaSpanServer {
let start: u32 = span.range.start().into();
let end: u32 = span.range.end().into();
self.callback.as_mut()?.source_text(file_id.file_id().index(), start, end)
self.callback.as_ref()?.source_text(file_id.file_id().index(), start, end)
}
fn parent(&mut self, _span: Self::Span) -> Option<Self::Span> {