diff --git a/.github/workflows/miri.yml b/.github/workflows/miri.yml index c9f9f5957077e2..092b95eb85e276 100644 --- a/.github/workflows/miri.yml +++ b/.github/workflows/miri.yml @@ -17,8 +17,9 @@ jobs: - name: Install Miri run: | - rustup component add miri + rustup toolchain install nightly --component miri + rustup override set nightly cargo miri setup - name: Test with Miri - run: MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test + run: cargo miri test -p oxc_parser -p oxc_ast -p oxc_allocator -p oxc_semantic diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index 7cce4a0685428f..96308407f95a2f 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -316,6 +316,17 @@ mod test { } } + #[test] + fn memory_leak() { + let allocator = Allocator::default(); + let source_type = SourceType::default(); + let sources = ["2n", ";'1234567890123456789012345678901234567890'"]; + for source in sources { + let ret = Parser::new(&allocator, source, source_type).parse(); + assert!(!ret.program.body.is_empty()); + } + } + // Source with length u32::MAX + 1 fails to parse #[test] fn overlong_source() {