Skip to content

Commit b4674ad

Browse files
committed
fix(docs): respect per-binding #[cfg] feature gates in generated docs
`alef docs` rendered the full extracted API surface without evaluating a binding's effective feature set, so feature-restricted bindings (e.g. wasm, whose `wasm-target` excludes `tree-sitter`) documented gated types, fields, enum variants, and functions that are compiled out of the real binding. `generate_lang_doc` now filters the surface through the new `ApiSurface::with_cfg_filtered_deep`, which drops cfg-gated members (fields/variants) as well as top-level items, using each backend's real effective feature set (Swift/Dart force-enable every cfg-referenced feature minus `excluded_default_features`; other backends use their configured list). `cfg_feature_satisfied` gains three-valued (Kleene) evaluation with full all/any/not and nested-predicate support, and keeps items whose gate depends on an unresolved non-feature leaf (e.g. target_arch). Bumps version to 0.36.1.
1 parent 4a1fec9 commit b4674ad

9 files changed

Lines changed: 529 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.36.1] - 2026-07-13
11+
12+
### Fixed
13+
14+
- **`alef docs` over-documented `#[cfg(feature = "…")]`-gated items for feature-restricted bindings**:
15+
the reference-docs generator rendered the full extracted API surface without evaluating each
16+
binding's effective feature set, so a binding whose feature set excludes a gate (e.g. the wasm
17+
binding — `wasm-target`, which does not enable `tree-sitter`) still documented the gated types,
18+
struct fields, enum variants, and functions, diverging from the surface the binding actually
19+
compiles. `generate_lang_doc` now filters the surface through the new
20+
`ApiSurface::with_cfg_filtered_deep` — which drops cfg-gated *members* (fields, enum variants,
21+
variant fields), not just top-level items — using each backend's real effective feature set
22+
(Swift/Dart force-enable every cfg-referenced feature minus `excluded_default_features`; other
23+
backends use their configured feature list). `cfg_feature_satisfied` gains three-valued (Kleene)
24+
evaluation with full `all`/`any`/`not` and nested-predicate support, and keeps any item whose gate
25+
depends on an unresolved non-feature leaf (e.g. `target_arch`), so target-conditional items are
26+
never wrongly dropped.
27+
28+
## [0.34.7] - 2026-07-10
29+
1030
### Fixed
1131

1232
- **dart native loader emitted unparseable Dart (`\${...}` instead of `${...}`)**: the
@@ -1065,7 +1085,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10651085
- **extendr (R): skip per-variant factory constructors whose fields cannot cross the extendr input boundary.**
10661086
A tagged data enum (e.g. `NodeContent`) generates a `_factory_<variant>` `#[extendr]` constructor per
10671087
struct variant. When a variant field was a Named DTO (`grid: TableGrid`) or `Vec<DTO>`
1068-
(`entries: Vec<MetadataEntry>`), the constructor took it _by value_, which the `#[extendr]` proc-macro
1088+
(`entries: Vec<MetadataEntry>`), the constructor took it *by value*, which the `#[extendr]` proc-macro
10691089
cannot accept (`error[E0277]: T: TryFrom<&Robj> not satisfied`) — extendr derives `TryFrom<&Robj>` only
10701090
for `&T`, never owned `T`, and has no R-list conversion for `Vec<DTO>`. `gen_extendr_enum_variant_constructors`
10711091
and `extendr_enum_variant_constructor_registrations` now skip such variants (predicate

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[package]
33
name = "alef"
4-
version = "0.36.0"
4+
version = "0.36.1"
55
edition = "2024"
66
rust-version = "1.85"
77
license = "MIT"

alef.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
alef_version = "0.36.0"
2+
alef_version = "0.36.1"
33
languages = []
44

55
[workspace.dto]

schemas/alef.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7481,7 +7481,7 @@
74817481
"type": "object"
74827482
}
74837483
},
7484-
"$id": "https://github.com/xberg-io/alef/releases/download/v0.36.0/alef.schema.json",
7484+
"$id": "https://github.com/xberg-io/alef/releases/download/v0.36.1/alef.schema.json",
74857485
"$schema": "https://json-schema.org/draft/2020-12/schema",
74867486
"additionalProperties": false,
74877487
"description": "JSON Schema for the JSON representation of alef.toml.",
@@ -7599,6 +7599,6 @@
75997599
],
76007600
"title": "Alef configuration",
76017601
"type": "object",
7602-
"version": "0.36.0",
7603-
"x-alef-version": "0.36.0"
7602+
"version": "0.36.1",
7603+
"x-alef-version": "0.36.1"
76047604
}

0 commit comments

Comments
 (0)