Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Mark-Simulacrum opened this issue Mar 1, 2022 · 2 comments
Closed
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

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

@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Mar 1, 2022
@Mark-Simulacrum Mark-Simulacrum added this to the 1.60.0 milestone Mar 1, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 1, 2022
@estebank
Copy link
Contributor

estebank commented Mar 2, 2022

Ah, didn't realize that we changed from a warning to an error in that PR. It wouldn't need to be reverted, but we need to add a check for if let ast::ItemKind::MacCall(_) = item.kind { to create a warn instead of an error.

estebank added a commit to estebank/rust that referenced this issue Mar 4, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Mar 5, 2022
Downgrade `#[test]` on macro call to warning

Follow up to rust-lang#92959. Address rust-lang#94508.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Mar 5, 2022
Downgrade `#[test]` on macro call to warning

Follow up to rust-lang#92959. Address rust-lang#94508.
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 10, 2022
Mark-Simulacrum pushed a commit to Mark-Simulacrum/rust that referenced this issue Mar 14, 2022
@Mark-Simulacrum
Copy link
Member Author

Fixed by #94933 on beta and #94624 on nightly, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants