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

Non-local impl definition warning #366

Open
TylerBloom opened this issue Jun 3, 2024 · 3 comments
Open

Non-local impl definition warning #366

TylerBloom opened this issue Jun 3, 2024 · 3 comments
Labels

Comments

@TylerBloom
Copy link

While using the Rust beta release, I got a some warning around derived Display impls. The exact warning message is below:

warning: non-local `impl` definition, they should be avoided as they go against expectation
   --> spirit/src/lookup.rs:609:68
    |
609 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, From, IsVariant, derive_more::Display)]
    |                                                                    ^^^^^^^^^^^^^^^^^^^^
    |
    = help: move this `impl` block outside the of the current constant `_derive_more_DisplayAs_impl` and up 2 bodies
    = note: an `impl` definition is non-local if it is nested inside an item and may impact type checking outside of that item. This can be the case if neither the trait or the self type are at the same nesting level as the `impl`
    = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
    = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
    = note: the derive macro `derive_more::Display` may come from an old version of the `derive_more` crate, try updating your dependency with `cargo update -p derive_more`
    = note: this warning originates in the derive macro `derive_more::Display` (in Nightly builds, run with -Z macro-backtrace for more info)

In the message, they link to an tracking issue.

Because this is on the beta channel, this warning will soon be on by default for anyone that updates their stable Rust version. I thought I would rise the issue now, and maybe it can be addressed before you get a much of duplicate issues.

@tyranron
Copy link
Collaborator

@TylerBloom is this reproducible on 1.0.0-beta.6?

@TylerBloom
Copy link
Author

Using that, I get a compile-time panic:

proc-macro derive panicked
message: not yet implemented: https://github.com/JelteF/derive_more/issues/142

@JelteF
Copy link
Owner

JelteF commented Jul 2, 2024

Can you share codesnipped that causes this warning?

Also could you try with this PR: #377 That should solve the "not yet implemented" error.

@JelteF JelteF added the moreinfo label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants