Skip to content

Commit 1e67565

Browse files
committed
Unify macro-generated and const-generic bounded integers
- Removes a dependency on `syn`. - We change the syntax of `bounded_integer!` to make it easier to parse by declarative macros. - Indexing functionality is removed. I decided that it’s probably not that useful. - To simplify things, applying a binary operator to two const-generic integers of different ranges is no longer supported. You should just use `.get()` on one.
1 parent a9f5fe4 commit 1e67565

26 files changed

Lines changed: 3666 additions & 4220 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
"uses": "actions-rs/cargo@v1",
2121
"with": {
2222
"command": "clippy",
23-
"args": "--workspace --all-targets --features types,__examples -- -Dwarnings",
23+
"args": "--workspace --all-targets --features macro -- -Dwarnings",
2424
},
2525
},
2626
{
2727
"uses": "actions-rs/cargo@v1",
2828
"with": {
2929
"command": "clippy",
30-
"args": "--workspace --all-targets --features types,__examples,arbitrary1,bytemuck1,serde1,zerocopy,std -- -Dwarnings",
30+
"args": "--workspace --all-targets --features macro,arbitrary1,bytemuck1,num-traits02,serde1,zerocopy,std -- -Dwarnings",
3131
},
3232
},
3333
],
@@ -49,7 +49,7 @@
4949
"uses": "actions-rs/cargo@v1",
5050
"with": {
5151
"command": "test",
52-
"args": "--workspace --features types,__examples,arbitrary1,bytemuck1,serde1,zerocopy,std",
52+
"args": "--workspace --features macro,arbitrary1,bytemuck1,num-traits02,serde1,zerocopy,std",
5353
},
5454
},
5555
],
@@ -72,7 +72,7 @@
7272
"uses": "actions-rs/cargo@v1",
7373
"with": {
7474
"command": "check",
75-
"args": "--workspace --all-targets --features types,__examples",
75+
"args": "--workspace --all-targets --all-features",
7676
},
7777
},
7878
],
@@ -94,7 +94,7 @@
9494
"uses": "actions-rs/cargo@v1",
9595
"with": {
9696
"command": "test",
97-
"args": "--workspace --features types,__examples,arbitrary1,bytemuck1,serde1,zerocopy,std,step_trait",
97+
"args": "--workspace --all-features",
9898
},
9999
},
100100
],

Cargo.lock

Lines changed: 217 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords = ["bounded", "integer", "macro", "refinement"]
66
license = "ISC"
77
repository = "https://github.com/Kestrer/bounded-integer"
88
readme = "README.md"
9-
edition = "2021"
9+
edition = "2024"
1010

1111
[dependencies]
1212
bounded-integer-macro = { path = "./macro", version = "=0.5.8", optional = true }
@@ -21,21 +21,23 @@ zerocopy = { version = "0.8.14", features = ["derive"], optional = true }
2121
std = ["alloc"]
2222
alloc = []
2323

24-
types = []
25-
2624
macro = ["bounded-integer-macro"]
27-
__examples = ["macro", "bounded-integer-macro/generate_tests"]
2825

2926
step_trait = []
3027

31-
serde = ["serde1"]
28+
# `__doc` is set when building the crate locally, but users should not set it.
29+
# There are a few reasons we use it instead of `cfg(doc)`:
30+
# + The examples are gated based on this feature, and we want them to typecheck.
31+
# + When it is enabled, we adjust the internals of the crate in a way that makes its macros unusable
32+
# outside the crate. This improves documentation, but should not be done only when `cfg(doc)` is
33+
# set.
34+
__doc = ["macro"]
35+
36+
[dev-dependencies]
37+
trybuild = "1.0.110"
3238

3339
[package.metadata.docs.rs]
3440
all-features = true
35-
rustdoc-args = ["--cfg", "doc_cfg"]
36-
37-
[lints.rust]
38-
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] }
3941

4042
[workspace]
4143
members = ["macro"]

0 commit comments

Comments
 (0)