Skip to content

Document test restriction in placement #908

Open
@Havvy

Description

@Havvy

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 and bench. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions