diff options
| author | Olivier Goffart <olivier.goffart@slint.dev> | 2024-09-11 10:35:02 +0200 |
|---|---|---|
| committer | Olivier Goffart <olivier.goffart@slint.dev> | 2024-09-11 11:33:10 +0200 |
| commit | 6eddbb704ee4d80f18e6359c027e9f249ad2a7ae (patch) | |
| tree | 81bd4ec5f356c23a7e9b0519c5c7e42fc3f5e077 /compiler/rustc_builtin_macros/src | |
| parent | 4c5fc2c334f1cc305eea79ed0b8fdb276342d101 (diff) | |
| download | rust-6eddbb704ee4d80f18e6359c027e9f249ad2a7ae.tar.gz rust-6eddbb704ee4d80f18e6359c027e9f249ad2a7ae.zip | |
Fix false positive with `missing_docs` and `#[test]`
Since #130025, the compiler don't ignore missing_docs when compiling the tests.
But there is now a false positive warning for every `#[test]`
For example, this code
```rust
//! Crate docs
fn just_a_test() {}
```
Would emit this warning when running `cargo test`
```
warning: missing documentation for a constant
--> src/lib.rs:5:1
|
4 | #[test]
| ------- in this procedural macro expansion
5 | fn just_a_test() {}
| ^^^^^^^^^^^^^^^^^^^
```
Diffstat (limited to 'compiler/rustc_builtin_macros/src')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/test.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index 1b76a5f3234..ab3517d3627 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -277,6 +277,8 @@ pub(crate) fn expand_test_or_bench( cx.attr_nested_word(sym::cfg, sym::test, attr_sp), // #[rustc_test_marker = "test_case_sort_key"] cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp), + // #[allow(missing_docs)] + cx.attr_nested_word(sym::allow, sym::missing_docs, attr_sp), ], // const $ident: test::TestDescAndFn = ast::ItemKind::Const( |
