rust-lang/cargo · error

not implemented

Error message

not implemented

What it means

mdman's plain-text formatter (format/text.rs) does not support footnote definitions. On Tag::FootnoteDefinition it calls unimplemented!(), panicking with 'not implemented'.

Solutions

  1. Remove footnote definitions from the source Markdown before text conversion.
  2. Handle Tag::FootnoteDefinition in crates/mdman/src/format/text.rs (e.g. append a footnotes section) instead of unimplemented!().

Example fix

// before
Tag::FootnoteDefinition(_label) => unimplemented!(),
// after
Tag::FootnoteDefinition(_label) => { /* dropped in text output */ }
Defensive patterns

Strategy: validation

Validate before calling

// Same footnote-detection guard as for man output, applied before text conversion
let src = std::fs::read_to_string(&md_path)?;
if src.lines().any(|l| l.trim_start().starts_with("[^") && l.contains(":")) {
    anyhow::bail!("source contains footnote definitions unsupported by text output");
}

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Generating plain-text output (`mdman --format txt`) from Markdown containing a footnote definition `[^id]: ...`. The event triggers the panic.

Common situations: Using the same Markdown source across man and text outputs where the source has footnotes; generating terminal-friendly text from annotated docs.

Related errors


AI-assisted analysis of rust-lang/cargo@eb98b54bc9 (2026-08-11). Data as JSON: /api/errors/db00ff34b936598e. Report an issue: GitHub.

Appendix: source

Thrown at crates/mdman/src/format/text.rs:167

                        Tag::Item => {
                            self.flush();
                            match list.last_mut().expect("item must have list start") {
                                // Ordered list.
                                Some(n) => {
                                    self.push_indent(self.indent);
                                    write!(self.line, "{}.", n)?;
                                    *n += 1;
                                }
                                // Unordered list.
                                None => {
                                    self.push_indent(self.indent);
                                    self.push_to_line("o ")
                                }
                            }
                            self.indent += 3;
                            suppress_paragraph = true;
                        }
                        Tag::FootnoteDefinition(_label) => unimplemented!(),
                        Tag::Table(alignment) => {
                            assert!(self.table.alignment.is_empty());
                            self.flush();
                            self.table.alignment.extend(alignment);
                            let table = self.table.process(&mut self.parser, self.indent)?;
                            self.output.push_str(&table);
                            self.hard_break();
                            self.table = Table::new();
                        }
                        Tag::TableHead | Tag::TableRow | Tag::TableCell => {
                            bail!("unexpected table element")
                        }
                        Tag::Emphasis => {}
                        Tag::Strong => {}
                        // Strikethrough isn't usually supported for TTY.
                        Tag::Strikethrough => self.word.push_str("~~"),
                        Tag::Link {
                            link_type,

View on GitHub (pinned to eb98b54bc9)