Description
Thanks! The sentence above the example should probably be updated (
The function will only be available while running tests.
) and the function name (test_only
) should also probably be changed.I think it would also be a good idea to document this behavior somehow. AFAIK (rustc_builtin_macros), the only attributes this affects is
test
andbench
. I don't know how soon rust-lang/rust#54726 might get stabilized, but if it might be a long time, maybe a brief mention at https://github.com/rust-lang/reference/blob/master/src/attributes/testing.md#the-test-attribute that says something along the lines of: "similar to proc-macros, the#[test]
attribute only works as an [outer attribute], and cannot be used as an [inner attribute]".
Originally posted by @ehuss in #906 (comment)