Macro zaplib::code_fragment
source · [−]macro_rules! code_fragment {
( $ code: expr ) => { ... };
}
Expand description
Tag a piece of code with filename+line+col. The line+col are done in a hacky way, exploiting the fact that rustfmt usually puts the multiline string start on a newline, with one greater indentation level. This doesn’t always work but it’s close enough!
We could at some point use something like this:
https://github.com/makepad/makepad/blob/719012b9348815acdcaec6365a99443b9208aecc/main/live_body/src/lib.rs#L47
But that depends on the nightly proc_macro_span
feature (https://github.com/rust-lang/rust/issues/54725).