Closed Bug 1894142 Opened 6 months ago Closed 6 months ago

[rustc 1.79] error: non-local `impl` definition, they should be avoided as they go against expectation

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(2 files)

[task 2024-04-30T00:31:00.014Z] 00:31:00    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation
[task 2024-04-30T00:31:00.014Z] 00:31:00     INFO -    --> servo/components/style/queries/values.rs:13:30
[task 2024-04-30T00:31:00.014Z] 00:31:00     INFO -     |
[task 2024-04-30T00:31:00.015Z] 00:31:00     INFO -  13 | #[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
[task 2024-04-30T00:31:00.015Z] 00:31:00     INFO -     |                              ^^^^^^^^^^^^^
[task 2024-04-30T00:31:00.015Z] 00:31:00     INFO -     |
[task 2024-04-30T00:31:00.016Z] 00:31:00     INFO -     = help: move this `impl` block outside the of the current constant `_IMPL_NUM_FromPrimitive_FOR_Orientation`
[task 2024-04-30T00:31:00.016Z] 00:31:00     INFO -     = 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`
[task 2024-04-30T00:31:00.017Z] 00:31:00     INFO -     = 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
[task 2024-04-30T00:31:00.017Z] 00:31:00     INFO -     = 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>
[task 2024-04-30T00:31:00.018Z] 00:31:00     INFO -     = note: the derive macro `FromPrimitive` may come from an old version of the `num_derive` crate, try updating your dependency with `cargo update -p num_derive`
[task 2024-04-30T00:31:00.018Z] 00:31:00     INFO -     = note: `-D non-local-definitions` implied by `-D warnings`
[task 2024-04-30T00:31:00.018Z] 00:31:00     INFO -     = help: to override `-D warnings` add `#[allow(non_local_definitions)]`
[task 2024-04-30T00:31:00.019Z] 00:31:00     INFO -     = note: this error originates in the derive macro `FromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)
[task 2024-04-30T00:31:00.019Z] 00:31:00    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation
[task 2024-04-30T00:31:00.019Z] 00:31:00     INFO -     --> servo/components/style/stylesheets/mod.rs:336:34
[task 2024-04-30T00:31:00.020Z] 00:31:00     INFO -      |
[task 2024-04-30T00:31:00.020Z] 00:31:00     INFO -  336 | #[derive(Clone, Copy, Debug, Eq, FromPrimitive, PartialEq)]
[task 2024-04-30T00:31:00.020Z] 00:31:00     INFO -      |                                  ^^^^^^^^^^^^^
[task 2024-04-30T00:31:00.020Z] 00:31:00     INFO -      |
[task 2024-04-30T00:31:00.021Z] 00:31:00     INFO -      = help: move this `impl` block outside the of the current constant `_IMPL_NUM_FromPrimitive_FOR_CssRuleType`
[task 2024-04-30T00:31:00.021Z] 00:31:00     INFO -      = 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`
[task 2024-04-30T00:31:00.022Z] 00:31:00     INFO -      = 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
[task 2024-04-30T00:31:00.022Z] 00:31:00     INFO -      = 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>
[task 2024-04-30T00:31:00.023Z] 00:31:00     INFO -      = note: the derive macro `FromPrimitive` may come from an old version of the `num_derive` crate, try updating your dependency with `cargo update -p num_derive`
[task 2024-04-30T00:31:00.023Z] 00:31:00     INFO -      = note: this error originates in the derive macro `FromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)
[task 2024-04-30T00:31:00.023Z] 00:31:00    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation
[task 2024-04-30T00:31:00.024Z] 00:31:00     INFO -    --> servo/components/style/values/computed/box.rs:68:5
[task 2024-04-30T00:31:00.024Z] 00:31:00     INFO -     |
[task 2024-04-30T00:31:00.024Z] 00:31:00     INFO -  68 |     FromPrimitive,
[task 2024-04-30T00:31:00.024Z] 00:31:00     INFO -     |     ^^^^^^^^^^^^^
[task 2024-04-30T00:31:00.025Z] 00:31:00     INFO -     |
[task 2024-04-30T00:31:00.025Z] 00:31:00     INFO -     = help: move this `impl` block outside the of the current constant `_IMPL_NUM_FromPrimitive_FOR_Float`
[task 2024-04-30T00:31:00.026Z] 00:31:00     INFO -     = 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`
[task 2024-04-30T00:31:00.026Z] 00:31:00     INFO -     = 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
[task 2024-04-30T00:31:00.027Z] 00:31:00     INFO -     = 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>
[task 2024-04-30T00:31:00.027Z] 00:31:00     INFO -     = note: the derive macro `FromPrimitive` may come from an old version of the `num_derive` crate, try updating your dependency with `cargo update -p num_derive`
[task 2024-04-30T00:31:00.028Z] 00:31:00     INFO -     = note: this error originates in the derive macro `FromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)
[task 2024-04-30T00:31:00.028Z] 00:31:00    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation

etc.

Also:

[task 2024-04-30T01:38:11.019Z] 01:38:11    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -     --> servo/components/style/values/specified/image.rs:558:9
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -  558 | /         impl LineDirection {
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -  559 | |             fn from_points(first: Point, second: Point) -> Self {
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -  560 | |                 let h_ord = first.horizontal.partial_cmp(&second.horizontal);
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -  561 | |                 let v_ord = first.vertical.partial_cmp(&second.vertical);
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -  ...   |
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -  582 | |             }
[task 2024-04-30T01:38:11.020Z] 01:38:11     INFO -  583 | |         }
[task 2024-04-30T01:38:11.021Z] 01:38:11     INFO -      | |_________^
[task 2024-04-30T01:38:11.021Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.021Z] 01:38:11     INFO -      = help: move this `impl` block outside the of the current associated function `parse_webkit_gradient_argument`
[task 2024-04-30T01:38:11.021Z] 01:38:11     INFO -      = 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`
[task 2024-04-30T01:38:11.021Z] 01:38:11     INFO -      = 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
[task 2024-04-30T01:38:11.021Z] 01:38:11     INFO -      = 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>
[task 2024-04-30T01:38:11.022Z] 01:38:11     INFO -      = note: `-D non-local-definitions` implied by `-D warnings`
[task 2024-04-30T01:38:11.022Z] 01:38:11     INFO -      = help: to override `-D warnings` add `#[allow(non_local_definitions)]`
[task 2024-04-30T01:38:11.022Z] 01:38:11    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation
[task 2024-04-30T01:38:11.022Z] 01:38:11     INFO -     --> servo/components/style/values/specified/image.rs:585:9
[task 2024-04-30T01:38:11.022Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.022Z] 01:38:11     INFO -  585 | /         impl From<Point> for Position {
[task 2024-04-30T01:38:11.022Z] 01:38:11     INFO -  586 | |             fn from(point: Point) -> Self {
[task 2024-04-30T01:38:11.023Z] 01:38:11     INFO -  587 | |                 Self::new(point.horizontal.into(), point.vertical.into())
[task 2024-04-30T01:38:11.023Z] 01:38:11     INFO -  588 | |             }
[task 2024-04-30T01:38:11.023Z] 01:38:11     INFO -  589 | |         }
[task 2024-04-30T01:38:11.023Z] 01:38:11     INFO -      | |_________^
[task 2024-04-30T01:38:11.023Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.023Z] 01:38:11     INFO -      = help: move this `impl` block outside the of the current associated function `parse_webkit_gradient_argument`
[task 2024-04-30T01:38:11.023Z] 01:38:11     INFO -      = 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`
[task 2024-04-30T01:38:11.024Z] 01:38:11     INFO -      = 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
[task 2024-04-30T01:38:11.024Z] 01:38:11     INFO -      = 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>
[task 2024-04-30T01:38:11.024Z] 01:38:11    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation
[task 2024-04-30T01:38:11.024Z] 01:38:11     INFO -     --> servo/components/style/values/specified/image.rs:605:9
[task 2024-04-30T01:38:11.024Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.025Z] 01:38:11     INFO -  605 | /         impl<S: Side> From<Component<S>> for NumberOrPercentage {
[task 2024-04-30T01:38:11.025Z] 01:38:11     INFO -  606 | |             fn from(component: Component<S>) -> Self {
[task 2024-04-30T01:38:11.025Z] 01:38:11     INFO -  607 | |                 match component {
[task 2024-04-30T01:38:11.025Z] 01:38:11     INFO -  608 | |                     Component::Center => NumberOrPercentage::Percentage(Percentage::new(0.5)),
[task 2024-04-30T01:38:11.025Z] 01:38:11     INFO -  ...   |
[task 2024-04-30T01:38:11.025Z] 01:38:11     INFO -  619 | |             }
[task 2024-04-30T01:38:11.025Z] 01:38:11     INFO -  620 | |         }
[task 2024-04-30T01:38:11.026Z] 01:38:11     INFO -      | |_________^
[task 2024-04-30T01:38:11.026Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.026Z] 01:38:11     INFO -      = help: move this `impl` block outside the of the current associated function `parse_webkit_gradient_argument`
[task 2024-04-30T01:38:11.026Z] 01:38:11     INFO -      = 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`
[task 2024-04-30T01:38:11.026Z] 01:38:11     INFO -      = 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
[task 2024-04-30T01:38:11.027Z] 01:38:11     INFO -      = 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>
[task 2024-04-30T01:38:11.027Z] 01:38:11    ERROR -  error: non-local `impl` definition, they should be avoided as they go against expectation
[task 2024-04-30T01:38:11.027Z] 01:38:11     INFO -     --> servo/components/style/values/specified/image.rs:622:9
[task 2024-04-30T01:38:11.027Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.027Z] 01:38:11     INFO -  622 | /         impl<S: Side> From<Component<S>> for PositionComponent<S> {
[task 2024-04-30T01:38:11.027Z] 01:38:11     INFO -  623 | |             fn from(component: Component<S>) -> Self {
[task 2024-04-30T01:38:11.027Z] 01:38:11     INFO -  624 | |                 match component {
[task 2024-04-30T01:38:11.028Z] 01:38:11     INFO -  625 | |                     Component::Center => PositionComponent::Center,
[task 2024-04-30T01:38:11.028Z] 01:38:11     INFO -  ...   |
[task 2024-04-30T01:38:11.028Z] 01:38:11     INFO -  634 | |             }
[task 2024-04-30T01:38:11.028Z] 01:38:11     INFO -  635 | |         }
[task 2024-04-30T01:38:11.028Z] 01:38:11     INFO -      | |_________^
[task 2024-04-30T01:38:11.028Z] 01:38:11     INFO -      |
[task 2024-04-30T01:38:11.028Z] 01:38:11     INFO -      = help: move this `impl` block outside the of the current associated function `parse_webkit_gradient_argument`
[task 2024-04-30T01:38:11.029Z] 01:38:11     INFO -      = 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`
[task 2024-04-30T01:38:11.029Z] 01:38:11     INFO -      = 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
[task 2024-04-30T01:38:11.029Z] 01:38:11     INFO -      = 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>
[task 2024-04-30T01:38:11.029Z] 01:38:11    ERROR -  error: could not compile `style` (lib) due to 4 previous errors

Two of those are false positives: https://github.com/rust-lang/rust/issues/124396#issuecomment-2084119812

Severity: -- → S3

Rustc 1.79 warns about them (which --enable-warnings-as-errors turns
into errors).

Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/c8f422b2bb5a Upgrade num-derive to 0.4.2. r=emilio,supply-chain-reviewers https://hg.mozilla.org/integration/autoland/rev/6d2d7ba3649f Avoid non-local impls in the style crate. r=emilio
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: