diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 750e86114c4bb057446f1024dcaff0a22d7b066d..193c8b9f925fbf0011f00e73860d6c0636b14291 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -81,6 +81,22 @@ pub mod rt { /// This type does not support transmission of an error other than that an error /// occurred. Any extra information must be arranged to be transmitted through /// some other means. +/// +/// An important thing to remember is that the type `fmt::Error` should not be +/// confused with `std::io::Error` or `std::error::Error`, which you may also +/// have in scope. +/// +/// # Examples +/// +/// ```rust +/// use std::fmt::{self, write}; +/// +/// let mut output = String::new(); +/// match write(&mut output, format_args!("Hello {}!", "world")) { +/// Err(fmt::Error) => panic!("An error occurred"), +/// _ => (), +/// } +/// ``` #[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Error;