Skip to content

wrapping hidden code in doctest corrupts it #3182

Closed
@scampi

Description

@scampi

For example, the hidden line at https://github.com/rust-lang-nursery/stdsimd/blob/f244bd2a598f1542fceb1767cf62416c3d366934/stdsimd/mod.rs#L211 is wrapped over multiple lines, which fails the execution of the doctest with the following error:

--- src/../../../stdsimd/mod.rs - stdsimd::arch (line 210) stdout ----
error: incorrect close delimiter: `)`
 --> src/../../../stdsimd/mod.rs:212:8
  |
2 | #![cfg_attr(not(dox), feature(cfg_target_feature, target_feature
  |            -                 - close delimiter possibly meant for this
  |            |
  |            close delimiter possibly meant for this
3 | extern crate stdsimd;
4 | fn main() {
  |           - un-closed delimiter
5 | stdsimd))]
  |        ^ incorrect close delimiter
error: unexpected close delimiter: `}`
  --> src/../../../stdsimd/mod.rs:248:1
   |
41 | }
   | ^ unexpected close delimiter
thread 'src/../../../stdsimd/mod.rs - stdsimd::arch (line 210)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13

An issue on rustdoc is opened to follow this at rust-lang/rust#55713 but in the meantime disabling the wrap_comments parameter for doctest would be needed to avoid failing builds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-commentsbugPanic, non-idempotency, invalid code, etc.only-with-optionrequires a non-default option value to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions