News for hackers. Stuff that matters.
Re:Rust Weird Expressions by Tuna-Fish on Friday May 14, 2021 @03:29PM (#27158707)
> whichever_compiles!, a joke macro that takes multiple expressions, forks the compiler (as in a fork syscall), and compiles the first one that compiles to valid rust.

This is inspired.

Re:Rust Weird Expressions by iudqnolq on Friday May 14, 2021 @03:50PM (#27158951)
It's definitely worth reading the full thread if you haven't

> Did you know you can just fork() the @rustlang compiler from your proc_macro? :D

> This is, of course, a horrible idea.

> Unfortunately rustc is multithreaded and fork() only forks one thread. We'll just assume the other threads weren't doing anything important.

> In today's rustc, this means we're only missing the main thread in the fork. But that one was only going to call exit() after joining our thread anyway, so not very important. It just means the process always exits with a success status. So instead we grep the output for "error".

Any my favorite reply:

> Is this a rust implementation of autoconf?

https://mobile.twitter.com/m_ou_se/status/136863270144881869...