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

Derive Trace, Finalize triggers non-local impl lint warning on nightly #174

Closed
TheBB opened this issue Jun 11, 2024 · 0 comments · Fixed by #175
Closed

Derive Trace, Finalize triggers non-local impl lint warning on nightly #174

TheBB opened this issue Jun 11, 2024 · 0 comments · Fixed by #175

Comments

@TheBB
Copy link
Contributor

TheBB commented Jun 11, 2024

You need almost nothing to trigger this:

use gc::{Trace, Finalize, Gc};

#[derive(Trace, Finalize)]
struct Test();

fn main() {
    let _x = Gc::new(Test());
}

Warning:

warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
 --> src/main.rs:3:17
  |
3 | #[derive(Trace, Finalize)]
  |                 ^-------
  |                 |
  |                 `Finalize` is not local
  |                 move the `impl` block outside of this constant `_DERIVE_gc_Finalize_FOR_Test`
4 | struct Test();
  |        ---- `Test` is not local
  |

This is probably due to an implementation detail in the derive macro.

It seems this may become an error in the future, so this should be fixed.

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

Successfully merging a pull request may close this issue.

1 participant