summaryrefslogtreecommitdiff
path: root/src/syntax
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-01-27 12:16:54 +0100
committerLaurenz <laurmaedje@gmail.com>2023-01-27 12:16:54 +0100
commit9d962c5c40da12207433a6e88aa34f11d036af37 (patch)
tree3b38502a4dc2cb1818f8282a400194937d0ac336 /src/syntax
parent43ef60c09cc48f6b7c6dd752ab7af7c0d6071bc5 (diff)
More `track_caller` annotations
Diffstat (limited to 'src/syntax')
-rw-r--r--src/syntax/ast.rs4
-rw-r--r--src/syntax/parser.rs1
-rw-r--r--src/syntax/span.rs2
3 files changed, 5 insertions, 2 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index 3b573f7d..a24b9fa2 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -406,7 +406,7 @@ impl Shorthand {
"|->" => '↦',
"<->" => '↔',
"<=>" => '⇔',
- _ => panic!("shorthand is invalid"),
+ _ => char::default(),
}
}
}
@@ -879,7 +879,7 @@ impl Numeric {
"em" => Unit::Em,
"fr" => Unit::Fr,
"%" => Unit::Percent,
- _ => panic!("number has invalid suffix"),
+ _ => Unit::Percent,
};
(value, unit)
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs
index a046b685..7eadf94a 100644
--- a/src/syntax/parser.rs
+++ b/src/syntax/parser.rs
@@ -1025,6 +1025,7 @@ impl<'s> Parser<'s> {
self.current == kind
}
+ #[track_caller]
fn assert(&mut self, kind: SyntaxKind) {
assert_eq!(self.current, kind);
self.eat();
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index 22ada359..0e4ec215 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -38,6 +38,7 @@ impl Span {
/// Create a new span from a source id and a unique number.
///
/// Panics if the `number` is not contained in `FULL`.
+ #[track_caller]
pub const fn new(id: SourceId, number: u64) -> Self {
assert!(
Self::FULL.start <= number && number < Self::FULL.end,
@@ -53,6 +54,7 @@ impl Span {
}
/// Pack the components into a span.
+ #[track_caller]
const fn pack(id: SourceId, number: u64) -> Span {
let bits = ((id.into_u16() as u64) << Self::BITS) | number;
match NonZeroU64::new(bits) {