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

Can't define headers in fn items (or doctests) #12

Open
FelixMcFelix opened this issue Jan 29, 2025 · 0 comments
Open

Can't define headers in fn items (or doctests) #12

FelixMcFelix opened this issue Jan 29, 2025 · 0 comments

Comments

@FelixMcFelix
Copy link
Collaborator

Code like the following which attempts to define a header within a fn breaks horribly:

fn hello() {
    #[derive(Ingot)]
    pub struct Broken {
        pub fine: u8,
    }
}
error: cannot find type `BrokenRef` in this scope
   --> ingot/src/lib.rs:180:16
    |
180 |     pub struct Broken {
    |                ^^^^^^ names from parent modules are not accessible without an explicit import
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
    = note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default

Although the types in question are not defined in a mod, all of them are referenced within the implementation-private module created to hold a header's chunk types and other generated artefacts.

An unfortunate victim of this is that doctests cannot include packet definitions, since they compile to a fn.

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

No branches or pull requests

1 participant