-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Ignore non_local_definitions false positive in macro-generated impls #28
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rust-lang/rust#121621 warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:11:5 | 11 | clone_trait_object!(Trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_plain` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = 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 <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: `#[warn(non_local_definitions)]` on by default = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:11:5 | 11 | clone_trait_object!(Trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_plain` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = 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 <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:23:5 | 23 | clone_trait_object!(<T> Trait<T>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_type_parameter` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = 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 <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:32:5 | 32 | clone_trait_object!(<T: PartialEq<T>, U> Trait<T, U>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_generic_bound` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = 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 <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:45:5 | 45 | clone_trait_object!(<T> Trait<T> where T: Clone); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_where_clause` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = 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 <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/macros.rs:54:5 | 54 | clone_trait_object!(<'a> Trait<'a>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: move this `impl` block outside the of the current function `test_lifetime` = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = 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 <rust-lang/rust#120363> = note: the macro `$crate::__internal_clone_trait_object` may come from an old version of the `dyn_clone` crate, try updating your dependency with `cargo update -p dyn_clone` = note: this warning originates in the macro `$crate::__internal_clone_trait_object` which comes from the expansion of the macro `clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These impls are for
Box<dyn Trait>
, wheredyn Trait
would typically be local.Box
is #[fundamental] yet the lint is still triggered.Upstream issue: rust-lang/rust#121621