Stream: t-compiler

Topic: -Ztreat-err-as-bug off by one issue


Santiago Pastorino (Apr 24 2020 at 19:14, on Zulip):

Meanwhile I was working on #71488, I've found a problem with -Ztreat-err-as-bug

Santiago Pastorino (Apr 24 2020 at 19:15, on Zulip):

we were looking briefly with @eddyb and found an off by one issue in delay_span_bug

Santiago Pastorino (Apr 24 2020 at 19:15, on Zulip):

opened #71489

Santiago Pastorino (Apr 24 2020 at 19:16, on Zulip):

I'm not proud of the code, maybe this needs a little better refactor because there are places where the count is incremented afterwards and other places when it's incremented beforehand

Santiago Pastorino (Apr 24 2020 at 19:17, on Zulip):

@LeSeulArtichaut maybe this problem is related to what you were saying here?

Santiago Pastorino (Apr 24 2020 at 19:18, on Zulip):

also -Ztreat-err-as-bug is undertested so I'm pretty sure that there are more bugs :)

Esteban Küber (Apr 27 2020 at 17:58, on Zulip):

I'm not surprised, treat-err-as-bug had originally only a "panic when encountering error" strategy, and teaching it to accept a number was a hack that I hastily added in order to debug something else entirely :)

Santiago Pastorino (Apr 27 2020 at 18:43, on Zulip):

@Esteban Küber I have the feeling that we have this kind of issues in more places, I guess would be nice to add tests and then try to fix it and maybe even refactor the code a bit :)

Santiago Pastorino (Apr 27 2020 at 18:43, on Zulip):

any pointers on ideas you have or something are welcome, I have no idea about the code base but I may have time to take a look at it

Esteban Küber (Apr 27 2020 at 18:44, on Zulip):

The reason it's not as thoroughly tested is because we're the only ones using it

Esteban Küber (Apr 27 2020 at 18:44, on Zulip):

And delay_span_bug is also kind of a hack

Santiago Pastorino (Apr 27 2020 at 18:44, on Zulip):

who is we? :P

Esteban Küber (Apr 27 2020 at 18:44, on Zulip):

We could keep two different counts

Esteban Küber (Apr 27 2020 at 18:44, on Zulip):

People hacking on rustc

Santiago Pastorino (Apr 27 2020 at 18:44, on Zulip):

ahh right

Santiago Pastorino (Apr 27 2020 at 18:45, on Zulip):

right now seems to be that increasing the err count is some times done after emitting and in other places it's done before

Santiago Pastorino (Apr 27 2020 at 18:46, on Zulip):

I guess we may refactor the code to be more sure that we always emit and increment or vice-versa but always in the same order

Esteban Küber (Apr 27 2020 at 18:49, on Zulip):

Probably low prio but useful to do

Santiago Pastorino (Apr 27 2020 at 18:51, on Zulip):

yep :)

Last update: May 29 2020 at 18:05UTC