Closed Bug 1653339 Opened 4 years ago Closed 4 years ago

Teach map_type_params to handle Self correctly.

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox-esr78 --- fixed
firefox80 --- fixed

People

(Reporter: emilio, Assigned: emilio)

Details

Attachments

(1 file)

No description provided.

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.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/da77d5528a08
Teach style_derive's map_type_params about mapping self correctly. r=boris
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80

Comment on attachment 9164088 [details]
Bug 1653339 - Teach style_derive's map_type_params about mapping self correctly. r=boris,#style

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Build fix for new rust compiler versions
  • User impact if declined: none
  • Fix Landed on Version: 80
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Build-only code change
  • String or UUID changes made by this patch: none
Attachment #9164088 - Flags: approval-mozilla-esr78?

Comment on attachment 9164088 [details]
Bug 1653339 - Teach style_derive's map_type_params about mapping self correctly. r=boris,#style

approved for 78.4esr

Attachment #9164088 - Flags: approval-mozilla-esr78? → approval-mozilla-esr78+

Re comment 5, it applied fine after the one patch from bug 1643201.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: