Skip to content

Commit a2e3209

Browse files
Replace num-bigint with malachite-bigint (#18)
Co-authored-by: Jeong YunWon <[email protected]>
1 parent 5e9e8a7 commit a2e3209

File tree

16 files changed

+51
-37
lines changed

16 files changed

+51
-37
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ jobs:
3737

3838
- uses: Swatinem/rust-cache@v2
3939

40-
- name: run tests with default features
41-
run: cargo test --all
42-
- name: run tests with embedded parser
43-
run: cargo test --all --no-default-features
44-
- name: run tests with generated parser
45-
run: cargo test --all --all-features
40+
- name: run tests with num-bigint
41+
run: cargo test --all --no-default-features --features num-bigint
42+
- name: run tests with malachite-bigint and all features
43+
run: cargo test --all --features location,malachite-bigint,constant-optimization,fold,unparse,visitor,all-nodes-with-ranges,full-lexer,serde --exclude rustpython-ast-pyo3
4644

4745
lint:
4846
name: Check Rust code with rustfmt and clippy
@@ -55,7 +53,9 @@ jobs:
5553
- name: run rustfmt
5654
run: cargo fmt --all -- --check
5755
- name: run clippy
58-
run: cargo clippy --all --all-features -- -Dwarnings
56+
run: cargo clippy --all --no-default-features --features num-bigint
57+
- name: run clippy
58+
run: cargo clippy --all --features location,malachite-bigint,constant-optimization,fold,unparse,visitor,all-nodes-with-ranges,full-lexer,serde --exclude rustpython-ast-pyo3 -- -Dwarnings
5959

6060
- uses: actions/setup-python@v4
6161
with:

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rustpython-ast = { path = "ast", default-features = false }
2121
rustpython-parser-core = { path = "core", features = [] }
2222
rustpython-literal = { path = "literal" }
2323
rustpython-format = { path = "format" }
24-
rustpython-parser = { path = "parser" }
24+
rustpython-parser = { path = "parser", default-features = false }
2525

2626
ahash = "0.7.6"
2727
anyhow = "1.0.45"
@@ -34,6 +34,7 @@ num-complex = "0.4.0"
3434
num-bigint = "0.4.3"
3535
num-traits = "0.2"
3636
pyo3 = { version = "0.18.3" }
37+
malachite-bigint = { version = "0.1.0" }
3738
rand = "0.8.5"
3839
serde = "1.0"
3940
static_assertions = "1.1"

ast-pyo3/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ crate-type = ["cdylib"]
1414

1515
[dependencies]
1616
rustpython-ast = { workspace = true, features = ["location"] }
17-
rustpython-parser = { workspace = true }
17+
rustpython-parser = { workspace = true, features = ["num-bigint"] }
1818
num-complex = { workspace = true }
1919
once_cell = { workspace = true }
2020

ast/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository = "https://github.com/RustPython/Parser/"
88
license = "MIT"
99

1010
[features]
11-
default = ["location"]
11+
default = ["location", "malachite-bigint"]
1212
constant-optimization = ["fold"]
1313
location = ["fold", "rustpython-parser-core/location"]
1414
fold = []
@@ -21,7 +21,6 @@ rustpython-parser-core = { workspace = true }
2121
rustpython-literal = { workspace = true, optional = true }
2222

2323
is-macro = { workspace = true }
24-
num-bigint = { workspace = true }
24+
num-bigint = { workspace = true, optional = true }
25+
malachite-bigint = { workspace = true, optional = true }
2526
static_assertions = "1.1.0"
26-
27-
pyo3 = { workspace = true, optional = true, features = ["num-bigint", "num-complex"] }

ast/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! `builtin_types` in asdl.py and Attributed
22
3-
use num_bigint::BigInt;
3+
use crate::bigint::BigInt;
44

55
pub type String = std::string::String;
66

ast/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ mod ranged;
1414
#[cfg(feature = "unparse")]
1515
mod unparse;
1616

17+
#[cfg(feature = "malachite-bigint")]
18+
pub use malachite_bigint as bigint;
19+
#[cfg(feature = "num-bigint")]
20+
pub use num_bigint as bigint;
21+
1722
pub use builtin::*;
1823
pub use generic::*;
1924
pub use ranged::Ranged;

ast/src/optimizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<U> crate::fold::Fold<U> for ConstantOptimizer {
5555

5656
#[cfg(test)]
5757
mod tests {
58-
use num_bigint::BigInt;
58+
use crate::bigint::BigInt;
5959
use rustpython_parser_core::text_size::TextRange;
6060

6161
#[cfg(feature = "constant-optimization")]

format/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ rustpython-literal = { workspace = true }
1212

1313
bitflags = "2.3.1"
1414
itertools = "0.10.5"
15-
num-bigint = { workspace = true }
15+
malachite-bigint = { workspace = true }
1616
num-traits = { workspace = true }

format/src/cformat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Implementation of Printf-Style string formatting
22
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
33
use bitflags::bitflags;
4-
use num_bigint::{BigInt, Sign};
4+
use malachite_bigint::{BigInt, Sign};
55
use num_traits::Signed;
66
use rustpython_literal::{float, format::Case};
77
use std::{

format/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use itertools::{Itertools, PeekingNext};
2-
use num_bigint::{BigInt, Sign};
2+
use malachite_bigint::{BigInt, Sign};
33
use num_traits::{cast::ToPrimitive, Signed};
44
use rustpython_literal::float;
55
use rustpython_literal::format::Case;

0 commit comments

Comments
 (0)