-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
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
Stack overflow in fmt::Display impl #45838
Comments
Rust does not emit any compiler error for stack overflow, except the very simple ones like fn f() {
g();
}
fn g() {
f();
}
fn main() {
f();
} |
I think the interesting thing about this one is that |
Marking as |
It's possible to write a impl of fmt::Display which compiles successfully and produces a stack overflow.
A minimal repro is available here: https://play.rust-lang.org/?gist=fb115e1e625e1b8038cdd13c5f9cdbb8&version=stable
The code is here for completeness of the bug report:
I would expect an error at compile time
Instead the error occurs at runtime as a stack overflow.
Meta
The text was updated successfully, but these errors were encountered: