Skip to content

Rustdoc should emit a warning if a main function is surrounded by non-items in a doctest #140310

@GuillaumeGomez

Description

@GuillaumeGomez

For example:

//! ```
//! let x = 12;
//!
//! fn main() {
//!     // this code is never run
//! }
//! ```

In this case, the main function will be wrapped into another main function and won't be run. We should warn about it.

Metadata

Metadata

Labels

A-doctestsArea: Documentation tests, run by rustdocA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions