Closed
Description
This error is related to #22050, not sure if it's a dupe. Some of the following code snippets rely on the term library (but the issue seems to be in Rust, not term
).
The following builds fine:
fn foo() {
let mut s = String::new();
writeln!(s, "foo").unwrap();
}
This gives an error:
extern crate term;
fn foo() {
let mut t = term::stdout().unwrap();
writeln!(t, "foo").unwrap();
}
Output:
lib.rs:5:5: 5:23 error: source trait is private
lib.rs:5 writeln!(t, "foo").unwrap();
This is the error mentioned in #22050. Importing std::io::Write
fixes the error. However, if println
is used, we get no errors:
extern crate term;
fn foo() {
let mut t = term::stdout().unwrap();
writeln!(t, "foo").unwrap();
println!("foo");
}