servo/components/derive_common
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
..
Cargo.toml Bump all in-tree components to syn 1 2019-09-27 13:29:55 +02:00
cg.rs style: Teach style_derive's map_type_params about mapping self correctly. 2021-02-26 16:44:05 +01:00
lib.rs Remove an unused extern crate. 2019-04-12 12:20:16 +02:00