We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display
The following overflows the stack:
use core::fmt; struct Foo; impl fmt::Display for Foo { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self) } } fn main() { println!("{}", Foo); }
The text was updated successfully, but these errors were encountered:
The first one shows
error[E0277]: `fn(i32) -> Foo {Foo}` doesn't implement `std::fmt::Display`
because you're passing the type constructor function, not an instance of Foo. Change it to Foo(123) and it also overflows the stack.
Foo
Foo(123)
The unconditional recursion lint not triggering on Display impls is a well known issue tracked (primarily) by #57965, so closing in favor of that.
Sorry, something went wrong.
No branches or pull requests
The following overflows the stack:
The text was updated successfully, but these errors were encountered: