]> git.proxmox.com Git - rustc.git/blame - src/test/ui/type/type-params-in-different-spaces-1.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / type / type-params-in-different-spaces-1.rs
CommitLineData
9346a6ac 1use std::ops::Add;
223e47cc 2
9346a6ac 3trait BrokenAdd: Copy + Add<Output=Self> {
1a4d82fc 4 fn broken_add<T>(&self, rhs: T) -> Self {
85aaf69f 5 *self + rhs //~ ERROR mismatched types
60c5eb7d
XL
6 //~| expected type parameter `Self`, found type parameter `T`
7 //~| expected type parameter `Self`
8 //~| found type parameter `T`
223e47cc 9 }
223e47cc
LB
10}
11
9346a6ac 12impl<T: Copy + Add<Output=T>> BrokenAdd for T {}
1a4d82fc 13
223e47cc 14pub fn main() {
c34b1796 15 let foo: u8 = 0;
1a4d82fc
JJ
16 let x: u8 = foo.broken_add("hello darkness my old friend".to_string());
17 println!("{}", x);
223e47cc 18}