Change:
From … … which met with general approval and two people saying they already were adding to all their own crates, so I'm just gonna go ahead and submit a PR. is included for completeness and symmetry; I'm not sure it's useful, but I think people would be surprised to find it missing.
I'd suggest to just implement this and send a PR (in the worst case you'll need to write an RFC as well). This was suggested many times in various places, but nobody pushed hard enough and took responsibility to actually get this implemented and merged. I encourage you to do it. The number of likes this suggestion gathered on internals in one day shows that the feature is clearly wanted.
This does require an RFC, as I mentioned in , so I'm going to give this a close; this would be tracked by the RFC process. Thanks!
If you are still running into this error, update Rust to version . I spent a while googling this error and wondering which package providing was old before realizing that this PR had eventually been merged in.

Discussion:
- [peek](library-features/peek.md) - [placement_in](library-features/placement-in.md) - [placement_new_protocol](library-features/placement-new-protocol.md) <del> - [print](library-features/print.md) </del> <ins> - [print_internals](library-features/print-internals.md) </ins> - [proc_macro_internals](library-features/proc-macro-internals.md) - [process_try_wait](library-features/process-try-wait.md) - [question_mark_carrier](library-features/question-mark-carrier.md)

<ins> # `print_internals` This feature is internal to the Rust compiler and is not intended for general use. ------------------------ </ins>

<del> # `print` This feature is internal to the Rust compiler and is not intended for general use. ------------------------ </del>

#[stable(feature = "rust1", since = "1.0.0")] pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat}; #[stable(feature = "rust1", since = "1.0.0")] <del> pub use self::stdio::{stdin, stdout, stderr, _print, Stdin, Stdout, Stderr}; </del> <ins> pub use self::stdio::{stdin, stdout, stderr, Stdin, Stdout, Stderr}; </ins> #[stable(feature = "rust1", since = "1.0.0")] pub use self::stdio::{StdoutLock, StderrLock, StdinLock}; <ins> #[unstable(feature = "print_internals", issue = "0")] pub use self::stdio::{_print, _eprint}; </ins> #[unstable(feature = "libstd_io_internals", issue = "0")] #[doc(no_inline, hidden)] pub use self::stdio::{set_panic, set_print};

use sync::{Arc, Mutex, MutexGuard}; use sys::stdio; use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; <del> use thread::LocalKeyState; </del> <ins> use thread::{LocalKey, LocalKeyState}; </ins> /// Stdout used by print! and println! macros thread_local! {

}) } <del> #[unstable(feature = "print", reason = "implementation detail which may disappear or be replaced at any time", issue = "0")] #[doc(hidden)] pub fn _print(args: fmt::Arguments) { // As an implementation of the `println!` macro, we want to try our best to // not panic wherever possible and get the output somewhere. There are // currently two possible vectors for panics we take care of here: // // 1. If the TLS key for the local stdout has been destroyed, accessing it //    would cause a panic. Note that we just lump in the uninitialized case //    here for convenience, we're not trying to avoid a panic. // 2. If the local stdout is currently in use (e.g. we're in the middle of //    already printing) then accessing again would cause a panic. // // If, however, the actual I/O causes an error, we do indeed panic. let result = match LOCAL_STDOUT.state() { </del> <ins> /// Write `args` to output stream `local_s` if possible, `global_s` /// otherwise. `label` identifies the stream in a panic message. /// /// This function is used to print error messages, so it takes extra /// care to avoid causing a panic when `local_stream` is unusable. /// For instance, if the TLS key for the local stream is uninitialized /// or already destroyed, or if the local stream is locked by another /// thread, it will just fall back to the global stream. /// /// However, if the actual I/O causes an error, this function does panic. fn print_to<T>(args: fmt::Arguments, local_s: &'static LocalKey<RefCell<Option<Box<Write+Send>>>>, global_s: fn() -> T, label: &str) where T: Write { let result = match local_s.state() { </ins> LocalKeyState::Uninitialized | <del> LocalKeyState::Destroyed => stdout().write_fmt(args), </del> <ins> LocalKeyState::Destroyed => global_s().write_fmt(args), </ins> LocalKeyState::Valid => { <del> LOCAL_STDOUT.with(|s| { </del> <ins> local_s.with(|s| { </ins> if let Ok(mut borrowed) = s.try_borrow_mut() { if let Some(w) = borrowed.as_mut() { return w.write_fmt(args); } } <del> stdout().write_fmt(args) </del> <ins> global_s().write_fmt(args) </ins> }) } }; if let Err(e) = result { <del> panic!("failed printing to stdout: {}", e); </del> <ins> panic!("failed printing to {}: {}", label, e); </ins> } } <ins> #[unstable(feature = "print_internals", reason = "implementation detail which may disappear or be replaced at any time", issue = "0")] #[doc(hidden)] pub fn _print(args: fmt::Arguments) { print_to(args, &LOCAL_STDOUT, stdout, "stdout"); } #[unstable(feature = "print_internals", reason = "implementation detail which may disappear or be replaced at any time", issue = "0")] #[doc(hidden)] pub fn _eprint(args: fmt::Arguments) { use panicking::LOCAL_STDERR; print_to(args, &LOCAL_STDERR, stderr, "stderr"); } </ins> #[cfg(test)] mod tests { use thread;

/// necessary to use `io::stdout().flush()` to ensure the output is emitted /// immediately. /// <ins> /// Use `print!` only for the primary output of your program.  Use /// `eprint!` instead to print error and progress messages. /// </ins> /// # Panics /// /// Panics if writing to `io::stdout()` fails.

/// Use the `format!` syntax to write data to the standard output. /// See `std::fmt` for more information. /// <ins> /// Use `println!` only for the primary output of your program.  Use /// `eprintln!` instead to print error and progress messages. /// </ins> /// # Panics /// <del> /// Panics if writing to `io::stdout()` fails. </del> <ins> /// Panics if writing to `io::stdout` fails. </ins> /// /// # Examples ///

($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "n"), $($arg)*)); } <ins> /// Macro for printing to the standard error. /// /// Equivalent to the `print!` macro, except that output goes to /// `io::stderr` instead of `io::stdout`.  See `print!` for /// example usage. /// /// Use `eprint!` only for error and progress messages.  Use `print!` /// instead for the primary output of your program. /// /// # Panics /// /// Panics if writing to `io::stderr` fails. #[macro_export] #[stable(feature = "eprint", since="1.18.0")] #[allow_internal_unstable] macro_rules! eprint { ($($arg:tt)*) => ($crate::io::_eprint(format_args!($($arg)*))); } /// Macro for printing to the standard error, with a newline. /// /// Equivalent to the `println!` macro, except that output goes to /// `io::stderr` instead of `io::stdout`.  See `println!` for /// example usage. /// /// Use `eprintln!` only for error and progress messages.  Use `println!` /// instead for the primary output of your program. /// /// # Panics /// /// Panics if writing to `io::stderr` fails. #[macro_export] #[stable(feature = "eprint", since="1.18.0")] macro_rules! eprintln { () => (eprint!("n")); ($fmt:expr) => (eprint!(concat!($fmt, "n"))); ($fmt:expr, $($arg:tt)*) => (eprint!(concat!($fmt, "n"), $($arg)*)); } </ins> /// A macro to select an event from a number of receivers. /// /// This macro is used to wait for the first event to occur on a number of

<ins> // Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // ignore-emscripten spawning processes is not supported use std::{env, process}; fn child() { print!("[stdout 0]"); print!("[stdout {}]", 1); println!("[stdout {}]", 2); println!(); eprint!("[stderr 0]"); eprint!("[stderr {}]", 1); eprintln!("[stderr {}]", 2); eprintln!(); } fn parent() { let this = env::args().next().unwrap(); let output = process::Command::new(this).arg("-").output().unwrap(); assert!(output.status.success()); let stdout = String::from_utf8(output.stdout).unwrap(); let stderr = String::from_utf8(output.stderr).unwrap(); assert_eq!(stdout, "[stdout 0][stdout 1][stdout 2]nn"); assert_eq!(stderr, "[stderr 0][stderr 1][stderr 2]nn"); } fn main() { if env::args().count() == 2 { child() } else { parent() } } </ins>