I have a really simple cat function written in the Rust 1.0 alpha.
use std::io;
fn main(){
let mut reader = io::stdin();
loop {
let input = reader.read_line().ok().expect("Failed to read line");
print!("{}", input);
}
}
When I compile it, I get the following warnings:
bindings.rs:5:26: 5:35 warning: use of unstable item, #[warn(unstable)] on by default
bindings.rs:5 let mut reader = io::stdin();
^~~~~~~~~
bindings.rs:6:28: 6:39 warning: use of unstable item, #[warn(unstable)] on by default
bindings.rs:6 let input = reader.read_line().ok().expect("Failed to read line");
^~~~~~~~~~~
Is there a way to remedy these warnings?
For the 1.0 release, Rust wants to provide a very strong guarantee about what features of the language and standard library will be available for the entire life of the language. This is not an easy feat!
New, untested, or just not-fully-cooked features will be marked with a stability attribute, and you won't be able to use unstable features in the beta or release. You will only be able to use them in the nightly builds.
During the alpha however, they are simply warnings. If you need to use a feature in the alpha and it's marked as unstable
, then you will want to make sure it becomes stable (or you find an alternate solution) before the beta!
In this case, the entire IO subsystem is undergoing last-minute changes, so it's marked as unstable.
Edit 1
When PR 21543 lands, the current world known as std::io
will be renamed as std::old_io
. Newly-written code will go into std::io
and the old version will be deprecated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With