Skip to content

regression: hard error on #[test] attribute on non-associated function #94508

Description

@Mark-Simulacrum

Crater picked up this issue in a number of crates:

[INFO] [stdout] 
[INFO] [stdout] error: the `#[test]` attribute may only be used on a non-associated function
[INFO] [stdout]    --> src/toxcore/dht_node.rs:947:5
[INFO] [stdout]     |
[INFO] [stdout] 947 |       #[test]
[INFO] [stdout]     |       ^^^^^^^
[INFO] [stdout] 948 | /     quickcheck! {
[INFO] [stdout] 949 | |         fn dht_node_send_nodes(pns: Vec<PackedNode>) -> TestResult {
[INFO] [stdout] 950 | |             if pns.is_empty() { return TestResult::discard() }
[INFO] [stdout] 951 | |
[INFO] [stdout] ...   |
[INFO] [stdout] 984 | |         }
[INFO] [stdout] 985 | |     }
[INFO] [stdout]     | |_____- expected a non-associated function, found an item macro invocation
[INFO] [stdout]     |
[INFO] [stdout]     = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions
[INFO] [stdout] help: replace with conditional compilation to make the item only exist when tests are being run
[INFO] [stdout]     |
[INFO] [stdout] 947 |     #[cfg(test)]
[INFO] [stdout]     |

cc @estebank - #92959 seems like the likely cause

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions