Stream: t-compiler/help

Topic: specialization RFC


Sunjay Varma (May 04 2019 at 01:23, on Zulip):

Hi, I'm reading the specialization RFC and I'm wondering if anyone could explain this paragraph:

One nice thing about this approach is that, if there is an overlap without there being an intersecting impl, the compiler can tell the programmer precisely which impl needs to be written to disambiguate the overlapping portion.

Sunjay Varma (May 04 2019 at 01:25, on Zulip):

I'm not sure what case this is referring to. I don't see how the compiler would generally be able to decide which impl needs to be written. Would it just take whatever the intersecting impl should be? I think I might be misunderstanding what this paragraph is trying to say

nikomatsakis (May 13 2019 at 17:44, on Zulip):

@Sunjay Varma

Imagine

impl<T: Clone> Foo for T { }
impl<T: Send> Foo for T { }

here the compiler could suggest adding the following

impl<T: Clone + Send> Foo for T { }
nikomatsakis (May 13 2019 at 17:44, on Zulip):

this is what the text is referring to, anyway

Sunjay Varma (May 13 2019 at 17:56, on Zulip):

Thanks! I thought this message got lost in all the activity :sweat_smile:

Last update: Nov 11 2019 at 22:05UTC