rust/src/test/compile-fail/issue-3973.rs
Brendan Zabarauskas 4fc0452ace Remove re-exports of std::io::stdio::{print, println} in the prelude.
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-11 10:46:00 +11:00

33 lines
852 B
Rust

// Copyright 2012 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.
// xfail-test
use std::io;
struct Point {
x: f64,
y: f64,
}
impl ToStr for Point { //~ ERROR implements a method not defined in the trait
fn new(x: f64, y: f64) -> Point {
Point { x: x, y: y }
}
fn to_str(&self) -> ~str {
fmt!("(%f, %f)", self.x, self.y)
}
}
fn main() {
let p = Point::new(0.0f, 0.0f);
println!("{}", p.to_str());
}