Skip to content

Commit

Permalink
Add "stacker" feature to band-aid common stack overflows (Kampfkarren…
Browse files Browse the repository at this point in the history
…#260)

* Stacker feature

* Move clippy to its own test
  • Loading branch information
Kampfkarren authored Dec 26, 2022
1 parent 4d4e3ae commit 7c4f844
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Clippy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Clippy (default)
run: |
cargo clippy -- -D warnings
- name: Clippy (all features)
run: |
cargo clippy --all-features -- -D warnings
8 changes: 1 addition & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Test (default features)
run: |
cd full-moon
Expand Down Expand Up @@ -39,12 +39,6 @@ jobs:
run: |
cd full-moon
cargo test --no-default-features --features serde
- name: Clippy (default)
run: |
cargo clippy -- -D warnings
- name: Clippy (all features)
run: |
cargo clippy --all-features -- -D warnings
- name: Rustfmt
run: |
cargo fmt -- --check
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- `full_moon::Error` and `full_moon::ast::Ast` now implement Serialize and Deserialize.
- Added optional "stacker" feature which uses the [stacker](https://docs.rs/stacker/latest/stacker/index.html) crate to conditionally expand stack size to avoid stack overflows, a known problem with full-moon.

### Fixed
- Support instantiated generics with no parameters, e.g. `Foo<>`
Expand Down
1 change: 1 addition & 0 deletions full-moon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ logos = "0.12.0"
paste = "0.1"
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
smol_str = { version = "0.1.17", features = ["serde"] }
stacker = { version = "0.1.15", optional = true }

[dev-dependencies]
criterion = "0.2"
Expand Down
5 changes: 5 additions & 0 deletions full-moon/src/ast/parser_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ macro_rules! define_parser {
&self,
state: ParserState<'a>,
) -> Result<(ParserState<'a>, $node), InternalAstError> {
#[cfg(feature = "stacker")]
if true {
return stacker::maybe_grow(32 * 1024, 1024 * 1024, || $body(self, state));
}

$body(self, state)
}
}
Expand Down

0 comments on commit 7c4f844

Please sign in to comment.