This is an automated archive made by the Lemmit Bot.
The original was posted on /r/rust by /u/AdmiralQuokka on 2025-04-22 21:05:47+00:00.
todo!()
is often used to mark an unfinished function. It’s convenient, because it silences the compiler about mismatched return types. However, that doens’t work if the return type is an “impl trait”. Why not though? There wouldn’t be any harm in pretending the never type implements all traits, right? Can’t call non-existant methods on values that will never exist, right?
Is there a fundamental reason why this cannot be or is it just a current compiler limitation?
Example:
) -> impl Iterator { └─
!is not an iterator the trait
std::iter::Iteratoris not implemented for
!``
You must log in or register to comment.