1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 #![allow(unused_must_use, dead_code, deprecated)]
14 #![feature(macro_rules)]
16 use std::io::MemWriter;
20 writer: &'a mut (Writer+'a),
26 impl fmt::Writer for Bar {
27 fn write_str(&mut self, _: &str) -> fmt::Result {
32 fn borrowing_writer_from_struct_and_formatting_struct_field(foo: Foo) {
33 write!(foo.writer, "{}", foo.other);
37 let mut w = MemWriter::new();
38 write!(&mut w as &mut Writer, "");
39 write!(&mut w, ""); // should coerce
45 write!(&mut s, "test");