Both --test and now rustpkg apply a type of syntax extension that is different from those in ext. These apply some global transformations, including replacing main, so they aren't applied by default. The test extension is actually a compiler pass that runs on all input, but it only does anything when in the test configuration--cfg test (indirectly by --test). rustpkg is similar but driven by the rustpkg command. I imagine there will be others.
Both
--testand nowrustpkgapply a type of syntax extension that is different from those inext. These apply some global transformations, including replacingmain, so they aren't applied by default. The test extension is actually a compiler pass that runs on all input, but it only does anything when in thetestconfiguration--cfg test(indirectly by--test).rustpkgis similar but driven by therustpkgcommand. I imagine there will be others.