Stream: t-compiler/rust-analyzer

Topic: panic_context


Florian Diebold (Oct 23 2020 at 13:14, on Zulip):

I was looking for examples of panic_context usage and found https://github.com/rust-analyzer/rust-analyzer/blob/81609960fa30ea92e37b23dc7b025d1939626812/crates/rust-analyzer/src/dispatch.rs#L37 and https://github.com/rust-analyzer/rust-analyzer/blob/81609960fa30ea92e37b23dc7b025d1939626812/crates/rust-analyzer/src/dispatch.rs#L163. Aren't these dropping the context immediately again?

matklad (Oct 23 2020 at 13:16, on Zulip):

Oups, good catch.

matklad (Oct 23 2020 at 13:16, on Zulip):

I definitelly tried this out and saw it working

matklad (Oct 23 2020 at 13:16, on Zulip):

So maybe I was running different code?

Florian Diebold (Oct 23 2020 at 13:16, on Zulip):

there's one in between that holds on to it

matklad (Oct 23 2020 at 13:19, on Zulip):

What a beautiful footgun: I've annotated PanicContext with #[must_use], but was returning it as impl Drop

matklad (Oct 23 2020 at 13:20, on Zulip):

#6335

Last update: Jul 27 2021 at 20:30UTC