slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
15.9k stars 519 forks source link

Too many non-local `impl` definition for sp :: FieldOffsets in rust nightly 1.81 #5490

Closed wuanzhuan closed 4 days ago

wuanzhuan commented 4 days ago

There are too many warning when i update rust to nightly1.81(from nightly 1.75)

warning: non-local impl definition, impl blocks should be written at the same level as their item --> out\main.rs:12:17 12 # [derive (sp :: FieldOffsets , Default)] # [const_field_offset (sp :: const_field_offset)] # [repr (C)] # [pin] struct InnerEnablesData { ^----------------- ---------------- InnerEnablesData is not local
Unpin is not local

= note: the derive macro sp::FieldOffsets defines the non-local impl, and may need to be changed = note: the derive macro sp::FieldOffsets may come from an old version of the const_field_offset_macro crate, try updating your dependency with cargo update -p const_field_offset_macro = note: impl may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type = note: an impl is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the impl help: move the impl block outside of this associated constant FIELD_OFFSETS --> C:\Users\wuanz\dev\github.com\wuanzhuan\system_monitor\target\debug\build\sys_monitor-cd7b756010b34e61\out\main.rs:12:17 | 12 | # [derive (sp :: FieldOffsets , Default)] # [const_field_offset (sp :: const_field_offset)] # [repr (C)] # [pin] struct InnerEnablesData { | ^^^^^^^^^^^^^^^^^^ may need to be moved as well = 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: #[warn(non_local_definitions)] on by default = note: this warning originates in the derive macro sp::FieldOffsets (in Nightly builds, run with -Z macro-backtrace for more info)

warning: non-local impl definition, impl blocks should be written at the same level as their item --> C:\Users\wuanz\dev\github.com\wuanzhuan\system_monitor\target\debug\build\sys_monitor-cd7b756010b34e61\out\main.rs:70:17 70 # [derive (sp :: FieldOffsets , Default)] # [const_field_offset (sp :: const_field_offset)] # [repr (C)] # [pin] struct InnerEventsViewData { ^----------------- ------------------- InnerEventsViewData is not local
Unpin is not local

= note: the derive macro sp::FieldOffsets defines the non-local impl, and may need to be changed = note: the derive macro sp::FieldOffsets may come from an old version of the const_field_offset_macro crate, try updating your dependency with cargo update -p const_field_offset_macro = note: impl may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type = note: an impl is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the impl help: move the impl block outside of this associated constant FIELD_OFFSETS --> C:\Users\wuanz\dev\github.com\wuanzhuan\system_monitor\target\debug\build\sys_monitor-cd7b756010b34e61\out\main.rs:70:17 | 70 | # [derive (sp :: FieldOffsets , Default)] # [const_field_offset (sp :: const_field_offset)] # [repr (C)] # [pin] struct InnerEventsViewData { | ^^^^^^^^^^^^^^^^^^ may need to be moved as well = 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: this warning originates in the derive macro sp::FieldOffsets (in Nightly builds, run with -Z macro-backtrace for more info)

warning: non-local impl definition, impl blocks should be written at the same level as their item --> C:\Users\wuanz\dev\github.com\wuanzhuan\system_monitor\target\debug\build\sys_monitor-cd7b756010b34e61\out\main.rs:163:17 163 # [derive (sp :: FieldOffsets , Default)] # [const_field_offset (sp :: const_field_offset)] # [repr (C)] # [pin] struct InnerColorSchemeSelector_261 { ^----------------- ---------------------------- InnerColorSchemeSelector_261 is not local
Unpin is not local
= note: the derive macro `sp::FieldOffsets` defines the non-local `impl`, and may need to be changed
= note: the derive macro `sp::FieldOffsets` may come from an old version of the `const_field_offset_macro` crate, try updating your dependency with `cargo update -p const_field_offset_macro`
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`

help: move the impl block outside of this associated constant FIELD_OFFSETS --> C:\Users\wuanz\dev\github.com\wuanzhuan\system_monitor\target\debug\build\sys_monitor-cd7b756010b34e61\out\main.rs:163:17 | 163 | # [derive (sp :: FieldOffsets , Default)] # [const_field_offset (sp :: const_field_offset)] # [repr (C)] # [pin] struct InnerColorSchemeSelector_261 { | ^^^^^^^^^^^^^^^^^^ may need to be moved as well = 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: this warning originates in the derive macro sp::FieldOffsets (in Nightly builds, run with -Z macro-backtrace for more info)

ogoffart commented 4 days ago

Thanks for filling an issue.

What version of Slint are you using? I believe this is already fixed in the master branch.

wuanzhuan commented 4 days ago

slint version is 1.6

ogoffart commented 4 days ago

Actually, the warning comes from the const-field-offset crate, and it should have been fixed in the 0.5.1 version of it in commit aa7360a91a622b2eb17181f6b963271b7646545f Can you try to run cargo update and see if that helps?

wuanzhuan commented 4 days ago

Have already been solved after cargo update. thanks

ogoffart commented 4 days ago

(I believe all the warning were fixed as part of #4706 , so now i updated the Cargo.toml to make sure an old version can't be used)