Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Rust codegen on when using type aliases to primitive types #80

Closed
brendanzab opened this issue Dec 6, 2017 · 1 comment
Closed

Comments

@brendanzab
Copy link
Member

Offset32 = u32be;

MyStruct = {
    offset: Offset32;
}

Will try cause the following rustc error:

error[E0599]: no function or associated item named `read` found for type `u32` in the current scope
   --> /Users/brendan/...
    |
480 |         let offset = Offset32::read(reader)?;
    |                      ^^^^^^^^^^^^^^ function or associated item not found in `u32`
    |
    = note: the method `read` exists but the following trait bounds were not satisfied:
            `&mut u32 : std::io::Read`

We might need to keep track of a context during compilation to allow us to lookup whether a type is an alias or something else, and what that alias points to...

@brendanzab
Copy link
Member Author

This relates to the first attempt at the DDL which is now obsolete, so closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant