Commit 1e3f344
committed
fix: Revert to embedded runtime with proper allocator (no UB)
Root cause: wit-bindgen-rt v0.39.0 is incompatible with wit-bindgen CLI v0.47.0
- The CLI generates code expecting Cleanup, CleanupGuard types
- wit-bindgen-rt 0.39.0 doesn't export these types
- This caused 'could not find export' and 'could not find Cleanup' errors
Solution: Use embedded runtime but fix the undefined behavior
- Replaced dummy pointer (let ptr = 1 as *mut u8) with real allocator
- Use std::alloc::alloc() for proper memory allocation
- CleanupGuard now stores ptr + layout for proper deallocation
- Drop impl calls std::alloc::dealloc() with correct layout
Changes:
- rust/rust_wasm_component_bindgen.bzl: Embedded runtime with real allocator
- tools/checksum_updater/Cargo.toml: Removed wit-bindgen-rt dependency
The embedded runtime is now:
✅ Compatible with wit-bindgen CLI 0.47.0
✅ No undefined behavior (real allocator, not dummy pointer)
✅ Proper memory management with Drop
✅ No external dependency version mismatches1 parent 071e0c1 commit 1e3f344
File tree
2 files changed
+55
-10
lines changed- rust
- tools/checksum_updater
2 files changed
+55
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 63 | + | |
| 64 | + | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
| |||
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | | - | |
| 73 | + | |
76 | 74 | | |
77 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
78 | 126 | | |
79 | 127 | | |
80 | 128 | | |
| |||
325 | 373 | | |
326 | 374 | | |
327 | 375 | | |
328 | | - | |
329 | 376 | | |
330 | 377 | | |
331 | 378 | | |
| |||
336 | 383 | | |
337 | 384 | | |
338 | 385 | | |
339 | | - | |
340 | 386 | | |
341 | 387 | | |
342 | 388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
0 commit comments