From 4df8ea8e8d9b77d0c3fc4d7252d6f4e233e2e0ef Mon Sep 17 00:00:00 2001 From: zyc <18611145971@163.com> Date: Tue, 3 Mar 2026 14:44:46 +0800 Subject: [PATCH 1/2] Fix inconsistency --- tackc_lib/src/span.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tackc_lib/src/span.rs b/tackc_lib/src/span.rs index 5538a2e..275c1a0 100644 --- a/tackc_lib/src/span.rs +++ b/tackc_lib/src/span.rs @@ -40,12 +40,12 @@ impl Span { /// This function will panic if the input string's length is greater than [`SpanValue::MAX`]. pub fn eof(string: &str) -> Self { assert!( - string.len() < SpanValue::MAX as usize, - "Length of `Span::eof` input must be less than `SpanValue::MAX!`" + string.len() <= SpanValue::MAX as usize, + "Length of `Span::eof` input must be less than or equal to `SpanValue::MAX!`" ); Self { - // Since `string.len() < SpanValue::MAX`, try_into() will return `Ok`. + // Since `string.len() <= SpanValue::MAX`, try_into() will return `Ok`. start: string.len().try_into().expect_unreachable(), // CHECKED(Chloe) end: string.len().try_into().expect_unreachable(), // CHECKED(Chloe) } @@ -57,13 +57,13 @@ impl Span { /// This function will panic if the input string's length is greater than [`SpanValue::MAX`]. pub fn full(string: &str) -> Self { assert!( - string.len() < SpanValue::MAX as usize, - "Length of `Span::full` input must be less than `SpanValue::MAX!`" + string.len() <= SpanValue::MAX as usize, + "Length of `Span::full` input must be less than or equal to `SpanValue::MAX!`" ); Self { start: 0, - // Since `string.len() < SpanValue::MAX`, try_into() will return `Ok`. + // Since `string.len() <= SpanValue::MAX`, try_into() will return `Ok`. end: string.len().try_into().expect_unreachable(), // CHECKED(Chloe) } } From 097afec62178cdc8496c3954835a9150b3e58eff Mon Sep 17 00:00:00 2001 From: zyc <18611145971@163.com> Date: Thu, 5 Mar 2026 11:59:07 +0800 Subject: [PATCH 2/2] Add contributors --- CONTRIBUTORS.md | 1 + tackc_lib/src/parser.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f5b6092..3b9e24c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,3 +16,4 @@ This document will **NOT** be updated for you, but feel free to update it whenev --- **Chloe** ([@akiramusic000](https://github.com/akiramusic000)) - Lead Developer +**Yichi Zhang** ([@YichiZhang0613](https://github.com/YichiZhang0613)) \ No newline at end of file diff --git a/tackc_lib/src/parser.rs b/tackc_lib/src/parser.rs index 12b9026..cc7faec 100644 --- a/tackc_lib/src/parser.rs +++ b/tackc_lib/src/parser.rs @@ -1079,8 +1079,8 @@ impl<'src, 'a> Parser<'src, 'a> { if !mode.normal() || self .peek() - .filter(|t| t.kind == TokenKind::LBrace) - .is_none() + .as_ref() + .is_none_or(|t| t.kind != TokenKind::LBrace) { return self.global_ident(recursion); }