Skip to content

Comments: `because` and `todo`

There are no free-form comments. There are two annotation forms, and both must directly prefix a statement:

fn retry(times: i64, attempt: fn() -> bool) -> bool {
for _ in 0..times {
if attempt() {
return true
}
}
return false
}
because the vendor API flakes under load, see INC-2231
let sent = retry(3, fn() => true)
todo(2027-01-15) remove once all clients send v2 headers
print(sent)
  • The text runs to the end of the line.
  • An annotation not followed by a statement is a compile error.
  • A because text longer than 100 characters produces a warning.
  • A todo past its date produces a warning; with --strict (meant for CI) it is an error. It is not an error by default, so old checkouts keep compiling.
  • There are no doc blocks.