Stream: t-compiler

Topic: checking divergence flag in coercion


Florian Diebold (May 08 2020 at 15:02, on Zulip):

there's this comment in demand.rs:

    // N.B., this code relies on `self.diverges` to be accurate. In
    // particular, assignments to `!` will be permitted if the
    // diverges flag is currently "always".

is that actually still true? I couldn't find any reference to diverges in the coercion code, but maybe I'm just missing it

nikomatsakis (May 08 2020 at 15:09, on Zulip):

hmm

nikomatsakis (May 08 2020 at 15:09, on Zulip):

I remember adding that flag

nikomatsakis (May 08 2020 at 15:09, on Zulip):

but I could imagine it became outdated

nikomatsakis (May 08 2020 at 15:10, on Zulip):

I feel like we may have opted against the approach we were trying there

nikomatsakis (May 08 2020 at 15:10, on Zulip):

sigh, the long and tortured history of !

Florian Diebold (May 08 2020 at 15:40, on Zulip):

I mean, the flag is being checked elsewhere -- check_block_with_expected handles it. So maybe that's where those cases are handled now

nikomatsakis (May 08 2020 at 15:40, on Zulip):

hmm

nikomatsakis (May 08 2020 at 15:40, on Zulip):

that sounds right

nikomatsakis (May 08 2020 at 15:41, on Zulip):

sorry, I've not had a sec to grep the codebase myself

nikomatsakis (May 08 2020 at 15:41, on Zulip):

I do remember there being some logic like "if the block diverges, then we ignore the type of the tail expression, but else we don't"

nikomatsakis (May 08 2020 at 15:41, on Zulip):

in order to accommodate

{ panic!(); }

and not give type errors

nikomatsakis (May 08 2020 at 15:42, on Zulip):

or at least, if the block diverges and has an implicit () tail

Florian Diebold (May 08 2020 at 15:42, on Zulip):

yeah, that's in check_block_with_expected

nikomatsakis (May 08 2020 at 15:42, on Zulip):

I believe this is what the comment was referring to

nikomatsakis (May 08 2020 at 15:42, on Zulip):

I think we used to maybe have more general logic there

Florian Diebold (May 08 2020 at 15:42, on Zulip):

I was just worried I was missing some edge case ;)

nikomatsakis (May 08 2020 at 15:42, on Zulip):

er, sorry

nikomatsakis (May 08 2020 at 15:43, on Zulip):

I believe the comment may have been referring to some older logic that I stripped down

nikomatsakis (May 08 2020 at 15:43, on Zulip):

I could do a bit of digging to find the issues where we dug into this... but I won't unels you really need it

Florian Diebold (May 08 2020 at 15:44, on Zulip):

I think that won't be necessary :)

Last update: May 29 2020 at 17:35UTC