hyperlight-dev / hyperlight-dev/hyperlight

hyperlight-component-macros generates name collisions

Đang mở
#813 4 bình luận 0 reaction 1 người được giao Được @syntactically nhận Xem trên GitHub
lifecycle/confirmed
Ngôn ngữ chính
Rust
Star
4.7k
Fork
208
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
47

Mô tả

### What happened?

The code generated by hyperlight-component-macros fails to compile.

If produces the following errors:
```
error[E0428]: the name `Types` is defined multiple times
--> src/main.rs:7:1
|
7 | hyperlight_component_macro::host_bindgen!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Types` redefined here
|
= note: `Types` must be defined only once in the type namespace of this trait
= note: this error originates in the macro `hyperlight_component_macro::host_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0428]: the name `types` is defined multiple times
--> src/main.rs:7:1
|
7 | hyperlight_component_macro::host_bindgen!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `types` redefined here
|
= note: `types` must be defined only once in the value namespace of this trait
= note: this error originates in the macro `hyperlight_component_macro::host_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0425]: cannot find value `rts` in this scope
--> src/main.rs:7:1
|
7 | hyperlight_component_macro::host_bindgen!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: this error originates in the macro `hyperlight_component_macro::host_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)
```

### What did you expect to happen?

The generated code to compile succesfully.

### Steps to reproduce the behavior

Generate host_bindings!() using the following world:
```wit
package root:component;

world root {
import wasi:cli/environment@0.2.3;
import wasi:io/poll@0.2.3;
import wasi:clocks/monotonic-clock@0.2.3;
import wasi:io/error@0.2.3;
import wasi:io/streams@0.2.3;
import wasi:http/types@0.2.3;
import wasi:cli/stdin@0.2.3;
import wasi:cli/stdout@0.2.3;
import wasi:cli/stderr@0.2.3;
import wasi:cli/terminal-input@0.2.3;
import wasi:cli/terminal-output@0.2.3;
import wasi:cli/terminal-stdin@0.2.3;
import wasi:cli/terminal-stdout@0.2.3;
import wasi:cli/terminal-stderr@0.2.3;
import wasi:clocks/wall-clock@0.2.3;
import wasi:filesystem/types@0.2.3;
import wasi:filesystem/preopens@0.2.3;
import wasi:random/random@0.2.3;
import wasi:http/outgoing-handler@0.2.3;

export wasi:http/incoming-handler@0.2.3;
}
```

```rust
extern crate alloc;

mod bindings {

use super::alloc;

hyperlight_component_macro::host_bindgen!();

}

fn main() {
}
```

### Hyperlight Version

0.8.0

### OS version

```console
On Linux:
$ cat /etc/os-release
# paste output here

$ uname -a
# paste output here

On Windows:
C:\> cmd /c ver
# paste output here

````

### Additional Information

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.