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

missing-docs lint reports on #[test] macro #130216

Closed
Nemo157 opened this issue Sep 11, 2024 · 2 comments · Fixed by #130219
Closed

missing-docs lint reports on #[test] macro #130216

Nemo157 opened this issue Sep 11, 2024 · 2 comments · Fixed by #130219
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Sep 11, 2024

I tried this code:

#![deny(missing_docs)]

//! Docs

#[test]
fn foo() {}

I expected to see this happen: no errors

Instead, this happened:

> cargo check --all-targets
error: missing documentation for a constant
 --> src/lib.rs:6:1
  |
5 | #[test]
  | ------- in this procedural macro expansion
6 | fn foo() {}
  | ^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/lib.rs:1:9
  |
1 | #![deny(missing_docs)]
  |         ^^^^^^^^^^^^
  = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (0ee7cb5e3 2024-09-10)
binary: rustc
commit-hash: 0ee7cb5e3633502d9a90a85c3c367eccd59a0aba
commit-date: 2024-09-10
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Very likely to be #130025 related

@Nemo157 Nemo157 added the C-bug Category: This is a bug. label Sep 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 11, 2024
@Nemo157
Copy link
Member Author

Nemo157 commented Sep 11, 2024

Looks like a1a8627 (#130025) allowed missing docs on the generated main function, but didn't test having any actual #[test]s.

cc @Urgau

@ogoffart
Copy link
Contributor

Attempt fix in #130219

@ChrisDenton ChrisDenton linked a pull request Sep 11, 2024 that will close this issue
@saethlin saethlin added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants