Skip to content

Commit

Permalink
fix(lexer): Source is not Clone (#8294)
Browse files Browse the repository at this point in the history
It's an invariant of `Source` that only a single instance of `Source` can exist at any time. `Source` was erroneously implementing `Clone`, which makes it trivial to break this invariant. `Clone` is unnecessary, so remove it.
  • Loading branch information
overlookmotel committed Jan 7, 2025
1 parent 64bfdfe commit e1f8ea4
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion crates/oxc_parser/src/lexer/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ use super::search::SEARCH_BATCH_SIZE;
/// are satisfied, to restore this invariant before passing control back to other code.
/// It will often be preferable to instead use `Source::peek_byte`, followed by `Source::next_char`,
/// which are safe methods, and compiler will often reduce to equally efficient code.
#[derive(Clone)]
pub(super) struct Source<'a> {
/// Pointer to start of source string. Never altered after initialization.
start: *const u8,
Expand Down

0 comments on commit e1f8ea4

Please sign in to comment.