shadow!() { /* proc-macro */ }Expand description
Declares the two faces of every chosen synchronization name, once, where the declaration stands.
The body declares the physical Loom path and a comma-separated choice of names from the compiler’s stated shadow roster.
Each chosen name expands to exactly the pair its author would have written by hand: the ordinary face behind #[cfg(not(loom))] over the standard-library path, and the shadowed face behind #[cfg(loom)] over the shadow path.
Write the declaration once in a module of the production crate and import through that module everywhere; the crate’s one remaining act is its own [target.'cfg(loom)'.dependencies] row, declared where it is used.
A name outside the roster, a malformed choice, and an empty declaration expand to compile_error! at the offending token, carrying the compiler’s own rendering of the established cause.