summaryrefslogtreecommitdiff
path: root/src/syntax/source.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-11 11:35:45 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-11 11:35:45 +0200
commit998a3c44fd79eac92c375ec9e755288bc146a279 (patch)
tree70825f2d68ed64c32b8b2551dcf0e545753f643c /src/syntax/source.rs
parent2f0b5eeae09bd880e4552bb83e44d9cd32571c58 (diff)
Remove tracing from cheap functions
Turns out that having tracing enabled on some functions that get called a lot distorts the traces so that their parent stack frames look much more expensive than they actually are.
Diffstat (limited to 'src/syntax/source.rs')
-rw-r--r--src/syntax/source.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/syntax/source.rs b/src/syntax/source.rs
index b325cf9e..f67ed656 100644
--- a/src/syntax/source.rs
+++ b/src/syntax/source.rs
@@ -109,6 +109,7 @@ impl Source {
/// Returns the range in the new source that was ultimately reparsed.
///
/// The method panics if the `replace` range is out of bounds.
+ #[track_caller]
pub fn edit(&mut self, replace: Range<usize>, with: &str) -> Range<usize> {
let start_byte = replace.start;
let start_utf16 = self.byte_to_utf16(replace.start).unwrap();
@@ -158,6 +159,7 @@ impl Source {
/// Map a span that points into this source file to a byte range.
///
/// Panics if the span does not point into this source file.
+ #[track_caller]
pub fn range(&self, span: Span) -> Range<usize> {
self.find(span)
.expect("span does not point into this source file")