You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ehuss opened this issue
Sep 7, 2020
· 1 comment
· Fixed by #76642
Assignees
Labels
A-lintArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
I expected to see this happen: No warning for the given code block.
Instead, this happened: Warning appears for the given code block.
warning: documentation test in private item
--> src/lib.rs:4:5
|
4 | / /// private doc test
5 | | ///
6 | | /// ```
7 | | /// assert!(false);
8 | | /// ```
| |___________^
|
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![warn(private_doc_tests)]
| ^^^^^^^^^^^^^^^^^
As it is, I don't see a way to include a rust-highlighted code block with this lint. It is not uncommon to have sample code that is not intended to be tested, or even pseudo-code that you want highlighted, like this:
/// struct Struct<'a, ..., 'z, A, B: DeclaredTrait, C, ..., Z> where C: WhereTrait {
/// a: A,
/// b: B::Item,
/// b1: <B as DeclaredTrait>::Item,
/// c1: <C as WhereTrait>::Item,
/// c2: Option<<C as WhereTrait>::Item>,
/// ...
/// }
/// ```
It would be nice to have some way to make the lint not fire, but still get rust syntax highlighting. ignore seems like the first choice I would make, though I guess there could be other options.
Meta
rustdoc 1.48.0-nightly (c59199efc 2020-09-04)
The text was updated successfully, but these errors were encountered:
jyn514
added
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
labels
Sep 8, 2020
A-lintArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: No warning for the given code block.
Instead, this happened: Warning appears for the given code block.
As it is, I don't see a way to include a rust-highlighted code block with this lint. It is not uncommon to have sample code that is not intended to be tested, or even pseudo-code that you want highlighted, like this:
rust/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Lines 490 to 499 in 9fe551a
It would be nice to have some way to make the lint not fire, but still get rust syntax highlighting.
ignore
seems like the first choice I would make, though I guess there could be other options.Meta
rustdoc 1.48.0-nightly (c59199efc 2020-09-04)
The text was updated successfully, but these errors were encountered: