External Publication
Visit Post

Add an implementation for the Default trait for std::ops::ControlFlow

Rust Internals [Unofficial] April 22, 2026
Source

IMHO it's much more obvious that "Default for Result should be Ok" than "Default for ControlFlow should be Continue". And yet even Result doesn't implement it.

Why "more obvious"?: I see ControlFlow as "like Result with without the semantic extra assumptions Result comes with", in other words ControlFlow should be more symmetrical in treating it's variants than Result is, and basically the only asymmetry should be in the behavior for the ? operator (and other uses of the Try trait).

Presumably a major reason why Result doesn't offer a Default based on Ok is that Option implements Default returning None!

Discussion in the ATmosphere

Loading comments...