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:
- 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
}
- Run locally:
All tests pass.
- 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.
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:
All tests pass.
The submission completes, but the website reports:
Removing the doctest makes the submission succeed.
Environment:
It appears that doctests produce a test event that the Exercism runner/parser does not handle.