diff --git a/crates/formality-core/src/collections.rs b/crates/formality-core/src/collections.rs index e9ac8ed4..a795b6e4 100644 --- a/crates/formality-core/src/collections.rs +++ b/crates/formality-core/src/collections.rs @@ -58,17 +58,6 @@ macro_rules! seq { } -pub trait VecExt: Sized { - fn with_pushed(self, other: T) -> Self; -} - -impl VecExt for Vec { - fn with_pushed(mut self, other: T) -> Self { - self.push(other); - self - } -} - pub trait SetExt: Sized { fn split_first(self) -> Option<(T, Set)>; diff --git a/crates/formality-core/src/parse/parser/left_recursion.rs b/crates/formality-core/src/parse/parser/left_recursion.rs index b96c4eb4..c63e6f09 100644 --- a/crates/formality-core/src/parse/parser/left_recursion.rs +++ b/crates/formality-core/src/parse/parser/left_recursion.rs @@ -97,7 +97,7 @@ impl StackEntry { let scope: *const () = erase_type(scope); let start_text: *const str = start_text; let type_id = TypeId::of::(); - scope == self.scope && start_text == self.start_text && self.type_id == type_id + scope == self.scope && std::ptr::eq(start_text, self.start_text) && self.type_id == type_id } /// True if a call to parse a value of type `T` with the given scope scope/text @@ -152,7 +152,7 @@ impl StackEntry { let Some(current_state) = &self.current_state else { panic!("observed a stack frame with no current state (forgot to call `recuse`?"); }; - if start_text != current_state.current_text { + if !std::ptr::eq(start_text, current_state.current_text) { return None; }