Stream: t-compiler

Topic: intercepting errors temporarily

nagisa (Jun 29 2019 at 11:49, on Zulip):

Is there a way to execute a certain function in some context that converts errors to Result or something? Hopefully it would not output anything to stdout/err either.

simulacrum (Jun 29 2019 at 12:56, on Zulip):

@nagisa I would look at compare mode for NLL transition

nagisa (Jun 29 2019 at 13:31, on Zulip):

It appears that compare mode simply passes through a flag which enables/disables error reporting – something I want to avoid doing as that would involve threading such information across entire trait machinery for an external project.

nagisa (Jul 04 2019 at 11:16, on Zulip):

cc @eddyb @pnkfelix any solutions that do not involve passing a flag through the call stack?

pnkfelix (Jul 04 2019 at 11:18, on Zulip):

I don't see how you can avoid threading something through to represent the interceptor itself. Unless you wanted to put an interceptor into thread-local storage or something?

nagisa (Jul 04 2019 at 12:36, on Zulip):

well I was thinking more something like this:

let result: Result<_, _> = diagnostics::catch_errors(|| {

which could work if we’re representing errors as panics (it could also change some state in diagnostics code or something)

oli (Jul 07 2019 at 19:57, on Zulip):

You could overwrite the error emitter with one that just stores the error and reinstate the previous emitter afterwards

oli (Jul 07 2019 at 19:57, on Zulip):

Though the error counter will still increase I think

Last update: Jan 24 2020 at 02:05UTC