by Animats · 3y ago · 0 comments
* invokes local_type_id to get the memory address of your value’s static implementation of local_type_id
* maps that memory address to an offset in your application’s binary
* searches your application’s debug info for the entry describing the function at that offset
* parses that debugging information entry (DIE) to determine the type of local_type_id’s &self parameter.
This is a rather strange thing to bolt onto a language. I could see this as an external tool. The use case seems to be programs which used "async" so much they can't figure out the resulting state machine. External debug tools to view and examine the async state machine might be helpful.
My experience with Rust has been that debugging of safe code is just not a problem. Print statements and logging are enough.
It is an external tool. This is a crate, not a part of the compiler.
This seems like a valuable library. It’s impressive that it can be so powerful in a compiled language. C and C++ are much older but don’t have anything quite like this.
It can just be an extremely fun and cute demo, without practical application.
I don't have the context to judge the probability of that in this specific case (lots of technical nitty-gritty comes in to this sort of thing), but I've certainly seen similar things happen in other communities.
You can already script gdb to provide rich views of any data structure.