servo/components/style_derive
Emilio Cobos Álvarez f27003c810 style: Teach style_derive's map_type_params about mapping self correctly.
Consider the following:

struct Complex<T> {
    something: T,
    #[compute(field_bound)]
    something_else: Generic<Self, T>,
}

That will generate:

impl<T> ToComputedValue for Complex<T>
where
    T: ToComputedValue,
    Generic<Self, T>: ToComputedValue<ComputedValue = Generic<Self, <T as ToComputedValue>::ComputedValue>>,
{
    // ...
}

That last clause is obviously incorrect. map_type_params correctly maps
the T, but it should know also about Self.

Ideally we could just do the same as for T and do:

    <Self as ToComputedValue>::ComputedValue

But that doesn't quite work, because we are in that implementation of
the trait, and the compiler rightfully complains about we don't yet
knowing the computed type. So we need to pass it explicitly, which is
simple enough, if a bit annoying.

Differential Revision: https://phabricator.services.mozilla.com/D83816
2021-02-26 16:44:05 +01:00
..
animate.rs Fix warnings introduced in newer Rust Nightly 2021-02-25 15:36:03 +01:00
Cargo.toml Bump all in-tree components to syn 1 2019-09-27 13:29:55 +02:00
compute_squared_distance.rs Fix warnings introduced in newer Rust Nightly 2021-02-25 15:36:03 +01:00
lib.rs style: Derive ToResolvedValue. 2019-04-12 12:20:09 +02:00
parse.rs Fix warnings introduced in newer Rust Nightly 2021-02-25 15:36:03 +01:00
specified_value_info.rs style: Teach style_derive's map_type_params about mapping self correctly. 2021-02-26 16:44:05 +01:00
to_animated_value.rs style: Ensure that derived types are right for optimized-away implementations. 2020-04-16 16:35:07 +02:00
to_animated_zero.rs Bump all in-tree components to syn 1 2019-09-27 13:29:55 +02:00
to_computed_value.rs style: Teach style_derive's map_type_params about mapping self correctly. 2021-02-26 16:44:05 +01:00
to_css.rs Fix warnings introduced in newer Rust Nightly 2021-02-25 15:36:03 +01:00
to_resolved_value.rs Fix warnings introduced in newer Rust Nightly 2021-02-25 15:36:03 +01:00