From ddd3b6a82b8c0353c942bfba8b89ca5476eedc58 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 21 Sep 2022 17:50:58 +0200 Subject: Tracked memoization --- src/syntax/span.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/syntax') diff --git a/src/syntax/span.rs b/src/syntax/span.rs index 4eae4124..59c4cc5c 100644 --- a/src/syntax/span.rs +++ b/src/syntax/span.rs @@ -81,7 +81,7 @@ impl Span { "span number outside valid range" ); - let bits = ((id.into_raw() as u64) << Self::BITS) | number; + let bits = ((id.into_u16() as u64) << Self::BITS) | number; Self(to_non_zero(bits)) } @@ -98,7 +98,7 @@ impl Span { /// The id of the source file the span points into. pub const fn source(self) -> SourceId { - SourceId::from_raw((self.0.get() >> Self::BITS) as u16) + SourceId::from_u16((self.0.get() >> Self::BITS) as u16) } /// The unique number of the span within the source file. @@ -157,7 +157,7 @@ mod tests { #[test] fn test_span_encoding() { - let id = SourceId::from_raw(5); + let id = SourceId::from_u16(5); let span = Span::new(id, 10).with_pos(SpanPos::End); assert_eq!(span.source(), id); assert_eq!(span.number(), 10); -- cgit v1.2.3