Skip to content

program hangs when using String::from_char with negativ value #18428

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

Closed
konstin opened this issue Oct 29, 2014 · 1 comment
Closed

program hangs when using String::from_char with negativ value #18428

konstin opened this issue Oct 29, 2014 · 1 comment

Comments

@konstin
Copy link

konstin commented Oct 29, 2014

The following program compiles, but when launched, it uses 100% of one cpu core but never finishes:

fn main() {
    println!("{}", String::from_char(-1, ' '));
}

EDIT: System & Version:

rustc 0.13.0-nightly (bd7138dd6 2014-10-27 23:02:55 +0000)
binary: rustc
commit-hash: bd7138dd698dde29fb4d7fd34529a863b85d947e
commit-date: 2014-10-27 23:02:55 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly
@thestinger
Copy link
Contributor

This is working as intended. The 1 is a uint literal, and the - makes it wrap around to uint::MAX. It would get killed by the OOM killer if you waited long enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants