Record the dependency-feeding pipeline and what it found
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
f7a0d53 parent: b867486 modified
DESIGN.md +36 -0 | @@ -1210,3 +1210,39 @@ halt twice: | ||
| 1210 | 1210 | |
| 1211 | 1211 | So the language-feature list did bottom out here, exactly as predicted; what |
| 1212 | 1212 | is left in front of libcosmic is source availability, not semantics. |
| 1213 | + | |
| 1214 | +## Feeding it the dependencies | |
| 1215 | + | |
| 1216 | +The answer to "other people's crates are just Rust" is to hand rustnim the | |
| 1217 | +dependency's Rust. Concretely, for libcosmic: | |
| 1218 | + | |
| 1219 | +```bash | |
| 1220 | +# one expansion per dependency crate, from inside the workspace | |
| 1221 | +RUSTC_BOOTSTRAP=1 cargo rustc -q -p <crate> --lib -- -Zunpretty=expanded | |
| 1222 | +``` | |
| 1223 | + | |
| 1224 | +465 library crates in the graph; **362 expanded** (the rest fail to build | |
| 1225 | +standalone under this invocation — build-script and target-gated crates, | |
| 1226 | +mostly), and **357 of those re-parse** as Rust. `-Zunpretty=expanded` output is | |
| 1227 | +not guaranteed to be re-parseable, and five crates are not. That is 3.0M lines | |
| 1228 | +of Rust handed to the transpiler in one invocation alongside libcosmic itself. | |
| 1229 | + | |
| 1230 | +What that found, in order, each one a real language feature rather than a | |
| 1231 | +missing standard-library name: | |
| 1232 | + | |
| 1233 | +| halt | what it actually was | | |
| 1234 | +|---|---| | |
| 1235 | +| `Auto::Window as u128` in `enum Auto`'s own declaration | a discriminant naming an earlier variant of the enum being declared | | |
| 1236 | +| `enumflags2::_internal::next_bit` | the dependency itself — fixed by feeding it, which is the point of this section | | |
| 1237 | +| `impl DoubleEndedIterator` in return position | an `Iterator` subtrait; the forward half is exactly a Nim closure iterator | | |
| 1238 | +| `Option<impl IntoListItem>` | nested argument-position `impl Trait`, misreported as return position | | |
| 1239 | +| serde's `const _: () = { .. }` | an item container, not a value | | |
| 1240 | +| `enum __Field` in a `deserialize` body | function-local items | | |
| 1241 | +| two different `__Field`s | function-local *scoping*, once 357 crates were in one namespace | | |
| 1242 | +| `[u8; BLOCK_LEN]` | array lengths are const expressions, not numbers | | |
| 1243 | + | |
| 1244 | +Two things worth saying about that list. None of these entries is "a method we | |
| 1245 | +have not mapped yet" — every one is a construct with a Nim equivalent that | |
| 1246 | +rustnim was not reaching for. And the last two only appear at scale: a single | |
| 1247 | +crate never puts two different `__Field`s in one namespace, so the 3M-line run | |
| 1248 | +is not a stunt, it is the only configuration in which those bugs exist. | |
| @@ -1210,3 +1210,39 @@ halt twice: | |||
| 1210 | 1210 | ||
| 1211 | So the language-feature list did bottom out here, exactly as predicted; what | 1211 | So the language-feature list did bottom out here, exactly as predicted; what |
| 1212 | is left in front of libcosmic is source availability, not semantics. | 1212 | is left in front of libcosmic is source availability, not semantics. |
| 1213 | + | ||
| 1214 | +## Feeding it the dependencies | ||
| 1215 | + | ||
| 1216 | +The answer to "other people's crates are just Rust" is to hand rustnim the | ||
| 1217 | +dependency's Rust. Concretely, for libcosmic: | ||
| 1218 | + | ||
| 1219 | +```bash | ||
| 1220 | +# one expansion per dependency crate, from inside the workspace | ||
| 1221 | +RUSTC_BOOTSTRAP=1 cargo rustc -q -p <crate> --lib -- -Zunpretty=expanded | ||
| 1222 | +``` | ||
| 1223 | + | ||
| 1224 | +465 library crates in the graph; **362 expanded** (the rest fail to build | ||
| 1225 | +standalone under this invocation — build-script and target-gated crates, | ||
| 1226 | +mostly), and **357 of those re-parse** as Rust. `-Zunpretty=expanded` output is | ||
| 1227 | +not guaranteed to be re-parseable, and five crates are not. That is 3.0M lines | ||
| 1228 | +of Rust handed to the transpiler in one invocation alongside libcosmic itself. | ||
| 1229 | + | ||
| 1230 | +What that found, in order, each one a real language feature rather than a | ||
| 1231 | +missing standard-library name: | ||
| 1232 | + | ||
| 1233 | +| halt | what it actually was | | ||
| 1234 | +|---|---| | ||
| 1235 | +| `Auto::Window as u128` in `enum Auto`'s own declaration | a discriminant naming an earlier variant of the enum being declared | | ||
| 1236 | +| `enumflags2::_internal::next_bit` | the dependency itself — fixed by feeding it, which is the point of this section | | ||
| 1237 | +| `impl DoubleEndedIterator` in return position | an `Iterator` subtrait; the forward half is exactly a Nim closure iterator | | ||
| 1238 | +| `Option<impl IntoListItem>` | nested argument-position `impl Trait`, misreported as return position | | ||
| 1239 | +| serde's `const _: () = { .. }` | an item container, not a value | | ||
| 1240 | +| `enum __Field` in a `deserialize` body | function-local items | | ||
| 1241 | +| two different `__Field`s | function-local *scoping*, once 357 crates were in one namespace | | ||
| 1242 | +| `[u8; BLOCK_LEN]` | array lengths are const expressions, not numbers | | ||
| 1243 | + | ||
| 1244 | +Two things worth saying about that list. None of these entries is "a method we | ||
| 1245 | +have not mapped yet" — every one is a construct with a Nim equivalent that | ||
| 1246 | +rustnim was not reaching for. And the last two only appear at scale: a single | ||
| 1247 | +crate never puts two different `__Field`s in one namespace, so the 3M-line run | ||
| 1248 | +is not a stunt, it is the only configuration in which those bugs exist. | ||