Feature request: forking the compiler in write! macro, write! without trait imports, and Write trait preference

Currently the write! macro requires explicitly importing a Write trait. It'd be more practical if it forked the compiler process and just tried to compile with both io::Write and fmt::Write (in whatever libs-team-preferred order), picking the first one that succeeds. This would also allow defining an inherent write_fmt that doesn't conflict with any of the Write traits for write! purposes.

Also forking the compiler process like that is quite useful and we should do more of that.

Then a crate that uses the write! macro a lot would take forever to compile, wouldn't it?

What about platforms that don't support fork? Fuschia is one. Windows is also pretty big I hear.

3 Likes

In addition to those problems... Someone already pointed out in your other thread today that the current behavior of write! is documented and used by existing code that we cannot simply break.

Also, "the current API requires an explicit import" or "I want to give a method the same name without conflicts" are not really strong motivations for breaking stability, or for major architectural changes to the implementation.

We have talked to you many, many times about what types of proposals are useful and actionable here. We have told you very explicitly what you should be considering before making such feature requests. Please consider this a final warning.

17 Likes