Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/oxc_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,20 @@ mod parser_parse {
///
/// `UniquePromise::new_for_benchmarks` is a backdoor for benchmarks, so they can create a
/// `ParserImpl` or `Lexer`, and manipulate it directly, for testing/benchmarking purposes.
pub(crate) struct UniquePromise {
_dummy: (),
}
pub(crate) struct UniquePromise(());

impl UniquePromise {
#[inline]
fn new() -> Self {
Self { _dummy: () }
Self(())
}

/// Backdoor for tests/benchmarks to create a `UniquePromise` (see above).
/// This function must NOT be exposed outside of tests and benchmarks,
/// as it allows circumventing safety invariants of the parser.
#[cfg(feature = "benchmarking")]
pub fn new_for_benchmarks() -> Self {
Self { _dummy: () }
Self(())
}
}

Expand Down