>>937673
>>937689
Sorry I made a few mistakes (I'm still a Rust rookie :) Don't be too hard on me :))).
const STRING: &'static str = "Hello, World!";
fn main() {
let stdout: ::std::io::Stdout = ::std::io::stdout();
let mut locked_stdout: ::std::io::StdoutLock = ::std::io::Stdout::lock(&stdout);
let mut i: usize = 0usize;
while ::std::cmp::PartialEq::eq(
&::std::cmp::Ord::cmp(
&i as &usize,
&<[u8]>::len(str::as_bytes(STRING as &'static str) as &[u8]) as &usize,
) as &::std::cmp::Ordering,
&::std::cmp::Ordering::Less as &::std::cmp::Ordering,
) as bool
{
match ::std::io::Write::write(
&mut locked_stdout as &mut ::std::io::StdoutLock,
::std::ops::Index::index(
str::as_bytes(STRING as &'static str) as &[u8],
::std::ops::Range {
start: i as usize,
end: <[u8]>::len(&str::as_bytes(STRING as &'static str)) as usize,
} as ::std::ops::Range<usize>,
),
) as ::std::result::Result<usize, ::std::io::Error>
{
::std::result::Result::Ok(len) => {
match usize::checked_add(i as usize, len as usize) as ::std::option::Option<usize> {
::std::option::Option::Some(j) => {
i = j as usize;
}
::std::option::Option::None => {
panic!("overflow while incrementing index" as &'static str);
}
}
}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error),
&::std::io::ErrorKind::Interrupted as &::std::io::ErrorKind,
) as bool => {}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error) as &::std::io::ErrorKind,
&::std::io::ErrorKind::BrokenPipe as &::std::io::ErrorKind,
) as bool =>
{
break;
}
::std::result::Result::Err(e) => {
panic!("error writing to stdout: {}", e as ::std::io::Error);
}
}
}
loop {
match ::std::io::Write::flush(&mut locked_stdout as &mut ::std::io::StdoutLock) {
::std::result::Result::Ok(()) => {
break;
}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error) as &::std::io::ErrorKind,
&::std::io::ErrorKind::Interrupted as &::std::io::ErrorKind,
) => {}
::std::result::Result::Err(ref e)
if ::std::cmp::PartialEq::eq(
&::std::io::Error::kind(e as &::std::io::Error) as &::std::io::ErrorKind,
&::std::io::ErrorKind::BrokenPipe as &::std::io::ErrorKind,
) =>
{
break;
}
::std::result::Result::Err(e) => {
panic!("error flushing stdout: {}", e as ::std::io::Error);
}
}
}
}
https://play.rust-lang.org/?gist=57f5015d60e64cf016482585ae7640f4&version=stable&mode=debug&edition=2015