]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type/type-params-in-different-spaces-1.rs
Sync rust-lang/portable-simd@03f6fbb21e6050da2a05b3ce8f480c020b384916
[rust.git] / src / test / ui / type / type-params-in-different-spaces-1.rs
1 use std::ops::Add;
2
3 trait BrokenAdd: Copy + Add<Output=Self> {
4     fn broken_add<T>(&self, rhs: T) -> Self {
5         *self + rhs //~  ERROR mismatched types
6                     //~| expected type parameter `Self`, found type parameter `T`
7                     //~| expected type parameter `Self`
8                     //~| found type parameter `T`
9     }
10 }
11
12 impl<T: Copy + Add<Output=T>> BrokenAdd for T {}
13
14 pub fn main() {
15     let foo: u8 = 0;
16     let x: u8 = foo.broken_add("hello darkness my old friend".to_string());
17     println!("{}", x);
18 }