Skip to content

Rust track submission fails when solution contains a doctest #202

Description

@jesper-olsen

I found that adding a doctest to my Rust exercise solution causes the submission
to fail on the website, even though all tests pass locally.

Steps to reproduce:

  1. Submit a solution containing a normal implementation plus a Rust doc example:
use std::fmt::Write;

/// # Examples
///
/// ```
/// let words = vec!["nail", "shoe", "horse"];
/// let expected = "For want of a nail the shoe was lost.\n\
///                 For want of a shoe the horse was lost.\n\
///                 And all for the want of a nail.";
///
/// assert_eq!(build_proverb(&words), expected);
/// ```
pub fn build_proverb(list: &[&str]) -> String {
    let mut s = String::new();
    if !list.is_empty() {
        for win in list.windows(2) {
            writeln!(s, "For want of a {} the {} was lost.", win[0], win[1]).unwrap();
        }
        write!(s, "And all for the want of a {}.", list[0]).unwrap();
    }
    s
}
  1. Run locally:
cargo test -- --ignored

All tests pass.

  1. Submit via Exercism CLI.

The submission completes, but the website reports:

An error occurred We received the following error when we ran your code: test event misparse at idx 20: unknown variant report, expected test or suite at line 21 column 18

Removing the doctest makes the submission succeed.

Environment:

rustc 1.97.1 (8bab26f4f 2026-07-14)
cargo 1.97.1 (c980f4866 2026-06-30)

It appears that doctests produce a test event that the Exercism runner/parser does not handle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions