Created
September 27, 2017 22:49
-
-
Save szeiger/93e4239ae544d8d98521e5c4ed7f146d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::Add; | |
struct Point<T, U> { x: T, y: U } | |
impl<T : Add<Output=T>> Point<T, T> { | |
fn f(self) -> T { self.x + self.y } | |
} | |
fn main() { | |
Point { x: 1, y: 2.0 }.f(); | |
// error[E0599]: no method named `f` found for type `Point<{integer}, {float}>` in the current scope | |
// --> src\main.rs:10:28 | |
// | | |
// 10 | Point { x: 1, y: 2.0 }.f(); | |
// | ^ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment