Skip to content

Warnings caused by examples in libstd should fail the doc tests #18199

Closed
@crumblingstatue

Description

@crumblingstatue

Recently, an incorrect example was discovered in the libstd documentation.

In this case, the compiler gives a warning for unused results on the I/O operations.
The example should have checked these results, uncovering a bug, which is the file being opened in read-only mode when it was intended to be written to.

If warnings would fail the doc tests, this issue would have been caught automatically.

In case an example wants to explicitly allow "questionable" constructs, it can use the allow(lint) attribute.

Metadata

Metadata

Assignees

Labels

T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions