Cannot generate Rust bindings for worlds with overlapping exports in the same crate using `pub_export_macro: true`
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
首先執行內嵌 Rust reproducer,並檢查設定 pub_export_macro: true 時 wit_bindgen::generate 的展開情況。追蹤匯出的巨集如何命名,以及它們在各模組之間的作用域;完成標準是兩個 generate! 呼叫都能在沒有重複巨集定義的情況下編譯。
由索引模型根據 Issue 內容生成。
描述
This input:
mod a {
wit_bindgen::generate!({
inline: r#"
package a:b;
interface foo {
x: func();
}
world a {
export foo;
}
"#,
world: "a",
pub_export_macro: true,
});
}
mod b {
wit_bindgen::generate!({
inline: r#"
package a:b;
interface foo {
x: func();
}
interface bar {
x: func();
}
world b {
export foo;
export bar;
}
"#,
world: "b",
pub_export_macro: true,
});
}
fn main() {}
fails with:
error[E0428]: the name `__export_a_b_foo_cabi` is defined multiple times
--> src/main.rs:20:5
|
2 | wit_bindgen::generate!({
| ----------------------- previous definition of the macro `__export_a_b_foo_cabi` here
...
20 | wit_bindgen::generate!({
| ^^^^^^^^^^^^^^^^^^^^^^^ `__export_a_b_foo_cabi` redefined here
|
= note: `__export_a_b_foo_cabi` must be defined only once in the macro namespace of this module
= note: this error originates in the macro `wit_bindgen::generate` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0428`.
error: could not compile `wat` (bin "wat") due to 1 previous error
Basically we need to do more namespacing/scoping of macros that avoids #[macro_export]. I couldn't figure it out earlier but it's probably possible nowadays.
- 主要語言
- Rust
- 星號
- 1.5k
- 分支
- 306
- 平均合併
- 1 天 4 小時
- 30 天內合併 PR
- 21
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
bytecodealliance/wit-bindgen 的其他 Issue
-
gen-rust
難度 4/5 3-5 天 新手友好度 25/100
bytecodealliance/wit-bindgen#1791 ·
維護者通常 1 天內回覆
-
gen-rust
難度 4/5 3-5 天 新手友好度 22/100
bytecodealliance/wit-bindgen#1790 ·
維護者通常 1 天內回覆
-
gen-rust
難度 3/5 半天 新手友好度 55/100
bytecodealliance/wit-bindgen#1787 ·
維護者通常 1 天內回覆
-
gen-c#
難度 4/5 3-5 天 新手友好度 22/100
bytecodealliance/wit-bindgen#1759 ·
維護者通常 1 天內回覆
-
Async exports never free the block of indirect parameters可能已有人在做 @Aditya1404Sal 於 37 天前認領。 未關閉async
難度 4/5 3-5 天 新手友好度 30/100
bytecodealliance/wit-bindgen#1757 ·
維護者通常 1 天內回覆
查看 bytecodealliance/wit-bindgen 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
storytold/photocraft#20056 ·
維護者通常 1 天內回覆
-
accessibility agent-ready area:android bug fleet needs-qa
難度 2/5 1-3 小時 新手友好度 69/100
-
A-Packaging C-Bug D-Straightforward S-Needs-Triage
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
area:doc bug needs-triage
難度 2/5 1-3 小時 新手友好度 65/100
bherbruck/solvecraft#26051 ·