Skip to content

rustdoc: Since 1.87 we permit shebangs in doctests that have a main fn #147014

@fmease

Description

@fmease

Note

This topic was already extensively discussed in #t-rustdoc/meetings > 2025-09-08 @ 💬. Verdict is still unclear, namely whether to simply accept it as an accidental feature (would need FCP after the fact with motivation) or revert (wouldn't need an FCP, might need a crater run).

Since PR #138104 (stabilized in 1.87), we accidentally permit rustdoc file.rs --test where file.rs:

//! ```
//! #!XYZ XYZ XYZ XYZ XYZ
//! fn main() {}
//! ```

Metadata

Metadata

Assignees

Labels

A-doctestsArea: Documentation tests, run by rustdocC-bugCategory: This is a bug.P-highHigh priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions